From 9300d77ab0d9337eb20d0280d8749b155a296498 Mon Sep 17 00:00:00 2001 From: "754998852@qq.com" <754998852@qq.com> Date: Wed, 20 Nov 2024 09:08:00 +0800 Subject: [PATCH] 1 --- .gitignore | 1 + DataBase/版本日志/SGGLDB_V2024-11-19.sql | 92 +++ SGGL/BLL/API/APIIndexService.cs | 339 ++++++++++ SGGL/BLL/API/APIPersonService.cs | 297 +++++++++ SGGL/BLL/API/HSSE/APITestPlanService.cs | 65 +- SGGL/BLL/API/HSSE/APITestRecordService.cs | 70 +- SGGL/BLL/API/HSSE/APITrainRecordService.cs | 3 +- .../BLL/API/HSSE/APITrainTestRecordService.cs | 2 +- SGGL/BLL/API/HSSE/APITrainingPlanService.cs | 46 +- SGGL/BLL/API/HSSE/APITrainingTaskService.cs | 44 +- SGGL/BLL/BLL.csproj | 1 + SGGL/BLL/BaseInfo/WorkPostService.cs | 79 +++ SGGL/BLL/Common/Const.cs | 5 + .../EduTrain/CompanyTrainingItemService.cs | 4 + SGGL/BLL/HSSE/EduTrain/TrainingItemService.cs | 4 +- SGGL/BLL/SQLHelper.cs | 24 + SGGL/BLL/SysManage/SysConstSetService.cs | 14 + SGGL/BLL/SysManage/UnitService.cs | 26 + SGGL/FineUIPro.Web/ErrLog.txt | 198 ++++++ SGGL/FineUIPro.Web/FineUIPro.Web.csproj | 360 +++++++++++ .../EduTrain/CompanyTrainingItemSave.aspx | 61 ++ .../EduTrain/CompanyTrainingItemSave.aspx.cs | 69 +- .../CompanyTrainingItemSave.aspx.designer.cs | 67 +- .../HSSE/EduTrain/TrainingItemSave.aspx | 5 + .../HSSE/EduTrain/TrainingItemSave.aspx.cs | 12 + .../TrainingItemSave.aspx.designer.cs | 49 +- .../Person/EduTrain/AccidentCase.aspx | 154 +++++ .../Person/EduTrain/AccidentCase.aspx.cs | 506 +++++++++++++++ .../EduTrain/AccidentCase.aspx.designer.cs | 287 +++++++++ .../Person/EduTrain/AccidentCaseItemSave.aspx | 65 ++ .../EduTrain/AccidentCaseItemSave.aspx.cs | 171 +++++ .../AccidentCaseItemSave.aspx.designer.cs | 125 ++++ .../AccidentCaseItemSelectCloumn.aspx | 38 ++ .../AccidentCaseItemSelectCloumn.aspx.cs | 32 + ...identCaseItemSelectCloumn.aspx.designer.cs | 80 +++ .../Person/EduTrain/AccidentCaseSave.aspx | 49 ++ .../Person/EduTrain/AccidentCaseSave.aspx.cs | 147 +++++ .../AccidentCaseSave.aspx.designer.cs | 98 +++ .../Person/EduTrain/CompanyTraining.aspx | 160 +++++ .../Person/EduTrain/CompanyTraining.aspx.cs | 532 +++++++++++++++ .../EduTrain/CompanyTraining.aspx.designer.cs | 278 ++++++++ .../EduTrain/CompanyTrainingItemSave.aspx | 70 ++ .../EduTrain/CompanyTrainingItemSave.aspx.cs | 193 ++++++ .../CompanyTrainingItemSave.aspx.designer.cs | 152 +++++ .../Person/EduTrain/CompanyTrainingSave.aspx | 52 ++ .../EduTrain/CompanyTrainingSave.aspx.cs | 154 +++++ .../CompanyTrainingSave.aspx.designer.cs | 98 +++ SGGL/FineUIPro.Web/Person/EduTrain/Plan.aspx | 119 ++++ .../Person/EduTrain/Plan.aspx.cs | 337 ++++++++++ .../Person/EduTrain/Plan.aspx.designer.cs | 188 ++++++ .../Person/EduTrain/PlanEdit.aspx | 172 +++++ .../Person/EduTrain/PlanEdit.aspx.cs | 444 +++++++++++++ .../Person/EduTrain/PlanEdit.aspx.designer.cs | 233 +++++++ .../Person/EduTrain/PlanView.aspx | 71 ++ .../Person/EduTrain/PlanView.aspx.cs | 47 ++ .../Person/EduTrain/PlanView.aspx.designer.cs | 134 ++++ .../Person/EduTrain/ShowPerson.aspx | 87 +++ .../Person/EduTrain/ShowPerson.aspx.cs | 229 +++++++ .../EduTrain/ShowPerson.aspx.designer.cs | 125 ++++ SGGL/FineUIPro.Web/Person/EduTrain/Task.aspx | 88 +++ .../Person/EduTrain/Task.aspx.cs | 208 ++++++ .../Person/EduTrain/Task.aspx.designer.cs | 134 ++++ .../Person/EduTrain/TaskNotice.aspx | 138 ++++ .../Person/EduTrain/TaskNotice.aspx.cs | 404 ++++++++++++ .../EduTrain/TaskNotice.aspx.designer.cs | 197 ++++++ .../Person/EduTrain/TaskNoticeEdit.aspx | 139 ++++ .../Person/EduTrain/TaskNoticeEdit.aspx.cs | 243 +++++++ .../EduTrain/TaskNoticeEdit.aspx.designer.cs | 251 ++++++++ .../Person/EduTrain/TaskRecordView.aspx | 91 +++ .../Person/EduTrain/TaskRecordView.aspx.cs | 90 +++ .../EduTrain/TaskRecordView.aspx.designer.cs | 125 ++++ .../Person/EduTrain/TaskView.aspx | 79 +++ .../Person/EduTrain/TaskView.aspx.cs | 178 +++++ .../Person/EduTrain/TaskView.aspx.designer.cs | 107 +++ .../Person/EduTrain/TestPlan.aspx | 127 ++++ .../Person/EduTrain/TestPlan.aspx.cs | 286 ++++++++ .../Person/EduTrain/TestPlan.aspx.designer.cs | 170 +++++ .../Person/EduTrain/TestPlanView.aspx | 85 +++ .../Person/EduTrain/TestPlanView.aspx.cs | 84 +++ .../EduTrain/TestPlanView.aspx.designer.cs | 170 +++++ .../Person/EduTrain/TestRecord.aspx | 149 +++++ .../Person/EduTrain/TestRecord.aspx.cs | 335 ++++++++++ .../EduTrain/TestRecord.aspx.designer.cs | 224 +++++++ .../Person/EduTrain/TestRecordItem.aspx | 129 ++++ .../Person/EduTrain/TestRecordItem.aspx.cs | 288 +++++++++ .../EduTrain/TestRecordItem.aspx.designer.cs | 179 ++++++ .../Person/EduTrain/TestRecordPrint.aspx | 254 ++++++++ .../Person/EduTrain/TestRecordPrint.aspx.cs | 262 ++++++++ .../EduTrain/TestRecordPrint.aspx.designer.cs | 188 ++++++ .../Person/EduTrain/TestRecordView.aspx | 103 +++ .../Person/EduTrain/TestRecordView.aspx.cs | 185 ++++++ .../EduTrain/TestRecordView.aspx.designer.cs | 188 ++++++ .../Person/EduTrain/TestStatistics.aspx | 84 +++ .../Person/EduTrain/TestStatistics.aspx.cs | 114 ++++ .../EduTrain/TestStatistics.aspx.designer.cs | 107 +++ .../Person/EduTrain/TestTrainRecord.aspx | 90 +++ .../Person/EduTrain/TestTrainRecord.aspx.cs | 155 +++++ .../EduTrain/TestTrainRecord.aspx.designer.cs | 125 ++++ .../Person/EduTrain/TestTraining.aspx | 189 ++++++ .../Person/EduTrain/TestTraining.aspx.cs | 539 ++++++++++++++++ .../EduTrain/TestTraining.aspx.designer.cs | 287 +++++++++ .../Person/EduTrain/TestTrainingItemIn.aspx | 112 ++++ .../EduTrain/TestTrainingItemIn.aspx.cs | 473 ++++++++++++++ .../TestTrainingItemIn.aspx.designer.cs | 143 ++++ .../Person/EduTrain/TestTrainingItemSave.aspx | 162 +++++ .../EduTrain/TestTrainingItemSave.aspx.cs | 406 ++++++++++++ .../TestTrainingItemSave.aspx.designer.cs | 368 +++++++++++ .../Person/EduTrain/TestTrainingOut.aspx | 97 +++ .../Person/EduTrain/TestTrainingOut.aspx.cs | 120 ++++ .../EduTrain/TestTrainingOut.aspx.designer.cs | 98 +++ .../Person/EduTrain/TestTrainingSave.aspx | 53 ++ .../Person/EduTrain/TestTrainingSave.aspx.cs | 150 +++++ .../TestTrainingSave.aspx.designer.cs | 107 +++ .../Person/EduTrain/TrainDB.aspx | 151 +++++ .../Person/EduTrain/TrainDB.aspx.cs | 554 ++++++++++++++++ .../Person/EduTrain/TrainDB.aspx.designer.cs | 287 +++++++++ .../Person/EduTrain/TrainFind.aspx | 124 ++++ .../Person/EduTrain/TrainFind.aspx.cs | 288 +++++++++ .../EduTrain/TrainFind.aspx.designer.cs | 215 +++++++ .../Person/EduTrain/TrainRecord.aspx | 154 +++++ .../Person/EduTrain/TrainRecord.aspx.cs | 608 ++++++++++++++++++ .../EduTrain/TrainRecord.aspx.designer.cs | 269 ++++++++ .../Person/EduTrain/TrainRecordEdit.aspx | 224 +++++++ .../Person/EduTrain/TrainRecordEdit.aspx.cs | 535 +++++++++++++++ .../EduTrain/TrainRecordEdit.aspx.designer.cs | 368 +++++++++++ .../Person/EduTrain/TrainRecordIn.aspx | 100 +++ .../Person/EduTrain/TrainRecordIn.aspx.cs | 363 +++++++++++ .../EduTrain/TrainRecordIn.aspx.designer.cs | 143 ++++ .../Person/EduTrain/TrainRecordView.aspx | 200 ++++++ .../Person/EduTrain/TrainRecordView.aspx.cs | 296 +++++++++ .../EduTrain/TrainRecordView.aspx.designer.cs | 305 +++++++++ .../Person/EduTrain/TrainTest.aspx | 68 ++ .../Person/EduTrain/TrainTest.aspx.cs | 94 +++ .../EduTrain/TrainTest.aspx.designer.cs | 89 +++ .../Person/EduTrain/TrainTestDB.aspx | 143 ++++ .../Person/EduTrain/TrainTestDB.aspx.cs | 523 +++++++++++++++ .../EduTrain/TrainTestDB.aspx.designer.cs | 260 ++++++++ .../Person/EduTrain/TrainTestDBEdit.aspx | 51 ++ .../Person/EduTrain/TrainTestDBEdit.aspx.cs | 159 +++++ .../EduTrain/TrainTestDBEdit.aspx.designer.cs | 98 +++ .../EduTrain/TrainTestDBSelectCloumn.aspx | 34 + .../EduTrain/TrainTestDBSelectCloumn.aspx.cs | 37 ++ .../TrainTestDBSelectCloumn.aspx.designer.cs | 80 +++ .../Person/EduTrain/TrainTestItemEdit.aspx | 54 ++ .../Person/EduTrain/TrainTestItemEdit.aspx.cs | 178 +++++ .../TrainTestItemEdit.aspx.designer.cs | 125 ++++ .../Person/EduTrain/TrainTestRecord.aspx | 139 ++++ .../Person/EduTrain/TrainTestRecord.aspx.cs | 270 ++++++++ .../EduTrain/TrainTestRecord.aspx.designer.cs | 206 ++++++ .../Person/EduTrain/TrainTestRecordEdit.aspx | 153 +++++ .../EduTrain/TrainTestRecordEdit.aspx.cs | 221 +++++++ .../TrainTestRecordEdit.aspx.designer.cs | 251 ++++++++ .../Person/EduTrain/TrainTestView.aspx | 68 ++ .../Person/EduTrain/TrainTestView.aspx.cs | 103 +++ .../EduTrain/TrainTestView.aspx.designer.cs | 80 +++ .../Person/EduTrain/TrainingItemSave.aspx | 68 ++ .../Person/EduTrain/TrainingItemSave.aspx.cs | 200 ++++++ .../TrainingItemSave.aspx.designer.cs | 152 +++++ .../Person/EduTrain/TrainingSave.aspx | 48 ++ .../Person/EduTrain/TrainingSave.aspx.cs | 153 +++++ .../EduTrain/TrainingSave.aspx.designer.cs | 98 +++ SGGL/FineUIPro.Web/index.aspx | 17 + SGGL/Model/APIItem/CQMSItem.cs | 149 +++++ SGGL/Model/APIItem/DefectItem.cs | 41 ++ SGGL/Model/APIItem/HJGLItem.cs | 53 ++ SGGL/Model/APIItem/HSSE/PersonItem.cs | 4 + SGGL/Model/APIItem/HSSE/TestPlanItem.cs | 18 + SGGL/Model/APIItem/HSSE/TrainingPlanItem.cs | 17 + SGGL/Model/APIItem/HSSE/TrainingTaskItem.cs | 13 + SGGL/Model/APIItem/HSSEItem.cs | 313 +++++++++ SGGL/Model/APIItem/HiddenDangerItem.cs | 46 ++ SGGL/Model/APIItem/SYHSEItem.cs | 169 +++++ SGGL/Model/Model.cs | 300 +++++++++ SGGL/Model/Model.csproj | 6 + .../Controllers/HJGL/ReportQueryController.cs | 92 +++ .../HSSE/ChartAnalysisController.cs | 79 +++ .../Controllers/HSSE/TestRecordController.cs | 59 +- SGGL/WebAPI/Controllers/PersonController.cs | 26 +- SGGL/WebAPI/Controllers/ShouYeController.cs | 144 +++++ .../PublishProfiles/FolderProfile.pubxml | 8 +- SGGL/WebAPI/WebAPI.csproj | 1 + 181 files changed, 28244 insertions(+), 119 deletions(-) create mode 100644 DataBase/版本日志/SGGLDB_V2024-11-19.sql create mode 100644 SGGL/BLL/API/APIIndexService.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/AccidentCase.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/AccidentCase.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/AccidentCase.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSave.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSave.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSave.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSelectCloumn.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSelectCloumn.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSelectCloumn.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseSave.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseSave.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseSave.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/CompanyTraining.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/CompanyTraining.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/CompanyTraining.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingItemSave.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingItemSave.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingItemSave.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingSave.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingSave.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingSave.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/Plan.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/Plan.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/Plan.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/PlanEdit.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/PlanEdit.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/PlanEdit.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/PlanView.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/PlanView.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/PlanView.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/ShowPerson.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/ShowPerson.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/ShowPerson.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/Task.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/Task.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/Task.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TaskNotice.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TaskNotice.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TaskNotice.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TaskNoticeEdit.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TaskNoticeEdit.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TaskNoticeEdit.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TaskRecordView.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TaskRecordView.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TaskRecordView.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TaskView.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TaskView.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TaskView.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestPlan.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestPlan.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestPlan.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestPlanView.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestPlanView.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestPlanView.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestRecord.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestRecord.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestRecord.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestRecordItem.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestRecordItem.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestRecordItem.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestRecordPrint.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestRecordPrint.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestRecordPrint.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestRecordView.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestRecordView.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestRecordView.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTrainRecord.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTrainRecord.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTrainRecord.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTraining.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTraining.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTraining.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemIn.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemIn.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemIn.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemSave.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemSave.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemSave.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingOut.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingOut.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingOut.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingSave.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingSave.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingSave.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainDB.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainDB.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainDB.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainFind.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainFind.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainFind.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordEdit.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordEdit.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordEdit.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordIn.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordIn.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordIn.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTest.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTest.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTest.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDB.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDB.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDB.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBEdit.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBEdit.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBEdit.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBSelectCloumn.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBSelectCloumn.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBSelectCloumn.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestItemEdit.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestItemEdit.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestItemEdit.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecord.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecord.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecord.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecordEdit.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecordEdit.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecordEdit.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestView.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestView.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainTestView.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainingItemSave.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainingItemSave.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainingItemSave.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainingSave.aspx create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainingSave.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Person/EduTrain/TrainingSave.aspx.designer.cs create mode 100644 SGGL/Model/APIItem/CQMSItem.cs create mode 100644 SGGL/Model/APIItem/DefectItem.cs create mode 100644 SGGL/Model/APIItem/HJGLItem.cs create mode 100644 SGGL/Model/APIItem/HSSEItem.cs create mode 100644 SGGL/Model/APIItem/HiddenDangerItem.cs create mode 100644 SGGL/Model/APIItem/SYHSEItem.cs create mode 100644 SGGL/WebAPI/Controllers/ShouYeController.cs diff --git a/.gitignore b/.gitignore index f32177d7..a01b8f9c 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ /SUBQHSE/DataExchange/bin /SUBQHSE/DataExchange/obj/Debug /SUBQHSEPackFile +/SGGLPackFile *.user /SUBQHSE/FineUIPro.Web/File/Excel/Temp *.xml diff --git a/DataBase/版本日志/SGGLDB_V2024-11-19.sql b/DataBase/版本日志/SGGLDB_V2024-11-19.sql new file mode 100644 index 00000000..787ab65a --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2024-11-19.sql @@ -0,0 +1,92 @@ +alter table Training_CompanyTrainingItem add LearningTime int +go +alter table Training_CompanyTrainingItem add TestTrainingIds nvarchar(max) +go +alter table Training_TestTrainingItem add DepartIds nvarchar(4000) +go +alter table Training_TestTrainingItem add DepartNames nvarchar(max) +go +alter table Training_TrainingItem add LearningTime int +go +alter table Training_TestRecord add Signature nvarchar(1000) +go +alter table Training_TestRecord add Fingerprint nvarchar(1000) +go +alter table Training_TaskItem add StartTime datetime +go +alter table Training_TaskItem add EndTime datetime +go +alter table Training_TaskItem add LearnTime int +go +alter table Training_TaskItem add VideoProgress int +go +alter table Training_TaskItem add CompanyTrainingItemId nvarchar(100) +go +alter table Training_Plan add DepartIds nvarchar(2000) +go +alter table Training_Plan add DepartNames nvarchar(2000) +go + +alter table Training_TestPlan +add TrainTypeId nvarchar(50) null; +go + +select*From Training_TestPlan + +SELECT*fROM SYS_MENU WHERE MenuType='Menu_Person' ORDER BY SortIndex + +insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed) +values('6DE58F2F-8BB0-4273-99B5-29638AAECD1F','ѵ','',100,'0','Menu_Person',0,0,1) +go + +insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed) +values('7680FF24-475A-4C8E-BD1A-CA0A90AE90DB','ѵƻ','Person/EduTrain/Plan.aspx',10,'6DE58F2F-8BB0-4273-99B5-29638AAECD1F','Menu_Person',0,1,1) +go +insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed) +values('0893D427-B55B-4569-AA77-8C1252FC7E8F','ѵ','Person/EduTrain/Task.aspx',20,'6DE58F2F-8BB0-4273-99B5-29638AAECD1F','Menu_Person',0,1,1) +go +insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed) +values('72907130-417B-48D0-87F8-F2753130CF96','ѵ','Person/EduTrain/TestTrainRecord.aspx',30,'6DE58F2F-8BB0-4273-99B5-29638AAECD1F','Menu_Person',0,1,1) +go +insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed) +values('B10594D1-06F6-4394-BC10-1AEA0C7704B1','Լƻ','Person/EduTrain/TestPlan.aspx',40,'6DE58F2F-8BB0-4273-99B5-29638AAECD1F','Menu_Person',0,1,1) +go +insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed) +values('88F3D9B7-5F08-441D-B2D7-9A152D2EAE11','Լ¼','Person/EduTrain/TestRecord.aspx',50,'6DE58F2F-8BB0-4273-99B5-29638AAECD1F','Menu_Person',0,1,1) +go +insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed) +values('809B6A68-952D-4906-BF72-997EB30F745A','ͳ','Person/EduTrain/TestStatistics.aspx',60,'6DE58F2F-8BB0-4273-99B5-29638AAECD1F','Menu_Person',0,1,1) +go + +ALTER VIEW [dbo].[View_Training_TestTrainingItem] AS +/*ѵϢͼ*/ +SELECT Training.TrainingId + ,Training.TrainingCode + ,Training.TrainingName + ,Item.TrainingItemId + ,Item.TrainingItemCode + ,Item.TrainingItemName + ,Item.Abstracts + ,Item.AbstractsEng + ,Item.AttachUrl + ,Item.VersionNum + ,Item.TestType + ,Item.WorkPostIds + ,Item.WorkPostNames + ,Item.AItem + ,Item.BItem + ,Item.CItem + ,Item.DItem + ,Item.EItem + ,Item.AItemEng + ,Item.BItemEng + ,Item.CItemEng + ,Item.DItemEng + ,Item.EItemEng + --,Item.Score + ,Item.AnswerItems + ,Item.DepartIds + ,Item.DepartNames + FROM dbo.Training_TestTrainingItem AS Item + LEFT JOIN Training_TestTraining AS Training ON Item.TrainingId = Training.TrainingId + go \ No newline at end of file diff --git a/SGGL/BLL/API/APIIndexService.cs b/SGGL/BLL/API/APIIndexService.cs new file mode 100644 index 00000000..f566bc39 --- /dev/null +++ b/SGGL/BLL/API/APIIndexService.cs @@ -0,0 +1,339 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BLL.API +{ + public class APIIndexService + { + #region 获取HSSE首页数据 + /// + /// 获取HSSE首页数据 + /// + /// + /// + public static Model.HSSEItem hsse() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.HSSEItem item = new Model.HSSEItem(); + var hsse = db.HSSEData_HSSE.OrderByDescending(x => x.ReportDate).FirstOrDefault(); + if (hsse != null) + { + + item.Id = hsse.Id; + item.UnitId = hsse.UnitId; + item.CollCropCode = hsse.CollCropCode; + item.UnitName = hsse.UnitName; + item.ReportDate = hsse.ReportDate; + item.BeUnderConstructionNum = hsse.BeUnderConstructionNum; + item.ShutdownNum = hsse.ShutdownNum; + item.JoinConstructionPersonNum = hsse.JoinConstructionPersonNum; + item.MajorProjectsUnderConstructionNum = hsse.MajorProjectsUnderConstructionNum; + item.TotalWorkingHour = hsse.TotalWorkingHour; + item.TotalWorkingHour = hsse.TotalWorkingHour; + item.SafeWorkingHour = hsse.SafeWorkingHour; + item.SafeTrainNum = hsse.SafeTrainNum; + item.SpecialTrainNum = hsse.SpecialTrainNum; + item.SpecialOperationTrainNum = hsse.SpecialOperationTrainNum; + item.TotalEnergyConsumption = hsse.TotalEnergyConsumption; + item.IncomeComprehensiveEnergyConsumption = hsse.IncomeComprehensiveEnergyConsumption; + item.NewWaterConsumption = hsse.NewWaterConsumption; + item.HeadOfficeInspectorGeneralNum = hsse.HeadOfficeInspectorGeneralNum; + item.HeadOfficeFullTimeNum = hsse.HeadOfficeFullTimeNum; + item.BranchInspectorGeneralNum = hsse.BranchInspectorGeneralNum; + item.BranchFullTimeNum = hsse.BranchFullTimeNum; + item.ProjectInspectorGeneralNum = hsse.ProjectInspectorGeneralNum; + item.ProjectFullTimeNum = hsse.ProjectFullTimeNum; + item.ProjectSafetyMonitorNum = hsse.ProjectSafetyMonitorNum; + item.SafetyInjectionEngineer = hsse.SafetyInjectionEngineer; + item.CertificateANum = hsse.CertificateANum; + item.CertificateBNum = hsse.CertificateBNum; + item.CertificateCNum = hsse.CertificateCNum; + item.SafetyCommitteeMeetingNum = hsse.SafetyCommitteeMeetingNum; + item.EnterpriseTopicsMeetingNum = hsse.EnterpriseTopicsMeetingNum; + item.ProjectSafetyLeadingGroupMeetingNum = hsse.ProjectSafetyLeadingGroupMeetingNum; + item.ProjectSafetyMeetingNum = hsse.ProjectSafetyMeetingNum; + item.CompanyLeadShiftCheckNum = hsse.CompanyLeadShiftCheckNum; + item.CompanyComprehensiveCheckNum = hsse.CompanyComprehensiveCheckNum; + item.CompanySpecialCheckNum = hsse.CompanySpecialCheckNum; + item.ProjectLeadShiftCheckNum = hsse.ProjectLeadShiftCheckNum; + item.ProjectSpecialCheckNum = hsse.ProjectSpecialCheckNum; + item.ProjectMajorCheckNum = hsse.ProjectMajorCheckNum; + item.NearMissNum = hsse.NearMissNum; + item.RecordableEventNum = hsse.RecordableEventNum; + item.GeneralAccidentNum = hsse.GeneralAccidentNum; + item.MajorAccidentNum = hsse.MajorAccidentNum; + item.SeriousAccidentNum = hsse.SeriousAccidentNum; + item.SpecialSeriousAccidentNum = hsse.SpecialSeriousAccidentNum; + item.CompanyComprehensivePlanNum = hsse.CompanyComprehensivePlanNum; + item.CompanySpecialPlanNum = hsse.CompanySpecialPlanNum; + item.CompanyOnSiteDisposalPlan = hsse.CompanyOnSiteDisposalPlan; + item.CompanyDrillNum = hsse.CompanyDrillNum; + item.ProjectComprehensivePlanNum = hsse.ProjectComprehensivePlanNum; + item.ProjectSpecialPlanNum = hsse.ProjectSpecialPlanNum; + item.ProjectOnSiteDisposalPlan = hsse.ProjectOnSiteDisposalPlan; + item.ProjectDrillNum = hsse.ProjectDrillNum; + item.CostExtract = hsse.CostExtract; + item.CostUse = hsse.CostUse; + item.UseEquipmentNum = hsse.UseEquipmentNum; + item.SpecialEquipmentNum = hsse.SpecialEquipmentNum; + item.LicensesNum = hsse.LicensesNum; + item.LicensesCloseNum = hsse.LicensesCloseNum; + item.GeneralClosedNum = hsse.GeneralClosedNum; + item.GeneralNotClosedNum = hsse.GeneralNotClosedNum; + item.MajorClosedNum = hsse.MajorClosedNum; + item.MajorNotClosedNum = hsse.MajorNotClosedNum; + item.GeneralRiskNum = hsse.GeneralRiskNum; + item.LowRiskNum = hsse.LowRiskNum; + item.MediumRiskNum = hsse.MediumRiskNum; + item.HighRiskNum = hsse.HighRiskNum; + item.CompletedNum = hsse.CompletedNum; + item.TrainPersonNum = hsse.TrainPersonNum; + item.ConstructionNum = hsse.ConstructionNum; + item.FinishedNum = hsse.FinishedNum; + item.SuperCompletedNum = hsse.SuperCompletedNum; + item.SuperTrainPersonNum = hsse.SuperTrainPersonNum; + item.SuperConstructionNum = hsse.SuperConstructionNum; + item.SuperFinishedNum = hsse.SuperFinishedNum; + } + return item; + } + } + #endregion + + #region 获取HSSE首页隐患排查治理数据明细 + /// + /// 获取HSSE首页隐患排查治理数据明细 + /// + /// + /// + public static List hiddenDanger() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + List res = new List(); + var reportDate = Funs.DB.HSSEData_HiddenDangerDetail.Max(x => x.ReportDate); + if (reportDate.HasValue) + { + var details = Funs.DB.HSSEData_HiddenDangerDetail.Where(x => x.ReportDate == reportDate.Value).ToList(); + + if (details != null && details.Count > 0) + { + foreach (var d in details) + { + Model.HiddenDangerItem item = new Model.HiddenDangerItem(); + item.Id = d.Id; + item.UnitId = d.UnitId; + item.CollCropCode = d.CollCropCode; + item.UnitName = d.UnitName; + item.ReportDate = d.ReportDate; + item.TypeName = d.TypeName; + item.TotalNum = d.TotalNum; + item.NeedRectifyNum = d.NeedRectifyNum; + res.Add(item); + } + + } + } + + return res; + } + } + #endregion + + #region 获取CQMS首页 + /// + /// 获取CQMS首页 + /// + /// + /// + public static Model.CQMSItem cqms() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.CQMSItem item = new Model.CQMSItem(); + var cqms = db.CQMSData_CQMS.OrderByDescending(x => x.ReportDate).FirstOrDefault(); + if (cqms != null) + { + + item.Id = cqms.Id; + item.UnitId = cqms.UnitId; + item.CollCropCode = cqms.CollCropCode; + item.UnitName = cqms.UnitName; + item.ReportDate = cqms.ReportDate.Value.ToShortDateString(); + item.TrainPersonNum = cqms.TrainPersonNum; + item.TechnicalDisclosePersonNum = cqms.TechnicalDisclosePersonNum; + item.UseNum = cqms.UseNum; + item.OKNum = cqms.OKNum; + item.CompanyPersonNum = cqms.CompanyPersonNum; + item.BranchPersonNum = cqms.BranchPersonNum; + item.ProjectPersonNum = cqms.ProjectPersonNum; + item.ProblemNum = cqms.ProblemNum; + item.ProblemCompletedNum = cqms.ProblemCompletedNum; + item.ProblemNotCompletedNum = cqms.ProblemNotCompletedNum; + item.SNum = cqms.SNum; + item.ANum = cqms.ANum; + item.BNum = cqms.BNum; + item.CNum = cqms.CNum; + item.KeyProcessNum = cqms.KeyProcessNum; + item.KeyProcessOKNum = cqms.KeyProcessOKNum; + item.SpecialProcessNum = cqms.SpecialProcessNum; + item.SpecialProcessOKNum = cqms.SpecialProcessOKNum; + item.ConcealedWorksNum = cqms.ConcealedWorksNum; + item.ConcealedWorksOKNum = cqms.ConcealedWorksOKNum; + item.UnitProjectOnesNum = cqms.UnitProjectOnesNum; + item.UnitProjectOnesOKNum = cqms.UnitProjectOnesOKNum; + item.MaterialInRecheckNum = cqms.MaterialInRecheckNum; + item.MaterialInRecheckOKNum = cqms.MaterialInRecheckOKNum; + item.SingleProjectNum = cqms.SingleProjectNum; + item.UnitProjectNum = cqms.UnitProjectNum; + item.SubProjectNum = cqms.SubProjectNum; + item.SubdivisionalWorksNum = cqms.SubdivisionalWorksNum; + item.InspectionLotNum = cqms.InspectionLotNum; + } + return item; + + + } + + + } + #endregion + + #region 获取HJGL首页 + /// + /// 获取HJGL首页 + /// + /// + /// + public static Model.HJGLItem hjgl() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.HJGLItem item = new Model.HJGLItem(); + var hjgl = db.HJGLData_HJGL.OrderByDescending(x => x.ReportDate).FirstOrDefault(); + if (hjgl != null) + { + + item.Id = hjgl.Id; + item.UnitId = hjgl.UnitId; + item.CollCropCode = hjgl.CollCropCode; + item.UnitName = hjgl.UnitName; + item.ReportDate = hjgl.ReportDate; + item.WelderNum = hjgl.WelderNum; + item.TotalDineNum = hjgl.TotalDineNum; + item.CompleteDineNum = hjgl.CompleteDineNum; + item.TotalFilmNum = hjgl.TotalFilmNum; + item.OKFilmNum = hjgl.OKFilmNum; + + } + return item; + } + } + #endregion + + #region 获取焊接缺陷 + /// + /// 获取焊接缺陷 + /// + /// + /// + public static List defect() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + List res = new List(); + var reportDate = Funs.DB.HJGLData_Defect.Max(x => x.ReportDate); + if (reportDate.HasValue) + { + var defects = Funs.DB.HJGLData_Defect.Where(x => x.ReportDate == reportDate.Value).ToList(); + + if (defects != null && defects.Count > 0) + { + foreach (var d in defects) + { + Model.DefectItem item = new Model.DefectItem(); + item.Id = d.Id; + item.UnitId = d.UnitId; + item.CollCropCode = d.CollCropCode; + item.UnitName = d.UnitName; + item.ReportDate = d.ReportDate; + item.DefectName = d.DefectName; + item.DefectNum = d.DefectNum; + res.Add(item); + } + + } + } + return res; + } + } + #endregion + + #region 获取SHIYE首页 + /// + /// 获取SHIYE首页 + /// + /// + /// + public static Model.SYHSEItem shiye() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.SYHSEItem item = new Model.SYHSEItem(); + var shiye = db.SYHSEData_SYHSE.OrderByDescending(x => x.ReportDate).FirstOrDefault(); + if (shiye != null) + { + + item.Id = shiye.Id; + item.UnitId = shiye.UnitId; + item.CollCropCode = shiye.CollCropCode; + item.UnitName = shiye.UnitName; + item.ReportDate = shiye.ReportDate; + item.GeneralRiskNum = shiye.GeneralRiskNum; + item.LowRiskNum = shiye.LowRiskNum; + item.MediumRiskNum = shiye.MediumRiskNum; + item.HighRiskNum = shiye.HighRiskNum; + item.GradedResponsiblePersonNum = shiye.GradedResponsiblePersonNum; + item.ChargeInsurancePersonNum = shiye.ChargeInsurancePersonNum; + item.DesignQuantity = shiye.DesignQuantity; + item.RunningCapacity = shiye.DesignQuantity; + item.InterlockSettingValue = shiye.InterlockSettingValue; + item.VideoSurveillanceNum = shiye.VideoSurveillanceNum; + item.TotalWorkinghours = shiye.TotalWorkinghours; + item.SafeWorkinghours = shiye.SafeWorkinghours; + item.LostWorkinghours = shiye.LostWorkinghours; + item.TotalEnergyConsumption = shiye.TotalEnergyConsumption; + item.IncomeComprehensiveEnergyConsumption = shiye.IncomeComprehensiveEnergyConsumption; + item.NewWaterConsumption = shiye.NewWaterConsumption; + item.GeneralClosedNum = shiye.GeneralClosedNum; + item.GeneralNotClosedNum = shiye.GeneralNotClosedNum; + item.MajorClosedNum = shiye.MajorClosedNum; + item.MajorNotClosedNum = shiye.MajorNotClosedNum; + item.HotWorkPermitNum = shiye.HotWorkPermitNum; + item.HotWorkClosedNum = shiye.HotWorkClosedNum; + item.HighPermitNum = shiye.HighPermitNum; + item.HighClosedNum = shiye.HighPermitNum; + item.TemporaryElectricityPermitNum = shiye.TemporaryElectricityPermitNum; + item.TemporaryElectricityClosedNum = shiye.TemporaryElectricityClosedNum; + item.BlindPlatePermitNum = shiye.BlindPlatePermitNum; + item.BlindPlateClosedNum = shiye.BlindPlateClosedNum; + item.GroundbreakingPermitNum = shiye.GroundbreakingPermitNum; + item.GroundbreakingClosedNum = shiye.GroundbreakingClosedNum; + item.OpenCircuitPermitNum = shiye.OpenCircuitPermitNum; + item.OpenCircuitClosedNum = shiye.OpenCircuitClosedNum; + item.HoistingPermitNum = shiye.HoistingPermitNum; + item.HoistingClosedNum = shiye.HoistingClosedNum; + + } + return item; + } + } + #endregion + + + } +} diff --git a/SGGL/BLL/API/APIPersonService.cs b/SGGL/BLL/API/APIPersonService.cs index 6ad72c7a..c154f225 100644 --- a/SGGL/BLL/API/APIPersonService.cs +++ b/SGGL/BLL/API/APIPersonService.cs @@ -1660,5 +1660,302 @@ namespace BLL } } } + + #region 根据培训类型获取项目培训人员信息 + /// + /// 根据培训类型获取项目培训人员信息 + /// + /// 项目ID + /// 培训单位ID + /// 培训岗位ID + /// 培训类型ID + /// + public static List getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string departIds, string trainTypeId, string InTime, string strParam) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + DateTime inDateTime = DateTime.Now; + if (!string.IsNullOrEmpty(InTime) && !"null".Equals(InTime)) + { + inDateTime = DateTime.Parse(InTime); + } + + List unitIdList = Funs.GetStrListByStr(unitIds, ','); + var getPersons = (from x in db.View_SitePerson_Person + where x.ProjectId == projectId && unitIdList.Contains(x.UnitId) && x.IsUsed == true && (string.IsNullOrEmpty(strParam) || x.PersonName.Contains(strParam)) && (string.IsNullOrEmpty(InTime) || x.InTime < inDateTime) + && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime >= DateTime.Now) + select new Model.PersonItem + { + PersonId = x.PersonId, + CardNo = x.CardNo, + PersonName = x.PersonName, + SexName = x.SexName, + IdentityCard = x.IdentityCard, + Address = x.Address, + ProjectId = x.ProjectId, + ProjectCode = x.ProjectCode, + ProjectName = x.ProjectName, + UnitId = x.UnitId, + UnitCode = x.UnitCode, + UnitName = x.UnitName, + TeamGroupId = x.TeamGroupId, + TeamGroupName = x.TeamGroupName, + WorkPostId = x.WorkPostId, + WorkPostName = x.WorkPostName, + InTime = string.Format("{0:yyyy-MM-dd}", x.InTime), + OutTime = string.Format("{0:yyyy-MM-dd}", x.OutTime), + OutResult = x.OutResult, + Telephone = x.Telephone, + PhotoUrl = x.PhotoUrl, + DepartName = x.DepartName, + }).ToList(); + + + + + if (!string.IsNullOrEmpty(workPostIds)) + { + List workPostIdList = Funs.GetStrListByStr(workPostIds, ','); + getPersons = getPersons.Where(x => workPostIdList.Contains(x.WorkPostId)).ToList(); + } + if (!string.IsNullOrEmpty(trainTypeId) && trainTypeId == Const.SpecialSafeTrainId)//专项安全培训 + { + var ids = db.Base_WorkPost.Where(x => x.PostType == "2").Select(x => x.WorkPostId).ToList(); + getPersons = getPersons.Where(x => ids.Contains(x.WorkPostId)).ToList(); + } + List getTrainPersonList = new List(); + var getTrainType = TrainTypeService.GetTrainTypeById(trainTypeId); + if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat.Value == false)) + { + int score = 80; + var sysTestRule = db.Sys_TestRule.FirstOrDefault(); + if (sysTestRule != null) + { + if (sysTestRule.PassingScore > 0) + { + score = sysTestRule.PassingScore; + } + } + foreach (var item in getPersons) + { + var getTrainPersonIdList3 = (from x in db.Training_TestRecord + join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId + where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.TestManId == item.PersonId + where x.TestScores > score + select x).FirstOrDefault(); + if (getTrainPersonIdList3 != null) + { + continue; + } + var getTrainPersonIdList1 = (from x in db.EduTrain_TrainRecordDetail + join y in db.EduTrain_TrainRecord on x.TrainingId equals y.TrainingId + where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && x.CheckResult == true && x.PersonId == item.PersonId + select x).FirstOrDefault(); + if (getTrainPersonIdList1 == null) + { + var getTrainPersonIdList2 = (from x in db.Training_Task + join y in db.Training_Plan on x.PlanId equals y.PlanId + where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.UserId == item.PersonId + + select x).FirstOrDefault(); + if (getTrainPersonIdList2 == null) + { + getTrainPersonList.Add(item); + } + } + } + return getTrainPersonList; + } + else if (getTrainType != null && getTrainType.IsRepeat.HasValue && getTrainType.IsRepeat.Value == true)//重复的 过滤人员 + { + foreach (var item in getPersons) + { + //int score = 80; + //var sysTestRule = db.Sys_TestRule.FirstOrDefault(); + //if (sysTestRule != null) + //{ + // if (sysTestRule.PassingScore > 0) + // { + // score = sysTestRule.PassingScore; + // } + //} + //var getTrainPersonIdList2 = (from x in db.Training_TestRecord + // join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId + // where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.TestManId == item.PersonId + // where x.TestScores > score + // select x).FirstOrDefault(); + //if (getTrainPersonIdList2 != null) + //{ + // continue; + //} + getTrainPersonList.Add(item); + } + return getTrainPersonList; + } + //else if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false))//重复的 过滤人员 + //{ + // int score = 80; + // var sysTestRule = db.Sys_TestRule.FirstOrDefault(); + // if (sysTestRule != null) + // { + // if (sysTestRule.PassingScore > 0) + // { + // score = sysTestRule.PassingScore; + // } + // } + // foreach (var item in getPersons) + // { + + // var getTrainPersonIdList2 = (from x in db.Training_TestRecord + // join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId + // where y.ProjectId == projectId && y.TrainTypeId == trainTypeId && y.States != "3" && x.TestManId == item.PersonId + // where x.TestScores > score + // select x).FirstOrDefault(); + // if (getTrainPersonIdList2 != null) + // { + // continue; + // } + // getTrainPersonList.Add(item); + // } + // return getTrainPersonList; + //} + else + { + return getPersons.ToList(); + } + } + } + + + + + + #endregion + + #region 根据培训类型获取项目培训人员信息 + /// + /// 根据培训类型获取项目培训人员信息 + /// + /// 项目ID + /// 培训单位ID + /// 培训岗位ID + /// 培训类型ID + /// + public static List getTrainingPersonListByDepartAndTrainTypeId(string unitIds, string departIds, string trainTypeId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + List unitIdList = Funs.GetStrListByStr(unitIds, ','); + var getPersons = from x in db.Sys_User + where unitIdList.Contains(x.UnitId) + + select new Model.PersonItem + { + PersonId = x.UserId, + PersonName = x.UserName, + SexName = x.Sex, + IdentityCard = x.IdentityCard, + UnitId = x.UnitId, + WorkPostId = x.WorkPostId, + Telephone = x.Telephone, + PhotoUrl = x.PhotoUrl, + DepartId = x.DepartId + }; + if (!string.IsNullOrEmpty(departIds)) + { + List departIdList = Funs.GetStrListByStr(departIds, ','); + getPersons = getPersons.Where(x => departIdList.Contains(x.DepartId)); + } + foreach (var item in getPersons) + { + Model.Base_Unit unit = db.Base_Unit.FirstOrDefault(x => x.UnitId == item.UnitId); + if (!string.IsNullOrEmpty(item.UnitId)) + { + if (unit != null) + { + item.UnitCode = unit.UnitCode; + item.UnitName = unit.UnitName; + } + } + if (!string.IsNullOrEmpty(item.DepartId)) + { + Model.Base_Depart depart = db.Base_Depart.FirstOrDefault(x => x.DepartId == item.DepartId); + if (depart != null) + { + item.DepartName = depart.DepartName; + } + } + + } + if (!string.IsNullOrEmpty(trainTypeId) && trainTypeId == Const.SpecialSafeTrainId)//专项安全培训 + { + var ids = db.Base_WorkPost.Where(x => x.PostType == "2").Select(x => x.WorkPostId).ToList(); + getPersons = getPersons.Where(x => ids.Contains(x.WorkPostId)); + } + + List getTrainPersonList = new List(); + var getTrainType = db.Base_TrainType.FirstOrDefault(e => e.TrainTypeId == trainTypeId); + + + + + if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false)) + { + int score = 80; + var sysTestRule = db.Sys_TestRule.FirstOrDefault(); + if (sysTestRule != null) + { + if (sysTestRule.PassingScore > 0) + { + score = sysTestRule.PassingScore; + } + } + + + foreach (var item in getPersons) + { + var getTrainPersonIdList3 = (from x in db.Training_TestRecord + join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId + where y.TrainTypeId == trainTypeId && y.States != "3" && x.TestManId == item.PersonId + where x.TestScores > score + select x).FirstOrDefault(); + if (getTrainPersonIdList3 != null) + { + continue; + } + + var getTrainPersonIdList1 = (from x in db.EduTrain_TrainRecordDetail + join y in db.EduTrain_TrainRecord on x.TrainingId equals y.TrainingId + where y.ProjectId == null && y.TrainTypeId == trainTypeId && x.CheckResult == true && x.PersonId == item.PersonId + select x).FirstOrDefault(); + if (getTrainPersonIdList1 == null) + { + var getTrainPersonIdList2 = (from x in db.Training_Task + join y in db.Training_Plan on x.PlanId equals y.PlanId + where y.ProjectId == null && y.TrainTypeId == trainTypeId && y.States != "3" && x.UserId == item.PersonId + select x).FirstOrDefault(); + if (getTrainPersonIdList2 == null) + { + getTrainPersonList.Add(item); + } + } + } + return getTrainPersonList; + } + else + { + + + + return getPersons.ToList(); + } + } + } + + + + + + #endregion } } diff --git a/SGGL/BLL/API/HSSE/APITestPlanService.cs b/SGGL/BLL/API/HSSE/APITestPlanService.cs index 291f1f97..3b206c2c 100644 --- a/SGGL/BLL/API/HSSE/APITestPlanService.cs +++ b/SGGL/BLL/API/HSSE/APITestPlanService.cs @@ -24,24 +24,53 @@ namespace BLL { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - var getDataLists = (from x in db.Training_TestPlan - where x.ProjectId == projectId && (x.States == states || states == null) - orderby x.TestStartTime descending - select new Model.TestPlanItem - { - TestPlanId = x.TestPlanId, - TestPlanCode = x.PlanCode, - TestPlanName = x.PlanName, - ProjectId = x.ProjectId, - TestPlanManId = x.PlanManId, - TestPlanManName = db.Sys_User.First(y => y.UserId == x.PlanManId).UserName, - TestPalce = x.TestPalce, - TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime), - TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime), - States = x.States, - QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'), - }).ToList(); - return getDataLists; + if (string.IsNullOrEmpty(projectId)) + { + var getDataLists = (from x in db.Training_TestPlan + where (x.ProjectId == null || x.ProjectId=="") && (x.States == states || states == null) + orderby x.TestStartTime descending + select new Model.TestPlanItem + { + TestPlanId = x.TestPlanId, + TestPlanCode = x.PlanCode, + TestPlanName = x.PlanName, + ProjectId = x.ProjectId, + DepartIds = x.DepartIds, + DepartNames = WorkPostService.getDepartNamesByIdsForApi(x.DepartIds), + TestPlanManId = x.PlanManId, + TestPlanManName = db.Sys_User.First(y => y.UserId == x.PlanManId).UserName, + TestPalce = x.TestPalce, + TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime), + TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime), + States = x.States, + QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'), + }).ToList(); + return getDataLists; + } + else + { + var getDataLists = (from x in db.Training_TestPlan + where x.ProjectId == projectId && (x.States == states || states == null) + orderby x.TestStartTime descending + select new Model.TestPlanItem + { + TestPlanId = x.TestPlanId, + TestPlanCode = x.PlanCode, + TestPlanName = x.PlanName, + ProjectId = x.ProjectId, + TestPlanManId = x.PlanManId, + DepartIds = x.DepartIds, + DepartNames = WorkPostService.getDepartNamesByIdsForApi(x.DepartIds), + TestPlanManName = db.Sys_User.First(y => y.UserId == x.PlanManId).UserName, + TestPalce = x.TestPalce, + TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime), + TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime), + States = x.States, + QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'), + }).ToList(); + return getDataLists; + + } } } #endregion diff --git a/SGGL/BLL/API/HSSE/APITestRecordService.cs b/SGGL/BLL/API/HSSE/APITestRecordService.cs index 0f836821..84fc7bb4 100644 --- a/SGGL/BLL/API/HSSE/APITestRecordService.cs +++ b/SGGL/BLL/API/HSSE/APITestRecordService.cs @@ -389,7 +389,7 @@ namespace BLL var getDataLists = (from x in db.Training_TestRecord join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId join z in db.SitePerson_Person on x.TestManId equals z.PersonId - where x.ProjectId == projectId && x.TestStartTime.HasValue && x.TestEndTime.HasValue + where ((string.IsNullOrEmpty(projectId) && x.ProjectId == null) || (!string.IsNullOrEmpty(projectId) && x.ProjectId == projectId)) && x.TestStartTime.HasValue && x.TestEndTime.HasValue orderby x.TestStartTime descending select new Model.TestRecordItem { @@ -697,5 +697,73 @@ namespace BLL return newTestRecord.TestRecordId; } #endregion + + public static List getTrainingTestRecordListByDepartId(string unitId, string departId, string strPass, string strParam) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Training_TestRecord + join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId + join z in db.Sys_User on x.TestManId equals z.UserId + where x.ProjectId == null && x.TestStartTime.HasValue && x.TestEndTime.HasValue + orderby x.TestStartTime descending + select new Model.TestRecordItem + { + TestRecordId = x.TestRecordId, + ProjectId = x.ProjectId, + TestPlanId = x.TestPlanId, + TestPlanName = y.PlanName, + UnitId = z.UnitId, + UnitName = getUnitName(z.UnitId), + WorkPostId = z.WorkPostId, + WorkPostName = db.Base_WorkPost.FirstOrDefault(p => p.WorkPostId == z.WorkPostId).WorkPostName, + DepartId = z.DepartId, + TestManId = x.TestManId, + TestManName = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == x.TestManId).PersonName, + TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime), + TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime), + Duration = x.Duration, + TestPlanEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime.Value.AddMinutes(x.Duration)), + TotalScore = y.TotalScore ?? 0, + TestScores = x.TestScores ?? 0, + TestType = x.TestType, + TemporaryUser = x.TemporaryUser, + }); + if (!string.IsNullOrEmpty(unitId)) + { + getDataLists = getDataLists.Where(x => x.UnitId == unitId); + } + if (!string.IsNullOrEmpty(departId)) + { + getDataLists = getDataLists.Where(x => x.DepartId == departId); + } + if (!string.IsNullOrEmpty(strParam)) + { + getDataLists = getDataLists.Where(x => x.TestManName.Contains(strParam)); + } + if (!string.IsNullOrEmpty(strPass)) + { + int PassingScore = SysConstSetService.getPassScoreForApi(); + if (strPass == "0") + { + getDataLists = getDataLists.Where(x => x.TestScores < PassingScore); + } + else + { + getDataLists = getDataLists.Where(x => x.TestScores >= PassingScore); + } + } + foreach (var item in getDataLists) + { + var depart = db.Base_Depart.FirstOrDefault(x => x.DepartId == item.DepartId); + if (depart != null) + { + item.DepartName = depart.DepartName; + } + + } + return getDataLists.ToList(); + } + } } } \ No newline at end of file diff --git a/SGGL/BLL/API/HSSE/APITrainRecordService.cs b/SGGL/BLL/API/HSSE/APITrainRecordService.cs index 82a9ff42..9334889d 100644 --- a/SGGL/BLL/API/HSSE/APITrainRecordService.cs +++ b/SGGL/BLL/API/HSSE/APITrainRecordService.cs @@ -21,7 +21,8 @@ namespace BLL using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { var getDataLists = (from x in db.EduTrain_TrainRecord - where x.ProjectId == projectId && x.TrainTypeId == trainTypeId + where ((string.IsNullOrEmpty(projectId) && x.ProjectId == null) + || (!string.IsNullOrEmpty(projectId) && (x.ProjectId == null || x.ProjectId == ""))) && x.TrainTypeId == trainTypeId orderby x.TrainStartDate descending select new Model.TrainRecordItem { diff --git a/SGGL/BLL/API/HSSE/APITrainTestRecordService.cs b/SGGL/BLL/API/HSSE/APITrainTestRecordService.cs index d73e5d57..360f015f 100644 --- a/SGGL/BLL/API/HSSE/APITrainTestRecordService.cs +++ b/SGGL/BLL/API/HSSE/APITrainTestRecordService.cs @@ -22,7 +22,7 @@ namespace BLL using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { var getDataLists = (from x in db.Training_TrainTestRecord - where x.ProjectId == projectId + where ((string.IsNullOrEmpty(projectId) && (x.ProjectId == null || x.ProjectId == "")) || (!string.IsNullOrEmpty(projectId) && x.ProjectId == projectId)) orderby x.DateA descending select new Model.HSSE.TrainTestRecordItem { diff --git a/SGGL/BLL/API/HSSE/APITrainingPlanService.cs b/SGGL/BLL/API/HSSE/APITrainingPlanService.cs index 8e55c7ee..cb198f1b 100644 --- a/SGGL/BLL/API/HSSE/APITrainingPlanService.cs +++ b/SGGL/BLL/API/HSSE/APITrainingPlanService.cs @@ -21,7 +21,15 @@ namespace BLL using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { var getDataLists = (from x in db.Training_Plan - where x.ProjectId == projectId && (x.States == states || states == null) && x.TrainTypeId == trainTypeId + where + ( + (string.IsNullOrEmpty(projectId) && (x.ProjectId == null || x.ProjectId == "")) + || + (!string.IsNullOrEmpty(projectId) && x.ProjectId == projectId) + ) + + && (x.States == states || states == null) + && x.TrainTypeId == trainTypeId orderby x.TrainStartDate descending select new Model.TrainingPlanItem { @@ -76,14 +84,18 @@ namespace BLL TeachMan = x.TeachMan, UnitIds = x.UnitIds, WorkPostId = x.WorkPostId, + DepartIds = x.DepartIds, + DepartNames = WorkPostService.getDepartNamesByIdsForApi(x.DepartIds), TrainContent = x.TrainContent, - UnitNames = UnitService.getUnitNamesUnitIds(x.UnitIds), - WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIds(x.WorkPostId), + UnitNames = UnitService.getUnitNamesUnitIdsForApi(x.UnitIds), + WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIdsForApi(x.WorkPostId), DesignerId = x.DesignerId, DesignerName = db.Sys_User.First(y => y.UserId == x.DesignerId).UserName, DesignerDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.TrainStartDate), States = x.States, QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'), + + TrainingTasks = getTrainingTasks(x.PlanId) }; return getDataLists.FirstOrDefault(); } @@ -136,7 +148,7 @@ namespace BLL { PlanId = trainingPlan.PlanId, PlanCode = trainingPlan.PlanCode, - ProjectId = trainingPlan.ProjectId, + DesignerId = trainingPlan.DesignerId, PlanName = trainingPlan.PlanName, TrainContent = trainingPlan.TrainContent, @@ -147,9 +159,15 @@ namespace BLL TrainTypeId = trainingPlan.TrainTypeId, UnitIds = trainingPlan.UnitIds, WorkPostId = trainingPlan.WorkPostId, + DepartIds = trainingPlan.DepartIds, + DepartNames = trainingPlan.DepartNames, States = trainingPlan.States, }; + if (!string.IsNullOrEmpty(trainingPlan.ProjectId)) + { + newTrainingPlan.ProjectId = trainingPlan.ProjectId; + } if (!string.IsNullOrEmpty(trainingPlan.TrainLevelId)) { newTrainingPlan.TrainLevelId = trainingPlan.TrainLevelId; @@ -200,6 +218,8 @@ namespace BLL isUpdate.UnitIds = newTrainingPlan.UnitIds; isUpdate.WorkPostId = newTrainingPlan.WorkPostId; isUpdate.States = newTrainingPlan.States; + isUpdate.DepartIds = newTrainingPlan.DepartIds; + isUpdate.DepartNames = newTrainingPlan.DepartNames; db.SubmitChanges(); } ////删除培训任务 @@ -275,6 +295,24 @@ namespace BLL } } + public static List getTrainingTasks(string planId) { + var list = new List(); + var taskList = Funs.DB.Training_Task.Where(x => x.PlanId == planId); + if (taskList.Count()>0) + { + foreach (var item in taskList) + { + var model = new Model.TrainingTaskItem(); + model.TaskId = item.TaskId; + model.PlanId = item.PlanId; + model.PersonId = item.UserId; + model.PersonName = UserService.GetUserNameByUserId(item.UserId); + list.Add(model); + } + } + return list; + } + /// /// 新增 培训人员明细 /// diff --git a/SGGL/BLL/API/HSSE/APITrainingTaskService.cs b/SGGL/BLL/API/HSSE/APITrainingTaskService.cs index e7a2d97a..1d06cefc 100644 --- a/SGGL/BLL/API/HSSE/APITrainingTaskService.cs +++ b/SGGL/BLL/API/HSSE/APITrainingTaskService.cs @@ -21,7 +21,7 @@ namespace BLL personId = PersonService.GetPersonIdByUserId(personId); var getDataLists = (from x in db.Training_Task join y in db.Training_Plan on x.PlanId equals y.PlanId - where x.ProjectId == projectId && x.UserId == personId && y.States != "0" + where ((string.IsNullOrEmpty(projectId) && (x.ProjectId == null || x.ProjectId == "")) || (!string.IsNullOrEmpty(projectId) && x.ProjectId == projectId)) && x.UserId == personId && y.States != "0" orderby x.TaskDate descending select new Model.TrainingTaskItem { @@ -31,17 +31,30 @@ namespace BLL PlanName = y.PlanName, TrainStartDate = string.Format("{0:yyyy-MM-dd HH:mm}", y.TrainStartDate), TeachAddress = y.TeachAddress, - //PersonId = x.UserId, + PersonId = x.UserId, PersonName = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == x.UserId).PersonName, TaskDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.TaskDate), TrainTypeName = db.Base_TrainType.FirstOrDefault(b => b.TrainTypeId == y.TrainTypeId).TrainTypeName, TrainLevelName = db.Base_TrainLevel.FirstOrDefault(b => b.TrainLevelId == y.TrainLevelId).TrainLevelName, PlanStatesName = y.States == "3" ? "已完成" : "培训中", - - }).ToList(); + TaskStatesName = x.States == "2" ? "已完成" : "培训中", + TrainingItemCode = getTrainingItemCode(y.PlanId) + }).ToList(); return getDataLists; } } + + public static string getTrainingItemCode(string PlanId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var ids = db.Training_PlanItem.Where(xx => xx.PlanId == PlanId).Select(x => x.CompanyTrainingItemId).ToList(); + var codes = db.Training_CompanyTrainingItem.Where(x => ids.Contains(x.CompanyTrainingItemId)).Select(x => x.CompanyTrainingItemCode); + string res = string.Join(",", codes); + return res; + } + return ""; + } #endregion #region 根据TaskId获取培训任务教材明细列表 @@ -210,10 +223,29 @@ namespace BLL TaskId = x.TaskId, PlanId = x.PlanId, PersonId = x.UserId, - PersonName = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == x.UserId).PersonName, + TaskDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.TaskDate), - States = x.States, + States = x.States, }).ToList(); + + foreach (var item in getDataLists) + { + var person = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == item.PersonId); + if (person != null) + { + item.PersonName = person.PersonName; + } + else + { + var sysUser = db.Sys_User.FirstOrDefault(p => p.UserId == item.PersonId); + if (sysUser != null) + { + item.PersonName = sysUser.UserName; + } + } + + } + return getDataLists; } } diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj index 54ba97a2..f14a9dce 100644 --- a/SGGL/BLL/BLL.csproj +++ b/SGGL/BLL/BLL.csproj @@ -170,6 +170,7 @@ + diff --git a/SGGL/BLL/BaseInfo/WorkPostService.cs b/SGGL/BLL/BaseInfo/WorkPostService.cs index 50cf13a4..000eb118 100644 --- a/SGGL/BLL/BaseInfo/WorkPostService.cs +++ b/SGGL/BLL/BaseInfo/WorkPostService.cs @@ -260,5 +260,84 @@ namespace BLL return workPostName; } #endregion + + public static string getDepartNamesByIds(object departIdsIds) + { + string departName = string.Empty; + if (departIdsIds != null) + { + string[] ids = departIdsIds.ToString().Split(','); + foreach (string id in ids) + { + var q = GetDepartById(id); + if (q != null) + { + departName += q.DepartName + ","; + } + } + if (departName != string.Empty) + { + departName = departName.Substring(0, departName.Length - 1); ; + } + } + + return departName; + } + public static Model.Base_Depart GetDepartById(string departId) + { + return Funs.DB.Base_Depart.FirstOrDefault(e => e.DepartId == departId); + } + + public static string getDepartNamesByIdsForApi(object departIdsIds) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string departName = string.Empty; + if (departIdsIds != null) + { + string[] ids = departIdsIds.ToString().Split(','); + foreach (string id in ids) + { + var q = db.Base_Depart.FirstOrDefault(e => e.DepartId == id); + if (q != null) + { + departName += q.DepartName + ","; + } + } + if (departName != string.Empty) + { + departName = departName.Substring(0, departName.Length - 1); ; + } + } + + return departName; + } + } + + public static string getWorkPostNamesWorkPostIdsForApi(object workPostIds) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string workPostName = string.Empty; + if (workPostIds != null) + { + string[] ids = workPostIds.ToString().Split(','); + foreach (string id in ids) + { + var q = db.Base_WorkPost.FirstOrDefault(e => e.WorkPostId == id); + if (q != null) + { + workPostName += q.WorkPostName + ","; + } + } + if (workPostName != string.Empty) + { + workPostName = workPostName.Substring(0, workPostName.Length - 1); ; + } + } + + return workPostName; + } + } } } \ No newline at end of file diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs index db2fcf13..31b762d9 100644 --- a/SGGL/BLL/Common/Const.cs +++ b/SGGL/BLL/Common/Const.cs @@ -6415,5 +6415,10 @@ namespace BLL /// 施工作业风险 /// public const string ConstructionRiskMenuId = "F531D523-35BC-4D13-88D3-CB2554C4185C"; + + /// + /// 专项安全培训 id + /// + public static string SpecialSafeTrainId = "0e7fdf78-eaa0-4d00-a60b-490040bbea18"; } } \ No newline at end of file diff --git a/SGGL/BLL/HSSE/EduTrain/CompanyTrainingItemService.cs b/SGGL/BLL/HSSE/EduTrain/CompanyTrainingItemService.cs index 7b841525..9e6898bc 100644 --- a/SGGL/BLL/HSSE/EduTrain/CompanyTrainingItemService.cs +++ b/SGGL/BLL/HSSE/EduTrain/CompanyTrainingItemService.cs @@ -33,6 +33,8 @@ namespace BLL newCompanyTrainingItem.AttachUrl = companyTrainingItem.AttachUrl; newCompanyTrainingItem.CompileMan = companyTrainingItem.CompileMan; newCompanyTrainingItem.CompileDate = companyTrainingItem.CompileDate; + newCompanyTrainingItem.LearningTime = companyTrainingItem.LearningTime; + newCompanyTrainingItem.TestTrainingIds = companyTrainingItem.TestTrainingIds; db.Training_CompanyTrainingItem.InsertOnSubmit(newCompanyTrainingItem); db.SubmitChanges(); } @@ -51,6 +53,8 @@ namespace BLL newCompanyTrainingItem.AttachUrl = companyTrainingItem.AttachUrl; newCompanyTrainingItem.CompileMan = companyTrainingItem.CompileMan; newCompanyTrainingItem.CompileDate = companyTrainingItem.CompileDate; + newCompanyTrainingItem.LearningTime = companyTrainingItem.LearningTime; + newCompanyTrainingItem.TestTrainingIds = companyTrainingItem.TestTrainingIds; db.SubmitChanges(); } } diff --git a/SGGL/BLL/HSSE/EduTrain/TrainingItemService.cs b/SGGL/BLL/HSSE/EduTrain/TrainingItemService.cs index fe33b8b7..27abd599 100644 --- a/SGGL/BLL/HSSE/EduTrain/TrainingItemService.cs +++ b/SGGL/BLL/HSSE/EduTrain/TrainingItemService.cs @@ -52,7 +52,8 @@ namespace BLL ResourcesFromType = trainingItem.ResourcesFromType, IsPass = trainingItem.IsPass, UnitId = trainingItem.UnitId, - UpState = trainingItem.UpState + UpState = trainingItem.UpState, + LearningTime = trainingItem.LearningTime }; db.Training_TrainingItem.InsertOnSubmit(newTrainingItem); @@ -80,6 +81,7 @@ namespace BLL newTrainingItem.ResourcesFrom = trainingItem.ResourcesFrom; newTrainingItem.ResourcesFromType = trainingItem.ResourcesFromType; newTrainingItem.UpState = trainingItem.UpState; + newTrainingItem.LearningTime = trainingItem.LearningTime; db.SubmitChanges(); } diff --git a/SGGL/BLL/SQLHelper.cs b/SGGL/BLL/SQLHelper.cs index 889cf6bc..a7db6592 100644 --- a/SGGL/BLL/SQLHelper.cs +++ b/SGGL/BLL/SQLHelper.cs @@ -972,5 +972,29 @@ namespace BLL maxId = GetIntValue(str); return maxId; } + + public static DataTable GetDataTableRunCommand(SqlCommand cmd) + { + try + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + cmd.Connection = conn; + conn.Open(); + + using (SqlDataAdapter adapter = new SqlDataAdapter(cmd)) + { + DataTable dataTable = new DataTable(); + adapter.Fill(dataTable); + return dataTable; + } + } + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + return null; + } + } } } diff --git a/SGGL/BLL/SysManage/SysConstSetService.cs b/SGGL/BLL/SysManage/SysConstSetService.cs index e5fe8a1d..1b50eb2a 100644 --- a/SGGL/BLL/SysManage/SysConstSetService.cs +++ b/SGGL/BLL/SysManage/SysConstSetService.cs @@ -380,5 +380,19 @@ } } #endregion + + public static int getPassScoreForApi() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + int passScore = 80; + var testRule = db.Sys_TestRule.FirstOrDefault(); + if (testRule != null) + { + passScore = testRule.PassingScore; + } + return passScore; + } + } } } diff --git a/SGGL/BLL/SysManage/UnitService.cs b/SGGL/BLL/SysManage/UnitService.cs index 8adebc22..86063351 100644 --- a/SGGL/BLL/SysManage/UnitService.cs +++ b/SGGL/BLL/SysManage/UnitService.cs @@ -927,5 +927,31 @@ namespace BLL return q; } } + + public static string getUnitNamesUnitIdsForApi(object unitIds) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string unitName = string.Empty; + if (unitIds != null) + { + string[] ids = unitIds.ToString().Split(','); + foreach (string id in ids) + { + var q = db.Base_Unit.FirstOrDefault(x => x.UnitId == id); + if (q != null) + { + unitName += q.UnitName + ","; + } + } + if (unitName != string.Empty) + { + unitName = unitName.Substring(0, unitName.Length - 1); ; + } + } + + return unitName; + } + } } } diff --git a/SGGL/FineUIPro.Web/ErrLog.txt b/SGGL/FineUIPro.Web/ErrLog.txt index c0528944..83f414ec 100644 --- a/SGGL/FineUIPro.Web/ErrLog.txt +++ b/SGGL/FineUIPro.Web/ErrLog.txt @@ -1020,3 +1020,201 @@ IP地址:::1 环境数据同步结束! 环境数据同步开始! 环境数据同步结束! +通用定时器开启! +启用环境定时器开始! +启用环境定时器结束! +通用定时器结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +通用定时器开启! +启用环境定时器开始! +启用环境定时器结束! +通用定时器结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +环境数据同步开始! +环境数据同步结束! +通用定时器开启! +启用环境定时器开始! +启用环境定时器结束! +通用定时器结束! +通用定时器开启! +启用环境定时器开始! +启用环境定时器结束! +通用定时器结束! + +错误信息开始=====> +错误类型:SqlException +错误信息:INSERT 语句与 FOREIGN KEY 约束"FK_Training_TrainingItem_Training_Training"冲突。该冲突发生于数据库"SGGLDB_XJYJ",表"dbo.Training_Training", column 'TrainingId'。 +语句已终止。 +错误堆栈: + 在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) + 在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) + 在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) + 在 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) + 在 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) + 在 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) + 在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) + 在 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) + 在 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() + 在 System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) + 在 System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) + 在 System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) + 在 System.Data.Linq.ChangeDirector.StandardChangeDirector.DynamicInsert(TrackedObject item) + 在 System.Data.Linq.ChangeDirector.StandardChangeDirector.Insert(TrackedObject item) + 在 System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode) + 在 System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode) + 在 System.Data.Linq.DataContext.SubmitChanges() + 在 BLL.TrainingItemService.AddTrainingItem(Training_TrainingItem trainingItem) 位置 G:\公司项目\新疆油建\SGGL_TCC\SGGL\BLL\HSSE\EduTrain\TrainingItemService.cs:行号 60 + 在 FineUIPro.Web.HSSE.EduTrain.TrainingItemSave.SaveData(Boolean isClose) 位置 G:\公司项目\新疆油建\SGGL_TCC\SGGL\FineUIPro.Web\HSSE\EduTrain\TrainingItemSave.aspx.cs:行号 121 + 在 FineUIPro.Web.HSSE.EduTrain.TrainingItemSave.btnSave_Click(Object sender, EventArgs e) 位置 G:\公司项目\新疆油建\SGGL_TCC\SGGL\FineUIPro.Web\HSSE\EduTrain\TrainingItemSave.aspx.cs:行号 148 + 在 FineUIPro.Button.OnClick(EventArgs e) + 在 (Button , EventArgs ) + 在 FineUIPro.Button.RaisePostBackEvent(String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:11/19/2024 14:30:27 +出错文件:http://localhost:4528/HSSE/EduTrain/TrainingItemSave.aspx?TrainingId=0 +IP地址:::1 +操作人员:JT + +出错时间:11/19/2024 14:30:27 + + +错误信息开始=====> +错误类型:SqlException +错误信息:INSERT 语句与 FOREIGN KEY 约束"FK_Training_TrainingItem_Training_Training"冲突。该冲突发生于数据库"SGGLDB_XJYJ",表"dbo.Training_Training", column 'TrainingId'。 +语句已终止。 +错误堆栈: + 在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) + 在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) + 在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) + 在 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) + 在 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) + 在 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) + 在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) + 在 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) + 在 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() + 在 System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) + 在 System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) + 在 System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) + 在 System.Data.Linq.ChangeDirector.StandardChangeDirector.DynamicInsert(TrackedObject item) + 在 System.Data.Linq.ChangeDirector.StandardChangeDirector.Insert(TrackedObject item) + 在 System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode) + 在 System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode) + 在 System.Data.Linq.DataContext.SubmitChanges() + 在 BLL.TrainingItemService.AddTrainingItem(Training_TrainingItem trainingItem) 位置 G:\公司项目\新疆油建\SGGL_TCC\SGGL\BLL\HSSE\EduTrain\TrainingItemService.cs:行号 60 + 在 FineUIPro.Web.HSSE.EduTrain.TrainingItemSave.SaveData(Boolean isClose) 位置 G:\公司项目\新疆油建\SGGL_TCC\SGGL\FineUIPro.Web\HSSE\EduTrain\TrainingItemSave.aspx.cs:行号 121 + 在 FineUIPro.Web.HSSE.EduTrain.TrainingItemSave.btnSave_Click(Object sender, EventArgs e) 位置 G:\公司项目\新疆油建\SGGL_TCC\SGGL\FineUIPro.Web\HSSE\EduTrain\TrainingItemSave.aspx.cs:行号 148 + 在 FineUIPro.Button.OnClick(EventArgs e) + 在 (Button , EventArgs ) + 在 FineUIPro.Button.RaisePostBackEvent(String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:11/19/2024 14:31:31 +出错文件:http://localhost:4528/HSSE/EduTrain/TrainingItemSave.aspx?TrainingId=0 +IP地址:::1 +操作人员:JT + +出错时间:11/19/2024 14:31:31 + +通用定时器开启! +启用环境定时器开始! +启用环境定时器结束! +通用定时器结束! + +错误信息开始=====> +错误类型:HttpParseException +错误信息:未能加载类型“FineUIPro.Web.Person.EduTrain.Plan”。 +错误堆栈: + 在 System.Web.UI.TemplateParser.ProcessException(Exception ex) + 在 System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) + 在 System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) +----错误类型:HttpException +----错误信息: +----未能加载类型“FineUIPro.Web.Person.EduTrain.Plan”。 +----错误堆栈: + 在 System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) + 在 System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) + 在 System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) +出错时间:11/19/2024 14:50:11 +出错文件:http://localhost:4528/Person/EduTrain/Plan.aspx +IP地址:::1 + +出错时间:11/19/2024 14:50:11 + + +错误信息开始=====> +错误类型:HttpParseException +错误信息:未能加载类型“FineUIPro.Web.Person.EduTrain.Task”。 +错误堆栈: + 在 System.Web.UI.TemplateParser.ProcessException(Exception ex) + 在 System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) + 在 System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) +----错误类型:HttpException +----错误信息: +----未能加载类型“FineUIPro.Web.Person.EduTrain.Task”。 +----错误堆栈: + 在 System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) + 在 System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) + 在 System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) +出错时间:11/19/2024 14:50:21 +出错文件:http://localhost:4528/Person/EduTrain/Task.aspx +IP地址:::1 + +出错时间:11/19/2024 14:50:21 + +通用定时器开启! +启用环境定时器开始! +启用环境定时器结束! +通用定时器结束! +通用定时器开启! +启用环境定时器开始! +启用环境定时器结束! +通用定时器结束! +通用定时器开启! +启用环境定时器开始! +启用环境定时器结束! +通用定时器结束! +通用定时器开启! +启用环境定时器开始! +启用环境定时器结束! +通用定时器结束! diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index d3e573f5..d616a9cf 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -2378,6 +2378,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -15939,6 +15984,321 @@ PersonDuty.aspx + + AccidentCase.aspx + ASPXCodeBehind + + + AccidentCase.aspx + + + AccidentCaseItemSave.aspx + ASPXCodeBehind + + + AccidentCaseItemSave.aspx + + + AccidentCaseItemSelectCloumn.aspx + ASPXCodeBehind + + + AccidentCaseItemSelectCloumn.aspx + + + AccidentCaseSave.aspx + ASPXCodeBehind + + + AccidentCaseSave.aspx + + + CompanyTraining.aspx + ASPXCodeBehind + + + CompanyTraining.aspx + + + CompanyTrainingItemSave.aspx + ASPXCodeBehind + + + CompanyTrainingItemSave.aspx + + + CompanyTrainingSave.aspx + ASPXCodeBehind + + + CompanyTrainingSave.aspx + + + Plan.aspx + ASPXCodeBehind + + + Plan.aspx + + + PlanEdit.aspx + ASPXCodeBehind + + + PlanEdit.aspx + + + PlanView.aspx + ASPXCodeBehind + + + PlanView.aspx + + + ShowPerson.aspx + ASPXCodeBehind + + + ShowPerson.aspx + + + Task.aspx + ASPXCodeBehind + + + Task.aspx + + + TaskNotice.aspx + ASPXCodeBehind + + + TaskNotice.aspx + + + TaskNoticeEdit.aspx + ASPXCodeBehind + + + TaskNoticeEdit.aspx + + + TaskRecordView.aspx + ASPXCodeBehind + + + TaskRecordView.aspx + + + TaskView.aspx + ASPXCodeBehind + + + TaskView.aspx + + + TestPlan.aspx + ASPXCodeBehind + + + TestPlan.aspx + + + TestPlanView.aspx + ASPXCodeBehind + + + TestPlanView.aspx + + + TestRecord.aspx + ASPXCodeBehind + + + TestRecord.aspx + + + TestRecordItem.aspx + ASPXCodeBehind + + + TestRecordItem.aspx + + + TestRecordPrint.aspx + ASPXCodeBehind + + + TestRecordPrint.aspx + + + TestRecordView.aspx + ASPXCodeBehind + + + TestRecordView.aspx + + + TestStatistics.aspx + ASPXCodeBehind + + + TestStatistics.aspx + + + TestTraining.aspx + ASPXCodeBehind + + + TestTraining.aspx + + + TestTrainingItemIn.aspx + ASPXCodeBehind + + + TestTrainingItemIn.aspx + + + TestTrainingItemSave.aspx + ASPXCodeBehind + + + TestTrainingItemSave.aspx + + + TestTrainingOut.aspx + ASPXCodeBehind + + + TestTrainingOut.aspx + + + TestTrainingSave.aspx + ASPXCodeBehind + + + TestTrainingSave.aspx + + + TestTrainRecord.aspx + ASPXCodeBehind + + + TestTrainRecord.aspx + + + TrainDB.aspx + ASPXCodeBehind + + + TrainDB.aspx + + + TrainFind.aspx + ASPXCodeBehind + + + TrainFind.aspx + + + TrainingItemSave.aspx + ASPXCodeBehind + + + TrainingItemSave.aspx + + + TrainingSave.aspx + ASPXCodeBehind + + + TrainingSave.aspx + + + TrainRecord.aspx + ASPXCodeBehind + + + TrainRecord.aspx + + + TrainRecordEdit.aspx + ASPXCodeBehind + + + TrainRecordEdit.aspx + + + TrainRecordIn.aspx + ASPXCodeBehind + + + TrainRecordIn.aspx + + + TrainRecordView.aspx + ASPXCodeBehind + + + TrainRecordView.aspx + + + TrainTest.aspx + ASPXCodeBehind + + + TrainTest.aspx + + + TrainTestDB.aspx + ASPXCodeBehind + + + TrainTestDB.aspx + + + TrainTestDBEdit.aspx + ASPXCodeBehind + + + TrainTestDBEdit.aspx + + + TrainTestDBSelectCloumn.aspx + ASPXCodeBehind + + + TrainTestDBSelectCloumn.aspx + + + TrainTestItemEdit.aspx + ASPXCodeBehind + + + TrainTestItemEdit.aspx + + + TrainTestRecord.aspx + ASPXCodeBehind + + + TrainTestRecord.aspx + + + TrainTestRecordEdit.aspx + ASPXCodeBehind + + + TrainTestRecordEdit.aspx + + + TrainTestView.aspx + ASPXCodeBehind + + + TrainTestView.aspx + PersonCheck.aspx ASPXCodeBehind diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx b/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx index f223b70c..c0e44ba4 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx @@ -39,6 +39,25 @@ + + + + + + + + + + + + + + + + + @@ -68,3 +87,45 @@ + \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.cs index 8af4d386..575a146b 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.cs @@ -2,6 +2,7 @@ using System.Linq; using Model; using BLL; +using System.Collections.Generic; namespace FineUIPro.Web.HSSE.EduTrain { @@ -46,7 +47,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { this.GetButtonPower(); btnClose.OnClientClick = ActiveWindow.GetHideReference(); - + BoundTree(treeTestTraining.Nodes, "0"); this.CompanyTrainingItemId = Request.QueryString["CompanyTrainingItemId"]; this.CompanyTrainingId = Request.QueryString["CompanyTrainingId"]; if (!string.IsNullOrEmpty(this.CompanyTrainingItemId)) @@ -59,6 +60,25 @@ namespace FineUIPro.Web.HSSE.EduTrain txtCompanyTrainingItemName.Text = q.CompanyTrainingItemName; txtCompileMan.Text = q.CompileMan; hdCompileMan.Text = q.CompileMan; + if (!string.IsNullOrEmpty(q.TestTrainingIds)) + { + ddTestTraining.Values = q.TestTrainingIds.Split(','); + string text = ""; + var trains = Funs.DB.Training_TestTraining.ToList(); + foreach (var ids in ddTestTraining.Values) + { + var t = trains.FirstOrDefault(x => x.TrainingId == ids); + if (t != null) + { + text += "[" + t.TrainingCode + "]" + t.TrainingName + ","; + } + } + ddTestTraining.Text = text.TrimEnd(new char[] { ',' }); + } + if (q.LearningTime.HasValue) + { + txtLearningTime.Text = (q.LearningTime.Value / 60).ToString(); + } if (q.CompileDate != null) { txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", q.CompileDate); @@ -81,6 +101,45 @@ namespace FineUIPro.Web.HSSE.EduTrain } #endregion + private List GetNewTraining(string parentId) + { + return (from x in Funs.DB.Training_TestTraining + where x.SupTrainingId == parentId + orderby x.TrainingCode + select x).ToList(); + } + private void BoundTree(TreeNodeCollection nodes, string parentId) + { + var dt = GetNewTraining(parentId); + if (dt.Count() > 0) + { + TreeNode tn = null; + foreach (var dr in dt) + { + string name = dr.TrainingName; + if (!string.IsNullOrEmpty(dr.TrainingCode)) + { + name = "[" + dr.TrainingCode + "]" + dr.TrainingName; + } + tn = new TreeNode + { + + Text = name, + NodeID = dr.TrainingId, + EnableClickEvent = true, + ToolTip = dr.TrainingName + }; + nodes.Add(tn); + ///是否存在下级节点 + var sup = Funs.DB.Training_TestTraining.FirstOrDefault(x => x.SupTrainingId == tn.NodeID); + if (sup != null) + { + BoundTree(tn.Nodes, tn.NodeID); + } + } + } + } + #region 保存 /// /// 保存数据 @@ -93,6 +152,14 @@ namespace FineUIPro.Web.HSSE.EduTrain CompanyTrainingItemName = this.txtCompanyTrainingItemName.Text.Trim(), CompileMan = hdCompileMan.Text.Trim() }; + if (ddTestTraining.Values != null && ddTestTraining.Values.Length > 0) + { + newCompanyTrainItem.TestTrainingIds = string.Join(",", ddTestTraining.Values); + } + if (!string.IsNullOrEmpty(txtLearningTime.Text)) + { + newCompanyTrainItem.LearningTime = int.Parse(txtLearningTime.Text) * 60; + } if (!string.IsNullOrEmpty(txtCompileDate.Text.Trim())) { newCompanyTrainItem.CompileDate = Convert.ToDateTime(txtCompileDate.Text.Trim()); diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.designer.cs index 676b7c19..0cba0240 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/CompanyTrainingItemSave.aspx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace FineUIPro.Web.HSSE.EduTrain { - - - public partial class CompanyTrainingItemSave { - +namespace FineUIPro.Web.HSSE.EduTrain +{ + + + public partial class CompanyTrainingItemSave + { + /// /// form1 控件。 /// @@ -20,7 +22,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; - + /// /// PageManager1 控件。 /// @@ -29,7 +31,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.PageManager PageManager1; - + /// /// SimpleForm1 控件。 /// @@ -38,7 +40,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Form SimpleForm1; - + /// /// txtCompanyTrainingItemCode 控件。 /// @@ -47,7 +49,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtCompanyTrainingItemCode; - + /// /// txtCompanyTrainingItemName 控件。 /// @@ -56,7 +58,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtCompanyTrainingItemName; - + /// /// txtCompileMan 控件。 /// @@ -65,7 +67,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtCompileMan; - + /// /// txtCompileDate 控件。 /// @@ -74,7 +76,34 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DatePicker txtCompileDate; - + + /// + /// txtLearningTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtLearningTime; + + /// + /// ddTestTraining 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownBox ddTestTraining; + + /// + /// treeTestTraining 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tree treeTestTraining; + /// /// Toolbar1 控件。 /// @@ -83,7 +112,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar1; - + /// /// lbTemp 控件。 /// @@ -92,7 +121,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label lbTemp; - + /// /// btnAttachUrl 控件。 /// @@ -101,7 +130,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnAttachUrl; - + /// /// ToolbarFill1 控件。 /// @@ -110,7 +139,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ToolbarFill ToolbarFill1; - + /// /// btnSave 控件。 /// @@ -119,7 +148,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnSave; - + /// /// btnClose 控件。 /// @@ -128,7 +157,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnClose; - + /// /// hdCompileMan 控件。 /// @@ -137,7 +166,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.HiddenField hdCompileMan; - + /// /// WindowAtt 控件。 /// diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainingItemSave.aspx b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainingItemSave.aspx index 62cace82..4ec5ad98 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainingItemSave.aspx +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainingItemSave.aspx @@ -39,6 +39,11 @@ + + + + + diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainingItemSave.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainingItemSave.aspx.cs index dab35f92..17f55f32 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainingItemSave.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainingItemSave.aspx.cs @@ -62,6 +62,14 @@ namespace FineUIPro.Web.HSSE.EduTrain { txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", q.CompileDate); } + if (q.LearningTime.HasValue) + { + txtLearningTime.Text = q.LearningTime.Value.ToString(); + } + if (q.CompileDate != null) + { + txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", q.CompileDate); + } } } else @@ -96,6 +104,10 @@ namespace FineUIPro.Web.HSSE.EduTrain CompileMan = hdCompileMan.Text.Trim(), UnitId = this.CurrUser.UnitId }; + if (!string.IsNullOrEmpty(this.txtLearningTime.Text)) + { + trainingItem.LearningTime = int.Parse(this.txtLearningTime.Text); + } if (!string.IsNullOrEmpty(txtCompileDate.Text.Trim())) { trainingItem.CompileDate = Convert.ToDateTime(txtCompileDate.Text.Trim()); diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainingItemSave.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainingItemSave.aspx.designer.cs index a4598767..9f571b95 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainingItemSave.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainingItemSave.aspx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace FineUIPro.Web.HSSE.EduTrain { - - - public partial class TrainingItemSave { - +namespace FineUIPro.Web.HSSE.EduTrain +{ + + + public partial class TrainingItemSave + { + /// /// form1 控件。 /// @@ -20,7 +22,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; - + /// /// PageManager1 控件。 /// @@ -29,7 +31,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.PageManager PageManager1; - + /// /// SimpleForm1 控件。 /// @@ -38,7 +40,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Form SimpleForm1; - + /// /// txtTrainingItemCode 控件。 /// @@ -47,7 +49,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtTrainingItemCode; - + /// /// txtTrainingItemName 控件。 /// @@ -56,7 +58,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtTrainingItemName; - + /// /// txtCompileMan 控件。 /// @@ -65,7 +67,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtCompileMan; - + /// /// txtCompileDate 控件。 /// @@ -74,7 +76,16 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DatePicker txtCompileDate; - + + /// + /// txtLearningTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtLearningTime; + /// /// Toolbar1 控件。 /// @@ -83,7 +94,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar1; - + /// /// lbTemp 控件。 /// @@ -92,7 +103,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label lbTemp; - + /// /// btnAttachUrl 控件。 /// @@ -101,7 +112,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnAttachUrl; - + /// /// ToolbarFill1 控件。 /// @@ -110,7 +121,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ToolbarFill ToolbarFill1; - + /// /// btnSave 控件。 /// @@ -119,7 +130,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnSave; - + /// /// btnClose 控件。 /// @@ -128,7 +139,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnClose; - + /// /// hdCompileMan 控件。 /// @@ -137,7 +148,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.HiddenField hdCompileMan; - + /// /// WindowAtt 控件。 /// diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCase.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCase.aspx new file mode 100644 index 00000000..b6b529a3 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCase.aspx @@ -0,0 +1,154 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AccidentCase.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.AccidentCase" %> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCase.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCase.aspx.cs new file mode 100644 index 00000000..7dcb3fef --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCase.aspx.cs @@ -0,0 +1,506 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.IO; +using System.Linq; +using System.Text; +using System.Web.UI; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class AccidentCase : PageBase + { + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + btnSelectColumns.OnClientClick = Window5.GetShowReference("AccidentCaseItemSelectCloumn.aspx"); + Funs.DropDownPageSize(this.ddlPageSize); + this.GetButtonPower(); + InitTreeMenu(); + } + } + + #region 加载树 + /// + /// 初始化树 + /// + private void InitTreeMenu() + { + trAccidentCase.Nodes.Clear(); + trAccidentCase.ShowBorder = false; + trAccidentCase.ShowHeader = false; + trAccidentCase.EnableIcons = true; + trAccidentCase.AutoScroll = true; + trAccidentCase.EnableSingleClickExpand = true; + TreeNode rootNode = new TreeNode + { + Text = "事故案例库", + NodeID = "0", + Expanded = true + }; + this.trAccidentCase.Nodes.Add(rootNode); + var aCaseList = (from x in Funs.DB.EduTrain_AccidentCase + select x).ToList(); + if (aCaseList.Count() > 0) + { + BoundTree(rootNode.Nodes, "0", aCaseList); + } + } + + /// + /// + /// + /// + /// + /// + private void BoundTree(TreeNodeCollection nodes, string menuId, List aCaseList) + { + var dt = aCaseList.Where(x => x.SupAccidentCaseId == menuId).ToList(); + if (dt.Count() > 0) + { + TreeNode tn = null; + foreach (var dr in dt) + { + tn = new TreeNode + { + Text = dr.AccidentCaseName, + ToolTip = dr.AccidentCaseName, + NodeID = dr.AccidentCaseId, + EnableClickEvent = true + }; + nodes.Add(tn); + BoundTree(tn.Nodes, dr.AccidentCaseId, aCaseList); + } + } + } + #endregion + + /// + /// Tree行点击事件 + /// + /// + /// + protected void trAccidentCase_NodeCommand(object sender, FineUIPro.TreeCommandEventArgs e) + { + BindGrid(); + } + + #region Tree增加、修改、删除 按钮事件 + /// + /// 增加Tree节点 + /// + /// + /// + protected void btnNew_Click(object sender, EventArgs e) + { + if (this.trAccidentCase.SelectedNode != null) + { + Model.EduTrain_AccidentCase accidentCase = BLL.AccidentCaseService.GetAccidentCaseById(this.trAccidentCase.SelectedNode.NodeID); + if ((accidentCase != null && accidentCase.IsEndLever == false) || this.trAccidentCase.SelectedNode.NodeID == "0") //根节点或者非末级节点,可以增加 + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("AccidentCaseSave.aspx?SupAccidentCaseId={0}", this.trAccidentCase.SelectedNode.NodeID, "编辑 - "))); + } + else + { + ShowNotify("选择的项已是末级!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + /// + /// 编辑Tree按钮 + /// + /// + /// + protected void btnEdit_Click(object sender, EventArgs e) + { + if (this.trAccidentCase.SelectedNode != null) + { + if (this.trAccidentCase.SelectedNode.NodeID != "0") //非根节点可以编辑 + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("AccidentCaseSave.aspx?AccidentCaseId={0}", this.trAccidentCase.SelectedNode.NodeID, "编辑 - "))); + } + else + { + ShowNotify("根节点无法编辑!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + /// + /// 删除Tree节点数据 + /// + /// + /// + protected void btnDelete_Click(object sender, EventArgs e) + { + if (this.trAccidentCase.SelectedNode != null) + { + var accidentCase = BLL.AccidentCaseService.GetAccidentCaseById(this.trAccidentCase.SelectedNode.NodeID); + if (accidentCase != null && BLL.AccidentCaseService.IsDeleteAccidentCase(this.trAccidentCase.SelectedNode.NodeID)) + { + BLL.LogService.AddSys_Log(this.CurrUser, accidentCase.AccidentCaseCode, accidentCase.AccidentCaseId, BLL.Const.AccidentCaseMenuId, BLL.Const.BtnDelete); + BLL.AccidentCaseService.DeleteAccidentCaseByAccidentCaseId(this.trAccidentCase.SelectedNode.NodeID); + InitTreeMenu(); + } + else + { + ShowNotify("存在下级菜单或已增加资源数据或者为内置项,不允许删除!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择删除项!", MessageBoxIcon.Warning); + } + } + #endregion + + #region BindGrid + + private void BindGrid() + { + if (!string.IsNullOrEmpty(this.trAccidentCase.SelectedNode.NodeID)) + { + string strSql = @"SELECT I.AccidentCaseItemId,I.AccidentCaseId,I.Activities,I.AccidentName,I.AccidentProfiles,I.AccidentReview, + A.AccidentCaseName,I.CompileMan,I.CompileDate,I.AuditMan,I.AuditDate,I.IsPass,U.UserName AS CompileManName,UR.UserName AS AuditManName + FROM dbo.EduTrain_AccidentCaseItem AS I + LEFT JOIN dbo.EduTrain_AccidentCase AS A ON A.AccidentCaseId = I.AccidentCaseId + LEFT JOIN dbo.Sys_User AS U ON U.UserId = I.CompileMan + LEFT JOIN dbo.Sys_User AS UR ON UR.UserId = I.AuditMan + WHERE I.AccidentCaseId=@AccidentCaseId"; + List listStr = new List + { + new SqlParameter("@AccidentCaseId", this.trAccidentCase.SelectedNode.NodeID) + }; + + if (!string.IsNullOrEmpty(this.Activities.Text.Trim())) + { + strSql += " AND Activities LIKE @Activities"; + listStr.Add(new SqlParameter("@Activities", "%" + this.Activities.Text.Trim() + "%")); + } + if (!string.IsNullOrEmpty(this.AccidentCaseName.Text.Trim())) + { + strSql += " AND AccidentCaseName LIKE @AccidentCaseName"; + listStr.Add(new SqlParameter("@AccidentCaseName", "%" + this.AccidentCaseName.Text.Trim() + "%")); + } + if (!string.IsNullOrEmpty(this.AccidentName.Text.Trim())) + { + strSql += " AND AccidentName LIKE @AccidentName"; + listStr.Add(new SqlParameter("@AccidentName", "%" + this.AccidentName.Text.Trim() + "%")); + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + + Grid1.DataSource = table; + Grid1.DataBind(); + } + } + + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + + /// + /// 过滤表头 + /// + /// + /// + protected void Grid1_FilterChange(object sender, EventArgs e) + { + BindGrid(); + } + + #region 关闭弹出框 + + protected void Window1_Close(object sender, EventArgs e) + { + InitTreeMenu(); + } + + protected void Window2_Close(object sender, EventArgs e) + { + BindGrid(); + } + #endregion + + #region 删除数据 + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 删除方法 + /// + private void DeleteData() + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + var getV = BLL.AccidentCaseItemService.GetAccidentCaseItemById(rowID); + if (getV != null) + { + BLL.LogService.AddSys_Log(this.CurrUser, getV.AccidentName, getV.AccidentCaseItemId, BLL.Const.AccidentCaseMenuId, BLL.Const.BtnDelete); + BLL.AccidentCaseItemService.DeleteAccidentCaseItemId(rowID); + } + } + + BindGrid(); + ShowNotify("删除数据成功!"); + } + } + #endregion + + #region 排序、分页 + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + Grid1.SortDirection = e.SortDirection; + Grid1.SortField = e.SortField; + BindGrid(); + } + #endregion + + #region 编辑 + /// + /// 双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuEdit_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑数据方法 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + + string accidentCaseItemId = Grid1.SelectedRowID; + + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("AccidentCaseItemSave.aspx?AccidentCaseItemId={0}", accidentCaseItemId, "编辑 - "))); + } + #endregion + + protected void btnNewDetail_Click(object sender, EventArgs e) + { + if (this.trAccidentCase.SelectedNode != null) + { + if (this.trAccidentCase.SelectedNode.Nodes.Count == 0) + { + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("AccidentCaseItemSave.aspx?AccidentCaseId={0}", this.trAccidentCase.SelectedNode.NodeID, "编辑 - "))); + } + else + { + ShowNotify("请选择末级节点!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + #region 导出 + /// + /// 关闭导出窗口 + /// + /// + /// + protected void Window5_Close(object sender, WindowCloseEventArgs e) + { + Response.ClearContent(); + Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + Response.Write(GetGridTableHtml(Grid1, e.CloseArgument.Split('#'))); + Response.End(); + } + + /// + /// 导出 + /// + /// + /// + /// + private string GetGridTableHtml(Grid grid, string[] columns) + { + StringBuilder sb = new StringBuilder(); + sb.Append(""); + List columnHeaderTexts = new List(columns); + List columnIndexs = new List(); + sb.Append(""); + sb.Append(""); + foreach (GridColumn column in grid.Columns) + { + if (columnHeaderTexts.Contains(column.HeaderText)) + { + sb.AppendFormat("", column.HeaderText); + columnIndexs.Add(column.ColumnIndex); + } + } + sb.Append(""); + foreach (GridRow row in grid.Rows) + { + sb.Append(""); + int columnIndex = 0; + foreach (object value in row.Values) + { + if (columnIndexs.Contains(columnIndex)) + { + string html = value.ToString(); + if (html.StartsWith(Grid.TEMPLATE_PLACEHOLDER_PREFIX)) + { + // 模板列 + string templateID = html.Substring(Grid.TEMPLATE_PLACEHOLDER_PREFIX.Length); + Control templateCtrl = row.FindControl(templateID); + html = GetRenderedHtmlSource(templateCtrl); + } + //else + //{ + // // 处理CheckBox + // if (html.Contains("f-grid-static-checkbox")) + // { + // if (!html.Contains("f-checked")) + // { + // html = "×"; + // } + // else + // { + // html = "√"; + // } + // } + // // 处理图片 + // if (html.Contains("{0}", html); + } + columnIndex++; + } + sb.Append(""); + } + sb.Append("
{0}
"); + return sb.ToString(); + } + + /// + /// 获取控件渲染后的HTML源代码 + /// + /// + /// + private string GetRenderedHtmlSource(Control ctrl) + { + if (ctrl != null) + { + using (StringWriter sw = new StringWriter()) + { + using (HtmlTextWriter htw = new HtmlTextWriter(sw)) + { + ctrl.RenderControl(htw); + return sw.ToString(); + } + } + } + return String.Empty; + } + #endregion + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.AccidentCaseMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnAdd)) + { + this.btnNew.Hidden = false; + this.btnNewDetail.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnModify)) + { + this.btnEdit.Hidden = false; + this.btnMenuEdit.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnDelete.Hidden = false; + this.btnMenuDelete.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnOut)) + { + this.btnSelectColumns.Hidden = false; + } + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCase.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCase.aspx.designer.cs new file mode 100644 index 00000000..d5cff87c --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCase.aspx.designer.cs @@ -0,0 +1,287 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class AccidentCase + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// panelLeftRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelLeftRegion; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// btnEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnEdit; + + /// + /// btnDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDelete; + + /// + /// trAccidentCase 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tree trAccidentCase; + + /// + /// panelCenterRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelCenterRegion; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar3; + + /// + /// Activities 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox Activities; + + /// + /// AccidentCaseName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox AccidentCaseName; + + /// + /// AccidentName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox AccidentName; + + /// + /// btnNewDetail 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNewDetail; + + /// + /// btnSelectColumns 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSelectColumns; + + /// + /// lblActivities 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblActivities; + + /// + /// lblAccidentName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblAccidentName; + + /// + /// Label2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label2; + + /// + /// Label3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label3; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Window2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window2; + + /// + /// Window5 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window5; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuEdit; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSave.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSave.aspx new file mode 100644 index 00000000..739c7e1d --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSave.aspx @@ -0,0 +1,65 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AccidentCaseItemSave.aspx.cs" + Async="true" Inherits="FineUIPro.Web.Person.EduTrain.AccidentCaseItemSave" %> + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSave.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSave.aspx.cs new file mode 100644 index 00000000..c8889813 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSave.aspx.cs @@ -0,0 +1,171 @@ +using BLL; +using Model; +using System; +using System.Linq; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class AccidentCaseItemSave : PageBase + { + #region 定义变量 + public string AccidentCaseId + { + get + { + return (string)ViewState["AccidentCaseId"]; + } + set + { + ViewState["AccidentCaseId"] = value; + } + } + + public string AccidentCaseItemId + { + get + { + return (string)ViewState["AccidentCaseItemId"]; + } + set + { + ViewState["AccidentCaseItemId"] = value; + } + } + #endregion + + #region 加载页面 + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.GetButtonPower(); + LoadData(); + this.AccidentCaseItemId = Request.QueryString["AccidentCaseItemId"]; + this.AccidentCaseId = Request.QueryString["AccidentCaseId"]; + if (!String.IsNullOrEmpty(this.AccidentCaseItemId)) + { + var q = BLL.AccidentCaseItemService.GetAccidentCaseItemById(this.AccidentCaseItemId); + if (q != null) + { + this.AccidentCaseId = q.AccidentCaseId; + this.txtActivities.Text = q.Activities; + this.txtAccidentName.Text = q.AccidentName; + this.txtAccidentProfiles.Text = q.AccidentProfiles; + this.txtAccidentReview.Text = q.AccidentReview; + if (!string.IsNullOrEmpty(q.AccidentCaseId)) + { + var accidentCase = BLL.AccidentCaseService.GetAccidentCaseById(q.AccidentCaseId); + if (accidentCase != null) + { + this.txtAccidentCaseName.Text = accidentCase.AccidentCaseName; + } + } + } + } + + + if (!string.IsNullOrEmpty(this.AccidentCaseId)) + { + var accidentCase = BLL.AccidentCaseService.GetAccidentCaseById(this.AccidentCaseId); + if (accidentCase != null) + { + this.txtAccidentCaseName.Text = accidentCase.AccidentCaseName; + } + } + } + } + + private void LoadData() + { + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + } + #endregion + + #region 保存 + /// + /// 保存数据 + /// + private void SaveData() + { + Model.EduTrain_AccidentCaseItem accidentCaseItem = new EduTrain_AccidentCaseItem + { + Activities = this.txtActivities.Text.Trim(), + AccidentName = this.txtAccidentName.Text.Trim(), + AccidentProfiles = this.txtAccidentProfiles.Text.Trim(), + AccidentReview = this.txtAccidentReview.Text.Trim(), + }; + if (string.IsNullOrEmpty(this.AccidentCaseItemId)) + { + accidentCaseItem.CompileMan = this.CurrUser.UserName; + accidentCaseItem.UnitId =this.CurrUser.UnitId; + accidentCaseItem.CompileDate = DateTime.Now; + accidentCaseItem.IsPass = true; + accidentCaseItem.AccidentCaseItemId = SQLHelper.GetNewID(typeof(Model.EduTrain_AccidentCaseItem)); + AccidentCaseItemId = accidentCaseItem.AccidentCaseItemId; + accidentCaseItem.AccidentCaseId = this.AccidentCaseId; + BLL.AccidentCaseItemService.AddAccidentCaseItem(accidentCaseItem); + BLL.LogService.AddSys_Log(this.CurrUser, accidentCaseItem.AccidentName, accidentCaseItem.AccidentCaseItemId, BLL.Const.AccidentCaseMenuId, BLL.Const.BtnAdd); + } + else + { + Model.EduTrain_AccidentCaseItem t = BLL.AccidentCaseItemService.GetAccidentCaseItemById(this.AccidentCaseItemId); + accidentCaseItem.AccidentCaseItemId = this.AccidentCaseItemId; + if (t != null) + { + accidentCaseItem.AccidentCaseId = t.AccidentCaseId; + } + BLL.AccidentCaseItemService.UpdateAccidentCaseItem(accidentCaseItem); + BLL.LogService.AddSys_Log(this.CurrUser, accidentCaseItem.AccidentName, accidentCaseItem.AccidentCaseItemId, BLL.Const.AccidentCaseMenuId, BLL.Const.BtnModify); + } + // 2. 关闭本窗体,然后刷新父窗体 + // PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + // 2. 关闭本窗体,然后回发父窗体 + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + //PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(wedId) + ActiveWindow.GetHideReference()); + } + + protected void btnSave_Click(object sender, EventArgs e) + { + SaveData(); + } + #endregion + + #region 按钮权限 + /// + /// 按钮权限 + /// + private void GetButtonPower() + { + if(Request.Params["value"] == "0") + { + return; + } + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.AccidentCaseMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnSave)) + { + this.btnSave.Hidden = false; + } + } + } + #endregion + + #region 验证事故名称是否存在 + /// + /// 验证事故名称是否存在 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + var q = Funs.DB.EduTrain_AccidentCaseItem.FirstOrDefault(x => x.IsPass == true && x.AccidentCaseId == this.AccidentCaseId && x.AccidentName == this.txtAccidentName.Text.Trim() && (x.AccidentCaseItemId != this.AccidentCaseItemId || (this.AccidentCaseItemId == null && x.AccidentCaseItemId != null))); + if (q != null) + { + ShowNotify("输入的事故名称已存在!", MessageBoxIcon.Warning); + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSave.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSave.aspx.designer.cs new file mode 100644 index 00000000..db8b5564 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSave.aspx.designer.cs @@ -0,0 +1,125 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class AccidentCaseItemSave + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtAccidentCaseName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtAccidentCaseName; + + /// + /// txtActivities 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtActivities; + + /// + /// txtAccidentName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtAccidentName; + + /// + /// txtAccidentProfiles 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtAccidentProfiles; + + /// + /// txtAccidentReview 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtAccidentReview; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + + /// + /// hdCompileMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdCompileMan; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSelectCloumn.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSelectCloumn.aspx new file mode 100644 index 00000000..c32ae63a --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSelectCloumn.aspx @@ -0,0 +1,38 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AccidentCaseItemSelectCloumn.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.AccidentCaseItemSelectCloumn" %> + + + + + + 事故案例导出选择列 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSelectCloumn.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSelectCloumn.aspx.cs new file mode 100644 index 00000000..13d40b18 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSelectCloumn.aspx.cs @@ -0,0 +1,32 @@ +using System; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class AccidentCaseItemSelectCloumn : PageBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + LoadData(); + } + } + + private void LoadData() + { + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + } + + /// + /// 导出按钮 + /// + /// + /// + protected void btnImport_Click(object sender, EventArgs e) + { + // 1. 这里放置保存窗体中数据的逻辑 + // 2. 关闭本窗体,然后回发父窗体 + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference(String.Join("#", cblColumns.SelectedValueArray))); + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSelectCloumn.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSelectCloumn.aspx.designer.cs new file mode 100644 index 00000000..04c19925 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseItemSelectCloumn.aspx.designer.cs @@ -0,0 +1,80 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class AccidentCaseItemSelectCloumn + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + + /// + /// btnImport 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnImport; + + /// + /// cblColumns 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBoxList cblColumns; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseSave.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseSave.aspx new file mode 100644 index 00000000..1b9e7501 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseSave.aspx @@ -0,0 +1,49 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AccidentCaseSave.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.AccidentCaseSave" %> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseSave.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseSave.aspx.cs new file mode 100644 index 00000000..e51124e2 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseSave.aspx.cs @@ -0,0 +1,147 @@ +using BLL; +using Model; +using System; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class AccidentCaseSave : PageBase + { + public string AccidentCaseId + { + get + { + return (string)ViewState["AccidentCaseId"]; + } + set + { + ViewState["AccidentCaseId"] = value; + } + } + + public string SupAccidentCaseId + { + get + { + return (string)ViewState["SupAccidentCaseId"]; + } + set + { + ViewState["SupAccidentCaseId"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.GetButtonPower(); + LoadData(); + this.drpIsEndLever.DataTextField = "TypeName"; + drpIsEndLever.DataValueField = "TypeId"; + drpIsEndLever.DataSource = BLL.TrainingService.GetIsEndLeverList(); + drpIsEndLever.DataBind(); + + this.AccidentCaseId = Request.QueryString["AccidentCaseId"]; + this.SupAccidentCaseId = Request.QueryString["SupAccidentCaseId"]; + if (!String.IsNullOrEmpty(this.AccidentCaseId)) + { + var q = BLL.AccidentCaseService.GetAccidentCaseById(this.AccidentCaseId); + if (q != null) + { + txtAccidentCaseCode.Text = q.AccidentCaseCode; + txtAccidentCaseName.Text = q.AccidentCaseName; + if (q.IsEndLever == true) + { + this.drpIsEndLever.SelectedValue = "true"; + } + else + { + this.drpIsEndLever.SelectedValue = "false"; + } + } + } + } + } + + private void LoadData() + { + + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + + } + + protected void btnSave_Click(object sender, EventArgs e) + { + Model.EduTrain_AccidentCase accidentCase = new EduTrain_AccidentCase + { + //string accidentCaseId = Request.QueryString["AccidentCaseId"]; + + AccidentCaseCode = txtAccidentCaseCode.Text.Trim(), + AccidentCaseName = txtAccidentCaseName.Text.Trim(), + + IsEndLever = Convert.ToBoolean(drpIsEndLever.SelectedValue) + }; + if (String.IsNullOrEmpty(this.AccidentCaseId)) + { + accidentCase.AccidentCaseId = SQLHelper.GetNewID(typeof(Model.EduTrain_AccidentCase)); + this.AccidentCaseId = accidentCase.AccidentCaseId; + accidentCase.SupAccidentCaseId = this.SupAccidentCaseId; + BLL.AccidentCaseService.AddAccidentCase(accidentCase); + BLL.LogService.AddSys_Log(this.CurrUser, accidentCase.AccidentCaseCode, accidentCase.AccidentCaseId, BLL.Const.AccidentCaseMenuId, BLL.Const.BtnAdd); + } + else + { + Model.EduTrain_AccidentCase t = BLL.AccidentCaseService.GetAccidentCaseById(this.AccidentCaseId); + accidentCase.AccidentCaseId = this.AccidentCaseId; + if (t != null) + { + accidentCase.SupAccidentCaseId = t.SupAccidentCaseId; + } + BLL.AccidentCaseService.UpdateAccidentCase(accidentCase); + BLL.LogService.AddSys_Log(this.CurrUser, accidentCase.AccidentCaseCode, accidentCase.AccidentCaseId, BLL.Const.AccidentCaseMenuId, BLL.Const.BtnModify); + } + // 2. 关闭本窗体,然后刷新父窗体 + // PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + // 2. 关闭本窗体,然后回发父窗体 + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + //PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(wedId) + ActiveWindow.GetHideReference()); + + } + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.AccidentCaseMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnSave)) + { + this.btnSave.Hidden = false; + } + } + } + #endregion + + #region 验证名称是否存在 + /// + /// 验证名称是否存在 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + var q = Funs.DB.EduTrain_AccidentCase.FirstOrDefault(x => x.SupAccidentCaseId == this.SupAccidentCaseId && x.AccidentCaseName == this.txtAccidentCaseName.Text.Trim() && (x.AccidentCaseId != this.AccidentCaseId || (this.AccidentCaseId == null && x.AccidentCaseId != null))); + if (q != null) + { + ShowNotify("输入的名称已存在!", MessageBoxIcon.Warning); + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseSave.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseSave.aspx.designer.cs new file mode 100644 index 00000000..10bb774e --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/AccidentCaseSave.aspx.designer.cs @@ -0,0 +1,98 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class AccidentCaseSave + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtAccidentCaseCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtAccidentCaseCode; + + /// + /// txtAccidentCaseName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtAccidentCaseName; + + /// + /// drpIsEndLever 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpIsEndLever; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTraining.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTraining.aspx new file mode 100644 index 00000000..9eb4c25e --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTraining.aspx @@ -0,0 +1,160 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CompanyTraining.aspx.cs" + Inherits="FineUIPro.Web.Person.EduTrain.CompanyTraining" %> + + + + + + 公司教材库 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + + --%> + + + + + + + + + + + <%-- + + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTraining.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTraining.aspx.cs new file mode 100644 index 00000000..f6736c1b --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTraining.aspx.cs @@ -0,0 +1,532 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.IO; +using System.Linq; +using System.Text; +using System.Web; +using AspNet = System.Web.UI.WebControls; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class CompanyTraining : PageBase + { + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.GetButtonPower(); + InitTreeMenu(); + } + } + #endregion + + #region 加载树 + /// + /// 初始化树 + /// + private void InitTreeMenu() + { + trCompanyTraining.Nodes.Clear(); + trCompanyTraining.ShowBorder = false; + trCompanyTraining.ShowHeader = false; + trCompanyTraining.EnableIcons = true; + trCompanyTraining.AutoScroll = true; + trCompanyTraining.EnableSingleClickExpand = true; + TreeNode rootNode = new TreeNode + { + Text = "公司教材库", + NodeID = "0", + Expanded = true + }; + this.trCompanyTraining.Nodes.Add(rootNode); + BoundTree(rootNode.Nodes, "0"); + } + + private void BoundTree(TreeNodeCollection nodes, string menuId) + { + var dt = GetNewTraining(menuId); + if (dt.Count() > 0) + { + TreeNode tn = null; + foreach (var dr in dt) + { + tn = new TreeNode + { + Text = dr.CompanyTrainingName, + NodeID = dr.CompanyTrainingId, + EnableClickEvent = true, + ToolTip = dr.CompanyTrainingName + }; + nodes.Add(tn); + BoundTree(tn.Nodes, dr.CompanyTrainingId); + } + } + } + + /// + /// 得到菜单方法 + /// + /// + /// + private List GetNewTraining(string parentId) + { + return (from x in Funs.DB.Training_CompanyTraining where x.SupCompanyTrainingId == parentId orderby x.CompanyTrainingCode select x).ToList(); ; + } + #endregion + + #region 增加、修改、删除公司教材库类别 + /// + /// 增加公司教材库类别 + /// + /// + /// + protected void btnNew_Click(object sender, EventArgs e) + { + if (this.trCompanyTraining.SelectedNode != null) + { + Model.Training_CompanyTraining training = BLL.CompanyTrainingService.GetCompanyTrainingById(this.trCompanyTraining.SelectedNode.NodeID); + if ((training != null && training.IsEndLever == false) || this.trCompanyTraining.SelectedNode.NodeID == "0") //根节点或者非末级节点,可以增加 + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CompanyTrainingSave.aspx?SupCompanyTrainingId={0}", this.trCompanyTraining.SelectedNode.NodeID, "编辑 - "))); + } + else + { + ShowNotify("选择的项已是末级!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + /// + /// 修改公司教材库类别 + /// + /// + /// + protected void btnEdit_Click(object sender, EventArgs e) + { + if (this.trCompanyTraining.SelectedNode != null) + { + if (this.trCompanyTraining.SelectedNode.NodeID != "0") //非根节点可以编辑 + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CompanyTrainingSave.aspx?CompanyTrainingId={0}", this.trCompanyTraining.SelectedNode.NodeID, "编辑 - "))); + } + else + { + ShowNotify("根节点无法编辑!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + /// + /// 删除公司教材库类别 + /// + /// + /// + protected void btnDelete_Click(object sender, EventArgs e) + { + if (this.trCompanyTraining.SelectedNode != null) + { + var q = BLL.CompanyTrainingService.GetCompanyTrainingById(this.trCompanyTraining.SelectedNode.NodeID); + + if (q != null && BLL.CompanyTrainingService.IsDeleteCompanyTraining(this.trCompanyTraining.SelectedNode.NodeID)) + { + BLL.CompanyTrainingService.DeleteCompanyTraining(this.trCompanyTraining.SelectedNode.NodeID); + InitTreeMenu(); + } + else + { + ShowNotify("存在下级菜单或已增加资源数据或者为内置项,不允许删除!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择删除项!", MessageBoxIcon.Warning); + } + } + #endregion + + #region 树点击事件 + /// + /// 树点击事件 + /// + /// + /// + protected void trCompanyTraining_NodeCommand(object sender, FineUIPro.TreeCommandEventArgs e) + { + BindGrid(); + } + #endregion + + #region 绑定数据 + /// + /// 绑定数据 + /// + private void BindGrid() + { + if (this.trCompanyTraining.SelectedNode != null && !string.IsNullOrEmpty(this.trCompanyTraining.SelectedNode.NodeID)) + { + string strSql = @"SELECT item.CompanyTrainingItemId,(item.CompanyTrainingItemId+'_'+CAST(row_number() over(order by item.CompanyTrainingItemCode) AS nvarchar(10))) AS CompanyTrainingItemIdNum," + + @" item.CompanyTrainingItemId,item.CompanyTrainingId,item.CompanyTrainingItemCode,item.CompanyTrainingItemName,A.AttachUrl," + + @" item.CompileMan, item.CompileDate,dbo.GetFileName(A.AttachUrl) AS AttachUrlName " + + @" FROM dbo.Training_CompanyTrainingItem AS item" + + @" LEFT JOIN (SELECT ToKeyId ,F1 as AttachUrl" + + @" FROM AttachFile CROSS APPLY (SELECT * FROM dbo.f_splitstr(AttachUrl,',')) t" + + @" WHERE LEN(F1) > 0) AS A ON A.ToKeyId=item.CompanyTrainingItemId " + + @" WHERE item.CompanyTrainingId=@CompanyTrainingId"; + + List listStr = new List + { + new SqlParameter("@CompanyTrainingId", this.trCompanyTraining.SelectedNode.NodeID) + }; + if (!string.IsNullOrEmpty(this.txtCompanyTrainingItemCode.Text.Trim())) + { + strSql += " AND CompanyTrainingItemCode LIKE @CompanyTrainingItemCode"; + listStr.Add(new SqlParameter("@CompanyTrainingItemCode", "%" + this.txtCompanyTrainingItemCode.Text.Trim() + "%")); + } + if (!string.IsNullOrEmpty(this.txtCompanyTrainingItemName.Text.Trim())) + { + strSql += " AND CompanyTrainingItemName LIKE @CompanyTrainingItemName"; + listStr.Add(new SqlParameter("@CompanyTrainingItemName", "%" + this.txtCompanyTrainingItemName.Text.Trim() + "%")); + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + + Grid1.DataSource = table; + Grid1.DataBind(); + } + } + #endregion + + #region 弹出窗关闭事件 + protected void Window1_Close(object sender, EventArgs e) + { + InitTreeMenu(); + } + + protected void Window2_Close(object sender, EventArgs e) + { + BindGrid(); + } + #endregion + + #region 排序、分页 + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + Grid1.SortDirection = e.SortDirection; + Grid1.SortField = e.SortField; + BindGrid(); + } + #endregion + + #region 查询 + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + + #region 增加、修改、删除明细信息 + #region 新增明细 + /// + /// 新增明细 + /// + /// + /// + protected void btnNewDetail_Click(object sender, EventArgs e) + { + if (this.trCompanyTraining.SelectedNode != null) + { + if (this.trCompanyTraining.SelectedNode.Nodes.Count == 0) + { + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("CompanyTrainingItemSave.aspx?CompanyTrainingId={0}", this.trCompanyTraining.SelectedNode.NodeID, "编辑 - "))); + } + else + { + ShowNotify("请选择末级节点!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + #endregion + + #region 编辑明细 + protected void btnEditDetail_Click(object sender, EventArgs e) + { + this.EditData(); + } + + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuEdit_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑数据方法 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + + string companyTrainingItemId = Grid1.SelectedRowID; + companyTrainingItemId = companyTrainingItemId.Substring(0, companyTrainingItemId.IndexOf("_")); + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("CompanyTrainingItemSave.aspx?CompanyTrainingItemId={0}", companyTrainingItemId, "编辑 - "))); + } + #endregion + + #region 删除明细 + // 删除数据 + protected void btnDeleteDetail_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 删除方法 + /// + private void DeleteData() + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + rowID = rowID.Substring(0, rowID.IndexOf("_")); + + var getD = BLL.CompanyTrainingItemService.GetCompanyTrainingItemById(rowID); + if (getD != null) + { + BLL.LogService.AddSys_Log(this.CurrUser, getD.CompanyTrainingItemCode, getD.CompanyTrainingItemId, BLL.Const.CompanyTrainingMenuId, BLL.Const.BtnDelete); + BLL.CompanyTrainingItemService.DeleteCompanyTrainingItemById(rowID); + + } + } + + BindGrid(); + ShowNotify("删除数据成功!"); + } + } + #endregion + #endregion + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.CompanyTrainingMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnAdd)) + { + this.btnNew.Hidden = false; + this.btnNewDetail.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnModify)) + { + this.btnEdit.Hidden = false; + this.btnMenuEdit.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnDelete.Hidden = false; + this.btnMenuDelete.Hidden = false; + } + } + } + #endregion + + /// + /// 导出 + /// + /// + /// + protected void btnOut_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("公司教材库" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid1.PageSize = Grid1.RecordCount; + BindGrid(); + Response.Write(GetGridTableHtml(Grid1, 5)); + Response.End(); + } + + #region 导出方法 + /// + /// 导出方法 + /// + /// + /// + public static string GetGridTableHtml(Grid grid, int count) + { + StringBuilder sb = new StringBuilder(); + sb.Append(""); + sb.Append(""); + sb.Append(""); + foreach (GridColumn column in grid.Columns) + { + if (column.ColumnIndex < count) + { + sb.AppendFormat("", column.HeaderText); + } + } + sb.Append(""); + foreach (GridRow row in grid.Rows) + { + sb.Append(""); + foreach (GridColumn column in grid.Columns) + { + if (column.ColumnIndex < count) + { + string html = row.Values[column.ColumnIndex].ToString(); + if (column.ColumnID == "tfNumber" && (row.FindControl("lbNumber") as AspNet.Label) != null) + { + html = (row.FindControl("lbNumber") as AspNet.Label).Text; + } + if (column.ColumnID == "tfCompanyTrainingItemCode" && (row.FindControl("lbCompanyTrainingItemCode") as AspNet.Label) != null) + { + html = (row.FindControl("lbCompanyTrainingItemCode") as AspNet.Label).Text; + } + if (column.ColumnID == "tfCompanyTrainingItemName" && (row.FindControl("lbCompanyTrainingItemName") as AspNet.Label) != null) + { + html = (row.FindControl("lbCompanyTrainingItemName") as AspNet.Label).Text; + } + if (column.ColumnID == "tfCompileMan" && (row.FindControl("lbCompileMan") as AspNet.Label) != null) + { + html = (row.FindControl("lbCompileMan") as AspNet.Label).Text; + } + if (column.ColumnID == "tfCompileDate" && (row.FindControl("lbCompileDate") as AspNet.Label) != null) + { + html = (row.FindControl("lbCompileDate") as AspNet.Label).Text; + } + sb.AppendFormat("", html); + } + } + + sb.Append(""); + } + + sb.Append("
{0}
{0}
"); + + return sb.ToString(); + } + #endregion + + /// + /// 行事件 + /// + /// + /// + protected void Grid1_RowCommand(object sender, GridCommandEventArgs e) + { + if (e.CommandName == "Attach") + { + string attUrl = this.Grid1.Rows[e.RowIndex].Values[this.Grid1.Columns.Count - 1].ToString(); + try + { + + string url = Funs.RootPath + attUrl; + FileInfo info = new FileInfo(url); + string savedName = Path.GetFileName(url); + if (!info.Exists || string.IsNullOrEmpty(savedName)) + { + url = Funs.RootPath + "Images//Null.jpg"; + info = new FileInfo(url); + } + + if (Path.GetExtension(savedName) == ".mp4" || Path.GetExtension(savedName).ToLower() == ".mp4" || Path.GetExtension(savedName) == ".m4v") + { + string mpUrl = HttpUtility.UrlEncode(attUrl.Replace('\\', '/')); + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/AttachFile/player.aspx?url={0}", attUrl.Replace('\\', '/'), "播放 - "),"播放视频",700,560)); + } + else + { + string fileName = Path.GetFileName(url); + long fileSize = info.Length; + System.Web.HttpContext.Current.Response.Clear(); + //System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed"; + System.Web.HttpContext.Current.Response.ContentType = "application/octet-stream"; + System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); + System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString()); + System.Web.HttpContext.Current.Response.TransmitFile(url, 0, fileSize); + System.Web.HttpContext.Current.Response.Flush(); + System.Web.HttpContext.Current.Response.End(); + } + } + catch (Exception) + { + + } + } + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTraining.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTraining.aspx.designer.cs new file mode 100644 index 00000000..c5e7c1ac --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTraining.aspx.designer.cs @@ -0,0 +1,278 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class CompanyTraining + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// panelLeftRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelLeftRegion; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// btnEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnEdit; + + /// + /// btnDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDelete; + + /// + /// trCompanyTraining 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tree trCompanyTraining; + + /// + /// panelCenterRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelCenterRegion; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar3; + + /// + /// txtCompanyTrainingItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCompanyTrainingItemCode; + + /// + /// txtCompanyTrainingItemName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCompanyTrainingItemName; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnNewDetail 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNewDetail; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// lbCompanyTrainingItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbCompanyTrainingItemCode; + + /// + /// lbCompanyTrainingItemName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbCompanyTrainingItemName; + + /// + /// lbCompileDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbCompileDate; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Window2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window2; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuEdit; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingItemSave.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingItemSave.aspx new file mode 100644 index 00000000..6549ccf0 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingItemSave.aspx @@ -0,0 +1,70 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CompanyTrainingItemSave.aspx.cs" + Inherits="FineUIPro.Web.Person.EduTrain.CompanyTrainingItemSave" %> + + + + + 编辑公司教材库 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingItemSave.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingItemSave.aspx.cs new file mode 100644 index 00000000..e322a568 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingItemSave.aspx.cs @@ -0,0 +1,193 @@ +using System; +using System.Linq; +using Model; +using BLL; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class CompanyTrainingItemSave : PageBase + { + #region 定义变量 + /// + /// 主键 + /// + public string CompanyTrainingItemId + { + get + { + return (string)ViewState["CompanyTrainingItemId"]; + } + set + { + ViewState["CompanyTrainingItemId"] = value; + } + } + + /// + /// 主表主键 + /// + public string CompanyTrainingId + { + get + { + return (string)ViewState["CompanyTrainingId"]; + } + set + { + ViewState["CompanyTrainingId"] = value; + } + } + #endregion + + #region 加载页面 + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.GetButtonPower(); + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + + this.CompanyTrainingItemId = Request.QueryString["CompanyTrainingItemId"]; + this.CompanyTrainingId = Request.QueryString["CompanyTrainingId"]; + if (!string.IsNullOrEmpty(this.CompanyTrainingItemId)) + { + var q = CompanyTrainingItemService.GetCompanyTrainingItemById(this.CompanyTrainingItemId); + if (q != null) + { + this.CompanyTrainingId = q.CompanyTrainingId; + txtCompanyTrainingItemCode.Text = q.CompanyTrainingItemCode; + txtCompanyTrainingItemName.Text = q.CompanyTrainingItemName; + txtCompileMan.Text = q.CompileMan; + hdCompileMan.Text = q.CompileMan; + if (q.CompileDate != null) + { + txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", q.CompileDate); + } + } + } + else + { + var cTraining = BLL.CompanyTrainingService.GetCompanyTrainingById(this.CompanyTrainingId); + if (cTraining != null) + { + txtCompileMan.Text = this.CurrUser.UserName; + hdCompileMan.Text = this.CurrUser.UserName; + this.txtCompanyTrainingItemName.Text = cTraining.CompanyTrainingName; + this.txtCompanyTrainingItemCode.Text = SQLHelper.RunProcNewId("SpGetNewCode3", "Training_CompanyTrainingItem", "CompanyTrainingItemCode", cTraining.CompanyTrainingCode + "-"); + txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); + } + } + } + } + #endregion + + #region 保存 + /// + /// 保存数据 + /// + private void SaveData(bool isClose) + { + Model.Training_CompanyTrainingItem newCompanyTrainItem = new Training_CompanyTrainingItem + { + CompanyTrainingItemCode = this.txtCompanyTrainingItemCode.Text.Trim(), + CompanyTrainingItemName = this.txtCompanyTrainingItemName.Text.Trim(), + CompileMan = hdCompileMan.Text.Trim() + }; + if (!string.IsNullOrEmpty(txtCompileDate.Text.Trim())) + { + newCompanyTrainItem.CompileDate = Convert.ToDateTime(txtCompileDate.Text.Trim()); + } + if (!string.IsNullOrEmpty(this.CompanyTrainingItemId)) + { + newCompanyTrainItem.CompanyTrainingItemId = this.CompanyTrainingItemId; + BLL.CompanyTrainingItemService.UpdateCompanyTrainingItem(newCompanyTrainItem); + BLL.LogService.AddSys_Log(this.CurrUser, newCompanyTrainItem.CompanyTrainingItemCode, newCompanyTrainItem.CompanyTrainingItemId,BLL.Const.CompanyTrainingMenuId,BLL.Const.BtnModify); + } + else + { + newCompanyTrainItem.CompanyTrainingId = this.CompanyTrainingId; + this.CompanyTrainingItemId = SQLHelper.GetNewID(typeof(Model.Training_CompanyTrainingItem)); + newCompanyTrainItem.CompanyTrainingItemId = this.CompanyTrainingItemId; + BLL.CompanyTrainingItemService.AddCompanyTrainingItem(newCompanyTrainItem); + BLL.LogService.AddSys_Log(this.CurrUser, newCompanyTrainItem.CompanyTrainingItemCode, newCompanyTrainItem.CompanyTrainingItemId, BLL.Const.CompanyTrainingMenuId, BLL.Const.BtnAdd); + } + if (isClose) + { + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + } + + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + SaveData(true); + } + #endregion + + #region 验证教材名称是否存在 + /// + /// 验证教材名称是否存在 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + var q = Funs.DB.Training_CompanyTrainingItem.FirstOrDefault(x => x.CompanyTrainingId == this.CompanyTrainingId && x.CompanyTrainingItemName == this.txtCompanyTrainingItemName.Text.Trim() && (x.CompanyTrainingItemId != this.CompanyTrainingItemId || (this.CompanyTrainingItemId == null && x.CompanyTrainingItemId != null))); + if (q != null) + { + ShowNotify("输入的教材名称已存在!", MessageBoxIcon.Warning); + } + } + #endregion + + #region 上传附件资源 + /// + /// 上传附件资源 + /// + /// + /// + protected void btnUploadResources_Click(object sender, EventArgs e) + { + if (this.btnSave.Hidden) + { + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CompanyTraining&menuId={1}&type=-1", CompanyTrainingItemId, BLL.Const.CompanyTrainingMenuId))); + } + else + { + if (string.IsNullOrEmpty(this.CompanyTrainingItemId)) + { + SaveData(false); + } + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CompanyTraining&menuId={1}", CompanyTrainingItemId, BLL.Const.CompanyTrainingMenuId))); + } + } + #endregion + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + if (Request.Params["value"] == "0") + { + return; + } + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.CompanyTrainingMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnSave)) + { + this.btnSave.Hidden = false; + } + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingItemSave.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingItemSave.aspx.designer.cs new file mode 100644 index 00000000..41369c2b --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingItemSave.aspx.designer.cs @@ -0,0 +1,152 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class CompanyTrainingItemSave + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtCompanyTrainingItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCompanyTrainingItemCode; + + /// + /// txtCompanyTrainingItemName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCompanyTrainingItemName; + + /// + /// txtCompileMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCompileMan; + + /// + /// txtCompileDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtCompileDate; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// lbTemp 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbTemp; + + /// + /// btnAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAttachUrl; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + + /// + /// hdCompileMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdCompileMan; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingSave.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingSave.aspx new file mode 100644 index 00000000..c9eddd53 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingSave.aspx @@ -0,0 +1,52 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CompanyTrainingSave.aspx.cs" + Inherits="FineUIPro.Web.Person.EduTrain.CompanyTrainingSave" %> + + + + + 编辑公司教材库类别 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingSave.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingSave.aspx.cs new file mode 100644 index 00000000..39c65e61 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingSave.aspx.cs @@ -0,0 +1,154 @@ +using System; +using System.Linq; +using BLL; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class CompanyTrainingSave : PageBase + { + #region 定义变量 + /// + /// 主键 + /// + public string CompanyTrainingId + { + get + { + return (string)ViewState["CompanyTrainingId"]; + } + set + { + ViewState["CompanyTrainingId"] = value; + } + } + + /// + /// 上级ID + /// + public string SupCompanyTrainingId + { + get + { + return (string)ViewState["SupCompanyTrainingId"]; + } + set + { + ViewState["SupCompanyTrainingId"] = value; + } + } + #endregion + + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.GetButtonPower(); + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + + this.drpIsEndLever.DataTextField = "TypeName"; + drpIsEndLever.DataValueField = "TypeId"; + drpIsEndLever.DataSource = BLL.TrainingService.GetIsEndLeverList(); + drpIsEndLever.DataBind(); + + this.CompanyTrainingId = Request.QueryString["CompanyTrainingId"]; + this.SupCompanyTrainingId = Request.QueryString["SupCompanyTrainingId"]; + if (!string.IsNullOrEmpty(CompanyTrainingId)) + { + var q = BLL.CompanyTrainingService.GetCompanyTrainingById(CompanyTrainingId); + if (q != null) + { + txtCompanyTrainingCode.Text = q.CompanyTrainingCode; + txtCompanyTrainingName.Text = q.CompanyTrainingName; + if (q.IsEndLever == true) + { + this.drpIsEndLever.SelectedValue = "true"; + } + else + { + this.drpIsEndLever.SelectedValue = "false"; + } + } + } + } + } + #endregion + + #region 保存 + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + Model.Training_CompanyTraining companyTraining = new Model.Training_CompanyTraining(); + companyTraining.CompanyTrainingCode = this.txtCompanyTrainingCode.Text.Trim(); + companyTraining.CompanyTrainingName = this.txtCompanyTrainingName.Text.Trim(); + companyTraining.IsEndLever = Convert.ToBoolean(drpIsEndLever.SelectedValue); + if (!string.IsNullOrEmpty(this.CompanyTrainingId)) + { + Model.Training_CompanyTraining t = BLL.CompanyTrainingService.GetCompanyTrainingById(this.CompanyTrainingId); + if (t != null) + { + companyTraining.SupCompanyTrainingId = t.SupCompanyTrainingId; + } + companyTraining.CompanyTrainingId = this.CompanyTrainingId; + BLL.CompanyTrainingService.UpdateCompanyTraining(companyTraining); + } + else + { + companyTraining.SupCompanyTrainingId = this.SupCompanyTrainingId; + this.CompanyTrainingId = SQLHelper.GetNewID(typeof(Model.Training_CompanyTraining)); + companyTraining.CompanyTrainingId = this.CompanyTrainingId; + BLL.CompanyTrainingService.AddCompanyTraining(companyTraining); + } + // 2. 关闭本窗体,然后刷新父窗体 + // PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + // 2. 关闭本窗体,然后回发父窗体 + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + //PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(trainingId) + ActiveWindow.GetHideReference()); + } + #endregion + + #region 验证公司教材库名称是否存在 + /// + /// 验证公司教材库名称是否存在 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + var companyTraining = Funs.DB.Training_CompanyTraining.FirstOrDefault(x => x.SupCompanyTrainingId == this.SupCompanyTrainingId && x.CompanyTrainingName == this.txtCompanyTrainingName.Text.Trim() && (x.CompanyTrainingId != this.CompanyTrainingId || (this.CompanyTrainingId == null && x.CompanyTrainingId != null))); + if (companyTraining != null) + { + ShowNotify("输入的名称已存在!", MessageBoxIcon.Warning); + } + } + #endregion + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.CompanyTrainingMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnSave)) + { + this.btnSave.Hidden = false; + } + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingSave.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingSave.aspx.designer.cs new file mode 100644 index 00000000..7ae780be --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/CompanyTrainingSave.aspx.designer.cs @@ -0,0 +1,98 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class CompanyTrainingSave + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtCompanyTrainingCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCompanyTrainingCode; + + /// + /// txtCompanyTrainingName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCompanyTrainingName; + + /// + /// drpIsEndLever 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpIsEndLever; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/Plan.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/Plan.aspx new file mode 100644 index 00000000..353d967e --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/Plan.aspx @@ -0,0 +1,119 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Plan.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.Plan" %> + + + + + + 培训计划 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/Plan.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/Plan.aspx.cs new file mode 100644 index 00000000..bab37f0f --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/Plan.aspx.cs @@ -0,0 +1,337 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class Plan : PageBase + { + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.GetButtonPower(); + ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + + var data = APIBaseInfoService.getWorkPost(CurrUser.ProjectId, null); + this.drpWorkPost.DataValueField = "BaseInfoId"; + this.drpWorkPost.DataTextField = "BaseInfoName"; + this.drpWorkPost.DataSource = data; + this.drpWorkPost.DataBind(); + Funs.FineUIPleaseSelect(drpWorkPost); + // 绑定表格 + BindGrid(); + } + else + { + if (GetRequestEventArgument() == "reloadGrid") + { + BindGrid(); + } + } + } + #region 编制 + /// + /// 编制 + /// + /// + /// + protected void btnNew_Click(object sender, EventArgs e) + { + + + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PlanEdit.aspx", "编辑 - "))); + + } + #endregion + /// + /// 绑定数据 + /// + private void BindGrid() + { + string strSql = @"SELECT Plans.PlanId,Plans.PlanCode, Plans.PlanName, Plans.DesignerId, Plans.DesignerDate, Plans.WorkPostId,UnitIds,TrainStartDate,TeachHour,TeachAddress, + (CASE Plans.States WHEN '0' THEN '计划中' WHEN '1' THEN '待考试' WHEN '2' THEN '考试中' WHEN '3' THEN '已结束' WHEN '-1' THEN '已作废' END ) AS States, + Users.UserName AS DesignerName,WorkPostNames" + + @" FROM dbo.Training_Plan AS Plans " + + @" LEFT JOIN Sys_User AS Users ON Users.UserId = Plans.DesignerId " + + @" WHERE (Plans.ProjectId is null or Plans.ProjectId='') "; + List listStr = new List(); + + if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) + { + strSql += " AND (PlanCode LIKE @name OR PlanName LIKE @name)"; + listStr.Add(new SqlParameter("@name", "%" + this.txtName.Text.Trim() + "%")); + } + if (!string.IsNullOrEmpty(this.drpWorkPost.SelectedValue) && this.drpWorkPost.SelectedValue != "null") + { + strSql += " AND Plans.WorkPostId = '@workPost' "; + listStr.Add(new SqlParameter("@workPost", "%" + this.drpWorkPost.SelectedValue + "%")); + } + + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + } + #endregion + + #region 分页、关闭窗口 + /// + /// 分页 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + BindGrid(); + } + + /// + /// 关闭窗口 + /// + /// + /// + protected void Window1_Close(object sender, EventArgs e) + { + BindGrid(); + } + #endregion + + #region 编辑 + /// + /// Grid行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuView_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑数据方法 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + return; + } + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PlanEdit.aspx?PlanId={0}", Grid1.SelectedRowID, "编辑 - "))); + } + #endregion + + #region 删除 + /// + /// 批量删除数据 + /// + /// + /// + protected void btnDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 删除方法 + /// + private void DeleteData() + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + string alterString = string.Empty; + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + string content = judgementDelete(rowID); + if (string.IsNullOrEmpty(content)) + { + var getV = BLL.TrainingPlanService.GetPlanById(rowID); + if (getV != null) + { + LogService.AddSys_Log(this.CurrUser, getV.PlanCode, rowID, BLL.Const.ProjectTrainingPlanMenuId, BLL.Const.BtnDelete); + TrainingTaskService.DeleteTaskByPlanId(rowID); + TrainingPlanItemService.DeletePlanItemByPlanId(rowID); + TrainingPlanService.DeletePlanById(rowID); + } + } + else + { + alterString += "第" + (rowIndex + 1) + "行" + content; + } + } + BindGrid(); + if (string.IsNullOrEmpty(alterString)) + { + ShowNotify("删除数据成功!", MessageBoxIcon.Success); + } + else + { + Alert.ShowInTop(alterString, MessageBoxIcon.Warning); + } + } + } + #endregion + + #region 格式化字符串 + /// + /// 格式化受伤情况 + /// + /// + /// + protected string ConvertWorkPostName(object workPostIds) + { + string name = string.Empty; + if (workPostIds != null) + { + name = BLL.WorkPostService.getDepartNamesByIds(workPostIds); + + } + return name; + } + + protected string ConvertUnitName(object unitIds) + { + string name = string.Empty; + if (unitIds != null) + { + name = UnitService.getUnitNamesUnitIds(unitIds); + } + return name; + } + #endregion + + #region 输入框查询事件 + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + + #region 获取权限按钮 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectTrainingPlanMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnMenuDelete.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnAdd)) + { + this.btnNew.Hidden = false; + } + } + } + #endregion + + #region 判断是否可删除 + /// + /// 判断是否可以删除 + /// + /// + private string judgementDelete(string id) + { + string content = string.Empty; + if (Funs.DB.EduTrain_TrainRecord.FirstOrDefault(x => x.PlanId == id) != null) + { + content = "该计划已归档【培训记录】,不能删除!"; + } + if (Funs.DB.Training_TestPlan.FirstOrDefault(x => x.PlanId == id) != null) + { + content = "该计划已做【考试计划】,不能删除!"; + } + + return content; + } + #endregion + + + protected void drpWorkPost_SelectedIndexChanged(object sender, EventArgs e) + { + BindGrid(); + } + + /// + /// 查看二维码 + /// + /// + /// + protected void btnQR_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + return; + } + + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/Controls/SeeQRImage.aspx?TrainingPlanId={0}&strCode={1}", Grid1.SelectedRowID, "trainingPlan$" + Grid1.SelectedRowID), "二维码查看", 400, 400)); + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/Plan.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/Plan.aspx.designer.cs new file mode 100644 index 00000000..1e978fe5 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/Plan.aspx.designer.cs @@ -0,0 +1,188 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class Plan + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// drpWorkPost 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpWorkPost; + + /// + /// txtName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtName; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// lbUnitNames 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbUnitNames; + + /// + /// lbtfWorkPostNames 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbtfWorkPostNames; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuView 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuView; + + /// + /// btnQR 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnQR; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/PlanEdit.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/PlanEdit.aspx new file mode 100644 index 00000000..8386688f --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/PlanEdit.aspx @@ -0,0 +1,172 @@ +<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" CodeBehind="PlanEdit.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.PlanEdit" %> +<%@ Register Src="~/Controls/FlowOperateControl.ascx" TagName="FlowOperateControl" TagPrefix="uc1" %> + + + + + 编辑专项检查 + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/PlanEdit.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/PlanEdit.aspx.cs new file mode 100644 index 00000000..3af5fbaf --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/PlanEdit.aspx.cs @@ -0,0 +1,444 @@ +using BLL; +using Model; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class PlanEdit : PageBase + { + #region 定义变量 + /// + /// 主键 + /// + public string PlanId + { + get + { + return (string)ViewState["PlanId"]; + } + set + { + ViewState["PlanId"] = value; + } + } + /// + /// 项目主键 + /// + public string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + + #endregion + + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); + this.ProjectId = this.CurrUser.LoginProjectId; + this.InitDropDownList(); + this.PlanId = Request.Params["PlanId"]; + + if (!string.IsNullOrEmpty(PlanId)) + { + var trainingPlan = TrainingPlanService.GetPlanById(PlanId); + if (trainingPlan != null) + { + + this.txtPlanName.Text = trainingPlan.PlanName; + this.txtTrainContent.Text = trainingPlan.TrainContent; + this.txtTeachMan.Text = trainingPlan.TeachMan; + if (trainingPlan.TeachHour.HasValue) + this.txtTeachHour.Text = trainingPlan.TeachHour.Value.ToString("0.##"); + if(trainingPlan.TrainStartDate.HasValue) + this.dpTrainStartDate.SelectedDate = trainingPlan.TrainStartDate ; + if (trainingPlan.TrainEndDate.HasValue) + this.dpTrainEndDate.SelectedDate = trainingPlan.TrainEndDate; + this.txtTeachAddress.Text = trainingPlan.TeachAddress; + if (!string.IsNullOrEmpty(trainingPlan.UnitIds)) + dpUnit.SelectedValueArray = trainingPlan.UnitIds.Split(','); + if (!string.IsNullOrEmpty(trainingPlan.WorkPostId)) + dpDepart.SelectedValueArray = trainingPlan.WorkPostId.Split(','); + if (!string.IsNullOrEmpty(trainingPlan.TrainLevelId)) + drpTrainLevel.SelectedValue = trainingPlan.TrainLevelId; + if (!string.IsNullOrEmpty(trainingPlan.TrainTypeId)) + drpTrainType.SelectedValue = trainingPlan.TrainTypeId; + if(!string.IsNullOrEmpty(trainingPlan.Cycle)) + drpCycle.SelectedValue = trainingPlan.Cycle; + + var planItem = (from x in Funs.DB.Training_PlanItem where x.PlanId == trainingPlan.PlanId select x.CompanyTrainingItemId).ToArray(); + if (planItem != null && planItem.Length > 0) + { + dpCompanyTraining.SelectedValueArray = planItem; + } + var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(this.CurrUser.LoginProjectId, trainingPlan.UnitIds, trainingPlan.WorkPostId,"", trainingPlan.TrainTypeId,"","").OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); + dpSysUser.DataTextField = "PersonName"; + dpSysUser.DataValueField = "PersonId"; + dpSysUser.DataSource = getDataList; + dpSysUser.DataBind(); + + var userids =( from x in Funs.DB.Training_Task where x.PlanId == trainingPlan.PlanId select x.UserId).ToArray(); + if (userids != null && userids.Length > 0) + { + dpSysUser.SelectedValueArray = userids; + } + } + } + } + } + #endregion + + /// + /// 初始化下拉框 + /// + private void InitDropDownList() + { + TrainTypeService.InitTrainTypeDropDownList(drpTrainType, true); + TrainLevelService.InitTrainLevelDropDownList(drpTrainLevel, true); + UnitService.InitUnitByProjectIdUnitTypeDropDownList1(dpUnit, this.CurrUser.LoginProjectId, false); + var postIds = (from u in Funs.DB.SitePerson_Person + where u.ProjectId == CurrUser.LoginProjectId + select u.WorkPostId).Distinct(); + + var workPost = (from x in Funs.DB.Base_Depart where postIds.Contains(x.DepartId) orderby x.DepartCode select x).ToList(); + dpDepart.DataValueField = "DepartId"; + dpDepart.DataTextField = "DepartName"; + dpDepart.DataSource = workPost; + dpDepart.DataBind(); + List myList = new List(); + + BoundTree(myList, "0", 0); + dpCompanyTraining.DataTextField = "Name"; + dpCompanyTraining.DataValueField = "Id"; + dpCompanyTraining.DataSimulateTreeLevelField = "Level"; + dpCompanyTraining.DataEnableSelectField = "EnableSelect"; + dpCompanyTraining.DataSource = myList; + dpCompanyTraining.DataBind(); + + + } + #region JQueryFeature + + public class JQueryFeature + { + private string _id; + + public string Id + { + get { return _id; } + set { _id = value; } + } + private string _name; + + public string Name + { + get { return _name; } + set { _name = value; } + } + + private int _level; + + public int Level + { + get { return _level; } + set { _level = value; } + } + + private bool _enableSelect; + + public bool EnableSelect + { + get { return _enableSelect; } + set { _enableSelect = value; } + } + + public JQueryFeature(string id, string name, int level, bool enableSelect) + { + _id = id; + _name = name; + _level = level; + _enableSelect = enableSelect; + } + + public override string ToString() + { + return String.Format("Name:{0}+Id:{1}", Name, Id); + } + } + #endregion + private void BoundTree(List myList, string menuId, int depth) + { + var dt = GetNewTraining(menuId); + if (dt.Count() > 0) + { + + foreach (var dr in dt) + { + myList.Add(new JQueryFeature(dr.CompanyTrainingId, dr.CompanyTrainingName, depth, false)); + BoundTree(myList, dr.CompanyTrainingId, depth + 1); + } + } + else + { + var item = Funs.DB.Training_CompanyTrainingItem.Where(x => x.CompanyTrainingId == menuId); + if (item.Count() > 0) + { + + foreach (var dr in item) + { + myList.Add(new JQueryFeature(dr.CompanyTrainingItemId, dr.CompanyTrainingItemName, depth, true)); + } + } + } + } + /// + /// 得到菜单方法 + /// + /// + /// + private List GetNewTraining(string parentId) + { + return (from x in Funs.DB.Training_CompanyTraining where x.SupCompanyTrainingId == parentId orderby x.CompanyTrainingCode select x).ToList(); ; + } + + + + #region 提交按钮 + /// + /// 提交按钮 + /// + /// + /// + protected void btnSubmit_Click(object sender, EventArgs e) + { + this.SaveData(Const.BtnSubmit); + } + #endregion + + #region 保存按钮 + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + + this.SaveData(Const.BtnSave); + } + #endregion + + #region 保存方法 + /// + /// 保存数据 + /// + /// + private void SaveData(string type) + { + + var db = Funs.DB; + + Model.Training_Plan trainingPlan = new Model.Training_Plan(); + trainingPlan.ProjectId = this.CurrUser.LoginProjectId; + trainingPlan.PlanName = this.txtPlanName.Text; + trainingPlan.TrainContent = this.txtTrainContent.Text; + trainingPlan.TeachMan = this.txtTeachMan.Text; + trainingPlan.TeachHour =decimal.Parse( this.txtTeachHour.Text); + trainingPlan.TrainStartDate = this.dpTrainStartDate.SelectedDate; + trainingPlan.TrainEndDate = this.dpTrainEndDate.SelectedDate; + trainingPlan.TeachAddress = this.txtTeachAddress.Text; + trainingPlan.UnitIds = string.Join(",", dpUnit.SelectedValueArray); + trainingPlan.WorkPostId = string.Join(",", dpDepart.SelectedValueArray); + trainingPlan.DesignerId = CurrUser.UserId; + trainingPlan.DesignerDate = DateTime.Now; + trainingPlan.TrainLevelId = drpTrainLevel.SelectedValue; + trainingPlan.TrainTypeId = drpTrainType.SelectedValue; + trainingPlan.Cycle = drpCycle.SelectedValue; + trainingPlan.States = "0"; + if (type == Const.BtnSubmit) + { + trainingPlan.States = "1"; + } + if (string.IsNullOrEmpty(PlanId)) + { + trainingPlan.PlanCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectTrainingPlanMenuId, CurrUser.LoginProjectId, CurrUser.UnitId); + trainingPlan.PlanId = SQLHelper.GetNewID(); + TrainingPlanService.AddPlan(trainingPlan); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectTrainingPlanMenuId, trainingPlan.ProjectId, null, trainingPlan.PlanId, trainingPlan.DesignerDate); + + } + else + { + trainingPlan.PlanId = PlanId; + TrainingPlanService.UpdatePlan(trainingPlan); + ////删除培训任务 + var tasks = from x in db.Training_Task where x.PlanId == trainingPlan.PlanId select x; + if (tasks.Count() > 0) + { + var taskItems = from x in db.Training_TaskItem where x.PlanId == trainingPlan.PlanId select x; + if (tasks.Count() > 0) + { + db.Training_TaskItem.DeleteAllOnSubmit(taskItems); + db.SubmitChanges(); + } + db.Training_Task.DeleteAllOnSubmit(tasks); + db.SubmitChanges(); + } + + ////删除培训教材类型 + var planItem = (from x in db.Training_PlanItem where x.PlanId == trainingPlan.PlanId select x).ToList(); + if (planItem.Count() > 0) + { + db.Training_PlanItem.DeleteAllOnSubmit(planItem); + db.SubmitChanges(); + } + } + + if (dpSysUser.SelectedValueArray!=null&&dpSysUser.SelectedValueArray.Count() > 0) + { + ////新增培训人员明细 + foreach (var PersonId in dpSysUser.SelectedValueArray) + { + if (!string.IsNullOrEmpty(PersonId)) + { + Model.Training_Task newTrainDetail = new Model.Training_Task + { + TaskId = SQLHelper.GetNewID(), + ProjectId = trainingPlan.ProjectId, + PlanId = trainingPlan.PlanId, + UserId = PersonId, + TaskDate = DateTime.Now, + States = Const.State_0, ////未生成培训教材明细 + }; + db.Training_Task.InsertOnSubmit(newTrainDetail); + db.SubmitChanges(); + + + } + } + } + if (dpCompanyTraining.SelectedValueArray!=null) + { + ////新增培训教材类型明细 + foreach (var CompanyTrainingItemId in dpCompanyTraining.SelectedValueArray) + { + if (!string.IsNullOrEmpty(CompanyTrainingItemId)) + { + Model.Training_PlanItem newPlanItem = new Model.Training_PlanItem + { + PlanItemId = SQLHelper.GetNewID(), + PlanId = trainingPlan.PlanId, + + }; + + if (!string.IsNullOrEmpty(CompanyTrainingItemId)) + { + newPlanItem.CompanyTrainingItemId = CompanyTrainingItemId; + + var trainingItem = Funs.DB.Training_CompanyTrainingItem.FirstOrDefault(x => x.CompanyTrainingItemId == CompanyTrainingItemId); + if (trainingItem != null) + { + newPlanItem.CompanyTrainingId = trainingItem.CompanyTrainingId; + } + } + db.Training_PlanItem.InsertOnSubmit(newPlanItem); + db.SubmitChanges(); + } + } + } + + + + + PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + } + #endregion + + + + + /// + /// + /// + /// + /// + protected void drpSupCheckItemSet_SelectedIndexChanged(object sender, EventArgs e) + { + //this.drpCheckItem.Items.Clear(); + //Technique_CheckItemSetService.InitCheckItemSetNameDropDownList(this.drpCheckItem, "2", this.drpSupCheckItemSet.SelectedValue, false); + } + protected void drpWorkUnit_SelectedIndexChanged(object sender, EventArgs e) + { + + string unitName = ((DropDownList)sender).SelectedValue; + string id = ""; + if(unitName != BLL.Const._Null) + { + var unit = Funs.DB.Base_Unit.FirstOrDefault(x=>x.UnitName == unitName); + if(unit != null) + { + id = unit.UnitId; + } + } + + var sysUser = BLL.ProjectUserService.GetProjectUserByUnitidAndProjectId(CurrUser.LoginProjectId, id, Const.HSSEManager); + List lists = new List(); + foreach(var item in sysUser) + { + lists.Add(new ListItem(item.UserName, item.UserName)); + } + + + } + + protected void dpUnit_SelectedIndexChanged(object sender, EventArgs e) + { + initdpSysUser(); + } + + protected void dpWorkPost_SelectedIndexChanged(object sender, EventArgs e) + { + initdpSysUser(); + } + protected void drpTrainType_SelectedIndexChanged(object sender, EventArgs e) + { + initdpSysUser(); + } + + private void initdpSysUser() + { + if (dpUnit.SelectedValueArray != null && dpDepart.SelectedValueArray != null) + { + dpSysUser.Items.Clear(); + string unitIds=string.Join(",",dpUnit.SelectedValue); + string workPostIds = string.Join(",", dpDepart.SelectedValue); + var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(this.CurrUser.LoginProjectId, unitIds, workPostIds,"", drpTrainType.SelectedValue,"","").OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); + dpSysUser.DataTextField = "PersonName"; + dpSysUser.DataValueField = "PersonId"; + dpSysUser.DataSource = getDataList; + dpSysUser.DataBind(); + } + } + + + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/PlanEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/PlanEdit.aspx.designer.cs new file mode 100644 index 00000000..8df6e872 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/PlanEdit.aspx.designer.cs @@ -0,0 +1,233 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class PlanEdit + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtPlanName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPlanName; + + /// + /// drpTrainType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpTrainType; + + /// + /// drpTrainLevel 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpTrainLevel; + + /// + /// txtTrainContent 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainContent; + + /// + /// dpTrainStartDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker dpTrainStartDate; + + /// + /// dpTrainEndDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker dpTrainEndDate; + + /// + /// txtTeachHour 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtTeachHour; + + /// + /// drpCycle 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpCycle; + + /// + /// txtTeachMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTeachMan; + + /// + /// txtTeachAddress 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTeachAddress; + + /// + /// dpUnit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList dpUnit; + + /// + /// dpDepart 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList dpDepart; + + /// + /// dpSysUser 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList dpSysUser; + + /// + /// dpCompanyTraining 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList dpCompanyTraining; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// lbTemp 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbTemp; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnSubmit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSubmit; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/PlanView.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/PlanView.aspx new file mode 100644 index 00000000..9349b7fa --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/PlanView.aspx @@ -0,0 +1,71 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PlanView.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.PlanView" %> + + + + + + 编辑培训计划 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/PlanView.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/PlanView.aspx.cs new file mode 100644 index 00000000..7a8c212a --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/PlanView.aspx.cs @@ -0,0 +1,47 @@ +using BLL; +using System; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class PlanView : PageBase + { + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + if (!IsPostBack) + { + this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); + string planId = Request.Params["PlanId"]; + var plan = BLL.TrainingPlanService.GetPlanById(planId); + if (plan != null) + { + this.txtPlanCode.Text = plan.PlanCode; + this.txtPlanName.Text = plan.PlanName; + this.txtDesignerName.Text = BLL.UserService.GetUserNameByUserId(plan.DesignerId); + this.txtDesignerDate.Text = string.Format("{0:yyyy-MM-dd}", plan.DesignerDate); + this.txtInstallationNames.Text = WorkPostService.getWorkPostNamesWorkPostIds(plan.WorkPostId); + this.txtUnitName.Text = UnitService.getUnitNamesUnitIds(plan.UnitIds); + var testPlanTraining = from x in db.Training_PlanItem + join y in db.Training_Training on x.TrainingEduId equals y.TrainingId + where x.PlanId == planId + orderby y.TrainingCode + select y.TrainingName; + foreach (var item in testPlanTraining) + { + this.txtTrainingEdu.Text += item + ";"; + } + } + } + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/PlanView.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/PlanView.aspx.designer.cs new file mode 100644 index 00000000..11bf5c64 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/PlanView.aspx.designer.cs @@ -0,0 +1,134 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class PlanView + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtPlanCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPlanCode; + + /// + /// txtPlanName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPlanName; + + /// + /// txtDesignerName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtDesignerName; + + /// + /// txtDesignerDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtDesignerDate; + + /// + /// txtUnitName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtUnitName; + + /// + /// txtInstallationNames 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtInstallationNames; + + /// + /// txtTrainingEdu 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtTrainingEdu; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/ShowPerson.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/ShowPerson.aspx new file mode 100644 index 00000000..06af9ecc --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/ShowPerson.aspx @@ -0,0 +1,87 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowPerson.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.ShowPerson" %> + + + + + + 查找人员 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/ShowPerson.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/ShowPerson.aspx.cs new file mode 100644 index 00000000..cc674b44 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/ShowPerson.aspx.cs @@ -0,0 +1,229 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class ShowPerson : PageBase + { + #region 定义项 + /// + /// 主键 + /// + public string TrainingId + { + get + { + return (string)ViewState["TrainingId"]; + } + set + { + ViewState["TrainingId"] = value; + } + } + + ///// + ///// GV被选择项列表 + ///// + //public List ItemSelectedList + //{ + // get + // { + // return (List)ViewState["ItemSelectedList"]; + // } + // set + // { + // ViewState["ItemSelectedList"] = value; + // } + //} + + /// + /// 项目id + /// + public string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + #endregion + + #region 页面加载 + /// + /// 页面加载 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.ProjectId = this.CurrUser.LoginProjectId; + if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.ProjectId) + { + this.ProjectId = Request.Params["projectId"]; + } + //单位 + BLL.UnitService.InitUnitDropDownList(this.drpUnit, this.ProjectId, true); + this.TrainingId = Request.Params["TrainingId"]; + // 绑定表格 + BindGrid(); + } + } + #endregion + + #region 保存 + /// + /// 保存 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string personId = Grid1.DataKeys[rowIndex][0].ToString(); + var trainRecordDetail = BLL.EduTrain_TrainRecordDetailService.GetTrainDetailByPersonIdTrainingId(this.TrainingId, personId); + if (trainRecordDetail == null && !string.IsNullOrEmpty(personId)) + { + Model.EduTrain_TrainRecordDetail detail = new Model.EduTrain_TrainRecordDetail + { + TrainingId = this.TrainingId, + PersonId = personId, + CheckResult = true, + CheckScore = 100 + }; + + detail.CheckScore = null; + BLL.EduTrain_TrainRecordDetailService.AddTrainDetail(detail); + } + } + ///更新培训人数 + var train = BLL.EduTrain_TrainRecordService.GetTrainingByTrainingId(this.TrainingId); + if (train != null) + { + var item = BLL.EduTrain_TrainRecordDetailService.GetTrainRecordDetailByTrainingId(this.TrainingId); + train.TrainPersonNum = item.Count(); + BLL.EduTrain_TrainRecordService.UpdateTraining(train); + } + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + else + { + Alert.ShowInParent("请至少选择一条记录!"); + return; + } + + } + #endregion + + #region 绑定数据 + /// + /// 绑定数据 + /// + private void BindGrid() + { + string type = Request.Params["TrainTypeId"]; + var trainType = BLL.TrainTypeService.GetTrainTypeById(type); + if (trainType != null) + { + string strSql = @"SELECT viewPerSon.PersonId,viewPerSon.UnitName,viewPerSon.PersonName,viewPerSon.CardNo,viewPerSon.SexName,WorkPostName,viewPerSon.IdentityCard,TeamGroupName,WorkAreaName,InTime " + + @" FROM View_SitePerson_Person AS viewPerSon " + //+ @" LEFT JOIN EduTrain_TrainRecordDetail AS TrainRecordDetail ON viewPerSon.PersonId=TrainRecordDetail.PersonId " + //+ @" LEFT JOIN EduTrain_TrainRecord AS TrainRecord ON TrainRecord.TrainingId=TrainRecordDetail.TrainingId " + + @" WHERE viewPerSon.ProjectId='" + this.ProjectId + "' AND viewPerSon.IsUsed='1' "; + + List listStr = new List(); + if (BLL.EduTrain_TrainRecordDetailService.GetTrainRecordDetailByTrainingId(this.TrainingId).Count() > 0) + { + strSql += @" AND (viewPerSon.PersonId NOT IN (SELECT PersonId FROM EduTrain_TrainRecord AS R + LEFT JOIN EduTrain_TrainRecordDetail AS D ON R.TrainingId = D.TrainingId + WHERE R.ProjectId='" + this.ProjectId + "' AND R.TrainingId = '" + this.TrainingId + "'))"; + } + + if (!trainType.IsRepeat.HasValue || trainType.IsRepeat == false) + { + strSql += @" AND viewPerSon.PersonId NOT IN + (SELECT PersonId FROM EduTrain_TrainRecord AS R + LEFT JOIN EduTrain_TrainRecordDetail AS D ON R.TrainingId = D.TrainingId + WHERE R.ProjectId='" + this.ProjectId + "' AND R.TrainTypeId ='" + type + "' AND D.CheckResult = 1)"; + } + + if (this.drpUnit.SelectedValue != BLL.Const._Null) + { + strSql += " AND viewPerSon.UnitId=@UnitId"; + listStr.Add(new SqlParameter("@UnitId", this.drpUnit.SelectedValue)); + } + if (!string.IsNullOrEmpty(this.txtPersonName.Text.Trim())) + { + strSql += " AND viewPerSon.PersonName LIKE @PersonName"; + listStr.Add(new SqlParameter("@PersonName", "%" + this.txtPersonName.Text.Trim() + "%")); + } + + if (!string.IsNullOrEmpty(this.txtCardNo.Text.Trim())) + { + strSql += " AND viewPerSon.CardNo LIKE @CardNo"; + listStr.Add(new SqlParameter("@CardNo", "%" + this.txtCardNo.Text.Trim() + "%")); + } + if (!string.IsNullOrEmpty(this.txtWorkPostName.Text.Trim())) + { + strSql += " AND viewPerSon.WorkPostName LIKE @WorkPostName"; + listStr.Add(new SqlParameter("@WorkPostName", "%" + this.txtWorkPostName.Text.Trim() + "%")); + } + if (ckPostType2.Checked) + { + strSql += " AND viewPerSon.PostType = @PostType"; + listStr.Add(new SqlParameter("@PostType", BLL.Const.PostType_2)); + } + if (ckIsHsse.Checked) + { + strSql += " AND IsHsse = @IsHsse"; + listStr.Add(new SqlParameter("@IsHsse", true)); + } + strSql += " group by viewPerSon.PersonId,viewPerSon.UnitName,viewPerSon.PersonName,viewPerSon.CardNo,viewPerSon.Sex,WorkPostName,viewPerSon.IdentityCard,TeamGroupName,WorkAreaName,InTime,SexName"; + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + Grid1.RecordCount = tb.Rows.Count; + var table1 = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table1; + Grid1.DataBind(); + } + } + #endregion + + #region 排序 + /// + /// Grid1排序 + /// + /// + /// + protected void Grid1_Sort(object sender, GridSortEventArgs e) + { + Grid1.SortDirection = e.SortDirection; + Grid1.SortField = e.SortField; + BindGrid(); + } + #endregion + + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/ShowPerson.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/ShowPerson.aspx.designer.cs new file mode 100644 index 00000000..8ac30499 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/ShowPerson.aspx.designer.cs @@ -0,0 +1,125 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class ShowPerson + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// drpUnit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpUnit; + + /// + /// txtPersonName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPersonName; + + /// + /// txtCardNo 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCardNo; + + /// + /// txtWorkPostName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtWorkPostName; + + /// + /// ckPostType2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBox ckPostType2; + + /// + /// ckIsHsse 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBox ckIsHsse; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/Task.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/Task.aspx new file mode 100644 index 00000000..c689c5ba --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/Task.aspx @@ -0,0 +1,88 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Task.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.Task" %> + + + + + + 培训任务 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/Task.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/Task.aspx.cs new file mode 100644 index 00000000..d84db9db --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/Task.aspx.cs @@ -0,0 +1,208 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class Task : PageBase + { + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.GetButtonPower(); + ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + BindGrid(); + } + else + { + if (GetRequestEventArgument() == "reloadGrid") + { + BindGrid(); + } + } + } + + /// + /// 绑定数据 + /// + private void BindGrid() + { + string strSql = @"SELECT Task.TaskId,Task.PlanId,Task.UserId,Task.TaskDate,(CASE Task.States WHEN '0' THEN '未响应' WHEN '1' THEN '已响应' WHEN '2' THEN '已完成' ELSE '' END) AS States,Plans.PlanName,Person.UserName PersonName + FROM dbo.Training_Task AS Task + LEFT JOIN dbo.Training_Plan AS Plans ON Plans.PlanId=Task.PlanId + LEFT JOIN dbo.Sys_User AS Person ON Person.UserId = Task.UserId + WHERE Task.ProjectId is null "; + List listStr = new List(); + if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) + { + strSql += " AND (Plans.PlanName LIKE @name OR Person.UserName LIKE @name)"; + listStr.Add(new SqlParameter("@name", "%" + this.txtName.Text.Trim() + "%")); + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + } + #endregion + + #region 分页、关闭窗口 + /// + /// 分页 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + BindGrid(); + } + + /// + /// 关闭窗口 + /// + /// + /// + protected void Window1_Close(object sender, EventArgs e) + { + BindGrid(); + } + #endregion + + #region 编辑 + /// + /// Grid行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuView_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑数据方法 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + return; + } + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TaskView.aspx?TaskId={0}", Grid1.SelectedRowID, "编辑 - "))); + } + #endregion + + #region 删除 + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 删除方法 + /// + private void DeleteData() + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + var getV = BLL.TrainingTaskService.GetTaskById(rowID); + if (getV != null) + { + BLL.LogService.AddSys_Log(this.CurrUser, null, rowID, BLL.Const.ProjectTrainingTaskMenuId, BLL.Const.BtnDelete); + BLL.TrainingTaskService.DeleteTaskById(rowID); + } + } + + BindGrid(); + ShowNotify("删除数据成功!"); + } + } + #endregion + + #region 输入框查询事件 + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + + #region 获取权限按钮 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectTrainingTaskMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnMenuDelete.Hidden = false; + } + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/Task.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/Task.aspx.designer.cs new file mode 100644 index 00000000..fb3ff7df --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/Task.aspx.designer.cs @@ -0,0 +1,134 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class Task + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// txtName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtName; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuView 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuView; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TaskNotice.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TaskNotice.aspx new file mode 100644 index 00000000..ee613c8a --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TaskNotice.aspx @@ -0,0 +1,138 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TaskNotice.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TaskNotice" %> + + + + + + + + + +
+ + + + + + + + + + <%-- + + + + + + + --%> + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TaskNotice.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TaskNotice.aspx.cs new file mode 100644 index 00000000..a96b7857 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TaskNotice.aspx.cs @@ -0,0 +1,404 @@ +using BLL; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using AspNet = System.Web.UI.WebControls; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TaskNotice : PageBase + { + + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + ////权限按钮方法 + this.GetButtonPower(); + this.btnMenuDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请至少选择一项!"); + this.btnMenuDelete.ConfirmText = String.Format("你确定要删除选中的  行数据吗?", Grid1.GetSelectedCountReference()); + //单位 + // BLL.UnitService.InitUnitDropDownList(this.drpUnitId, this.CurrUser.LoginProjectId, true); + //培训类型 + BLL.TrainTypeService.InitTrainTypeDropDownList(this.drpTrainType, true); + + ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + BindGrid(); + + } + } + + /// + /// 绑定数据 + /// + private void BindGrid() + { + string projectId = this.CurrUser.LoginProjectId; + + string strSql = @"SELECT task.TaskNoticeId, + task.TrainTitle, + task.TrainType, + traintype.TrainTypeName, + task.TeachHour, + task.Units, + task.TeachAddress, + task.TeachMan, + task.TrainStartDate, + task.Cycle, + task.CycleStartDate, + task.CycleEndDate, + task.TrainContent, + users.UserName AS CreatMan, + task.CreatDate,task.DayOfWeek,task.WeekOfMonth,task.State, + task.ProjectId + FROM dbo.EduTrain_TaskNotice AS task + LEFT JOIN dbo.Base_TrainType AS traintype ON traintype.TrainTypeId = task.TrainType + LEFT JOIN dbo.Sys_User AS users ON users.UserId = task.CreatMan where 1=1 "; + List listStr = new List(); + strSql += " AND task.ProjectId = @ProjectId"; + listStr.Add(new SqlParameter("@ProjectId", projectId)); + if (drpTrainType.SelectedValue!=Const._Null) + { + strSql += " AND task.TrainType = @TrainType"; + listStr.Add(new SqlParameter("@TrainType", drpTrainType.SelectedValue)); + + } + + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + Grid1.RecordCount = tb.Rows.Count; + //tb = GetFilteredTable(Grid1.FilteredData, tb); + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + // int totalPersonNum = 0; + // for (int i = 0; i < tb.Rows.Count; i++) + // { + // totalPersonNum += Funs.GetNewIntOrZero(tb.Rows[i][8].ToString()); + // } + + // JObject summary = new JObject + //{ + // { "TeachMan", "合计:" }, + // { "TrainPersonNum", totalPersonNum } + //}; + + // Grid1.SummaryData = summary; + + } + #endregion + + #region 页索引改变事件 + /// + /// 页索引改变事件 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + BindGrid(); + } + #endregion + + #region 排序 + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, GridSortEventArgs e) + { + BindGrid(); + } + #endregion + + #region 分页选择下拉改变事件 + /// + /// 分页选择下拉改变事件 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + BindGrid(); + } + #endregion + + #region 增加 + /// + /// 增加 + /// + /// + /// + protected void btnNew_Click(object sender, EventArgs e) + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TaskNoticeEdit.aspx", "编辑 - "))); + } + #endregion + + #region 编辑 + /// + /// Grid行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuEdit_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + var TaskNoticeId = Grid1.SelectedRowID; + var model = EduTrain_TaskNoticeService.GetEduTrain_TaskNoticeById(TaskNoticeId); + if (model != null) + { + + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TaskNoticeEdit.aspx?TaskNoticeId={0}", TaskNoticeId, "编辑 - "))); + + } + } + #endregion + protected void btnMenuAddNew_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + var TaskNoticeId = Grid1.SelectedRowID; + var model = EduTrain_TaskNoticeService.GetEduTrain_TaskNoticeById(TaskNoticeId); + if (model != null) + { + + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TaskNoticeEdit.aspx?TaskNoticeId={0}&Type=new", TaskNoticeId, "编辑 - "))); + + } + } + #region 删除 + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 删除方法 + /// + private void DeleteData() + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + bool isShow = false; + if (Grid1.SelectedRowIndexArray.Length == 1) + { + isShow = true; + } + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + if (this.judgementDelete(rowID, isShow)) + { + var TrainRecord = EduTrain_TrainRecordService.GetTrainingByTrainingId(rowID); + if (TrainRecord != null) + { + LogService.AddSys_Log(this.CurrUser, TrainRecord.TrainingCode, TrainRecord.TrainingId, BLL.Const.ProjectTrainRecordMenuId, BLL.Const.BtnDelete); + EduTrain_TrainRecordService.DeleteTrainingByTrainingId(rowID); + BindGrid(); + ShowNotify("删除数据成功!(表格数据已重新绑定)", MessageBoxIcon.Success); + } + } + } + } + } + + /// + /// 判断是否可删除 + /// + /// + /// + /// + private bool judgementDelete(string rowID, bool isShow) + { + string content = string.Empty; + if (string.IsNullOrEmpty(content)) + { + return true; + } + else + { + if (isShow) + { + Alert.ShowInTop(content); + } + return false; + } + } + #endregion + + #region 关闭弹出窗 + /// + /// 关闭弹出窗 + /// + /// + /// + protected void Window1_Close(object sender, WindowCloseEventArgs e) + { + BindGrid(); + } + #endregion + + #region 获取按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + if (Request.Params["value"] == "0") + { + return; + } + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectTrainRecordMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnAdd)) + { + this.btnNew.Hidden = false; + this.btnMenuAddNew.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnModify)) + { + this.btnMenuEdit.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnMenuDelete.Hidden = false; + } + } + } + #endregion + + + #region 格式化字符串 + /// + /// 获取单位名称 + /// + /// + /// + protected string ConvertUnitName(object unitIds) + { + string unitName = string.Empty; + if (unitIds != null) + { + List infos = unitIds.ToString().Split(',').ToList(); + if (infos.Count() > 0) + { + foreach (var item in infos) + { + Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(item); + if (unit != null) + { + unitName += unit.UnitName + ","; + } + } + if (!string.IsNullOrEmpty(unitName)) + { + unitName = unitName.Substring(0, unitName.LastIndexOf(",")); + } + } + } + return unitName; + } + + protected string ConvertState(object state) + { + if (state != null) + { + switch (state.ToString()) + { + case "0": return "编制"; + case "1": return "已提交"; + + } + } + return ""; + } + + protected string ConvertUserName(object users) + { + string userName = string.Empty; + if (users != null) + { + List infos = users.ToString().Split(',').ToList(); + if (infos.Count() > 0) + { + foreach (var item in infos) + { + Model.Sys_User unit = BLL.UserService.GetUserByUserId(item); + if (unit != null) + { + userName += unit.UserName + ","; + } + } + if (!string.IsNullOrEmpty(userName)) + { + userName = userName.Substring(0, userName.LastIndexOf(",")); + } + } + } + return userName; + } + #endregion + + #region 查询事件 + /// + /// 查询事件 + /// + /// + /// + protected void Text_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + + + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TaskNotice.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TaskNotice.aspx.designer.cs new file mode 100644 index 00000000..953947fc --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TaskNotice.aspx.designer.cs @@ -0,0 +1,197 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TaskNotice + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// drpTrainType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpTrainType; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// lblNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblNumber; + + /// + /// lblTeachMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblTeachMan; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label1; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Window2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window2; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuEdit; + + /// + /// btnMenuAddNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuAddNew; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TaskNoticeEdit.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TaskNoticeEdit.aspx new file mode 100644 index 00000000..3c64b308 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TaskNoticeEdit.aspx @@ -0,0 +1,139 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TaskNoticeEdit.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TaskNoticeEdit" %> + + + + + 编辑培训任务通知 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<%-- + --%> + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TaskNoticeEdit.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TaskNoticeEdit.aspx.cs new file mode 100644 index 00000000..3346709e --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TaskNoticeEdit.aspx.cs @@ -0,0 +1,243 @@ +using BLL; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TaskNoticeEdit : PageBase + { + #region 定义变量 + /// + /// 主键 + /// + public string TaskNoticeId + { + get + { + return (string)ViewState["TaskNoticeId"]; + } + set + { + ViewState["TaskNoticeId"] = value; + } + } + + /// + /// 主键 + /// + public string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + public string Type + { + get + { + return (string)ViewState["Type"]; + } + set + { + ViewState["Type"] = value; + } + } + + + + #endregion + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.btnClose.OnClientClick = ActiveWindow.GetHidePostBackReference(); + this.ProjectId = this.CurrUser.LoginProjectId; + this.InitDropDownList(); + this.TaskNoticeId = Request.Params["TaskNoticeId"]; + this.Type= Request.Params["Type"]; + var model=BLL.EduTrain_TaskNoticeService.GetEduTrain_TaskNoticeById(this.TaskNoticeId); + if (model != null) + { + txtTrainTitle.Text = model.TrainTitle; + drpTrainType.SelectedValue = model.TrainType; + txtTrainContent.Text = model.TrainContent; + txtTrainStartDate.SelectedDate = model.TrainStartDate; + txtTeachHour.Text = model.TeachHour.ToString(); + txtTeachMan.SelectedValueArray = model.TeachMan.Split(','); + txtTeachAddress.Text = model.TeachAddress; + drpUnits.SelectedValueArray = model.Units.Split(','); + drpCycle.SelectedValue = model.Cycle; + txtCycleStartDate.SelectedDate = model.CycleStartDate; + txtCycleEndDate.SelectedDate = model.CycleEndDate; + nbAheadOfTime.Text = model.AheadOfTime; + dpDayOfWeek.SelectedValue = model.DayOfWeek; + dpWeekOfMonth.SelectedValue = model.WeekOfMonth; + } + + + } + } + #endregion + + + /// + /// + /// + private void InitDropDownList() + { + //培训类型 + TrainTypeService.InitTrainTypeDropDownList(this.drpTrainType, true); + //培训单位 + UnitService.InitUnitDropDownList(this.drpUnits, this.ProjectId, false); + + UserService.InitUserDropDownList(this.txtTeachMan, this.ProjectId, false); + + } + + + #region 提交按钮 + /// + /// 提交按钮 + /// + /// + /// + protected void btnSubmit_Click(object sender, EventArgs e) + { + + this.SaveData(Const.BtnSubmit); + PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + } + #endregion + + #region 保存按钮 + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + this.SaveData(Const.BtnSave); + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + #endregion + + #region 保存方法 + /// + /// 保存数据 + /// + /// + private void SaveData(string type) + { + var model =new Model.EduTrain_TaskNotice (); + model.TrainTitle=txtTrainTitle.Text ; + model.TrainType= drpTrainType.SelectedValue; + model.TrainContent = txtTrainContent.Text ; + model.TrainStartDate= txtTrainStartDate.SelectedDate ; + model.TeachHour= Funs.GetNewIntOrZero( txtTeachHour.Text) ; + model.TeachMan= String.Join (",", txtTeachMan.SelectedValueArray) ; + model.TeachAddress= txtTeachAddress.Text; + model.Units= String .Join (",", drpUnits.SelectedValueArray) ; + model.Cycle= drpCycle.SelectedValue ; + model.CycleStartDate= txtCycleStartDate.SelectedDate; + model.CycleEndDate= txtCycleEndDate.SelectedDate ; + model.CreatMan=this.CurrUser.UserId ; + model.CreatDate = DateTime.Now; + model.ProjectId= ProjectId; + model.AheadOfTime = nbAheadOfTime.Text; + model.DayOfWeek = dpDayOfWeek.SelectedValue; + model.WeekOfMonth = dpWeekOfMonth.SelectedValue; + if (Const.BtnSubmit == type) + { + model.State = "1"; + } + else + { + model.State = "0"; + + } + if (this.Type=="new") + { + TaskNoticeId = null; + } + if (string.IsNullOrEmpty( TaskNoticeId) ) + { + TaskNoticeId = SQLHelper.GetNewID(typeof(Model.EduTrain_TaskNotice)); + model.TaskNoticeId = TaskNoticeId ; + BLL.EduTrain_TaskNoticeService.AddEduTrain_TaskNotice(model); + } + else + { + model.TaskNoticeId = TaskNoticeId; + BLL.EduTrain_TaskNoticeService.UpdateEduTrain_TaskNotice (model); + } + + } + #endregion + + #region 关闭弹出窗 + /// + /// 关闭弹出窗 + /// + /// + /// + protected void Window1_Close(object sender, EventArgs e) + { + } + #endregion + + + + //#region 附件上传 + ///// + ///// 上传附件 + ///// + ///// + ///// + //protected void btnAttachUrl_Click(object sender, EventArgs e) + //{ + // if (this.drpTrainType.SelectedValue == BLL.Const._Null) + // { + // ShowNotify("请选择培训类型!", MessageBoxIcon.Warning); + // return; + // } + // if (string.IsNullOrEmpty(this.TaskNoticeId)) + // { + // this.SaveData(BLL.Const.BtnSave); + // } + // PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/TrainRecord&menuId={1}", this.TaskNoticeId, BLL.Const.ProjectTrainRecordMenuId))); + //} + //#endregion + + + + + ///// + ///// 选择培训教材类型 + ///// + ///// + ///// + //protected void btnTrainingType_Click(object sender, EventArgs e) + //{ + // if (string.IsNullOrEmpty(this.TaskNoticeId)) + // { + // this.SaveData(BLL.Const.BtnSave); + // } + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ShowTrainingType.aspx?TaskNoticeId={0}&TrainTypeId={1}", this.TaskNoticeId, this.drpTrainType.SelectedValue, "编辑 - "))); + //} + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TaskNoticeEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TaskNoticeEdit.aspx.designer.cs new file mode 100644 index 00000000..f9ad69d4 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TaskNoticeEdit.aspx.designer.cs @@ -0,0 +1,251 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TaskNoticeEdit + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtTrainTitle 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainTitle; + + /// + /// drpTrainType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpTrainType; + + /// + /// txtTeachHour 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtTeachHour; + + /// + /// drpUnits 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpUnits; + + /// + /// txtTeachAddress 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTeachAddress; + + /// + /// txtTeachMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList txtTeachMan; + + /// + /// txtTrainStartDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtTrainStartDate; + + /// + /// nbAheadOfTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox nbAheadOfTime; + + /// + /// drpCycle 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpCycle; + + /// + /// dpWeekOfMonth 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList dpWeekOfMonth; + + /// + /// dpDayOfWeek 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList dpDayOfWeek; + + /// + /// txtCycleStartDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtCycleStartDate; + + /// + /// txtCycleEndDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtCycleEndDate; + + /// + /// txtTrainContent 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtTrainContent; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// lbTemp 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbTemp; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnSubmit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSubmit; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Window2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window2; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TaskRecordView.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TaskRecordView.aspx new file mode 100644 index 00000000..8b41c9ba --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TaskRecordView.aspx @@ -0,0 +1,91 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TaskRecordView.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TaskRecordView" %> + + + + + + + + + + +
+ + + + + + + + + + + + <%-- + + + + + + + + + --%> + <%-- + + + + + + + + + +
+
+
+
+
+
+
+
+
+
--%> + + + + + + + +
+
+
+
+
+
+
+
+ + + + + + + + + + + +
+ + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TaskRecordView.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TaskRecordView.aspx.cs new file mode 100644 index 00000000..47beafb2 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TaskRecordView.aspx.cs @@ -0,0 +1,90 @@ +using System; +using System.Linq; +using BLL; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TaskRecordView : PageBase + { + #region 加载页面 + /// + /// + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); + var q = BLL.TrainingItemService.GetTrainingItemByTrainingItemId(Request.QueryString["TrainingEduItemId"]); + if (q != null) + { + this.txtTrainingEduItemCode.Text = q.TrainingItemCode; + this.txtTrainingEduItemName.Text = q.TrainingItemName; + //this.txtSummary.Text = q.Summary; + //this.txtInstallationNames.Text = q.InstallationNames; + //if (!string.IsNullOrEmpty(q.PictureUrl)) + //{ + // this.trImageUrl.Visible = true; + // this.divPictureUrl.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../", q.PictureUrl); + // this.divBeImageUrl.InnerHtml = BLL.UploadAttachmentService.ShowImage("../", q.PictureUrl); + //} + if (!string.IsNullOrEmpty(q.AttachUrl)) + { + this.divAttachUrl.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../../", q.AttachUrl); + } + } + else + { + var q1 = BLL.CompanyTrainingItemService.GetCompanyTrainingItemById(Request.QueryString["TrainingEduItemId"]); + if (q1 != null) + { + this.txtTrainingEduItemCode.Text = q1.CompanyTrainingItemCode; + this.txtTrainingEduItemName.Text = q1.CompanyTrainingItemName; + //this.txtSummary.Text = q.Summary; + //this.txtInstallationNames.Text = q.InstallationNames; + //if (!string.IsNullOrEmpty(q.PictureUrl)) + //{ + // this.trImageUrl.Visible = true; + // this.divPictureUrl.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../", q.PictureUrl); + // this.divBeImageUrl.InnerHtml = BLL.UploadAttachmentService.ShowImage("../", q.PictureUrl); + //} + + this.divAttachUrl.InnerHtml = GetBtnFileUrl(q1.CompanyTrainingItemId); + + } + + } + } + } + #endregion + + public static string GetBtnFileUrl(object toKey) + { + string fileUrl = string.Empty; + if (toKey != null) + { + Model.AttachFile file = Funs.DB.AttachFile.FirstOrDefault(e => e.ToKeyId == toKey.ToString()); + if (file != null && !string.IsNullOrEmpty(file.AttachUrl)) + { + string url = file.AttachUrl.Replace('\\', '/'); + fileUrl = BLL.UploadAttachmentService.ShowAttachment2("../../", url); + } + } + return fileUrl; + } + + #region 附件上传 + /// + /// 上传附件 + /// + /// + /// + protected void btnAttachUrlC_Click(object sender, EventArgs e) + { + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Training&menuId={1}&type=-1", Request.QueryString["TrainingEduItemId"], BLL.Const.TrainDBMenuId))); + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TaskRecordView.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TaskRecordView.aspx.designer.cs new file mode 100644 index 00000000..966cb7e4 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TaskRecordView.aspx.designer.cs @@ -0,0 +1,125 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TaskRecordView + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtTrainingEduItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainingEduItemCode; + + /// + /// txtTrainingEduItemName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainingEduItemName; + + /// + /// ContentPanel2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ContentPanel ContentPanel2; + + /// + /// divAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divAttachUrl; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button Button1; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TaskView.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TaskView.aspx new file mode 100644 index 00000000..6dac025a --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TaskView.aspx @@ -0,0 +1,79 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TaskView.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TaskView" %> + + + + + + 编辑培训任务 + + + +
+ + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TaskView.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TaskView.aspx.cs new file mode 100644 index 00000000..2f97baa9 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TaskView.aspx.cs @@ -0,0 +1,178 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TaskView : PageBase + { + #region 定义项 + /// + /// 主键 + /// + private string TaskId + { + get + { + return (string)ViewState["TaskId"]; + } + set + { + ViewState["TaskId"] = value; + } + } + #endregion + + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.TaskId = Request.Params["TaskId"]; + ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + this.BindGrid(); + + } + } + #endregion + + #region 分页、关闭窗口 + /// + /// 分页 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + Grid1.SortDirection = e.SortDirection; + Grid1.SortField = e.SortField; + BindGrid(); + } + + /// + /// 关闭窗口 + /// + /// + /// + protected void Window1_Close(object sender, EventArgs e) + { + BindGrid(); + } + #endregion + + #region 绑定数据 + /// + /// 绑定数据 + /// + private void BindGrid() + { + var task = BLL.TrainingTaskService.GetTaskById(this.TaskId); + if (task != null) + { + string strSql = @"SELECT PlanItem.PlanItemId,PlanItem.PlanId,PlanItem.TrainingEduId,Training.TrainingCode,Training.TrainingId,Training.TrainingName + ,TrainingItem.TrainingItemId,TrainingItem.TrainingItemCode,TrainingItem.TrainingItemName + FROM Training_PlanItem AS PlanItem + LEFT JOIN Training_TrainingItem AS TrainingItem ON PlanItem.TrainingEduItemId =TrainingItem.TrainingItemId + LEFT JOIN Training_Training AS Training ON TrainingItem.TrainingId =Training.TrainingId + WHERE PlanItem.TrainingEduItemId is not null and PlanItem.PlanId=@PlanId + union all + SELECT PlanItem.PlanItemId,PlanItem.PlanId,PlanItem.TrainingEduId,Training.CompanyTrainingCode,Training.CompanyTrainingId,Training.CompanyTrainingName + ,TrainingItem.CompanyTrainingItemId,TrainingItem.CompanyTrainingItemCode,TrainingItem.CompanyTrainingItemName + FROM Training_PlanItem AS PlanItem + LEFT JOIN Training_CompanyTrainingItem AS TrainingItem ON PlanItem.CompanyTrainingId =TrainingItem.CompanyTrainingId + LEFT JOIN Training_CompanyTraining AS Training ON TrainingItem.CompanyTrainingId =Training.CompanyTrainingId + WHERE PlanItem.CompanyTrainingId is not null and PlanItem.PlanId=@PlanId"; + List listStr = new List(); + listStr.Add(new SqlParameter("@PlanId", task.PlanId)); + //var user = BLL.UserService.GetUserByUserId(task.UserId); + //if (user != null && !string.IsNullOrEmpty(user.InstallationId)) + //{ + // List installs = Funs.GetStrListByStr(user.InstallationId, ','); + // if (installs.Count > 0) + // { + // int i = 0; + // foreach (var item in installs) + // { + // strSql += " AND (TrainingEduItem.InstallationIds LIKE @InstallationId" + i.ToString() + " OR TrainingEduItem.InstallationIds IS NULL)"; + // listStr.Add(new SqlParameter("@InstallationId" + i.ToString(), item)); + // i++; + // } + // } + //} + + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + } + } + #endregion + + #region 查看 + /// + /// Grid行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑 + /// + /// + /// + protected void btnMenuView_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + return; + } + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TaskRecordView.aspx?TrainingEduItemId={0}", Grid1.SelectedRowID, "编辑 - "))); + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TaskView.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TaskView.aspx.designer.cs new file mode 100644 index 00000000..c3488aa1 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TaskView.aspx.designer.cs @@ -0,0 +1,107 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TaskView + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuView 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuView; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestPlan.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TestPlan.aspx new file mode 100644 index 00000000..0de8109a --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestPlan.aspx @@ -0,0 +1,127 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestPlan.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TestPlan" %> + + + + + + 考试计划 + + + +
+ + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + + + --%> + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestPlan.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestPlan.aspx.cs new file mode 100644 index 00000000..7ac6dc8b --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestPlan.aspx.cs @@ -0,0 +1,286 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TestPlan : PageBase + { + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.GetButtonPower(); + var data = APIBaseInfoService.getWorkPost(CurrUser.ProjectId, null); + this.drpWorkPost.DataValueField = "BaseInfoId"; + this.drpWorkPost.DataTextField = "BaseInfoName"; + this.drpWorkPost.DataSource = data; + this.drpWorkPost.DataBind(); + Funs.FineUIPleaseSelect(drpWorkPost); + ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + BindGrid(); + } + else + { + if (GetRequestEventArgument() == "reloadGrid") + { + BindGrid(); + } + } + } + + /// + /// 绑定数据 + /// + private void BindGrid() + { + string strSql = @"SELECT TestPlan.TestPlanId,TestPlan.PlanName,TestPlan.PlanCode,TestPlan.PlanManId,PlanMan.UserName AS PlanManName,TestPlan.PlanDate,TestPlan.TestStartTime,TestPlan.TestEndTime,TestPlan.Duration,TestPlan.TotalScore,TestPlan.QuestionCount,TestPlan.TestPalce,TestPlan.UnitIds,TestPlan.UnitNames,TestPlan.DepartIds,TestPlan.DepartNames,TestPlan.WorkPostIds,TestPlan.WorkPostNames,TestPlan.QRCodeUrl,TestPlan.States" + + @" ,(CASE WHEN TestPlan.States='1' THEN '已发布未考试' WHEN TestPlan.States='2' THEN '考试中' WHEN TestPlan.States='3' THEN '考试结束' WHEN TestPlan.States='-1' THEN '已作废' ELSE '待提交' END) AS StatesName" + + @" FROM dbo.Training_TestPlan AS TestPlan" + + @" LEFT JOIN Sys_User AS PlanMan ON TestPlan.PlanManId= PlanMan.UserId " + + @" WHERE TestPlan.ProjectId is null "; + List listStr = new List(); + if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) + { + strSql += " AND (TestPlan.PlanName LIKE @name OR TestPlan.PlanCode LIKE @name OR PlanMan.UserName LIKE @name OR TestPlan.TestPalce LIKE @name OR TestPlan.WorkPostNames LIKE @name)"; + listStr.Add(new SqlParameter("@name", "%" + this.txtName.Text.Trim() + "%")); + } + if (!string.IsNullOrEmpty(this.ckStates.SelectedValue) && this.ckStates.SelectedValue != "-2") + { + if (this.ckStates.SelectedValue == "1") + { + strSql += " AND TestPlan.States !='0' AND TestPlan.States !='-1' AND TestPlan.States IS NOT NULL"; + } + else + { + strSql += " AND TestPlan.States = @States"; + listStr.Add(new SqlParameter("@States", this.ckStates.SelectedValue)); + } + } + if (!string.IsNullOrEmpty(this.drpWorkPost.SelectedValue)&& this.drpWorkPost.SelectedValue!="null") + { + strSql += " AND TestPlan.WorkPostIds like '%@workPost%' "; + listStr.Add(new SqlParameter("@workPost", "%" + this.drpWorkPost.SelectedValue + "%")); + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + } + #endregion + + #region 分页、关闭窗口 + /// + /// 分页 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + BindGrid(); + } + #endregion + + #region 编辑 + /// + /// Grid行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuView_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑数据方法 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + return; + } + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TestPlanView.aspx?TestPlanId={0}", Grid1.SelectedRowID, "编辑 - "))); + } + #endregion + + #region 删除 + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 删除方法 + /// + private void DeleteData() + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + string alterString = string.Empty; + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + string content = judgementDelete(rowID); + if (string.IsNullOrEmpty(content)) + { + var getV = TestPlanService.GetTestPlanById(rowID); + if (getV != null) + { + BLL.LogService.AddSys_Log(this.CurrUser, getV.PlanCode, rowID, BLL.Const.ProjectTestPlanMenuId, BLL.Const.BtnDelete); + BLL.TestPlanService.DeleteTestPlanById(rowID); + } + else + { + alterString += "第" + (rowIndex + 1) + "行" + content; + } + } + else + { + alterString += "第" + (rowIndex + 1) + "行" + content; + } + } + BindGrid(); + if (string.IsNullOrEmpty(alterString)) + { + ShowNotify("删除数据成功!", MessageBoxIcon.Success); + } + else + { + Alert.ShowInTop(alterString, MessageBoxIcon.Warning); + } + } + } + #endregion + + #region 输入框查询事件 + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + + #region 获取权限按钮 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectTestPlanMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnMenuDelete.Hidden = false; + } + } + } + #endregion + + #region 判断是否可删除 + /// + /// 判断是否可以删除 + /// + /// + private string judgementDelete(string id) + { + string content = string.Empty; + if (Funs.DB.Training_TestRecord.FirstOrDefault(x => x.TestPlanId == id) != null) + { + content = "该计划已存在【考试记录】,不能删除!"; + } + + return content; + } + #endregion + + /// + /// + /// + /// + private void ShowQurl(string strValue, string title) + { + string urlName = strValue.Replace("$", ""); + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/Controls/ShowQRImage.aspx?strValue={0}&urlName={1}&title={2}", strValue, urlName, System.Web.HttpUtility.UrlEncode(title), "查看 - "), "二维码查看", 340, 400)); + } + protected void drpWorkPost_SelectedIndexChanged(object sender, EventArgs e) + { + BindGrid(); + } + /// + /// 查看二维码 + /// + /// + /// + protected void btnQR_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + return; + } + + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/Controls/SeeQRImage.aspx?TestPlanId={0}&strCode={1}", Grid1.SelectedRowID, "testPlan$" + Grid1.SelectedRowID), "二维码查看", 400, 400)); + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestPlan.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestPlan.aspx.designer.cs new file mode 100644 index 00000000..1b6cbcb4 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestPlan.aspx.designer.cs @@ -0,0 +1,170 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TestPlan + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// ckStates 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.RadioButtonList ckStates; + + /// + /// drpWorkPost 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpWorkPost; + + /// + /// txtName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtName; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuView 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuView; + + /// + /// btnQR 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnQR; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestPlanView.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TestPlanView.aspx new file mode 100644 index 00000000..df9e6d9b --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestPlanView.aspx @@ -0,0 +1,85 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestPlanView.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TestPlanView" %> + + + + + + 考试计划 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestPlanView.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestPlanView.aspx.cs new file mode 100644 index 00000000..37efb63f --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestPlanView.aspx.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using BLL; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TestPlanView : PageBase + { + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + if (!IsPostBack) + { + string testPlanId = Request.Params["TestPlanId"]; + Model.Training_TestPlan plan = BLL.TestPlanService.GetTestPlanById(testPlanId); + if (plan != null) + { + this.txtPlanCode.Text = plan.PlanCode; + this.txtPlanName.Text = plan.PlanName; + switch (plan.States) + { + case "0": + this.txtStates.Text = "未发布"; + break; + case "1": + this.txtStates.Text = "待考试"; + break; + + case "2": + this.txtStates.Text = "考试中"; + break; + case "3": + this.txtStates.Text = "考试结束"; + break; + case "-1": + this.txtStates.Text = "已作废"; + break; + } + + this.txtTestStartTime.Text = string.Format("{0:yyyy-MM-dd hh:mm:ss}", plan.TestStartTime); + this.txtTestEndTime.Text = string.Format("{0:yyyy-MM-dd hh:mm:ss}", plan.TestEndTime); + this.txtDuration.Text = plan.Duration.ToString(); + this.txtTestPalce.Text = plan.TestPalce; + this.txtTotalScore.Text = plan.TotalScore.ToString(); + this.txtQuestionCount.Text = plan.QuestionCount.ToString(); + this.txtWorkPostNames.Text = plan.WorkPostNames; + + + var testPlanTraining = from x in db.Training_TestPlanTraining + join y in db.Training_Training on x.TrainingId equals y.TrainingId + where x.TestPlanId == testPlanId + orderby y.TrainingCode + select new { y.TrainingName, x.TestType1Count, x.TestType2Count, x.TestType3Count }; + foreach (var item in testPlanTraining) + { + this.txtTrainingName.Text += item.TrainingName + ";"; + if (item.TestType1Count.HasValue) + { + this.txtTestType1.Text += item.TrainingName + ":" + item.TestType1Count.Value + ";"; + } + if (item.TestType2Count.HasValue) + { + this.txtTestType2.Text += item.TrainingName + ":" + item.TestType2Count.Value + ";"; + } + if (item.TestType3Count.HasValue) + { + this.txtTestType3.Text += item.TrainingName + ":" + item.TestType3Count.Value + ";"; + } + } + } + } + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestPlanView.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestPlanView.aspx.designer.cs new file mode 100644 index 00000000..c0c94c13 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestPlanView.aspx.designer.cs @@ -0,0 +1,170 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TestPlanView + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtPlanCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPlanCode; + + /// + /// txtPlanName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPlanName; + + /// + /// txtStates 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtStates; + + /// + /// txtWorkPostNames 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtWorkPostNames; + + /// + /// txtTestStartTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTestStartTime; + + /// + /// txtTestEndTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTestEndTime; + + /// + /// txtTestPalce 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTestPalce; + + /// + /// txtDuration 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtDuration; + + /// + /// txtTotalScore 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTotalScore; + + /// + /// txtQuestionCount 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtQuestionCount; + + /// + /// txtTestType1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTestType1; + + /// + /// txtTestType2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTestType2; + + /// + /// txtTestType3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTestType3; + + /// + /// txtTrainingName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtTrainingName; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestRecord.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecord.aspx new file mode 100644 index 00000000..8b723602 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecord.aspx @@ -0,0 +1,149 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestRecord.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TestRecord" %> + + + + + + 考试记录 + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestRecord.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecord.aspx.cs new file mode 100644 index 00000000..4f057bce --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecord.aspx.cs @@ -0,0 +1,335 @@ +using Aspose.Words; +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.IO; +using System.Text; +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TestRecord : PageBase + { + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + GetButtonPower(); + + + + ///更新没有结束时间且超时的考试记录 + GetDataService.UpdateTestPlanStates(); + // 绑定表格 + BindGrid(); + } + else + { + if (GetRequestEventArgument() == "reloadGrid") + { + BindGrid(); + } + } + } + #endregion + + #region 绑定数据 + /// + /// 绑定数据 + /// + private void BindGrid() + { + string strSql = @"SELECT TestRecord.TestRecordId,TestRecord.TestPlanId, TestRecord.TestManId,TestRecord.TestStartTime,TestRecord.TestEndTime, TestRecord.TestScores, + (CASE WHEN TestPlan.PlanName IS NULL THEN Training.TrainingName ELSE TestPlan.PlanName END) AS PlanName, + ISNULL(TestPlan.Duration,90) AS Duration,ISNULL(TestPlan.TotalScore,100) AS TotalScore,TestPlan.TestPalce,ISNULL(TestPlan.QuestionCount,95) AS QuestionCount,TestRecord.TemporaryUser,Person.UserName AS TestManName + ,Unit.UnitName + FROM dbo.Training_TestRecord AS TestRecord + LEFT JOIN dbo.Training_TestPlan AS TestPlan ON TestPlan.TestPlanId=TestRecord.TestPlanId + LEFT JOIN dbo.Training_TestTraining AS Training ON Training.TrainingId = TestRecord.TestType + LEFT JOIN dbo.Sys_User AS Person ON Person.UserId = TestRecord.TestManId + LEFT JOIN dbo.Base_Unit AS Unit ON Person.UnitId=Unit.UnitId + WHERE (isFiled IS NULL OR isFiled = 0) and TestRecord.ProjectId is null "; + List listStr = new List(); + if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) + { + strSql += " AND (Person.UserName LIKE @name OR TestPlan.PlanName LIKE @name OR Training.TrainingName LIKE @name)"; + listStr.Add(new SqlParameter("@name", "%" + this.txtName.Text.Trim() + "%")); + } + if (!string.IsNullOrEmpty(this.txtMinScores.Text.Trim())) + { + strSql += " AND TestRecord.TestScores >= @MinScores"; + listStr.Add(new SqlParameter("@MinScores", Funs.GetNewDecimalOrZero(this.txtMinScores.Text.Trim()))); + } + if (!string.IsNullOrEmpty(this.txtMaxScores.Text.Trim())) + { + strSql += " AND TestRecord.TestScores <= @MaxScores"; + listStr.Add(new SqlParameter("@MaxScores", Funs.GetNewDecimalOrZero(this.txtMaxScores.Text.Trim()))); + } + //if (this.IsTemp.Checked) + //{ + // strSql += " AND Users.IsTemp = 1 "; + //} + //else + //{ + // strSql += " AND (Users.IsTemp = 0 OR Users.IsTemp IS NULL)"; + //} + if (this.ckIsNULL.Checked) + { + strSql += " AND (TestRecord.TestStartTime IS NULL OR TestRecord.TestEndTime IS NULL) "; + } + if (!string.IsNullOrEmpty(this.txtStartDate.Text)) + { + strSql += " AND TestRecord.TestStartTime >= @StartDate"; + listStr.Add(new SqlParameter("@StartDate", Funs.GetNewDateTime(this.txtStartDate.Text))); + } + if (!string.IsNullOrEmpty(this.txtEndDate.Text)) + { + strSql += " AND TestRecord.TestEndTime <= @EndDate "; + listStr.Add(new SqlParameter("@EndDate", Funs.GetNewDateTime(this.txtEndDate.Text))); + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + + Grid1.DataSource = table; + Grid1.DataBind(); + for (int i = 0; i < Grid1.Rows.Count; i++) + { + string testRecordId = Grid1.Rows[i].DataKeys[0].ToString(); + var testRecord = BLL.TestRecordService.GetTestRecordById(testRecordId); + if (testRecord != null) + { + if (testRecord.TestScores < SysConstSetService.getPassScore()) + { + Grid1.Rows[i].RowCssClass = "Red"; + } + } + } + } + #endregion + + #region 分页、关闭窗口 + /// + /// 分页 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + BindGrid(); + } + + #endregion + + #region 编辑 + /// + /// Grid行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuView_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑数据方法 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + return; + } + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TestRecordItem.aspx?TestRecordId={0}", Grid1.SelectedRowID, "编辑 - "))); + } + #endregion + + #region 归档 + /// + /// 右键编辑事件 + /// + /// + /// + //protected void btnMenuFile_Click(object sender, EventArgs e) + //{ + // if (Grid1.SelectedRowIndexArray.Length > 0) + // { + // string values = string.Empty; + // foreach (int rowIndex in Grid1.SelectedRowIndexArray) + // { + // string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + // values += rowID + "|"; + // } + + // if (!string.IsNullOrEmpty(values) && values.Length <= 1850) + // { + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/InformationProject/FileCabinetAChange.aspx?values={0}&menuId={1}", values, BLL.Const.ProjectTestRecordMenuId, "查看 - "), "归档", 600, 540)); + // } + // else + // { + // Alert.ShowInTop("请一次至少一条,最多50条记录归档!", MessageBoxIcon.Warning); + // } + + // BindGrid(); + // } + //} + #endregion + + #region 查询事件 + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + + protected void IsTemp_CheckedChanged(object sender, CheckedEventArgs e) + { + this.BindGrid(); + } + #endregion + + #region 删除 + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 删除方法 + /// + private void DeleteData() + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + var getV = BLL.TestRecordService.GetTestRecordById(rowID); + if (getV != null) + { + BLL.LogService.AddSys_Log(this.CurrUser, "考试记录", rowID, BLL.Const.ProjectTestRecordMenuId, BLL.Const.BtnDelete); + BLL.TestRecordService.DeleteTestRecordByTestRecordId(rowID); + } + } + BindGrid(); + ShowNotify("删除数据成功!"); + } + } + #endregion + + #region 导出按钮 + /// + /// 导出事件 + /// + /// + /// + protected void btnMenuOut_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("考试记录" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid1.PageSize = Grid1.RecordCount; + BindGrid(); + Response.Write(GetGridTableHtml(Grid1)); + Response.End(); + } + #endregion + + //protected void btnPrint_Click(object sender, EventArgs e) + //{ + // if (Grid1.SelectedRowIndexArray.Length == 0) + // { + // Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + // return; + // } + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TestRecordPrint.aspx?TestRecordId={0}", Grid1.SelectedRowID, "编辑 - "), "考试试卷", 900, 650)); + //} + + protected void btnPrint_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + + PrinterDocService.PrinterDocMethod(Const.ProjectTestRecordMenuId, Grid1.SelectedRowID, "试卷"); + } + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HSSETestRecordMenuId); + if (buttonList.Count > 0) + { + + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnMenuDelete.Hidden = false; + } + + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestRecord.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecord.aspx.designer.cs new file mode 100644 index 00000000..ce3ff92c --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecord.aspx.designer.cs @@ -0,0 +1,224 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TestRecord + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// txtName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtName; + + /// + /// txtMinScores 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtMinScores; + + /// + /// txtMaxScores 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtMaxScores; + + /// + /// IsTemp 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBox IsTemp; + + /// + /// txtStartDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtStartDate; + + /// + /// txtEndDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtEndDate; + + /// + /// ckIsNULL 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBox ckIsNULL; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// labNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label labNumber; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuView 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuView; + + /// + /// btnPrinter 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnPrinter; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordItem.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordItem.aspx new file mode 100644 index 00000000..5582e7dd --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordItem.aspx @@ -0,0 +1,129 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestRecordItem.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TestRecordItem" %> + + + + + + 考试记录 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordItem.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordItem.aspx.cs new file mode 100644 index 00000000..dd1fa4dc --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordItem.aspx.cs @@ -0,0 +1,288 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TestRecordItem : PageBase + { + #region 定义项 + /// + /// 主键 + /// + public string TestRecordId + { + get + { + return (string)ViewState["TestRecordId"]; + } + set + { + ViewState["TestRecordId"] = value; + } + } + /// + /// 考试类型 + /// + public string Type + { + get + { + return (string)ViewState["Type"]; + } + set + { + ViewState["Type"] = value; + } + } + #endregion + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + this.TestRecordId = Request.Params["TestRecordId"]; + this.Type = Request.Params["type"]; + // 绑定表格 + BindGrid(); + if (this.CurrUser.UserId == BLL.Const.sysglyId) + { + this.btnMenuDelete.Hidden = false; + } + } + else + { + if (GetRequestEventArgument() == "reloadGrid") + { + BindGrid(); + } + } + } + + /// + /// 绑定数据 + /// + private void BindGrid() + { + string strSql = string.Empty; + if(this.Type== "1") + { + strSql = @"SELECT TestRecordItemId,TestRecordId,Abstracts,AttachUrl,AItem,BItem,CItem,DItem,EItem,Replace(Replace(Replace(Replace(Replace(AnswerItems,'1','A'),'2', 'B'),'3', 'C'),'4', 'D'),'5', 'E') AS AnswerItems + ,Score,SubjectScore,Replace(Replace(Replace(Replace(Replace(SelectedItem,'1','A'),'2', 'B'),'3', 'C'),'4', 'D'),'5', 'E') AS SelectedItem" + + @",TestType,TrainingItemCode,(CASE WHEN TestType = '1' THEN '单选题' WHEN TestType = '2' THEN '多选题' ELSE '判断题' END) AS TestTypeName" + + @" FROM Test_TestRecordItem " + + @" WHERE TestRecordId= '" + this.TestRecordId + "'"; + } + else + { + strSql = @"SELECT TestRecordItemId,TestRecordId,TrainingItemName,Abstracts,AttachUrl,AItem,BItem,CItem,DItem,EItem,Replace(Replace(Replace(Replace(Replace(AnswerItems,'1','A'),'2', 'B'),'3', 'C'),'4', 'D'),'5', 'E') AS AnswerItems + ,Score,SubjectScore,Replace(Replace(Replace(Replace(Replace(SelectedItem,'1','A'),'2', 'B'),'3', 'C'),'4', 'D'),'5', 'E') AS SelectedItem" + + @",TestType,TrainingItemCode,(CASE WHEN TestType = '1' THEN '单选题' WHEN TestType = '2' THEN '多选题' ELSE '判断题' END) AS TestTypeName" + + @" FROM Training_TestRecordItem " + + @" WHERE TestRecordId= '" + this.TestRecordId + "'"; + } + + List listStr = new List(); + if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) + { + strSql += " AND (Abstracts LIKE @Name OR SubjectScore LIKE @Name)"; + listStr.Add(new SqlParameter("@Name", "%" + this.txtName.Text.Trim() + "%")); + } + + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + for (int i = 0; i < Grid1.Rows.Count; i++) + { + if (this.Type == "1") + { + var item = Funs.DB.Test_TestRecordItem.FirstOrDefault(e => e.TestRecordItemId == Grid1.Rows[i].DataKeys[0].ToString()); + if (item != null && item.Score != item.SubjectScore) + { + Grid1.Rows[i].RowCssClass = "Red"; + } + } + else + { + var item = TestRecordItemService.GetTestRecordItemTestRecordItemId(Grid1.Rows[i].DataKeys[0].ToString()); + if (item != null && item.Score != item.SubjectScore) + { + Grid1.Rows[i].RowCssClass = "Red"; + } + } + } + } + #endregion + + #region 分页、关闭窗口 + /// + /// 分页 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + BindGrid(); + } + #endregion + + #region 编辑 + /// + /// Grid行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuView_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑数据方法 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + return; + } + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TestRecordView.aspx?TestRecordItemId={0}&type={1}", Grid1.SelectedRowID, this.Type, "编辑 - "))); + } + #endregion + + #region 输入框查询事件 + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + + #region 删除 + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 删除方法 + /// + private void DeleteData() + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + var getV = BLL.TestRecordItemService.GetTestRecordItemTestRecordItemId(rowID); + if (getV != null) + { + BLL.LogService.AddSys_Log(this.CurrUser, getV.TrainingItemCode, rowID, BLL.Const.ProjectTestRecordMenuId, BLL.Const.BtnDelete); + BLL.TestRecordItemService.DeleteTestRecordItemmByTestRecordItemId(rowID); + } + } + BindGrid(); + ShowNotify("删除数据成功!"); + } + } + #endregion + + #region 导出按钮 + /// + /// 导出事件 + /// + /// + /// + protected void btnMenuOut_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("考试记录" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid1.PageSize = Grid1.RecordCount; + BindGrid(); + Response.Write(GetGridTableHtml(Grid1)); + Response.End(); + } + #endregion + + #region 附件 + /// + /// 上传附件 + /// + /// + /// + protected void btnAttachUrl_Click(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(this.TestRecordId)) + { + string menuId = Const.ProjectTestRecordMenuId; + if (this.Type == "1") + { + menuId = Const.ServerTestRecordMenuId; + } + + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&menuId={1}&type=-1", this.TestRecordId, menuId))); + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordItem.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordItem.aspx.designer.cs new file mode 100644 index 00000000..c7bd5caf --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordItem.aspx.designer.cs @@ -0,0 +1,179 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TestRecordItem + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// txtName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtName; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAttachUrl; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// labNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label labNumber; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuView 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuView; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordPrint.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordPrint.aspx new file mode 100644 index 00000000..418a693a --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordPrint.aspx @@ -0,0 +1,254 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestRecordPrint.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TestRecordPrint" %> + + + + + + + + + + + +
+ + + + + + + +
+
+ + + + +
+ 页面设置 + 打印设置 + 打印预览 + 打印 +
+
+
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ +
+ +
+ +
+
+ + + + + <%=Namea%> + + + + <%----%> + + + + + + + + + + + + + + + + + <%-- + + + + --%> + + + + + + + +
+ + + + + <%=Nameb%> + + + + <%----%> + + + + + + + + + + + + + + + + + <%-- + + + + --%> + + + + + + + +
+ + + + + <%=Namec%> + + + + <%----%> + + + + + + <%-- + + + + --%> + + + + + + + +
+ + + + + + +
+ + + + + +
+
+ +
+ + +
+ + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordPrint.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordPrint.aspx.cs new file mode 100644 index 00000000..2f0e1bd9 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordPrint.aspx.cs @@ -0,0 +1,262 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TestRecordPrint : PageBase + { + #region 定义项 + /// + /// 主键 + /// + public string TestRecordId + { + get + { + return (string)ViewState["TestRecordId"]; + } + set + { + ViewState["TestRecordId"] = value; + } + } + /// + /// 类型 + /// + public string Type + { + get + { + return (string)ViewState["Type"]; + } + set + { + ViewState["Type"] = value; + } + } + + #endregion + + protected void Page_Load(object sender, EventArgs e) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + if (!IsPostBack) + { + this.lbTitleName.Text = UnitService.GetUnitNameByUnitId(CommonService.GetThisUnitId()) + ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId); + this.lbTestType.Text = "培训试题"; + this.TestRecordId = Request.Params["TestRecordId"]; + this.Type = Request.Params["Type"]; + string sql = string.Empty; + if (this.Type == "1") + { + var testRecord = ServerTestRecordService.GetTestRecordById(this.TestRecordId); + if (testRecord != null) + { + this.lbTestType.Text = "知识竞赛" + this.lbTestType.Text; + string personInfo = "单位:" + UnitService.GetUnitNameByUnitId(testRecord.UnitId) + " "; + if (testRecord.ManType == "3") + { + personInfo += "项目:" + ProjectService.GetProjectNameByProjectId(testRecord.ProjectId) + " "; + } + else if (testRecord.UnitId == CommonService.GetThisUnitId()) + { + personInfo += "部门:" + DepartService.getDepartNameById(testRecord.DepartId) + " "; + } + else + { + personInfo += "部门:" + DepartService.getDepartNameById(testRecord.DepartId) + " "; + personInfo += "项目:" + ProjectService.GetProjectNameByProjectId(testRecord.ProjectId) + " "; + } + personInfo += "姓名:" + testRecord.TestManName + " " + + "身份证号码:" + testRecord.IdentityCard + " "; + if (testRecord.TestScores.HasValue) + { + personInfo += "成绩:" + testRecord.TestScores.ToString(); + } + + this.lbTestPerson.Text = personInfo; + var attachFile = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.TestRecordId); + if (attachFile != null && !string.IsNullOrEmpty(attachFile.AttachUrl)) + { + List listUrl = Funs.GetStrListByStr(attachFile.AttachUrl, ','); + int count = listUrl.Count(); + if (count > 0) + { + this.timg1.Src = "../../" + listUrl[0]; + this.timg2.Src = "../../" + listUrl[0]; + if (count >= 2) + { + int cout2 = count / 2; + this.timg2.Src = "../../" + listUrl[cout2]; + } + this.timg3.Src = "../../" + listUrl[count - 1]; + } + } + var getTestPlan = db.Test_TestPlan.FirstOrDefault(x => x.TestPlanId == testRecord.TestPlanId); + if (getTestPlan != null) + { + int getA = 0, getB = 0, getC = 0; + var getTraining = from x in db.Test_TestPlanTraining + where x.TestPlanId == testRecord.TestPlanId && x.UserType == testRecord.ManType + select x; + if (getTraining.Count() > 0) + { + getA = getTraining.Sum(x => x.TestType1Count) ?? 0; + getB = getTraining.Sum(x => x.TestType2Count) ?? 0; + getC = getTraining.Sum(x => x.TestType3Count) ?? 0; + } + + Namea += "(每题" + getTestPlan.SValue.ToString() + "分,共" + getTestPlan.SValue * getA + "分)"; + Nameb += "(每题" + getTestPlan.MValue.ToString() + "分,共" + getTestPlan.MValue * getB + "分)"; + Namec += "(每题" + getTestPlan.JValue.ToString() + "分,共" + getTestPlan.JValue * getC + "分)"; + } + } + sql = @"SELECT TestRecordItemId,TestRecordId,replace(replace(replace(replace(Abstracts,' ',''),'(','('),')',')'),'()',('('+ISNULL(Replace(Replace(Replace(Replace(Replace(SelectedItem,'1','A'),'2', 'B'),'3', 'C'),'4', 'D'),'5', 'E'),'')+')')) AS Abstracts,AttachUrl + ,('A. '+AItem) AS AItem,('B. '+BItem) AS BItem,(CASE WHEN CItem IS NULL OR CItem='' THEN '' ELSE ('C. '+CItem) END) AS CItem + ,(CASE WHEN DItem IS NULL OR DItem='' THEN NULL ELSE 'D. '+DItem END) AS DItem,(CASE WHEN EItem IS NULL OR EItem='' THEN NULL ELSE 'E. '+EItem END) AS EItem + ,('('+ISNULL(Replace(Replace(Replace(Replace(Replace(SelectedItem,'1','A'),'2', 'B'),'3', 'C'),'4', 'D'),'5', 'E'),'')+')') AS SelectedItem + ,TestType,TrainingItemCode + FROM Test_TestRecordItem WHERE TestRecordId= '" + this.TestRecordId + "'"; + } + else + { + var testRecord = TestRecordService.GetTestRecordById(this.TestRecordId); + if (testRecord != null) + { + var getTrainTypeName = (from x in db.Training_TestRecord + join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId + join z in db.Training_Plan on y.PlanId equals z.PlanId + join t in db.Base_TrainType on z.TrainTypeId equals t.TrainTypeId + where x.TestRecordId == this.TestRecordId + select t.TrainTypeName).FirstOrDefault(); + if (getTrainTypeName != null) + { + this.lbTestType.Text = getTrainTypeName + this.lbTestType.Text; + } + string personInfo = string.Empty; + var testMan = PersonService.GetPersonByUserId(testRecord.TestManId, testRecord.ProjectId); + if (testMan != null) + { + personInfo = "单位:" + UnitService.GetUnitNameByUnitId(testMan.UnitId) + " " + + "姓名:" + testMan.PersonName + " " + + "身份证号码:" + testMan.IdentityCard + " " + + "岗位:" + WorkPostService.getWorkPostNamesWorkPostIds(testMan.WorkPostId) + " "; + } + //this.Namea += "时间:" + string.Format("{0:yyyy-MM-dd HH:mm}", testRecord.TestStartTime) + " 至 "+ string.Format("{0:yyyy-MM-dd HH:mm}", testRecord.TestEndTime)+" "; + if (testRecord.TestScores.HasValue) + { + personInfo += "成绩:" + testRecord.TestScores.ToString(); + } + + this.lbTestPerson.Text = personInfo; + var attachFile = db.AttachFile.FirstOrDefault(x => x.ToKeyId == this.TestRecordId); + if (attachFile != null && !string.IsNullOrEmpty(attachFile.AttachUrl)) + { + List listUrl = Funs.GetStrListByStr(attachFile.AttachUrl, ','); + int count = listUrl.Count(); + if (count > 0) + { + this.timg1.Src = "../../" + listUrl[0]; + this.timg2.Src = "../../" + listUrl[0]; + if (count >= 2) + { + int cout2 = count / 2; + this.timg2.Src = "../../" + listUrl[cout2]; + } + this.timg3.Src = "../../" + listUrl[count - 1]; + } + } + + var getTestPlan = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == testRecord.TestPlanId); + if (getTestPlan != null) + { + int getA = 0, getB = 0, getC = 0; + var getTraining = from x in db.Training_TestPlanTraining + where x.TestPlanId == getTestPlan.TestPlanId + select x; + if (getTraining.Count() > 0) + { + getA = getTraining.Sum(x => x.TestType1Count) ?? 0; + getB = getTraining.Sum(x => x.TestType2Count) ?? 0; + getC = getTraining.Sum(x => x.TestType3Count) ?? 0; + } + + Namea += "(每题" + getTestPlan.SValue.ToString() + "分,共" + getTestPlan.SValue * getA + "分)"; + Nameb += "(每题" + getTestPlan.MValue.ToString() + "分,共" + getTestPlan.MValue * getB + "分)"; + Namec += "(每题" + getTestPlan.JValue.ToString() + "分,共" + getTestPlan.JValue * getC + "分)"; + } + } + sql = @"SELECT TestRecordItemId,TestRecordId,TrainingItemName,replace(replace(replace(replace(Abstracts,' ',''),'(','('),')',')'),'()',('('+ISNULL(Replace(Replace(Replace(Replace(Replace(SelectedItem,'1','A'),'2', 'B'),'3', 'C'),'4', 'D'),'5', 'E'),'')+')')) AS Abstracts,AttachUrl + ,('A. '+AItem) AS AItem,('B. '+BItem) AS BItem,(CASE WHEN CItem IS NULL OR CItem='' THEN '' ELSE ('C. '+CItem) END) AS CItem + ,(CASE WHEN DItem IS NULL OR DItem='' THEN NULL ELSE 'D. '+DItem END) AS DItem,(CASE WHEN EItem IS NULL OR EItem='' THEN NULL ELSE 'E. '+EItem END) AS EItem + ,('('+ISNULL(Replace(Replace(Replace(Replace(Replace(SelectedItem,'1','A'),'2', 'B'),'3', 'C'),'4', 'D'),'5', 'E'),'')+')') AS SelectedItem + ,TestType,TrainingItemCode + FROM Training_TestRecordItem WHERE TestRecordId= '" + this.TestRecordId + "'"; + } + this.BindGrid(sql); + this.BindGrid2(sql); + this.BindGrid3(sql); + } + } + } + + protected string Namea = "一、单项选择题 "; + protected string Nameb = "二、多项选择题 "; + protected string Namec = "三、判断题 "; + + /// + /// 绑定数据 + /// + private void BindGrid(string sql) + { + gvTest.DataSource = SQLHelper.GetDataTableRunText(sql + " AND TestType= '1' ORDER BY TrainingItemCode", null); + gvTest.DataBind(); + } + /// + /// 绑定数据 + /// + private void BindGrid2(string sql) + { + gvTest2.DataSource = SQLHelper.GetDataTableRunText(sql + " AND TestType= '2' ORDER BY TrainingItemCode", null); ; + gvTest2.DataBind(); + } + + /// + /// 绑定数据 + /// + private void BindGrid3(string sql) + { + gvTest3.DataSource = SQLHelper.GetDataTableRunText(sql + " AND TestType= '3' ORDER BY TrainingItemCode", null); ; ; + gvTest3.DataBind(); + } + /// + /// 在控件被绑定后激发 + /// + /// + /// + protected void gvTest_DataBound(object sender, EventArgs e) + { + } + /// + /// 在控件被绑定后激发 + /// + /// + /// + protected void gvTest2_DataBound(object sender, EventArgs e) + { + } + /// + /// 在控件被绑定后激发 + /// + /// + /// + protected void gvTest3_DataBound(object sender, EventArgs e) + { + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordPrint.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordPrint.aspx.designer.cs new file mode 100644 index 00000000..7434ad2a --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordPrint.aspx.designer.cs @@ -0,0 +1,188 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TestRecordPrint + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// Table1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlTable Table1; + + /// + /// tabbtn 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlTable tabbtn; + + /// + /// Img2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlImage Img2; + + /// + /// btnPrint 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlImage btnPrint; + + /// + /// Img1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlImage Img1; + + /// + /// Img3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlImage Img3; + + /// + /// Table5 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlTable Table5; + + /// + /// Table2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlTable Table2; + + /// + /// lbTitleName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbTitleName; + + /// + /// lbTestType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbTestType; + + /// + /// lbTestPerson 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbTestPerson; + + /// + /// gvTest 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.GridView gvTest; + + /// + /// gvTest2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.GridView gvTest2; + + /// + /// gvTest3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.GridView gvTest3; + + /// + /// Table3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlTable Table3; + + /// + /// timg1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlImage timg1; + + /// + /// timg2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlImage timg2; + + /// + /// timg3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlImage timg3; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordView.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordView.aspx new file mode 100644 index 00000000..a30ad1fc --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordView.aspx @@ -0,0 +1,103 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestRecordView.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TestRecordView" %> + + + + + + 查看考试记录 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+
+ + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordView.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordView.aspx.cs new file mode 100644 index 00000000..869e73d1 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordView.aspx.cs @@ -0,0 +1,185 @@ +using BLL; +using System; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TestRecordView : PageBase + { + #region 定义项 + /// + /// 考试记录ID + /// + private string TestRecordItemId + { + get + { + return (string)ViewState["TestRecordItemId"]; + } + set + { + ViewState["TestRecordItemId"] = value; + } + } + #endregion + + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.TestRecordItemId = Request.Params["TestRecordItemId"]; + if (!string.IsNullOrEmpty(this.TestRecordItemId)) + { + if (Request.Params["type"] == "1") + { + var testRecordItem =Funs.DB.Test_TestRecordItem.FirstOrDefault (x=>x.TestRecordItemId == this.TestRecordItemId); + if (testRecordItem != null) + { + this.txtAbstracts.Text = testRecordItem.Abstracts; + if (!string.IsNullOrEmpty(testRecordItem.TestType)) + { + if (testRecordItem.TestType == "1") + { + this.txtTestType.Text = "单选题"; + this.txtEItem.Hidden = true; + } + else if (testRecordItem.TestType == "2") + { + this.txtTestType.Text = "多选题"; + } + else if (testRecordItem.TestType == "3") + { + this.txtTestType.Text = "判断题"; + this.txtCItem.Hidden = true; + this.txtDItem.Hidden = true; + this.txtEItem.Hidden = true; + } + } + this.txtAItem.Text = testRecordItem.AItem; + this.txtBItem.Text = testRecordItem.BItem; + this.txtCItem.Text = testRecordItem.CItem; + this.txtDItem.Text = testRecordItem.DItem; + this.txtEItem.Text = testRecordItem.EItem; + + if (!string.IsNullOrEmpty(testRecordItem.AnswerItems)) + { + this.txtAnswerItems.Text = testRecordItem.AnswerItems.Replace("1", "A").Replace("2", "B").Replace("3", "C").Replace("4", "D").Replace("5", "E"); + } + if (testRecordItem.Score.HasValue) + { + this.txtScore.Text = testRecordItem.Score.ToString(); + } + if (testRecordItem.SubjectScore.HasValue) + { + this.txtSubjectScore.Text = testRecordItem.SubjectScore.ToString(); + } + if (!string.IsNullOrEmpty(testRecordItem.SelectedItem)) + { + this.txtSelectedItem.Text = testRecordItem.SelectedItem.Replace("1", "A").Replace("2", "B").Replace("3", "C").Replace("4", "D").Replace("5", "E"); + } + if (!string.IsNullOrEmpty(testRecordItem.AttachUrl)) + { + this.divFile.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../../", testRecordItem.AttachUrl); + } + + var testRecord = BLL.ServerTestRecordService.GetTestRecordById(testRecordItem.TestRecordId); + if (testRecord != null) + { + if (!string.IsNullOrEmpty(testRecord.TestPlanId)) + { + var testPlan = BLL.ServerTestPlanService.GetTestPlanById(testRecord.TestPlanId); + if (testPlan != null) + { + this.txtPlanName.Text = testPlan.PlanName; + } + } + this.txtTestManName.Text = testRecord.TestManName; + } + } + } + else + { + var testRecordItem = BLL.TestRecordItemService.GetTestRecordItemTestRecordItemId(this.TestRecordItemId); + if (testRecordItem != null) + { + this.txtAbstracts.Text = testRecordItem.Abstracts; + if (!string.IsNullOrEmpty(testRecordItem.TestType)) + { + if (testRecordItem.TestType == "1") + { + this.txtTestType.Text = "单选题"; + this.txtEItem.Hidden = true; + } + else if (testRecordItem.TestType == "2") + { + this.txtTestType.Text = "多选题"; + } + else if (testRecordItem.TestType == "3") + { + this.txtTestType.Text = "判断题"; + this.txtCItem.Hidden = true; + this.txtDItem.Hidden = true; + this.txtEItem.Hidden = true; + } + } + this.txtAItem.Text = testRecordItem.AItem; + this.txtBItem.Text = testRecordItem.BItem; + this.txtCItem.Text = testRecordItem.CItem; + this.txtDItem.Text = testRecordItem.DItem; + this.txtEItem.Text = testRecordItem.EItem; + + if (!string.IsNullOrEmpty(testRecordItem.AnswerItems)) + { + this.txtAnswerItems.Text = testRecordItem.AnswerItems.Replace("1", "A").Replace("2", "B").Replace("3", "C").Replace("4", "D").Replace("5", "E"); + } + if (testRecordItem.Score.HasValue) + { + this.txtScore.Text = testRecordItem.Score.ToString(); + } + if (testRecordItem.SubjectScore.HasValue) + { + this.txtSubjectScore.Text = testRecordItem.SubjectScore.ToString(); + } + if (!string.IsNullOrEmpty(testRecordItem.SelectedItem)) + { + this.txtSelectedItem.Text = testRecordItem.SelectedItem.Replace("1", "A").Replace("2", "B").Replace("3", "C").Replace("4", "D").Replace("5", "E"); + } + if (!string.IsNullOrEmpty(testRecordItem.AttachUrl)) + { + this.divFile.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../../", testRecordItem.AttachUrl); + } + + var testRecord = BLL.TestRecordService.GetTestRecordById(testRecordItem.TestRecordId); + if (testRecord != null) + { + if (!string.IsNullOrEmpty(testRecord.TestPlanId)) + { + Model.Training_TestPlan testPlan = BLL.TestPlanService.GetTestPlanById(testRecord.TestPlanId); + if (testPlan != null) + { + this.txtPlanName.Text = testPlan.PlanName; + } + } + if (!string.IsNullOrEmpty(testRecord.TestManId)) + { + var user = BLL.PersonService.GetPersonByUserId(testRecord.TestManId, testRecord.ProjectId); + if (user != null) + { + this.txtTestManName.Text = user.PersonName; + } + } + } + } + } + } + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordView.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordView.aspx.designer.cs new file mode 100644 index 00000000..de037eaf --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestRecordView.aspx.designer.cs @@ -0,0 +1,188 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TestRecordView + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtPlanName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPlanName; + + /// + /// txtTestManName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTestManName; + + /// + /// txtAbstracts 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtAbstracts; + + /// + /// txtTestType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTestType; + + /// + /// txtAItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtAItem; + + /// + /// txtBItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtBItem; + + /// + /// txtCItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCItem; + + /// + /// txtDItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtDItem; + + /// + /// txtEItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtEItem; + + /// + /// txtAnswerItems 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtAnswerItems; + + /// + /// txtScore 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtScore; + + /// + /// txtSelectedItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSelectedItem; + + /// + /// txtSubjectScore 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSubjectScore; + + /// + /// trUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FormRow trUrl; + + /// + /// ContentPanel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ContentPanel ContentPanel1; + + /// + /// divFile 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divFile; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx new file mode 100644 index 00000000..9bedaa24 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx @@ -0,0 +1,84 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestStatistics.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TestStatistics" %> + + + + + + 考试统计 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx.cs new file mode 100644 index 00000000..d2dbaf19 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx.cs @@ -0,0 +1,114 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TestStatistics : PageBase + { + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + this.BindGrid(); + } + else + { + if (GetRequestEventArgument() == "reloadGrid") + { + BindGrid(); + } + } + } + + /// + /// 绑定数据 + /// + private void BindGrid() + { + string strSql = @"SELECT UserId PersonId,IdentityCard CardNo,UserName PersonName,person.UnitId,Unit.UnitCode,Unit.UnitName,person.DepartId,Depart.DepartCode,Depart.DepartName + ,WorkPostName,ISNULL(TestCount,0) AS TestCount,ISNULL(TestQualifyCount,0) AS TestQualifyCount + FROM Sys_User AS person + LEFT JOIN Base_Unit AS Unit ON person.UnitId=Unit.UnitId + LEFT JOIN Base_WorkPost AS WorkPost ON person.WorkPostId=WorkPost.WorkPostId + LEFT JOIN Base_Depart AS Depart ON person.DepartId=Depart.DepartId + LEFT JOIN (SELECT COUNT(TestRecordId) AS TestCount,TestManId FROM Training_TestRecord GROUP BY TestManId) AS TestCount + ON person.UserId=TestCount.TestManId + LEFT JOIN (SELECT COUNT(TestRecordId) AS TestQualifyCount,TestManId FROM Training_TestRecord WHERE TestScores>= 60 GROUP BY TestManId) AS TestQualifyCount + ON person.UserId=TestQualifyCount.TestManId + WHERE UserId <> '" + BLL.Const.sysglyId + "' "; + List listStr = new List(); + if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) + { + strSql += " AND (UserName LIKE @name OR IdentityCard LIKE @name OR Unit.UnitName LIKE @name OR Depart.DepartName LIKE @name OR WorkPostName LIKE @name)"; + listStr.Add(new SqlParameter("@name", "%" + this.txtName.Text.Trim() + "%")); + } + + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + + Grid1.DataSource = table; + Grid1.DataBind(); + } + #endregion + + #region 分页排序 + /// + /// 分页 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + BindGrid(); + } + #endregion + + #region 输入框查询事件 + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx.designer.cs new file mode 100644 index 00000000..e8996f6b --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestStatistics.aspx.designer.cs @@ -0,0 +1,107 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TestStatistics + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// txtName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtName; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainRecord.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainRecord.aspx new file mode 100644 index 00000000..e00127e6 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainRecord.aspx @@ -0,0 +1,90 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestTrainRecord.aspx.cs" Inherits="FineUIPro.Web.Person.Train.TestTrainRecord" %> + + + + + + 培训试题 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainRecord.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainRecord.aspx.cs new file mode 100644 index 00000000..c133df50 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainRecord.aspx.cs @@ -0,0 +1,155 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; + +namespace FineUIPro.Web.Person.Train +{ + public partial class TestTrainRecord : PageBase + { + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + this.BindGrid(); + } + else + { + if (GetRequestEventArgument() == "reloadGrid") + { + BindGrid(); + } + } + } + #endregion + + #region 绑定数据 + /// + /// 绑定数据 + /// + private void BindGrid() + { + string strSql = @"SELECT Task.TaskId,Task.TaskDate,person.PersonName,TrainingItem.TrainingId,TrainingItem.TrainingItemId,Training.TrainingCode,Training.TrainingName" + + @",TrainingItem.TrainingItemCode,TrainingItem.TrainingItemName " + + @" FROM Training_Task AS Task" + + @" LEFT JOIN Training_PlanItem AS PlanItem ON Task.PlanId =PlanItem.PlanId " + + @" LEFT JOIN SitePerson_Person AS person ON Task.UserId =person.PersonId " + + @" LEFT JOIN Training_TrainingItem AS TrainingItem ON PlanItem.TrainingEduItemId =TrainingItem.TrainingItemId" + + @" LEFT JOIN Training_Training AS Training ON TrainingItem.TrainingId=Training.TrainingId" + + @" WHERE Task.UserId=@UserId "; + List listStr = new List + { + new SqlParameter("@UserId", this.CurrUser.UserId) + }; + if (!string.IsNullOrEmpty(this.ckStates.SelectedValue) && this.ckStates.SelectedValue != "0") + { + if (this.ckStates.SelectedValue == "1") + { + strSql += " AND (Task.States ='0') "; + } + else + { + strSql += " AND Task.States ='1' "; + } + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + } + #endregion + + #region 查看 + /// + /// Grid行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑 + /// + /// + /// + protected void btnMenuView_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + return; + } + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TaskRecordView.aspx?TrainingEduItemId={0}", Grid1.SelectedRowID, "编辑 - "))); + } + #endregion + + /// + /// 状态 + /// + /// + /// + protected void ckStates_SelectedIndexChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + + #region 分页排序 + /// + /// 分页 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + Grid1.SortDirection = e.SortDirection; + Grid1.SortField = e.SortField; + BindGrid(); + } + + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainRecord.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainRecord.aspx.designer.cs new file mode 100644 index 00000000..225f4130 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainRecord.aspx.designer.cs @@ -0,0 +1,125 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.Train +{ + + + public partial class TestTrainRecord + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// ckStates 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.RadioButtonList ckStates; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuView 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuView; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTraining.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TestTraining.aspx new file mode 100644 index 00000000..3a87b765 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTraining.aspx @@ -0,0 +1,189 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestTraining.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TestTraining" %> + + + + + + + + + + +
+ + + + + + + + <%-- --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + <%-- + + + + + + + + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTraining.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestTraining.aspx.cs new file mode 100644 index 00000000..2fd6cc76 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTraining.aspx.cs @@ -0,0 +1,539 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TestTraining : PageBase + { + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.GetButtonPower(); + this.InitTreeMenu(); + } + } + + /// + /// 初始化树 + /// + private void InitTreeMenu() + { + tvTestTraining.Nodes.Clear(); + tvTestTraining.ShowBorder = false; + tvTestTraining.ShowHeader = false; + tvTestTraining.EnableIcons = true; + tvTestTraining.AutoScroll = true; + tvTestTraining.EnableSingleClickExpand = true; + TreeNode rootNode = new TreeNode + { + Text = "考试试题库", + NodeID = "0", + Expanded = true + }; + this.tvTestTraining.Nodes.Add(rootNode); + BoundTree(rootNode.Nodes, rootNode.NodeID); + } + + private void BoundTree(TreeNodeCollection nodes, string parentId) + { + var dt = GetNewTraining(parentId); + if (dt.Count() > 0) + { + TreeNode tn = null; + foreach (var dr in dt) + { + string name = dr.TrainingName; + if (!string.IsNullOrEmpty(dr.TrainingCode)) + { + name = "[" + dr.TrainingCode + "]" + dr.TrainingName; + } + tn = new TreeNode + { + + Text = name, + NodeID = dr.TrainingId, + EnableClickEvent = true, + ToolTip = dr.TrainingName + }; + nodes.Add(tn); + ///是否存在下级节点 + var sup = Funs.DB.Training_TestTraining.FirstOrDefault(x => x.SupTrainingId == tn.NodeID); + if (sup != null) + { + BoundTree(tn.Nodes, tn.NodeID); + } + } + } + } + + /// + /// 得到培训类型 + /// + /// + /// + private List GetNewTraining(string parentId) + { + return (from x in Funs.DB.Training_TestTraining + where x.SupTrainingId == parentId + orderby x.TrainingCode + select x).ToList(); + } + + //protected void btnNew_Click(object sender, EventArgs e) + //{ + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TrainingSave.aspx", "编辑 - "))); + //} + + + protected void btnMenuADD_Click(object sender, EventArgs e) + { + if (this.tvTestTraining.SelectedNode != null) + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TestTrainingSave.aspx?SupTrainingId={0}", this.tvTestTraining.SelectedNode.NodeID, "新增 - "))); + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + protected void btnTreeMenuEdit_Click(object sender, EventArgs e) + { + if (this.tvTestTraining.SelectedNode != null) + { + if (this.tvTestTraining.SelectedNode.NodeID != "0") //非根节点可以编辑 + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TestTrainingSave.aspx?TrainingId={0}", this.tvTestTraining.SelectedNode.NodeID, "编辑 - "))); + } + else + { + ShowNotify("根节点无法编辑!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + protected void btnTreeMenuDelete_Click(object sender, EventArgs e) + { + if (this.tvTestTraining.SelectedNode != null && this.tvTestTraining.SelectedNodeID != "0") + { + var edu = Funs.DB.Training_TestTraining.FirstOrDefault(x => x.SupTrainingId == this.tvTestTraining.SelectedNode.NodeID); + if (edu == null) + { + BLL.TestTrainingService.DeleteTestTrainingById(this.tvTestTraining.SelectedNode.NodeID); + InitTreeMenu(); + Grid1.DataSource = null; + Grid1.DataBind(); + } + else + { + ShowNotify("存在子目录,不能删除!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择删除项!", MessageBoxIcon.Warning); + } + } + + protected void tvTestTraining_NodeCommand(object sender, FineUIPro.TreeCommandEventArgs e) + { + BindGrid(); + } + + #region BindGrid + + private void BindGrid() + { + if (this.tvTestTraining.SelectedNode != null && !string.IsNullOrEmpty(this.tvTestTraining.SelectedNode.NodeID)) + { + string strSql = @"SELECT TrainingItemId,TrainingId,TrainingItemCode,TrainingItemName,Abstracts,AttachUrl,VersionNum,TestType " + + @" ,(CASE WHEN TestType = '1' THEN '单选题' WHEN TestType = '2' THEN '多选题' ELSE '判断题' END) AS TestTypeName " + + @" ,(CASE WHEN WorkPostNames IS NULL THEN '通用' ELSE WorkPostNames END) AS WorkPostNames,AItem,BItem,CItem,DItem,EItem,AnswerItems " + + @" FROM dbo.Training_TestTrainingItem" + + @" WHERE TrainingId=@TrainingId "; + List listStr = new List + { + new SqlParameter("@TrainingId", this.tvTestTraining.SelectedNode.NodeID) + }; + if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) + { + strSql += " AND (TrainingItemCode LIKE @Name OR TrainingItemName LIKE @Name OR Abstracts LIKE @Name OR WorkPostNames LIKE @Name)"; + listStr.Add(new SqlParameter("@Name", "%" + this.txtName.Text.Trim() + "%")); + } + if (this.drptype.SelectedValue != "0") + { + strSql += " AND TestType=@TestType"; + listStr.Add(new SqlParameter("@TestType", this.drptype.SelectedValue)); + } + if (this.ckIsItem.Checked) + { + strSql += " AND (AItem IS NULL OR BItem IS NULL OR AItem ='' OR BItem ='')"; + } + + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + } + } + #endregion + + #region Events + protected void Window1_Close(object sender, EventArgs e) + { + this.InitTreeMenu(); + } + + protected void Window2_Close(object sender, EventArgs e) + { + this.BindGrid(); + } + protected void Window3_Close(object sender, EventArgs e) + { + this.InitTreeMenu(); + this.BindGrid(); + } + + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 删除方法 + /// + private void DeleteData() + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + var getD = BLL.TestTrainingItemService.GetTestTrainingItemById(rowID); + if (getD != null) + { + BLL.LogService.AddSys_Log(this.CurrUser, getD.TrainingItemCode, getD.TrainingItemId, BLL.Const.TestTrainingMenuId, BLL.Const.BtnDelete); + BLL.TestTrainingItemService.DeleteTestTrainingItemById(rowID); + } + } + + BindGrid(); + ShowNotify("删除数据成功!"); + } + } + #endregion + + #region GV排序页面 + /// + /// + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + Grid1.SortDirection = e.SortDirection; + Grid1.SortField = e.SortField; + + BindGrid(); + } + #endregion + + /// + /// 编辑试题 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuEdit_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑数据方法 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + + string trainingItemId = Grid1.SelectedRowID; + + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("TestTrainingItemSave.aspx?TrainingItemId={0}", trainingItemId, "编辑 - "))); + } + + /// + /// 增加 + /// + /// + /// + protected void btnNewDetail_Click(object sender, EventArgs e) + { + if (this.tvTestTraining.SelectedNode != null) + { + string id = this.tvTestTraining.SelectedNodeID; + var testTrain = BLL.TestTrainingService.GetTestTrainingById(id); + if (testTrain != null && testTrain.IsEndLever == true) + { + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("TestTrainingItemSave.aspx?TrainingId={0}", this.tvTestTraining.SelectedNode.NodeID, "编辑 - "))); + } + else + { + ShowNotify("请选择末级树节点!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TestTrainingMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnAdd)) + { + this.btnMenuADD.Hidden = false; + this.btnImport.Hidden = false; + this.btnNewDetail.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnModify)) + { + this.btnTreeMenuEdit.Hidden = false; + this.btnMenuEdit.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnTreeMenuDelete.Hidden = false; + this.btnMenuDelete.Hidden = false; + } + } + + //if (this.CurrUser.UserId == BLL.Const.sysglyId) + //{ + // this.btnRefresh.Hidden = false; + // this.btnRefresh1.Hidden = false; + //} + } + #endregion + + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + + #region 导入 + /// + /// 导入按钮 + /// + /// + /// + protected void btnImport_Click(object sender, EventArgs e) + { + PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("TestTrainingItemIn.aspx", "导入 - "))); + } + #endregion + + #region 导出 + /// + /// 导出按钮 + /// + /// + /// + protected void btnMenuOut_Click(object sender, EventArgs e) + { + PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("TestTrainingOut.aspx", "导出 - "))); + } + /// + /// 导出按钮 + /// + /// + /// + protected void btnMenuOut1_Click(object sender, EventArgs e) + { + if (this.tvTestTraining.SelectedNode != null && this.tvTestTraining.SelectedNodeID != "0") + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("考试试题" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid1.PageSize = Grid1.RecordCount; + BindGrid(); + Response.Write(GetGridTableHtml(Grid1)); + Response.End(); + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + #endregion + + #region 刷新装置 + /// + /// 刷新 + /// + /// + /// + protected void Refresh_Click(object sender, EventArgs e) + { + var trainingItems = from x in Funs.DB.Training_TestTrainingItem select x; + if (trainingItems.Count() > 0) + { + foreach (var trainingItem in trainingItems) + { + if (trainingItem.TestType == "3" && string.IsNullOrEmpty(trainingItem.AItem)) + { + trainingItem.AItem = "对"; + trainingItem.BItem = "错"; + } + + if (!string.IsNullOrEmpty(trainingItem.WorkPostIds)) + { + string name = string.Empty; + var workPostList = Funs.GetStrListByStr(trainingItem.WorkPostIds, ','); + if (workPostList.Count() > 0) + { + foreach (var workPostId in workPostList) + { + var workPost = BLL.WorkPostService.GetWorkPostById(workPostId).WorkPostName; + if (!string.IsNullOrEmpty(workPost)) + { + name += workPost + ","; + } + } + } + + if (!string.IsNullOrEmpty(name)) + { + trainingItem.WorkPostNames = name.Substring(0, name.LastIndexOf(",")); + } + } + + BLL.TestTrainingItemService.UpdateTestTrainingItem(trainingItem); + } + } + + Alert.ShowInTop("操作完成!", MessageBoxIcon.Success); + } + + /// + /// 刷新 + /// + /// + /// + protected void Refresh1_Click(object sender, EventArgs e) + { + var trainingItems = from x in Funs.DB.Training_TestTrainingItem select x; + if (trainingItems.Count() > 0) + { + foreach (var trainingItem in trainingItems) + { + if (trainingItem.TestType == "3" && string.IsNullOrEmpty(trainingItem.AItem)) + { + trainingItem.AItem = "对"; + trainingItem.BItem = "错"; + } + + if (!string.IsNullOrEmpty(trainingItem.WorkPostNames)) + { + string getInstallationId = string.Empty; + var installList = Funs.GetStrListByStr(trainingItem.WorkPostNames, ','); + if (installList.Count() > 0) + { + foreach (var installItem in installList) + { + var install = Funs.DB.Base_WorkPost.FirstOrDefault(x => x.WorkPostName == installItem); + if (install != null && !string.IsNullOrEmpty(install.WorkPostId)) + { + getInstallationId += install.WorkPostId + ","; + } + } + } + + if (!string.IsNullOrEmpty(getInstallationId)) + { + trainingItem.WorkPostIds = getInstallationId.Substring(0, getInstallationId.LastIndexOf(",")); + } + } + + BLL.TestTrainingItemService.UpdateTestTrainingItem(trainingItem); + } + } + + Alert.ShowInTop("操作完成!", MessageBoxIcon.Success); + } + #endregion + + /// + /// 显示选项不全的题目 + /// + /// + /// + protected void ckIsItem_CheckedChanged(object sender, CheckedEventArgs e) + { + this.BindGrid(); + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTraining.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestTraining.aspx.designer.cs new file mode 100644 index 00000000..7403a5bf --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTraining.aspx.designer.cs @@ -0,0 +1,287 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TestTraining + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// panelLeftRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelLeftRegion; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// tvTestTraining 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tree tvTestTraining; + + /// + /// panelCenterRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelCenterRegion; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar3; + + /// + /// txtName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtName; + + /// + /// drptype 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drptype; + + /// + /// ckIsItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBox ckIsItem; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnNewDetail 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNewDetail; + + /// + /// btnImport 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnImport; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button Button1; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Window2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window2; + + /// + /// Window3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window3; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuEdit; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + + /// + /// Menu2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu2; + + /// + /// btnMenuADD 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuADD; + + /// + /// btnTreeMenuEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnTreeMenuEdit; + + /// + /// btnTreeMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnTreeMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemIn.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemIn.aspx new file mode 100644 index 00000000..dfaa5ebd --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemIn.aspx @@ -0,0 +1,112 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestTrainingItemIn.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TestTrainingItemIn" %> + + + + + + 导入考试试题 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemIn.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemIn.aspx.cs new file mode 100644 index 00000000..6f96af1e --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemIn.aspx.cs @@ -0,0 +1,473 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.OleDb; +using System.IO; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TestTrainingItemIn : PageBase + { + #region 定义变量 + /// + /// 上传预设的虚拟路径 + /// + private string initPath = Const.ExcelUrl; + + /// + /// 导入集合 + /// + public static List viewTrainingItems = new List(); + + /// + /// 错误集合 + /// + public static string errorInfos = string.Empty; + #endregion + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.hdFileName.Text = string.Empty; + this.hdCheckResult.Text = string.Empty; + if (viewTrainingItems != null) + { + viewTrainingItems.Clear(); + } + errorInfos = string.Empty; + } + } + #endregion + + #region 数据导入 + /// + /// 数据导入 + /// + /// + /// + protected void btnAudit_Click(object sender, EventArgs e) + { + try + { + if (this.fuAttachUrl.HasFile == false) + { + ShowNotify("请您选择Excel文件!", MessageBoxIcon.Warning); + return; + } + string IsXls = Path.GetExtension(this.fuAttachUrl.FileName).ToString().Trim().ToLower(); + if (IsXls != ".xls") + { + ShowNotify("只可以选择Excel文件!", MessageBoxIcon.Warning); + return; + } + if (viewTrainingItems != null) + { + viewTrainingItems.Clear(); + } + if (!string.IsNullOrEmpty(errorInfos)) + { + errorInfos = string.Empty; + } + string rootPath = Server.MapPath("~/"); + string initFullPath = rootPath + initPath; + if (!Directory.Exists(initFullPath)) + { + Directory.CreateDirectory(initFullPath); + } + + this.hdFileName.Text = BLL.Funs.GetNewFileName() + IsXls; + string filePath = initFullPath + this.hdFileName.Text; + this.fuAttachUrl.PostedFile.SaveAs(filePath); + ImportXlsToData(rootPath + initPath + this.hdFileName.Text); + } + catch (Exception ex) + { + ShowNotify("'" + ex.Message + "'", MessageBoxIcon.Warning); + } + } + + #region 读Excel提取数据 + /// + /// 从Excel提取数据--》Dataset + /// + /// Excel文件路径名 + private void ImportXlsToData(string fileName) + { + try + { + viewTrainingItems.Clear(); + string oleDBConnString = String.Empty; + oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;"; + oleDBConnString += "Data Source="; + oleDBConnString += fileName; + oleDBConnString += ";Extended Properties=Excel 8.0;"; + OleDbConnection oleDBConn = null; + OleDbDataAdapter oleAdMaster = null; + DataTable m_tableName = new DataTable(); + DataSet ds = new DataSet(); + + oleDBConn = new OleDbConnection(oleDBConnString); + oleDBConn.Open(); + m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); + + if (m_tableName != null && m_tableName.Rows.Count > 0) + { + + m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim(); + + } + string sqlMaster; + sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]"; + oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn); + oleAdMaster.Fill(ds, "m_tableName"); + oleAdMaster.Dispose(); + oleDBConn.Close(); + oleDBConn.Dispose(); + + AddDatasetToSQL(ds.Tables[0]); + } + catch (Exception ex) + { + throw ex; + } + } + #endregion + + #region 将Dataset的数据导入数据库 + /// + /// 将Dataset的数据导入数据库 + /// + /// 数据集 + /// 数据集行数 + /// + private bool AddDatasetToSQL(DataTable pds) + { + string result = string.Empty; + int ic, ir; + ic = pds.Columns.Count; + ir = pds.Rows.Count; + if (pds != null && ir > 0) + { + ///试题类型 + var trainings = from x in Funs.DB.Training_TestTraining select x; + ///岗位 + var workPosts = from x in Funs.DB.Base_WorkPost select x; + var departs = from x in Funs.DB.Base_Depart select x; + for (int i = 0; i < ir; i++) + { + Model.View_Training_TestTrainingItem newViewTrainingItem = new Model.View_Training_TestTrainingItem + { + TrainingCode = pds.Rows[i][0].ToString().Trim(), + TrainingItemCode = pds.Rows[i][2].ToString().Trim(), + Abstracts = pds.Rows[i][6].ToString().Trim(), + AItem = pds.Rows[i][7].ToString().Trim(), + BItem = pds.Rows[i][8].ToString().Trim(), + }; + + ////试题类型 + string col1 = pds.Rows[i][1].ToString().Trim(); + if (string.IsNullOrEmpty(col1)) + { + result += "第" + (i + 2).ToString() + "行," + "导入试题类型" + "," + "此项为必填项!" + "|"; + } + else + { + var standard = trainings.FirstOrDefault(x => x.TrainingName == col1); + if (standard != null) + { + newViewTrainingItem.TrainingId = standard.TrainingId; + newViewTrainingItem.TrainingCode = standard.TrainingCode; + newViewTrainingItem.TrainingName = standard.TrainingName; + } + else + { + Model.Training_TestTraining newTraining = new Model.Training_TestTraining(); + newViewTrainingItem.TrainingId = newTraining.TrainingId = SQLHelper.GetNewID(typeof(Model.Training_TestTraining)); + newViewTrainingItem.TrainingName = newTraining.TrainingName = col1; + newTraining.TrainingCode = newViewTrainingItem.TrainingCode; + BLL.TestTrainingService.AddTestTraining(newTraining); + } + } + ///试题题型 + string col3 = pds.Rows[i][3].ToString().Trim(); + if (string.IsNullOrEmpty(col3)) + { + result += "第" + (i + 2).ToString() + "行," + "导入试题题型" + "," + "此项为必填项!" + "|"; + } + else + { + + if (col3 == "单选题") + { + newViewTrainingItem.TestType = "1"; + //newViewTrainingItem.Score = SValue; + newViewTrainingItem.CItem = pds.Rows[i][9].ToString().Trim(); + newViewTrainingItem.DItem = pds.Rows[i][10].ToString().Trim(); + //if (string.IsNullOrEmpty(newViewTrainingItem.AItem) || string.IsNullOrEmpty(newViewTrainingItem.BItem) || string.IsNullOrEmpty(newViewTrainingItem.CItem) || string.IsNullOrEmpty(newViewTrainingItem.DItem)) + //{ + // result += "第" + (i + 2).ToString() + "行," + "单选题ABCD都不能为空!" + "|"; + //} + + } + else if (col3 == "多选题") + { + newViewTrainingItem.TestType = "2"; + //newViewTrainingItem.Score = MValue; + newViewTrainingItem.CItem = pds.Rows[i][9].ToString().Trim(); + newViewTrainingItem.DItem = pds.Rows[i][10].ToString().Trim(); + newViewTrainingItem.EItem = pds.Rows[i][11].ToString().Trim(); + //if (string.IsNullOrEmpty(newViewTrainingItem.AItem) || string.IsNullOrEmpty(newViewTrainingItem.BItem) || string.IsNullOrEmpty(newViewTrainingItem.CItem) || string.IsNullOrEmpty(newViewTrainingItem.DItem)) + //{ + // result += "第" + (i + 2).ToString() + "行," + "多选题ABCD都不能为空!" + "|"; + //} + } + else + { + newViewTrainingItem.TestType = "3"; + //newViewTrainingItem.Score = JValue; + //if (string.IsNullOrEmpty(newViewTrainingItem.AItem) || string.IsNullOrEmpty(newViewTrainingItem.BItem)) + //{ + // result += "第" + (i + 2).ToString() + "行," + "判断题AB不能为空!" + "|"; + //} + } + } + ////适合岗位 + string col4 = pds.Rows[i][4].ToString().Trim(); + if (!string.IsNullOrEmpty(col4)) + { + + List WorkPostSels = Funs.GetStrListByStr(col4, ','); + if (WorkPostSels.Count() > 0) + { + string ids = string.Empty; + foreach (var item in WorkPostSels) + { + var wp = workPosts.FirstOrDefault(x => x.WorkPostName == item); + if (wp != null) + { + ids += wp.WorkPostId + ","; + } + else + { + result += "第" + (i + 2).ToString() + "行," + "导入适合岗位" + item + "," + "此项基础表不存在!" + "|"; + } + } + if (!string.IsNullOrEmpty(ids)) + { + newViewTrainingItem.WorkPostNames = col4; + newViewTrainingItem.WorkPostIds = ids.Substring(0, ids.LastIndexOf(",")); + } + } + } ////适合部门 + string col5 = pds.Rows[i][5].ToString().Trim(); + if (!string.IsNullOrEmpty(col5)) + { + + List DepartSels = Funs.GetStrListByStr(col5, ','); + if (DepartSels.Count() > 0) + { + string ids = string.Empty; + foreach (var item in DepartSels) + { + var wp = departs.FirstOrDefault(x => x.DepartName == item); + if (wp != null) + { + ids += wp.DepartId + ","; + } + else + { + result += "第" + (i + 2).ToString() + "行," + "导入适合部门" + item + "," + "此项基础表不存在!" + "|"; + } + } + if (!string.IsNullOrEmpty(ids)) + { + newViewTrainingItem.DepartNames = col5; + newViewTrainingItem.DepartIds = ids.Substring(0, ids.LastIndexOf(",")); + } + } + } + + + ////正确答案 + string col12 = pds.Rows[i][12].ToString().Trim(); + if (string.IsNullOrEmpty(col12)) + { + result += "第" + (i + 2).ToString() + "行," + "导入正确答案项" + "," + "为必填项!" + "|"; + } + else + { + int icount = 0; + List selecItem = Funs.GetStrListByStr(col12, ','); + foreach (var item in selecItem) + { + if (item != "A" && item != "a" && item != "B" && item != "b" && item != "C" && item != "c" && item != "D" && item != "d" && item != "E" && item != "e") + { + icount++; + } + } + if (icount == 0) + { + newViewTrainingItem.AnswerItems = col12.Replace("a", "A").Replace("b", "B").Replace("c", "C").Replace("d", "D").Replace("e", "E"); + } + else + { + result += "第" + (i + 2).ToString() + "行," + "正确答案项只能输入ABCDE且用','隔开!" + "|"; + } + } + + ////试题内容 + if (string.IsNullOrEmpty(newViewTrainingItem.Abstracts)) + { + result += "第" + (i + 2).ToString() + "行," + "导入试题内容" + "," + "为必填项!" + "|"; + } + else + { + var addTrainingItem = Funs.DB.Training_TestTrainingItem.FirstOrDefault(x => x.Abstracts == newViewTrainingItem.Abstracts + && x.TrainingId == newViewTrainingItem.TrainingId); + if (addTrainingItem == null) + { + Model.Training_TestTrainingItem newTrainingItem = new Model.Training_TestTrainingItem + { + TrainingItemId = newViewTrainingItem.TrainingItemId = SQLHelper.GetNewID(typeof(Model.Training_TestTraining)), + TrainingId = newViewTrainingItem.TrainingId, + TrainingItemCode = newViewTrainingItem.TrainingItemCode, + TrainingItemName = newViewTrainingItem.TrainingItemName, + + AttachUrl = newViewTrainingItem.AttachUrl, + VersionNum = newViewTrainingItem.VersionNum, + TestType = newViewTrainingItem.TestType, + WorkPostIds = newViewTrainingItem.WorkPostIds, + WorkPostNames = newViewTrainingItem.WorkPostNames, + AItem = newViewTrainingItem.AItem, + BItem = newViewTrainingItem.BItem, + CItem = newViewTrainingItem.CItem, + DItem = newViewTrainingItem.DItem, + EItem = newViewTrainingItem.EItem, + // Score = newViewTrainingItem.Score, + AnswerItems = newViewTrainingItem.AnswerItems, + }; + if (newViewTrainingItem.Abstracts.Contains("(") || newViewTrainingItem.Abstracts.Contains(")") + || newViewTrainingItem.Abstracts.Contains("(") || newViewTrainingItem.Abstracts.Contains(")")) + { + newTrainingItem.Abstracts = newViewTrainingItem.Abstracts; + } + else + { + newTrainingItem.Abstracts = newViewTrainingItem.Abstracts + "( )"; + } + + BLL.TestTrainingItemService.AddTestTrainingItem(newTrainingItem); + ///加入培训试题库 + viewTrainingItems.Add(newViewTrainingItem); + } + else + { + result += "第" + (i + 2).ToString() + "行," + "导入试题重复" + "|"; + } + } + } + if (viewTrainingItems.Count > 0) + { + viewTrainingItems = viewTrainingItems.Distinct().ToList(); + this.Grid1.Hidden = false; + this.Grid1.DataSource = viewTrainingItems; + this.Grid1.DataBind(); + } + + if (!string.IsNullOrEmpty(result)) + { + viewTrainingItems.Clear(); + result = "数据导入完成,未成功数据:" + result.Substring(0, result.LastIndexOf("|")); + errorInfos = result; + Alert alert = new Alert + { + Message = result, + Target = Target.Self + }; + alert.Show(); + } + else + { + errorInfos = string.Empty; + ShowNotify("导入成功!", MessageBoxIcon.Success); + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + } + else + { + Alert.ShowInTop("导入数据为空!", MessageBoxIcon.Warning); + } + return true; + } + #endregion + #endregion + + #region 关闭弹出窗口 + /// + /// 关闭导入弹出窗口 + /// + /// + /// + protected void Window1_Close(object sender, WindowCloseEventArgs e) + { + if (Session["trainingItem"] != null) + { + viewTrainingItems = Session["trainingItem"] as List; + } + if (viewTrainingItems.Count > 0) + { + this.Grid1.Hidden = false; + this.Grid1.DataSource = viewTrainingItems; + this.Grid1.DataBind(); + } + } + + #endregion + + #region 下载模板 + /// + /// 下载模板按钮 + /// + /// + /// + protected void btnDownLoad_Click(object sender, EventArgs e) + { + PageContext.RegisterStartupScript(Confirm.GetShowReference("确定下载导入模板吗?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel"))); + } + + /// + /// 下载导入模板 + /// + /// + /// + protected void PageManager1_CustomEvent(object sender, CustomEventArgs e) + { + if (e.EventArgument == "Confirm_OK") + { + string rootPath = Server.MapPath("~/"); + string filePath = Const.TestTrainingTemplateUrl; + string uploadfilepath = rootPath + filePath; + string fileName = Path.GetFileName(filePath); + FileInfo info = new FileInfo(uploadfilepath); + long fileSize = info.Length; + Response.ClearContent(); + Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); + Response.ContentType = "excel/plain"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + Response.AddHeader("Content-Length", fileSize.ToString().Trim()); + Response.TransmitFile(uploadfilepath, 0, fileSize); + Response.End(); + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemIn.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemIn.aspx.designer.cs new file mode 100644 index 00000000..55615f88 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemIn.aspx.designer.cs @@ -0,0 +1,143 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TestTrainingItemIn + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnAudit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAudit; + + /// + /// btnDownLoad 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDownLoad; + + /// + /// fuAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FileUpload fuAttachUrl; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Label2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label2; + + /// + /// hdFileName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdFileName; + + /// + /// hdCheckResult 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdCheckResult; + + /// + /// lblBottom 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lblBottom; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemSave.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemSave.aspx new file mode 100644 index 00000000..8b271d4f --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemSave.aspx @@ -0,0 +1,162 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestTrainingItemSave.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TestTrainingItemSave" %> + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ + +
+
+
+ + + + + + + + + + + + + +
+ + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemSave.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemSave.aspx.cs new file mode 100644 index 00000000..c3cbecbd --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemSave.aspx.cs @@ -0,0 +1,406 @@ +using BLL; +using Model; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TestTrainingItemSave : PageBase + { + #region 定义变量 + /// + /// 主键 + /// + public string TrainingItemId + { + get + { + return (string)ViewState["TrainingItemId"]; + } + set + { + ViewState["TrainingItemId"] = value; + } + } + + /// + /// 主表主键 + /// + public string TrainingId + { + get + { + return (string)ViewState["TrainingId"]; + } + set + { + ViewState["TrainingId"] = value; + } + } + + /// + /// 附件 + /// + private string AttachUrl + { + get + { + return (string)ViewState["AttachUrl"]; + } + set + { + ViewState["AttachUrl"] = value; + } + } + /// + /// 单选题分值 + /// + private int SValue + { + get + { + return (int)ViewState["SValue"]; + } + set + { + ViewState["SValue"] = value; + } + } + /// + /// 多选题分值 + /// + private int MValue + { + get + { + return (int)ViewState["MValue"]; + } + set + { + ViewState["MValue"] = value; + } + } + + /// + /// 判断题分值 + /// + private int JValue + { + get + { + return (int)ViewState["JValue"]; + } + set + { + ViewState["JValue"] = value; + } + } + #endregion + + #region 加载页面 + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + SValue = 1; + MValue = 2; + JValue = 1; + var testRule = Funs.DB.Sys_TestRule.FirstOrDefault(); + if (testRule != null) + { + SValue = testRule.SValue ; + MValue = testRule.MValue; + JValue = testRule.JValue; + } + + this.GetButtonPower(); + LoadData(); + BindEnumrableToDropDownList(); + this.TrainingItemId = Request.QueryString["TrainingItemId"]; + this.TrainingId = Request.QueryString["TrainingId"]; + if (!String.IsNullOrEmpty(this.TrainingItemId)) + { + var q = BLL.TestTrainingItemService.GetTestTrainingItemById(this.TrainingItemId); + if (q != null) + { + txtTrainingItemCode.Text = q.TrainingItemCode; + if (!string.IsNullOrEmpty(q.TestType)) + { + this.rblTestType.SelectedValue = q.TestType; + if (q.TestType == "1") + { + this.lbScore.Text = SValue.ToString(); + this.trE.Hidden = true; + } + else if (q.TestType == "2") + { + this.lbScore.Text = MValue.ToString(); + } + else if (q.TestType == "3") + { + this.lbScore.Text = JValue.ToString(); + this.trC.Hidden = true; + this.trD.Hidden = true; + this.trE.Hidden = true; + } + + System.Web.UI.WebControls.ListItem[] myList2 = BLL.TestTrainingItemService.GetAnswerItemsList(this.rblTestType.SelectedValue); + RadioButtonList2.DataTextField = "Text"; + RadioButtonList2.DataValueField = "Value"; + RadioButtonList2.DataSource = myList2; + RadioButtonList2.DataBind(); + + if (!string.IsNullOrEmpty(q.AnswerItems)) + { + string[] ids2 = q.AnswerItems.Split(','); + DropDownBox2.Values = ids2; + } + } + txtAbstracts.Text = q.Abstracts; + if (!string.IsNullOrEmpty(q.WorkPostIds)) + { + string[] ids1 = q.WorkPostIds.Split(','); + DropDownBox1.Values = ids1; + } + if (!string.IsNullOrEmpty(q.DepartIds)) + { + string[] ids1 = q.DepartIds.Split(','); + DropDownBox3.Values = ids1; + } + this.txtAItem.Text = q.AItem; + this.txtBItem.Text = q.BItem; + this.txtCItem.Text = q.CItem; + this.txtDItem.Text = q.DItem; + this.txtEItem.Text = q.EItem; + + this.AttachUrl = q.AttachUrl; + if (!string.IsNullOrEmpty(this.AttachUrl)) + { + this.trImageUrl.Visible = true; + this.divFile.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../../", this.AttachUrl); + this.divBeImageUrl.InnerHtml = BLL.UploadAttachmentService.ShowImage("../../", this.AttachUrl); + } + } + } + else + { + this.lbScore.Text = SValue.ToString(); + this.trE.Hidden = true; + } + } + } + + /// + /// 删除附件 + /// + /// + /// + protected void btnDelete_Click(object sender, EventArgs e) + { + this.trImageUrl.Visible = false; + this.AttachUrl = string.Empty; + this.divFile.InnerHtml = string.Empty; + this.divBeImageUrl.InnerHtml = string.Empty; ; + } + + private void LoadData() + { + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + } + + private void BindEnumrableToDropDownList() + { + List myList = BLL.WorkPostService.GetWorkPostList(); + RadioButtonList1.DataTextField = "WorkPostName"; + RadioButtonList1.DataValueField = "WorkPostId"; + RadioButtonList1.DataSource = myList; + RadioButtonList1.DataBind(); + + System.Web.UI.WebControls.ListItem[] myList2 = BLL.TestTrainingItemService.GetAnswerItemsList(this.rblTestType.SelectedValue); + RadioButtonList2.DataTextField = "Text"; + RadioButtonList2.DataValueField = "Value"; + RadioButtonList2.DataSource = myList2; + RadioButtonList2.DataBind(); + + List myList3 = BLL.DepartService.GetDepartList(); + RadioButtonList3.DataTextField = "DepartName"; + RadioButtonList3.DataValueField = "DepartId"; + RadioButtonList3.DataSource = myList3; + RadioButtonList3.DataBind(); + } + #endregion + + #region 保存 + /// + /// 保存数据 + /// + private void SaveData(bool isClosed) + { + Model.Training_TestTrainingItem trainingItem = new Training_TestTrainingItem + { + TrainingItemCode = txtTrainingItemCode.Text.Trim(), + Abstracts = txtAbstracts.Text.Trim(), + TestType = this.rblTestType.SelectedValue, + AItem = txtAItem.Text.Trim(), + BItem = txtBItem.Text.Trim(), + CItem = txtCItem.Text.Trim(), + DItem = txtDItem.Text.Trim(), + EItem = txtEItem.Text.Trim(), + AttachUrl = this.AttachUrl, + + }; + if (!string.IsNullOrEmpty(DropDownBox1.Text)) + { + trainingItem.WorkPostIds = String.Join(",", DropDownBox1.Values); + trainingItem.WorkPostNames = String.Join(",", DropDownBox1.Texts); + } + if (!string.IsNullOrEmpty(DropDownBox3.Text)) + { + trainingItem.DepartIds = String.Join(",", DropDownBox3.Values); + trainingItem.DepartNames = String.Join(",", DropDownBox3.Texts); + } + + if (!string.IsNullOrEmpty(DropDownBox2.Text)) + { + trainingItem.AnswerItems = String.Join(",", DropDownBox2.Values); + } + else + { + trainingItem.AnswerItems = string.Empty; + } + if (String.IsNullOrEmpty(TrainingItemId)) + { + trainingItem.TrainingItemId = SQLHelper.GetNewID(typeof(Model.Training_TestTrainingItem)); + trainingItem.TrainingId = this.TrainingId; + this.TrainingItemId = trainingItem.TrainingItemId; + BLL.TestTrainingItemService.AddTestTrainingItem(trainingItem); + BLL.LogService.AddSys_Log(this.CurrUser, trainingItem.TrainingItemCode, trainingItem.TrainingItemId, BLL.Const.TestTrainingMenuId, BLL.Const.BtnAdd); + } + else + { + Model.Training_TestTrainingItem t = BLL.TestTrainingItemService.GetTestTrainingItemById(TrainingItemId); + trainingItem.TrainingItemId = TrainingItemId; + if (t != null) + { + trainingItem.TrainingId = t.TrainingId; + } + BLL.TestTrainingItemService.UpdateTestTrainingItem(trainingItem); + BLL.LogService.AddSys_Log(this.CurrUser, trainingItem.TrainingItemCode, trainingItem.TrainingItemId, BLL.Const.TestTrainingMenuId, BLL.Const.BtnModify); + } + if (isClosed) + { + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + } + + protected void btnSave_Click(object sender, EventArgs e) + { + SaveData(true); + } + #endregion + + #region 附件上传 + /// + /// 附件上传 + /// + /// + /// + protected void btnFile_Click(object sender, EventArgs e) + { + if (btnFile.HasFile) + { + this.AttachUrl = BLL.UploadFileService.UploadAttachment(BLL.Funs.RootPath, this.btnFile, this.AttachUrl, UploadFileService.TrainingFilePath); + if (!string.IsNullOrEmpty(this.AttachUrl)) + { + this.trImageUrl.Visible = true; + this.divFile.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../../", this.AttachUrl); + this.divBeImageUrl.InnerHtml = BLL.UploadAttachmentService.ShowImage("../../", this.AttachUrl); + } + } + } + #endregion + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TestTrainingMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnSave)) + { + this.btnSave.Hidden = false; + } + } + } + #endregion + + #region 验证教材名称是否存在 + /// + /// 验证教材名称是否存在 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + //var q = Funs.DB.Training_TrainingItem.FirstOrDefault(x => x.IsPass == true && x.TrainingId == this.TrainingId && x.TrainingItemName == this.txtTrainingItemName.Text.Trim() && (x.TrainingItemId != this.TrainingItemId || (this.TrainingItemId == null && x.TrainingItemId != null))); + //if (q != null) + //{ + // ShowNotify("输入的教材名称已存在!", MessageBoxIcon.Warning); + //} + } + #endregion + + /// + /// 题型变换事件 + /// + /// + /// + protected void rblTestType_SelectedIndexChanged(object sender, EventArgs e) + { + this.trC.Hidden = false; + this.trD.Hidden = false; + this.trE.Hidden = false; + + this.txtAItem.Text = string.Empty; + this.txtBItem.Text = string.Empty; + this.txtCItem.Text = string.Empty; + this.txtDItem.Text = string.Empty; + this.txtEItem.Text = string.Empty; + + string testType = this.rblTestType.SelectedValue; + System.Web.UI.WebControls.ListItem[] myList2 = BLL.TestTrainingItemService.GetAnswerItemsList(testType); + RadioButtonList2.DataTextField = "Text"; + RadioButtonList2.DataValueField = "Value"; + RadioButtonList2.DataSource = myList2; + RadioButtonList2.DataBind(); + + DropDownBox2.Text = string.Empty; + DropDownBox2.Values = null; + + if (testType == "1") + { + this.lbScore.Text = SValue.ToString(); + this.trE.Hidden = true; + } + else if (testType == "2") + { + this.lbScore.Text = MValue.ToString(); + } + else if (testType == "3") + { + this.lbScore.Text = JValue.ToString(); + this.trC.Hidden = true; + this.trD.Hidden = true; + this.trE.Hidden = true; + this.txtAItem.Text = "对"; + this.txtBItem.Text = "错"; + } + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemSave.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemSave.aspx.designer.cs new file mode 100644 index 00000000..c693d645 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingItemSave.aspx.designer.cs @@ -0,0 +1,368 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TestTrainingItemSave + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtTrainingItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainingItemCode; + + /// + /// rblTestType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.RadioButtonList rblTestType; + + /// + /// lbScore 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbScore; + + /// + /// DropDownBox1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownBox DropDownBox1; + + /// + /// SimpleForm2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.SimpleForm SimpleForm2; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label1; + + /// + /// RadioButtonList1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBoxList RadioButtonList1; + + /// + /// DropDownBox3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownBox DropDownBox3; + + /// + /// SimpleForm4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.SimpleForm SimpleForm4; + + /// + /// Label3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label3; + + /// + /// RadioButtonList3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBoxList RadioButtonList3; + + /// + /// txtAbstracts 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtAbstracts; + + /// + /// txtAItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtAItem; + + /// + /// txtBItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtBItem; + + /// + /// trC 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FormRow trC; + + /// + /// txtCItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCItem; + + /// + /// trD 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FormRow trD; + + /// + /// txtDItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtDItem; + + /// + /// trE 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FormRow trE; + + /// + /// txtEItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtEItem; + + /// + /// DropDownBox2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownBox DropDownBox2; + + /// + /// SimpleForm3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.SimpleForm SimpleForm3; + + /// + /// Label2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label2; + + /// + /// RadioButtonList2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBoxList RadioButtonList2; + + /// + /// btnFile 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FileUpload btnFile; + + /// + /// ContentPanel2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ContentPanel ContentPanel2; + + /// + /// divFile 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divFile; + + /// + /// trImageUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trImageUrl; + + /// + /// divBeImageUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divBeImageUrl; + + /// + /// btnDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDelete; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// lbTemp 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbTemp; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + + /// + /// hdCompileMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdCompileMan; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingOut.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingOut.aspx new file mode 100644 index 00000000..45d5f20b --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingOut.aspx @@ -0,0 +1,97 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestTrainingOut.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TestTrainingOut" %> + + + + + + 培训试题 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingOut.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingOut.aspx.cs new file mode 100644 index 00000000..07c4a05e --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingOut.aspx.cs @@ -0,0 +1,120 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TestTrainingOut : PageBase + { + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + this.BindGrid(); + } + } + + /// + /// 绑定数据 + /// + private void BindGrid() + { + string strSql = @"SELECT TrainingItemId,Training.TrainingCode,Training.TrainingName,TrainingItemCode,TrainingItemName,Abstracts,AttachUrl,VersionNum,TestType,WorkPostIds " + + @" ,(CASE WHEN TestType = '1' THEN '单选题' WHEN TestType = '2' THEN '多选题' ELSE '判断题' END) AS TestTypeName,WorkPostNames,AItem,BItem,CItem,DItem,EItem " + + @" ,Score,Replace(Replace(Replace(Replace(Replace(AnswerItems,'1','A'),'2', 'B'),'3', 'C'),'4', 'D'),'5', 'E') AS AnswerItems " + + @" FROM dbo.Training_TestTrainingItem AS Item" + + @" LEFT JOIN Training_TestTraining AS Training ON Item.TrainingId=Training.TrainingId" + + @" WHERE 1 = 1"; + List listStr = new List(); + + //if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) + //{ + // strSql += " AND (JobActivityName LIKE @Name OR JobActivityCode LIKE @Name OR JobActivitys.Remark LIKE @Name OR WorkAreas.WorkAreaName LIKE @Name OR Installation.InstallationName LIKE @Name)"; + // listStr.Add(new SqlParameter("@Name", "%" + this.txtName.Text.Trim() + "%")); + //} + + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + } + + #region 查询 + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + + #region 分页 + /// + /// 分页 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + BindGrid(); + } + + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + BindGrid(); + } + #endregion + + #region 导出按钮 + /// + /// 导出事件 + /// + /// + /// + protected void btnMenuOut_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("考试试题" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid1.PageSize = Grid1.RecordCount; + BindGrid(); + Response.Write(GetGridTableHtml(Grid1)); + Response.End(); + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingOut.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingOut.aspx.designer.cs new file mode 100644 index 00000000..e8b44cc0 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingOut.aspx.designer.cs @@ -0,0 +1,98 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TestTrainingOut + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingSave.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingSave.aspx new file mode 100644 index 00000000..4025be33 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingSave.aspx @@ -0,0 +1,53 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestTrainingSave.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TestTrainingSave" %> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingSave.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingSave.aspx.cs new file mode 100644 index 00000000..3b49485a --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingSave.aspx.cs @@ -0,0 +1,150 @@ +using BLL; +using Model; +using System; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TestTrainingSave : PageBase + { + #region 自定义项 + /// + /// 主键 + /// + public string TrainingId + { + get + { + return (string)ViewState["TrainingId"]; + } + set + { + ViewState["TrainingId"] = value; + } + } + + /// + /// 上级主键 + /// + public string SupTrainingId + { + get + { + return (string)ViewState["SupTrainingId"]; + } + set + { + ViewState["SupTrainingId"] = value; + } + } + #endregion + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.GetButtonPower(); + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + this.TrainingId = Request.QueryString["TrainingId"]; + this.SupTrainingId = Request.QueryString["SupTrainingId"]; + if (!String.IsNullOrEmpty(TrainingId)) + { + var q = BLL.TestTrainingService.GetTestTrainingById(TrainingId); + if (q != null) + { + this.SupTrainingId = q.SupTrainingId; + txtTrainingCode.Text = q.TrainingCode; + txtTrainingName.Text = q.TrainingName; + if (q.IsEndLever == true) + { + ckIsEndLever.Checked = true; + } + else + { + ckIsEndLever.Checked = false; + } + } + } + var supq = BLL.TestTrainingService.GetTestTrainingById(this.SupTrainingId); + if (supq != null) + { + this.txtSupTraining.Text = supq.TrainingName; + } + else + { + this.SupTrainingId = "0"; + this.txtSupTraining.Text = "考试试题库"; + } + } + } + + /// + /// + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + Model.Training_TestTraining training = new Training_TestTraining + { + TrainingCode = txtTrainingCode.Text.Trim(), + TrainingName = txtTrainingName.Text.Trim(), + SupTrainingId = this.SupTrainingId, + IsEndLever = this.ckIsEndLever.Checked, + }; + + if (String.IsNullOrEmpty(TrainingId)) + { + TrainingId = SQLHelper.GetNewID(typeof(Model.Training_TestTraining)); + training.TrainingId = TrainingId; + BLL.TestTrainingService.AddTestTraining(training); + } + else + { + training.TrainingId = TrainingId; + BLL.TestTrainingService.UpdateTestTraining(training); + } + // 2. 关闭本窗体,然后刷新父窗体 + // PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + // 2. 关闭本窗体,然后回发父窗体 + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + //PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(trainingId) + ActiveWindow.GetHideReference()); + + } + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TestTrainingMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnSave)) + { + this.btnSave.Hidden = false; + } + } + } + #endregion + + #region 验证考试试题库名称是否存在 + /// + /// 验证考试试题库名称是否存在 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + var standard = Funs.DB.Training_TestTraining.FirstOrDefault(x => x.TrainingName == this.txtTrainingName.Text.Trim() && (x.TrainingId != this.TrainingId || (this.TrainingId == null && x.TrainingId != null))); + if (standard != null) + { + ShowNotify("输入的名称已存在!", MessageBoxIcon.Warning); + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingSave.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingSave.aspx.designer.cs new file mode 100644 index 00000000..7ce6a3fc --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TestTrainingSave.aspx.designer.cs @@ -0,0 +1,107 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TestTrainingSave + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtSupTraining 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSupTraining; + + /// + /// txtTrainingCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainingCode; + + /// + /// txtTrainingName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtTrainingName; + + /// + /// ckIsEndLever 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBox ckIsEndLever; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainDB.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainDB.aspx new file mode 100644 index 00000000..e6fd139d --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainDB.aspx @@ -0,0 +1,151 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainDB.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TrainDB" %> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + <%----%> + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainDB.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainDB.aspx.cs new file mode 100644 index 00000000..24553c56 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainDB.aspx.cs @@ -0,0 +1,554 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.IO; +using System.Linq; +using System.Text; +using System.Web.UI; +using AspNet = System.Web.UI.WebControls; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TrainDB : PageBase + { + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.GetButtonPower(); + InitTreeMenu(); + } + } + + /// + /// 初始化树 + /// + private void InitTreeMenu() + { + trTraining.Nodes.Clear(); + trTraining.ShowBorder = false; + trTraining.ShowHeader = false; + trTraining.EnableIcons = true; + trTraining.AutoScroll = true; + trTraining.EnableSingleClickExpand = true; + TreeNode rootNode = new TreeNode + { + Text = "培训教材库", + NodeID = "0", + Expanded = true + }; + this.trTraining.Nodes.Add(rootNode); + BoundTree(rootNode.Nodes, "0"); + } + + private void BoundTree(TreeNodeCollection nodes, string menuId) + { + var dt = GetNewTraining(menuId); + if (dt.Count() > 0) + { + TreeNode tn = null; + foreach (var dr in dt) + { + tn = new TreeNode + { + Text = dr.TrainingName, + NodeID = dr.TrainingId, + EnableClickEvent = true, + ToolTip = dr.TrainingName + }; + //var dt2 = GetNewTraining(dr.TrainingId); + //if (dt2.Count == 0) + //{ + // tn.Icon = "TagBlue"; + //} + nodes.Add(tn); + BoundTree(tn.Nodes, dr.TrainingId); + } + } + } + + /// + /// 得到菜单方法 + /// + /// + /// + private List GetNewTraining(string parentId) + { + return (from x in Funs.DB.Training_Training where x.SupTrainingId == parentId + orderby x.TrainingCode select x).ToList(); + } + + protected void btnNew_Click(object sender, EventArgs e) + { + if (this.trTraining.SelectedNode != null) + { + Model.Training_Training training = BLL.TrainingService.GetTrainingByTrainingId(this.trTraining.SelectedNode.NodeID); + if ((training != null && training.IsEndLever == false) || this.trTraining.SelectedNode.NodeID == "0") //根节点或者非末级节点,可以增加 + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TrainingSave.aspx?SupTrainingId={0}", this.trTraining.SelectedNode.NodeID, "编辑 - "))); + } + else + { + ShowNotify("选择的项已是末级!",MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + protected void btnEdit_Click(object sender, EventArgs e) + { + if (this.trTraining.SelectedNode != null) + { + if (this.trTraining.SelectedNode.NodeID != "0") //非根节点可以编辑 + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TrainingSave.aspx?TrainingId={0}", this.trTraining.SelectedNode.NodeID, "编辑 - "))); + } + else + { + ShowNotify("根节点无法编辑!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + protected void btnDelete_Click(object sender, EventArgs e) + { + if (this.trTraining.SelectedNode != null) + { + var q = BLL.TrainingService.GetTrainingByTrainingId(this.trTraining.SelectedNode.NodeID); + + if (q != null && BLL.TrainingService.IsDeleteTraining(this.trTraining.SelectedNode.NodeID)) + { + BLL.TrainingService.DeleteTrainingByTrainingId(this.trTraining.SelectedNode.NodeID); + InitTreeMenu(); + } + else + { + ShowNotify("存在下级菜单或已增加资源数据或者为内置项,不允许删除!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择删除项!", MessageBoxIcon.Warning); + } + } + + protected void trTraining_NodeCommand(object sender, FineUIPro.TreeCommandEventArgs e) + { + BindGrid(); + } + + #region BindGrid + + private void BindGrid() + { + if (this.trTraining.SelectedNode !=null && !string.IsNullOrEmpty(this.trTraining.SelectedNode.NodeID)) + { + string strSql = @"SELECT TrainingItemId,TrainingId,TrainingItemCode,TrainingItemName,AttachUrl,VersionNum,ApproveState,ResourcesFrom " + + @" ,CompileMan,CompileDate,ResourcesFromType,AuditMan,AuditDate,IsPass,UnitId,UnitCode,UnitName,TrainingCode,TrainingName,AttachUrlName " + + @" FROM dbo.View_Training_TrainingItem" + + @" WHERE TrainingId=@TrainingId "; + + List listStr = new List + { + new SqlParameter("@TrainingId", this.trTraining.SelectedNode.NodeID), + }; + if (!string.IsNullOrEmpty(this.TrainingItemCode.Text.Trim())) + { + strSql += " AND TrainingItemCode LIKE @TrainingItemCode"; + listStr.Add(new SqlParameter("@TrainingItemCode", "%" + this.TrainingItemCode.Text.Trim() + "%")); + } + if (!string.IsNullOrEmpty(this.TrainingItemName.Text.Trim())) + { + strSql += " AND TrainingItemName LIKE @TrainingItemName"; + listStr.Add(new SqlParameter("@TrainingItemName", "%" + this.TrainingItemName.Text.Trim() + "%")); + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + + Grid1.DataSource = table; + Grid1.DataBind(); + } + } + #endregion + + #region Events + protected void Window1_Close(object sender, EventArgs e) + { + InitTreeMenu(); + } + + protected void Window2_Close(object sender, EventArgs e) + { + BindGrid(); + } + + // 删除数据 + protected void btnDeleteDetail_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 删除方法 + /// + private void DeleteData() + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + var getV = BLL.TrainingItemService.GetTrainingItemByTrainingItemId(rowID); + if(getV !=null) + { + BLL.LogService.AddSys_Log(this.CurrUser, getV.TrainingItemCode, getV.TrainingItemId, BLL.Const.TrainDBMenuId, BLL.Const.BtnDelete); + BLL.TrainingItemService.DeleteTrainingItemsByTrainingItemId(rowID); + } + + } + + BindGrid(); + ShowNotify("删除数据成功!"); + } + } + #endregion + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + BindGrid(); + } + + protected void btnEditDetail_Click(object sender, EventArgs e) + { + this.EditData(); + } + + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuEdit_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑数据方法 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + + string trainingItemId = Grid1.SelectedRowID; + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("TrainingItemSave.aspx?TrainingItemId={0}", trainingItemId, "编辑 - "))); + } + + protected void btnNewDetail_Click(object sender, EventArgs e) + { + if (this.trTraining.SelectedNode != null) + { + if (this.trTraining.SelectedNode.Nodes.Count == 0) + { + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("TrainingItemSave.aspx?TrainingId={0}", this.trTraining.SelectedNode.NodeID, "编辑 - "))); + } + else + { + ShowNotify("请选择末级节点!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + #region 导出 + /// + /// 关闭导出窗口 + /// + /// + /// + protected void Window5_Close(object sender, WindowCloseEventArgs e) + { + Response.ClearContent(); + Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + Response.Write(GetGridTableHtml(Grid1, e.CloseArgument.Split('#'))); + Response.End(); + } + + /// + /// 导出 + /// + /// + /// + /// + private string GetGridTableHtml(Grid grid, string[] columns) + { + StringBuilder sb = new StringBuilder(); + sb.Append(""); + List columnHeaderTexts = new List(columns); + List columnIndexs = new List(); + sb.Append(""); + sb.Append(""); + foreach (GridColumn column in grid.Columns) + { + if (columnHeaderTexts.Contains(column.HeaderText)) + { + sb.AppendFormat("", column.HeaderText); + columnIndexs.Add(column.ColumnIndex); + } + } + sb.Append(""); + foreach (GridRow row in grid.Rows) + { + sb.Append(""); + int columnIndex = 0; + foreach (object value in row.Values) + { + if (columnIndexs.Contains(columnIndex)) + { + string html = value.ToString(); + if (html.StartsWith(Grid.TEMPLATE_PLACEHOLDER_PREFIX)) + { + // 模板列 + string templateID = html.Substring(Grid.TEMPLATE_PLACEHOLDER_PREFIX.Length); + Control templateCtrl = row.FindControl(templateID); + html = GetRenderedHtmlSource(templateCtrl); + } + //else + //{ + // // 处理CheckBox + // if (html.Contains("f-grid-static-checkbox")) + // { + // if (!html.Contains("f-checked")) + // { + // html = "×"; + // } + // else + // { + // html = "√"; + // } + // } + // // 处理图片 + // if (html.Contains("{0}", html); + } + columnIndex++; + } + sb.Append(""); + } + sb.Append("
{0}
"); + return sb.ToString(); + } + + /// + /// 获取控件渲染后的HTML源代码 + /// + /// + /// + private string GetRenderedHtmlSource(Control ctrl) + { + if (ctrl != null) + { + using (StringWriter sw = new StringWriter()) + { + using (HtmlTextWriter htw = new HtmlTextWriter(sw)) + { + ctrl.RenderControl(htw); + return sw.ToString(); + } + } + } + return String.Empty; + } + #endregion + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TrainDBMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnAdd)) + { + this.btnNew.Hidden = false; + this.btnNewDetail.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnModify)) + { + this.btnEdit.Hidden = false; + this.btnMenuEdit.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnDelete.Hidden = false; + this.btnMenuDelete.Hidden = false; + } + } + } + #endregion + + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + + protected void Grid1_RowCommand(object sender, GridCommandEventArgs e) + { + if (e.CommandName == "Action1" && !string.IsNullOrEmpty(Grid1.SelectedRow.Values[5].ToString())) + { + string url = "~/common/ShowUpFile.aspx?fileUrl=" + Server.UrlEncode(Grid1.SelectedRow.Values[5].ToString()); + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format(url), "从集团服务下载大附件")); + } + else + { + Alert.ShowInTop("附件不存在或数据不同步!", MessageBoxIcon.Warning); + } + } + + /// + /// 导出 + /// + /// + /// + protected void btnOut_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("培训教材库" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid1.PageSize = Grid1.RecordCount; + BindGrid(); + Response.Write(GetGridTableHtml(Grid1, 3)); + Response.End(); + } + + #region 导出方法 + /// + /// 导出方法 + /// + /// + /// + public static string GetGridTableHtml(Grid grid, int count) + { + StringBuilder sb = new StringBuilder(); + sb.Append(""); + sb.Append(""); + sb.Append(""); + foreach (GridColumn column in grid.Columns) + { + if (column.ColumnIndex < count) + { + sb.AppendFormat("", column.HeaderText); + } + } + sb.Append(""); + foreach (GridRow row in grid.Rows) + { + sb.Append(""); + foreach (GridColumn column in grid.Columns) + { + if (column.ColumnIndex < count) + { + string html = row.Values[column.ColumnIndex].ToString(); + if (column.ColumnID == "tfNumber" && (row.FindControl("lbNumber") as AspNet.Label) != null) + { + html = (row.FindControl("lbNumber") as AspNet.Label).Text; + } + if (column.ColumnID == "tfTrainingItemCode" && (row.FindControl("lbTrainingItemCode") as AspNet.Label) != null) + { + html = (row.FindControl("lbTrainingItemCode") as AspNet.Label).Text; + } + if (column.ColumnID == "tfTrainingItemName" && (row.FindControl("lbTrainingItemName") as AspNet.Label) != null) + { + html = (row.FindControl("lbTrainingItemName") as AspNet.Label).Text; + } + if (column.ColumnID == "tfCompileMan" && (row.FindControl("lbCompileMan") as AspNet.Label) != null) + { + html = (row.FindControl("lbCompileMan") as AspNet.Label).Text; + } + if (column.ColumnID == "tfCompileDate" && (row.FindControl("lbCompileDate") as AspNet.Label) != null) + { + html = (row.FindControl("lbCompileDate") as AspNet.Label).Text; + } + sb.AppendFormat("", html); + } + } + + sb.Append(""); + } + + sb.Append("
{0}
{0}
"); + + return sb.ToString(); + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainDB.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainDB.aspx.designer.cs new file mode 100644 index 00000000..8d9e60bc --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainDB.aspx.designer.cs @@ -0,0 +1,287 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainDB + { + + /// + /// Head1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlHead Head1; + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// panelLeftRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelLeftRegion; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// btnEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnEdit; + + /// + /// btnDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDelete; + + /// + /// trTraining 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tree trTraining; + + /// + /// panelCenterRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelCenterRegion; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar3; + + /// + /// TrainingItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox TrainingItemCode; + + /// + /// TrainingItemName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox TrainingItemName; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnNewDetail 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNewDetail; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// lbNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbNumber; + + /// + /// lbTrainingItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbTrainingItemCode; + + /// + /// lbTrainingItemName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbTrainingItemName; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Window2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window2; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuEdit; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainFind.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainFind.aspx new file mode 100644 index 00000000..bb34862c --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainFind.aspx @@ -0,0 +1,124 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainFind.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TrainFind" %> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainFind.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainFind.aspx.cs new file mode 100644 index 00000000..9817f02d --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainFind.aspx.cs @@ -0,0 +1,288 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Text; +using AspNet = System.Web.UI.WebControls; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TrainFind : PageBase + { + #region 项目主键 + /// + /// 项目主键 + /// + public string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + #endregion + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.ProjectId = this.CurrUser.LoginProjectId; + if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId) + { + this.ProjectId = Request.Params["projectId"]; + } + //单位 + BLL.UnitService.InitUnitDropDownList(this.drpUnitId, this.ProjectId, true); + if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId, this.CurrUser.UnitId)) + { + this.drpUnitId.SelectedValue = this.CurrUser.UnitId; + this.drpUnitId.Enabled = false; + } + //培训类型 + BLL.TrainTypeService.InitTrainTypeDropDownList(this.drpTrainType, true); + //培训级别; + //BLL.TrainLevelService.InitTrainLevelDropDownList(this.drpTrainLevel, true); + ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + BindGrid(); + } + } + + /// + /// 加载数据 + /// + private void BindGrid() + { + string strSql = @"SELECT NEWID() AS ID, CardNo,PersonName,ProjectId,UnitId,UnitName,WorkPostName,TrainTitle ,TrainStartDate,TrainEndDate,TrainTypeId,TeachHour,TrainTypeName,CheckScore,CheckResult,TeachMan,UnitType,TrainLevelName" + + @" FROM dbo.View_EduTrain_TrainFind" + + @" WHERE 1=1"; + List listStr = new List(); + strSql += " AND ProjectId = @ProjectId"; + listStr.Add(new SqlParameter("@ProjectId", this.ProjectId)); + + if (!string.IsNullOrEmpty(this.txtPersonName.Text.Trim())) + { + strSql += " AND PersonName LIKE @PersonName"; + listStr.Add(new SqlParameter("@PersonName", "%" + this.txtPersonName.Text.Trim() + "%")); + } + if (this.drpUnitId.SelectedValue != BLL.Const._Null) + { + strSql += " AND UnitId = @UnitId"; + listStr.Add(new SqlParameter("@UnitId", this.drpUnitId.SelectedValue.Trim())); + } + if (this.drpTrainType.SelectedValue != BLL.Const._Null) + { + strSql += " AND TrainTypeId = @TrainTypeId"; + listStr.Add(new SqlParameter("@TrainTypeId", this.drpTrainType.SelectedValue.Trim())); + } + //if (this.drpTrainLevel.SelectedValue != BLL.Const._Null) + //{ + // strSql += " AND TrainLevelId = @TrainLevel"; + // listStr.Add(new SqlParameter("@TrainLevel", this.drpTrainLevel.SelectedValue)); + //} + + if (!string.IsNullOrEmpty(this.txtTeachMan.Text.Trim())) + { + strSql += " AND TeachMan LIKE @TeachMan"; + listStr.Add(new SqlParameter("@TeachMan", "%" + this.txtTeachMan.Text.Trim() + "%")); + } + + if (this.cbIssue.SelectedValueArray.Length == 1) + { + ///是否通过 + string selectValue = String.Join(", ", this.cbIssue.SelectedValueArray); + if (selectValue == "1") + { + strSql += " AND CheckResult = 1 "; + } + else + { + strSql += " AND (CheckResult = 0 OR CheckResult IS NULL) "; + } + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + + Grid1.DataSource = table; + Grid1.DataBind(); + } + #endregion + + #region 页索引改变事件 + /// + /// 页索引改变事件 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + #endregion + + #region 排序 + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, GridSortEventArgs e) + { + Grid1.SortDirection = e.SortDirection; + Grid1.SortField = e.SortField; + BindGrid(); + } + #endregion + + #region 分页选择下拉改变事件 + /// + /// 分页选择下拉改变事件 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + #endregion + + #region 查询 + /// + /// 查询 + /// + /// + /// + protected void Text_OnTextChanged(object sender, EventArgs e) + { + BindGrid(); + } + #endregion + + #region 转换字符串 + /// + /// 考核结果 + /// + /// + /// + protected string ConvertCheckResult(object checkResult) + { + if (checkResult != null) + { + if (checkResult.ToString() == "True") + { + return "合格"; + } + else + { + return "不合格"; + } + } + return ""; + } + #endregion + + #region 导出按钮 + /// 导出按钮 + ///
+ /// + /// + protected void btnOut_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("人员培训" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid1.PageSize = 500; + BindGrid(); + Response.Write(GetGridTableHtml(Grid1)); + Response.End(); + } + + +#pragma warning disable CS0108 // “TrainFind.GetGridTableHtml(Grid)”隐藏继承的成员“PageBase.GetGridTableHtml(Grid)”。如果是有意隐藏,请使用关键字 new。 + /// + /// 导出方法 + /// + /// + /// + private string GetGridTableHtml(Grid grid) +#pragma warning restore CS0108 // “TrainFind.GetGridTableHtml(Grid)”隐藏继承的成员“PageBase.GetGridTableHtml(Grid)”。如果是有意隐藏,请使用关键字 new。 + { + StringBuilder sb = new StringBuilder(); + sb.Append(""); + sb.Append(""); + sb.Append(""); + foreach (GridColumn column in grid.Columns) + { + sb.AppendFormat("", column.HeaderText); + } + sb.Append(""); + foreach (GridRow row in grid.Rows) + { + sb.Append(""); + foreach (GridColumn column in grid.Columns) + { + string html = row.Values[column.ColumnIndex].ToString(); + if (column.ColumnID == "tfNumber") + { + html = (row.FindControl("labNumber") as AspNet.Label).Text; + } + if (column.ColumnID == "tfUnitName") + { + html = (row.FindControl("lbUnitName") as AspNet.Label).Text; + } + if (column.ColumnID == "tfWorkPostName") + { + html = (row.FindControl("lbWorkPostName") as AspNet.Label).Text; + } + if (column.ColumnID == "tfTrainTypeName") + { + html = (row.FindControl("lbTrainTypeName") as AspNet.Label).Text; + } + if (column.ColumnID == "tfTrainLevelName") + { + html = (row.FindControl("lbTrainLevelName") as AspNet.Label).Text; + } + if (column.ColumnID == "tfTrainTitle") + { + html = (row.FindControl("lbTrainTitle") as AspNet.Label).Text; + } + if (column.ColumnID == "tfCheckResult") + { + html = (row.FindControl("lbCheckResult") as AspNet.Label).Text; + } + if (column.ColumnID == "tfI") + { + html = "'" + (row.FindControl("lbI") as AspNet.Label).Text; + } + sb.AppendFormat("", html); + } + + sb.Append(""); + } + + sb.Append("
{0}
{0}
"); + + return sb.ToString(); + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainFind.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainFind.aspx.designer.cs new file mode 100644 index 00000000..06275b30 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainFind.aspx.designer.cs @@ -0,0 +1,215 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainFind + { + + /// + /// Head1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlHead Head1; + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// cbIssue 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBoxList cbIssue; + + /// + /// txtPersonName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPersonName; + + /// + /// drpUnitId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpUnitId; + + /// + /// txtTeachMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTeachMan; + + /// + /// drpTrainType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpTrainType; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// labNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label labNumber; + + /// + /// lbUnitName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbUnitName; + + /// + /// lbWorkPostName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbWorkPostName; + + /// + /// lbTrainTitle 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbTrainTitle; + + /// + /// lbTrainTypeName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbTrainTypeName; + + /// + /// lbCheckResult 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbCheckResult; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx new file mode 100644 index 00000000..99e95a04 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx @@ -0,0 +1,154 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainRecord.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TrainRecord" %> + + + + + 培训记录 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + <%-- + --%> + + + <%-- + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.cs new file mode 100644 index 00000000..9f250bcf --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.cs @@ -0,0 +1,608 @@ +using BLL; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using AspNet = System.Web.UI.WebControls; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TrainRecord : PageBase + { + #region 定义项 + /// + /// 培训记录主键 + /// + public string TrainingId + { + get + { + return (string)ViewState["TrainingId"]; + } + set + { + ViewState["TrainingId"] = value; + } + } + #endregion + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + ////权限按钮方法 + this.GetButtonPower(); + this.btnMenuDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请至少选择一项!"); + this.btnMenuDelete.ConfirmText = String.Format("你确定要删除选中的  行数据吗?", Grid1.GetSelectedCountReference()); + //单位 + BLL.UnitService.InitUnitDropDownList(this.drpUnitId, this.CurrUser.LoginProjectId, true); + //培训类型 + BLL.TrainTypeService.InitTrainTypeDropDownList(this.drpTrainType, true); + //培训级别; + BLL.TrainLevelService.InitTrainLevelDropDownList(this.drpTrainLevel, true); + + ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + BindGrid(); + if (this.CurrUser.UserId == Const.hfnbdId || this.CurrUser.UserId == Const.sysglyId) + { + this.btnRefresh.Hidden = false; + } + } + } + + /// + /// 绑定数据 + /// + private void BindGrid() + { + string projectId = this.CurrUser.LoginProjectId; + if (!string.IsNullOrEmpty(Request.Params["projectId"])) ///是否文件柜查看页面传项目值 + { + projectId = Request.Params["projectId"]; + } + if (!string.IsNullOrEmpty(projectId)) + { + string strSql = "select TrainRecord.TrainingId" + + @",TrainRecord.TrainTitle" + + @",TrainType.TrainTypeName,TrainLevel.TrainLevelName" + + @",TrainRecord.TrainStartDate" + + @",TrainRecord.TrainEndDate" + + @",TrainRecord.TeachHour" + + @",TrainRecord.TeachMan" + + @",TrainRecord.TrainPersonNum" + + @",TrainingCode" + // + @",CodeRecords.Code AS TrainingCode" + + @",(CASE WHEN TrainRecord.States = " + BLL.Const.State_0 + " OR TrainRecord.States IS NULL THEN '待['+OperateUser.UserName+']提交' WHEN TrainRecord.States = " + BLL.Const.State_2 + " THEN '审核/审批完成' ELSE '待['+OperateUser.UserName+']办理' END) AS FlowOperateName" + + @",TrainRecord.UnitIds" + + @" from EduTrain_TrainRecord AS TrainRecord " + + @" LEFT JOIN Sys_FlowOperate AS FlowOperate ON TrainRecord.TrainingId=FlowOperate.DataId AND FlowOperate.IsClosed <> 1" + + @" LEFT JOIN Sys_User AS OperateUser ON FlowOperate.OperaterId=OperateUser.UserId " + + @" LEFT JOIN Base_TrainType AS TrainType ON TrainRecord.TrainTypeId=TrainType.TrainTypeId " + + @" LEFT JOIN Base_TrainLevel AS TrainLevel ON TrainRecord.TrainLevelId=TrainLevel.TrainLevelId " + + @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON TrainRecord.TrainingId=CodeRecords.DataId WHERE 1=1 "; + List listStr = new List(); + strSql += " AND TrainRecord.ProjectId = @ProjectId"; + listStr.Add(new SqlParameter("@ProjectId", projectId)); + if (!string.IsNullOrEmpty(Request.Params["projectId"])) ///是否文件柜查看页面传项目值 + { + strSql += " AND TrainRecord.States = @States"; ///状态为已完成 + listStr.Add(new SqlParameter("@States", BLL.Const.State_2)); + } + if (this.drpTrainType.SelectedValue != BLL.Const._Null) + { + strSql += " AND TrainRecord.TrainTypeId = @TrainType"; + listStr.Add(new SqlParameter("@TrainType", this.drpTrainType.SelectedValue)); + } + if (this.drpTrainLevel.SelectedValue != BLL.Const._Null) + { + strSql += " AND TrainRecord.TrainLevelId = @TrainLevel"; + listStr.Add(new SqlParameter("@TrainLevel", this.drpTrainLevel.SelectedValue)); + } + if (!string.IsNullOrEmpty(this.txtStartDate.Text.Trim())) + { + strSql += " AND TrainRecord.TrainStartDate >= @StartDate "; + listStr.Add(new SqlParameter("@StartDate", this.txtStartDate.Text.Trim())); + } + if (!string.IsNullOrEmpty(this.txtEndDate.Text.Trim())) + { + strSql += " AND TrainRecord.TrainStartDate <= @EndDate "; + listStr.Add(new SqlParameter("@EndDate", this.txtEndDate.Text.Trim())); + } + if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.CurrUser.LoginProjectId, this.CurrUser.UnitId)) + { + strSql += " AND TrainRecord.UnitIds LIKE @UnitId1"; + listStr.Add(new SqlParameter("@UnitId1", "%" + this.CurrUser.UnitId + "%")); + } + if (this.drpUnitId.SelectedValue != BLL.Const._Null) + { + strSql += " AND TrainRecord.UnitIds LIKE @UnitId"; + listStr.Add(new SqlParameter("@UnitId", "%" + this.drpUnitId.SelectedValue.Trim() + "%")); + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + Grid1.RecordCount = tb.Rows.Count; + //tb = GetFilteredTable(Grid1.FilteredData, tb); + var table = this.GetPagedDataTable(Grid1, tb); + + Grid1.DataSource = table; + Grid1.DataBind(); + int totalPersonNum = 0; + for (int i = 0; i < tb.Rows.Count; i++) + { + totalPersonNum += Funs.GetNewIntOrZero(tb.Rows[i][8].ToString()); + } + + JObject summary = new JObject + { + { "TeachMan", "合计:" }, + { "TrainPersonNum", totalPersonNum } + }; + + Grid1.SummaryData = summary; + } + } + #endregion + + #region 页索引改变事件 + /// + /// 页索引改变事件 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + BindGrid(); + } + #endregion + + #region 排序 + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, GridSortEventArgs e) + { + BindGrid(); + } + #endregion + + #region 分页选择下拉改变事件 + /// + /// 分页选择下拉改变事件 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + BindGrid(); + } + #endregion + + #region 增加 + /// + /// 增加 + /// + /// + /// + protected void btnNew_Click(object sender, EventArgs e) + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TrainRecordEdit.aspx", "编辑 - "))); + } + #endregion + + #region 编辑 + /// + /// Grid行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuEdit_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + this.TrainingId = Grid1.SelectedRowID; + var trainRecord = EduTrain_TrainRecordService.GetTrainingByTrainingId(TrainingId); + if (trainRecord != null) + { + if (this.btnMenuEdit.Hidden || trainRecord.States == BLL.Const.State_2) ////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面 + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TrainRecordView.aspx?TrainingId={0}", TrainingId, "查看 - "))); + } + else + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TrainRecordEdit.aspx?TrainingId={0}", TrainingId, "编辑 - "))); + } + } + } + #endregion + + #region 删除 + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 删除方法 + /// + private void DeleteData() + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + bool isShow = false; + if (Grid1.SelectedRowIndexArray.Length == 1) + { + isShow = true; + } + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + if (this.judgementDelete(rowID, isShow)) + { + var TrainRecord = EduTrain_TrainRecordService.GetTrainingByTrainingId(rowID); + if (TrainRecord != null) + { + LogService.AddSys_Log(this.CurrUser, TrainRecord.TrainingCode, TrainRecord.TrainingId, BLL.Const.ProjectTrainRecordMenuId, BLL.Const.BtnDelete); + EduTrain_TrainRecordService.DeleteTrainingByTrainingId(rowID); + BindGrid(); + ShowNotify("删除数据成功!(表格数据已重新绑定)", MessageBoxIcon.Success); + } + } + } + } + } + + /// + /// 判断是否可删除 + /// + /// + /// + /// + private bool judgementDelete(string rowID, bool isShow) + { + string content = string.Empty; + if (string.IsNullOrEmpty(content)) + { + return true; + } + else + { + if (isShow) + { + Alert.ShowInTop(content); + } + return false; + } + } + #endregion + + #region 关闭弹出窗 + /// + /// 关闭弹出窗 + /// + /// + /// + protected void Window1_Close(object sender, WindowCloseEventArgs e) + { + BindGrid(); + } + #endregion + + #region 获取按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + if (Request.Params["value"] == "0") + { + return; + } + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectTrainRecordMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnAdd)) + { + this.btnNew.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnModify)) + { + this.btnMenuEdit.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnMenuDelete.Hidden = false; + } + } + } + #endregion + + #region 导出按钮 + /// 导出按钮 + /// + /// + /// + protected void btnOut_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("培训记录" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid1.PageSize = this.Grid1.Rows.Count(); + BindGrid(); + Response.Write(GetGridTableHtml(Grid1)); + Response.End(); + } + +#pragma warning disable CS0108 // “TrainRecord.GetGridTableHtml(Grid)”隐藏继承的成员“PageBase.GetGridTableHtml(Grid)”。如果是有意隐藏,请使用关键字 new。 + /// + /// 导出方法 + /// + /// + /// + private string GetGridTableHtml(Grid grid) +#pragma warning restore CS0108 // “TrainRecord.GetGridTableHtml(Grid)”隐藏继承的成员“PageBase.GetGridTableHtml(Grid)”。如果是有意隐藏,请使用关键字 new。 + { + StringBuilder sb = new StringBuilder(); + sb.Append(""); + sb.Append(""); + sb.Append(""); + foreach (GridColumn column in grid.Columns) + { + sb.AppendFormat("", column.HeaderText); + } + sb.Append(""); + foreach (GridRow row in grid.Rows) + { + sb.Append(""); + foreach (GridColumn column in grid.Columns) + { + string html = row.Values[column.ColumnIndex].ToString(); + if (column.ColumnID == "tfNumber") + { + html = (row.FindControl("lblNumber") as AspNet.Label).Text; + } + if (column.ColumnID == "tfTeachAddress") + { + html = (row.FindControl("lblTeachAddress") as AspNet.Label).Text; + } + if (column.ColumnID == "tfUnitIds") + { + html = (row.FindControl("lblUnitId") as AspNet.Label).Text; + } + if (column.ColumnID == "tfTrainingCode") + { + html = (row.FindControl("lblTrainingCode") as AspNet.Label).Text; + } + //sb.AppendFormat("", html); + sb.AppendFormat("", html); + } + + sb.Append(""); + } + + sb.Append("
{0}
{0}{0}
"); + + return sb.ToString(); + } + #endregion + + #region 格式化字符串 + /// + /// 获取单位名称 + /// + /// + /// + protected string ConvertUnitName(object unitIds) + { + string unitName = string.Empty; + if (unitIds != null) + { + List infos = unitIds.ToString().Split(',').ToList(); + if (infos.Count() > 0) + { + foreach (var item in infos) + { + Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(item); + if (unit != null) + { + unitName += unit.UnitName + ","; + } + } + if (!string.IsNullOrEmpty(unitName)) + { + unitName = unitName.Substring(0, unitName.LastIndexOf(",")); + } + } + } + return unitName; + } + #endregion + + #region 查询事件 + /// + /// 查询事件 + /// + /// + /// + protected void Text_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + + #region 打印 + /// + /// 打印 + /// + /// + /// + protected void btnPrint_Click(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(Grid1.SelectedRowID)) + { + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/ReportPrint/ExReportPrint.aspx?reportId={0}&&replaceParameter={1}&&varValue={2}", Const.TrainRecordReportId, Grid1.SelectedRowID, "", "打印 - "))); + } + } + #endregion + + protected void btnMenuView_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + this.TrainingId = Grid1.SelectedRowID; + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TrainRecordView.aspx?TrainingId={0}", TrainingId, "查看 - "))); + } + + /// + /// + /// + /// + /// + protected void btnRefresh_Click(object sender, EventArgs e) + { + var getTrainRecords = from x in Funs.DB.EduTrain_TrainRecord + where x.ProjectId == this.CurrUser.LoginProjectId && x.PlanId != null + select x; + if (getTrainRecords.Count() > 0) + { + foreach (var itemRecord in getTrainRecords) + { + var getTrainRecordDetail = Funs.DB.EduTrain_TrainRecordDetail.Where(x => x.TrainingId == itemRecord.TrainingId); + if (itemRecord.TrainPersonNum > getTrainRecordDetail.Count()) + { + var getTrainingTasks = from x in Funs.DB.Training_Task + where x.PlanId == itemRecord.PlanId + select x; + ////及格分数 + int passScore = 80; + var testRule = Funs.DB.Sys_TestRule.FirstOrDefault(); + if (testRule != null) + { + passScore = testRule.PassingScore; + } + foreach (var item in getTrainingTasks) + { + bool isInsert = true; + var geteu = getTrainRecordDetail.FirstOrDefault(x => x.PersonId == item.UserId); + if (geteu != null) + { + var getperson = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.PersonId == geteu.PersonId); + if (getperson != null && !string.IsNullOrEmpty(getperson.CardNo)) + { + isInsert = false; + } + else + { + Funs.DB.EduTrain_TrainRecordDetail.DeleteOnSubmit(geteu); + Funs.DB.SubmitChanges(); + } + } + + if (isInsert) + { + decimal gScores = 0; + bool result = false; + var getTestPlan = Funs.DB.Training_TestPlan.FirstOrDefault(x => x.PlanId == itemRecord.PlanId); + if (getTestPlan != null) + { + ////获取 考生试卷 + var getTestRecord = Funs.DB.Training_TestRecord.Where(x => x.TestPlanId == getTestPlan.TestPlanId && x.TestManId == item.UserId); + foreach (var itemR in getTestRecord) + { + if (itemR.TestScores > gScores) + { + gScores = itemR.TestScores ?? 0; + } + } + + if (gScores >= passScore) + { + result = true; + } + + Model.EduTrain_TrainRecordDetail newDetail = new Model.EduTrain_TrainRecordDetail + { + TrainDetailId = SQLHelper.GetNewID(), + TrainingId = itemRecord.TrainingId, + PersonId = item.UserId, + CheckScore = gScores, + CheckResult = result, + }; + Funs.DB.EduTrain_TrainRecordDetail.InsertOnSubmit(newDetail); + Funs.DB.SubmitChanges(); + + ///// 培训考试 通过 更新卡号 + if (result) + { + var getPerson = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.PersonId == newDetail.PersonId); + if (getPerson != null && string.IsNullOrEmpty(getPerson.CardNo)) + { + getPerson.CardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", getPerson.ProjectId, UnitService.GetUnitCodeByUnitId(getPerson.UnitId)); + Funs.DB.SubmitChanges(); + } + } + } + } + } + } + } + Alert.ShowInTop("刷新完成!", MessageBoxIcon.Success); + } + + var getTestPlanStates = from x in Funs.DB.Training_TestPlan + join y in Funs.DB.Training_Plan on x.PlanId equals y.PlanId + where x.States == Const.State_3 && y.States == Const.State_2 + select x; + foreach (var item in getTestPlanStates) + { + ////TODO 讲培训计划 考试记录 写入到培训记录 + BLL. APITrainRecordService.InsertTrainRecord(item); + } + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.designer.cs new file mode 100644 index 00000000..cdb7d40f --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.designer.cs @@ -0,0 +1,269 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainRecord + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// drpUnitId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpUnitId; + + /// + /// drpTrainType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpTrainType; + + /// + /// drpTrainLevel 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpTrainLevel; + + /// + /// txtStartDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtStartDate; + + /// + /// lblTo 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lblTo; + + /// + /// txtEndDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtEndDate; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// btnRefresh 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnRefresh; + + /// + /// lblNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblNumber; + + /// + /// lblTrainingCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblTrainingCode; + + /// + /// lblUnitId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblUnitId; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Window2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window2; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuView 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuView; + + /// + /// btnMenuEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuEdit; + + /// + /// btnPrint 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnPrint; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordEdit.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordEdit.aspx new file mode 100644 index 00000000..f14fedc6 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordEdit.aspx @@ -0,0 +1,224 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainRecordEdit.aspx.cs" + Inherits="FineUIPro.Web.Person.EduTrain.TrainRecordEdit" %> + +<%@ Register Src="~/Controls/FlowOperateControl.ascx" TagName="FlowOperateControl" + TagPrefix="uc1" %> + + + + 编辑培训记录 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%----%> + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordEdit.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordEdit.aspx.cs new file mode 100644 index 00000000..b6746c1d --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordEdit.aspx.cs @@ -0,0 +1,535 @@ +using BLL; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TrainRecordEdit : PageBase + { + #region 定义变量 + /// + /// 主键 + /// + public string TrainingId + { + get + { + return (string)ViewState["TrainingId"]; + } + set + { + ViewState["TrainingId"] = value; + } + } + + /// + /// 主键 + /// + public string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + + /// + /// 考试计划ID + /// + public string TestPlanId + { + get + { + return (string)ViewState["TestPlanId"]; + } + set + { + ViewState["TestPlanId"] = value; + } + } + /// + /// 定义集合 + /// + private static List trainRecordDetails = new List(); + #endregion + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.btnClose.OnClientClick = ActiveWindow.GetHidePostBackReference(); + this.ProjectId = this.CurrUser.LoginProjectId; + this.InitDropDownList(); + trainRecordDetails.Clear(); + + this.TrainingId = Request.Params["TrainingId"]; + var trainRecord = EduTrain_TrainRecordService.GetTrainingByTrainingId(this.TrainingId); + if (trainRecord != null) + { + this.ProjectId = trainRecord.ProjectId; + if (this.ProjectId != this.CurrUser.LoginProjectId) + { + this.InitDropDownList(); + } + this.txtTrainingCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.TrainingId); + if (!string.IsNullOrEmpty(trainRecord.TrainTypeId)) + { + this.drpTrainType.SelectedValue = trainRecord.TrainTypeId; + } + if (!string.IsNullOrEmpty(trainRecord.TrainLevelId)) + { + this.drpTrainLevel.SelectedValue = trainRecord.TrainLevelId; + } + this.txtTrainTitle.Text = trainRecord.TrainTitle; + if (!string.IsNullOrEmpty(trainRecord.UnitIds)) + { + this.drpUnits.SelectedValueArray = trainRecord.UnitIds.Split(','); + } + if (!string.IsNullOrEmpty(trainRecord.WorkPostIds)) + { + this.drpWorkPostIds.SelectedValueArray = trainRecord.WorkPostIds.Split(','); + } + this.txtTeachMan.Text = trainRecord.TeachMan; + this.txtTeachAddress.Text = trainRecord.TeachAddress; + if (trainRecord.TeachHour != null) + { + this.txtTeachHour.Text = trainRecord.TeachHour.ToString(); + } + if (trainRecord.TrainStartDate != null) + { + this.txtTrainStartDate.Text = string.Format("{0:yyyy-MM-dd}", trainRecord.TrainStartDate); + } + if (trainRecord.TrainPersonNum != null) + { + this.txtTrainPersonNum.Text = Convert.ToString(trainRecord.TrainPersonNum); + } + this.txtTrainContent.Text = trainRecord.TrainContent; + var getTestPlan = TestPlanService.GetTestPlanByPlanId(trainRecord.PlanId); + if (getTestPlan != null) + { + this.TestPlanId = getTestPlan.TestPlanId; + } + } + else + { + ////自动生成编码 + this.txtTrainingCode.Text = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectTrainRecordMenuId, this.ProjectId, this.CurrUser.UnitId); + this.txtTrainStartDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); + this.txtTeachMan.Text = this.CurrUser.UserName; + this.txtTeachAddress.Text = "办公室"; + this.txtTeachHour.Text = "1"; + //this.txtTrainEndDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); + } + + this.Grid1DataBind(); + ///初始化审核菜单 + this.ctlAuditFlow.MenuId = Const.ProjectTrainRecordMenuId; + this.ctlAuditFlow.DataId = this.TrainingId; + this.ctlAuditFlow.ProjectId = this.ProjectId; + this.ctlAuditFlow.UnitId = this.CurrUser.UnitId; + } + } + #endregion + + /// + /// 绑定 Grid1 + /// + private void Grid1DataBind() + { + trainRecordDetails = (from x in Funs.DB.View_EduTrain_TrainRecordDetail + where x.TrainingId == this.TrainingId + orderby x.UnitName, x.PersonName + select x).ToList(); + Grid1.DataSource = trainRecordDetails; + Grid1.DataBind(); + for (int i = 0; i < Grid1.Rows.Count; i++) + { + bool isRed = true; + string trainDetailId = Grid1.Rows[i].DataKeys[0].ToString(); + var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == trainDetailId); + if (getAtt != null) + { + isRed = false; + } + if(isRed) + { + var getRecordDetail = trainRecordDetails.FirstOrDefault(x => x.TrainDetailId == trainDetailId); + if (getRecordDetail != null && !string.IsNullOrEmpty(this.TestPlanId)) ////未参加过培训的人员 + { + var getTestRecord = Funs.DB.Training_TestRecord.FirstOrDefault(x => x.TestManId == getRecordDetail.PersonId && x.TestPlanId == this.TestPlanId); + if (getTestRecord != null) + { + isRed = false; + } + } + } + if (isRed) + { + Grid1.Rows[i].RowCssClass = "Red"; + } + } + } + + /// + /// + /// + private void InitDropDownList() + { + //培训类型 + TrainTypeService.InitTrainTypeDropDownList(this.drpTrainType, true); + //培训级别 + TrainLevelService.InitTrainLevelDropDownList(this.drpTrainLevel, true); + //培训单位 + UnitService.InitUnitDropDownList(this.drpUnits, this.ProjectId, false); + WorkPostService.InitWorkPostDropDownList(this.drpWorkPostIds, true); + this.drpUnits.SelectedValue = this.CurrUser.UnitId; + } + + #region 选择按钮 + /// + /// 选择按钮 + /// + /// + /// + protected void btnSelect_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(this.TrainingId)) + { + this.SaveData(BLL.Const.BtnSave); + } + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ShowPerson.aspx?TrainingId={0}&TrainTypeId={1}", this.TrainingId, this.drpTrainType.SelectedValue, "编辑 - "))); + } + #endregion + + #region 导入 + /// + /// 导入按钮 + /// + /// + /// + protected void btnImport_Click(object sender, EventArgs e) + { + if (this.drpTrainType.SelectedValue == BLL.Const._Null) + { + ShowNotify("请选择培训类型!", MessageBoxIcon.Warning); + return; + } + if (string.IsNullOrEmpty(this.TrainingId)) + { + this.SaveData(BLL.Const.BtnSave); + } + + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TrainRecordIn.aspx?TrainingId={0}", this.TrainingId, "导入 - "), "导入", 900, 560)); + } + #endregion + + #region 提交按钮 + /// + /// 提交按钮 + /// + /// + /// + protected void btnSubmit_Click(object sender, EventArgs e) + { + if (this.ctlAuditFlow.NextStep == BLL.Const.State_1 && this.ctlAuditFlow.NextPerson == BLL.Const._Null) + { + ShowNotify("请选择下一步办理人!", MessageBoxIcon.Warning); + return; + } + this.SaveData(BLL.Const.BtnSubmit); + PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + } + #endregion + + #region 保存按钮 + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + this.SaveData(BLL.Const.BtnSave); + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + #endregion + + #region 保存方法 + /// + /// 保存数据 + /// + /// + private void SaveData(string type) + { + int i = 0; + if (this.drpTrainType.SelectedValue == BLL.Const._Null) + { + ShowNotify("请选择培训类型!", MessageBoxIcon.Warning); + i++; + return; + } + + Model.EduTrain_TrainRecord trainRecord = new Model.EduTrain_TrainRecord + { + TrainingCode = this.txtTrainingCode.Text.Trim(), + ProjectId = this.ProjectId, + TrainTitle = this.txtTrainTitle.Text.Trim(), + TrainContent = this.txtTrainContent.Text.Trim(), + TrainStartDate = Funs.GetNewDateTime(this.txtTrainStartDate.Text.Trim()), + TrainPersonNum = this.Grid1.Rows.Count, + TeachHour = Funs.GetNewDecimalOrZero(this.txtTeachHour.Text.Trim()), + TeachMan = this.txtTeachMan.Text.Trim(), + TeachAddress = this.txtTeachAddress.Text.Trim(), + }; + if (this.drpTrainType.SelectedValue != BLL.Const._Null) + { + trainRecord.TrainTypeId = this.drpTrainType.SelectedValue; + } + if (this.drpTrainLevel.SelectedValue != BLL.Const._Null) + { + trainRecord.TrainLevelId = this.drpTrainLevel.SelectedValue; + } + //培训单位 + string unitIds = string.Empty; + foreach (var item in this.drpUnits.SelectedValueArray) + { + unitIds += item + ","; + } + if (!string.IsNullOrEmpty(unitIds)) + { + unitIds = unitIds.Substring(0, unitIds.LastIndexOf(",")); + } + trainRecord.UnitIds = unitIds; + + //培训岗位 + string workPostIds = string.Empty; + foreach (var item in this.drpWorkPostIds.SelectedValueArray) + { + workPostIds += item + ","; + } + if (!string.IsNullOrEmpty(workPostIds)) + { + workPostIds = workPostIds.Substring(0, workPostIds.LastIndexOf(",")); + } + trainRecord.WorkPostIds = workPostIds; + + ////单据状态 + trainRecord.States = BLL.Const.State_0; + if (type == BLL.Const.BtnSubmit) + { + trainRecord.States = this.ctlAuditFlow.NextStep; + //if (!this.drpTrainStates.Hidden && trainRecord.TrainStates != "3" && trainRecord.States == Const.State_2) + //{ + // ShowNotify("当前培训还未结束,不能审核完成!", MessageBoxIcon.Warning); + // i++; + // return; + //} + } + if (!string.IsNullOrEmpty(this.TrainingId)) + { + var getTrain = BLL.EduTrain_TrainRecordService.GetTrainingByTrainingId(this.TrainingId); + if (getTrain != null) + { + trainRecord.FromRecordId = getTrain.FromRecordId; + } + + trainRecord.TrainingId = this.TrainingId; + BLL.EduTrain_TrainRecordService.UpdateTraining(trainRecord); + BLL.LogService.AddSys_Log(this.CurrUser, trainRecord.TrainingCode, trainRecord.TrainingId, BLL.Const.ProjectTrainRecordMenuId, BLL.Const.BtnModify); + } + else + { + trainRecord.TrainingId = SQLHelper.GetNewID(typeof(Model.EduTrain_TrainRecord)); + this.TrainingId = trainRecord.TrainingId; + trainRecord.CompileMan = this.CurrUser.UserId; + BLL.EduTrain_TrainRecordService.AddTraining(trainRecord); + BLL.LogService.AddSys_Log(this.CurrUser, trainRecord.TrainingCode, trainRecord.TrainingId, BLL.Const.ProjectTrainRecordMenuId, BLL.Const.BtnAdd); + } + + JArray mergedData = Grid1.GetMergedData(); + foreach (JObject mergedRow in mergedData) + { + string status = mergedRow.Value("status"); + JObject values = mergedRow.Value("values"); + Model.EduTrain_TrainRecordDetail detail = BLL.EduTrain_TrainRecordDetailService.GetTrainDetailByTrainDetailId(values.Value("TrainDetailId").ToString()); + if (detail != null) + { + if (values.Value("CheckResult").ToString() == "1") + { + detail.CheckResult = true; + } + else + { + detail.CheckResult = false; + } + detail.CheckScore = Funs.GetNewDecimalOrZero(values.Value("CheckScore").ToString()); ; + BLL.EduTrain_TrainRecordDetailService.UpdateTrainDetail(detail); + } + } + + if (i == 0) + { + ////保存流程审核数据 + this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectTrainRecordMenuId, this.TrainingId, (type == BLL.Const.BtnSubmit ? true : false), this.txtTrainTitle.Text.Trim(), "../EduTrain/TrainRecordView.aspx?TrainingId={0}"); + } + } + #endregion + + #region 关闭弹出窗 + /// + /// 关闭弹出窗 + /// + /// + /// + protected void Window1_Close(object sender, EventArgs e) + { + this.Grid1DataBind(); + this.txtTrainPersonNum.Text = trainRecordDetails.Count.ToString(); + } + #endregion + + #region 删除 + /// + /// 批量删除 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + BLL.EduTrain_TrainRecordDetailService.DeleteTrainDetailByTrainDetail(rowID); + } + + this.Grid1DataBind(); + this.txtTrainPersonNum.Text = trainRecordDetails.Count.ToString(); + this.ShowNotify("删除数据成功!(表格数据已重新绑定)"); + } + } + #endregion + + #region 附件上传 + /// + /// 上传附件 + /// + /// + /// + protected void btnAttachUrl_Click(object sender, EventArgs e) + { + if (this.drpTrainType.SelectedValue == BLL.Const._Null) + { + ShowNotify("请选择培训类型!", MessageBoxIcon.Warning); + return; + } + if (string.IsNullOrEmpty(this.TrainingId)) + { + this.SaveData(BLL.Const.BtnSave); + } + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/TrainRecord&menuId={1}", this.TrainingId, BLL.Const.ProjectTrainRecordMenuId))); + } + #endregion + + /// + /// 培训试题 + /// + /// + /// + protected void btnTrainTest_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(this.TrainingId)) + { + this.SaveData(BLL.Const.BtnSave); + } + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("TrainTest.aspx?TrainingId={0}", this.TrainingId, "编辑 - "))); + } + + /// + /// + /// + /// + /// + protected void btnMenuView_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("TrainTestView.aspx?TrainDetailId={0}", rowID, "查看试卷 - "))); + } + } + } + + ///// + ///// 选择培训教材类型 + ///// + ///// + ///// + //protected void btnTrainingType_Click(object sender, EventArgs e) + //{ + // if (string.IsNullOrEmpty(this.TrainingId)) + // { + // this.SaveData(BLL.Const.BtnSave); + // } + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ShowTrainingType.aspx?TrainingId={0}&TrainTypeId={1}", this.TrainingId, this.drpTrainType.SelectedValue, "编辑 - "))); + //} + + #region 格式化字符串 + /// + /// 格式化受伤情况 + /// + /// + /// + protected string GetCheckScore(object TrainDetailId) + { + string values = string.Empty; + var getTrainRecordDetail = Funs.DB.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.TrainDetailId == TrainDetailId.ToString()); + if (getTrainRecordDetail != null) + { + var getTrainRecord = Funs.DB.EduTrain_TrainRecord.FirstOrDefault(x => x.TrainingId == getTrainRecordDetail.TrainingId); + if (getTrainRecord != null) + { + var getTestPlan = Funs.DB.Training_TestPlan.FirstOrDefault(x => x.PlanId == getTrainRecord.PlanId); + if (getTestPlan != null) + { + decimal? scors = 0; + var getTestRecord = Funs.DB.Training_TestRecord.Where(x => x.TestPlanId == getTestPlan.TestPlanId && x.TestManId == getTrainRecordDetail.PersonId); + foreach (var item in getTestRecord) + { + if (scors == 0) + { + scors = item.TestScores; + } + else + { + if (item.TestScores < scors) + { + scors = item.TestScores ?? 0; + } + } + } + + values = scors.ToString(); + } + } + } + return values; + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordEdit.aspx.designer.cs new file mode 100644 index 00000000..dc3ec06f --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordEdit.aspx.designer.cs @@ -0,0 +1,368 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainRecordEdit + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtTrainingCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainingCode; + + /// + /// drpTrainType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpTrainType; + + /// + /// drpTrainLevel 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpTrainLevel; + + /// + /// txtTeachHour 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtTeachHour; + + /// + /// txtTrainTitle 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainTitle; + + /// + /// txtTeachAddress 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTeachAddress; + + /// + /// txtTrainStartDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtTrainStartDate; + + /// + /// txtTrainPersonNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtTrainPersonNum; + + /// + /// txtTeachMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTeachMan; + + /// + /// drpUnits 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpUnits; + + /// + /// trWorkPost 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FormRow trWorkPost; + + /// + /// drpWorkPostIds 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpWorkPostIds; + + /// + /// txtTrainContent 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtTrainContent; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// btnTrainTest 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnTrainTest; + + /// + /// btnImport 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnImport; + + /// + /// btnSelect 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSelect; + + /// + /// drpCheckResult 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpCheckResult; + + /// + /// lbTrainDetailId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbTrainDetailId; + + /// + /// txtCheckScore 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtCheckScore; + + /// + /// ContentPanel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ContentPanel ContentPanel1; + + /// + /// ctlAuditFlow 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Web.Controls.FlowOperateControl ctlAuditFlow; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// lbTemp 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbTemp; + + /// + /// btnAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAttachUrl; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnSubmit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSubmit; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Window2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window2; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuView 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuView; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordIn.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordIn.aspx new file mode 100644 index 00000000..f856f106 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordIn.aspx @@ -0,0 +1,100 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainRecordIn.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TrainRecordIn" %> + + + + + + 导入 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordIn.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordIn.aspx.cs new file mode 100644 index 00000000..35c1674c --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordIn.aspx.cs @@ -0,0 +1,363 @@ +namespace FineUIPro.Web.Person.EduTrain +{ + using BLL; + using System; + using System.Collections.Generic; + using System.Data; + using System.Data.OleDb; + using System.IO; + using System.Linq; + + public partial class TrainRecordIn : PageBase + { + #region 定义变量 + /// + /// 上传预设的虚拟路径 + /// + private string initPath = Const.ExcelUrl; + + /// + /// 导入集合 + /// + public static List viewTrainRecordDetails = new List(); + + /// + /// 错误集合 + /// + public static string errorInfos = string.Empty; + + /// + /// 主键 + /// + public string TrainingId + { + get + { + return (string)ViewState["TrainingId"]; + } + set + { + ViewState["TrainingId"] = value; + } + } + #endregion + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.btnClose.OnClientClick = ActiveWindow.GetHidePostBackReference(); + this.hdFileName.Text = string.Empty; + this.hdCheckResult.Text = string.Empty; + this.TrainingId = Request.Params["TrainingId"]; + if (viewTrainRecordDetails != null) + { + viewTrainRecordDetails.Clear(); + } + errorInfos = string.Empty; + } + } + #endregion + + #region 数据导入 + /// + /// 数据导入 + /// + /// + /// + protected void btnAudit_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(this.TrainingId)) + { + Alert.ShowInTop("先保存培训,再导入!", MessageBoxIcon.Warning); + return; + } + try + { + if (this.fuAttachUrl.HasFile == false) + { + Alert.ShowInTop("请您选择Excel文件!", MessageBoxIcon.Warning); + return; + } + string IsXls = Path.GetExtension(this.fuAttachUrl.FileName).ToString().Trim().ToLower(); + if (IsXls != ".xls") + { + Alert.ShowInTop("只可以选择Excel文件!", MessageBoxIcon.Warning); + return; + } + if (viewTrainRecordDetails != null) + { + viewTrainRecordDetails.Clear(); + } + if (!string.IsNullOrEmpty(errorInfos)) + { + errorInfos = string.Empty; + } + string rootPath = Server.MapPath("~/"); + string initFullPath = rootPath + initPath; + if (!Directory.Exists(initFullPath)) + { + Directory.CreateDirectory(initFullPath); + } + + this.hdFileName.Text = BLL.Funs.GetNewFileName() + IsXls; + string filePath = initFullPath + this.hdFileName.Text; + this.fuAttachUrl.PostedFile.SaveAs(filePath); + ImportXlsToData(rootPath + initPath + this.hdFileName.Text); + } + catch (Exception ex) + { + ShowNotify("'" + ex.Message + "'", MessageBoxIcon.Warning); + } + } + + #region 读Excel提取数据 + /// + /// 从Excel提取数据--》Dataset + /// + /// Excel文件路径名 + private void ImportXlsToData(string fileName) + { + try + { + viewTrainRecordDetails.Clear(); + string oleDBConnString = String.Empty; + oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;"; + oleDBConnString += "Data Source="; + oleDBConnString += fileName; + oleDBConnString += ";Extended Properties=Excel 8.0;"; + OleDbConnection oleDBConn = null; + OleDbDataAdapter oleAdMaster = null; + DataTable m_tableName = new DataTable(); + DataSet ds = new DataSet(); + + oleDBConn = new OleDbConnection(oleDBConnString); + oleDBConn.Open(); + m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); + + if (m_tableName != null && m_tableName.Rows.Count > 0) + { + m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim(); + } + string sqlMaster; + sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]"; + oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn); + oleAdMaster.Fill(ds, "m_tableName"); + oleAdMaster.Dispose(); + oleDBConn.Close(); + oleDBConn.Dispose(); + + AddDatasetToSQL(ds.Tables[0]); + } + catch (Exception ex) + { + throw ex; + } + } + #endregion + + #region 将Dataset的数据导入数据库 + /// + /// 将Dataset的数据导入数据库 + /// + /// 数据集 + /// 数据集行数 + /// + private bool AddDatasetToSQL(DataTable pds) + { + string results = string.Empty; + int ir = pds.Rows.Count; + if (pds != null && ir > 0) + { + var trainRecord = BLL.EduTrain_TrainRecordService.GetTrainingByTrainingId(this.TrainingId); + if (trainRecord != null) + { + var units = from x in Funs.DB.Base_Unit select x; + var persons = from x in Funs.DB.SitePerson_Person where x.ProjectId == trainRecord.ProjectId select x; + for (int i = 0; i < ir; i++) + { + string result = string.Empty; + string col0 = pds.Rows[i][0].ToString().Trim(); + string col1 = pds.Rows[i][1].ToString().Trim(); + string col2 = pds.Rows[i][2].ToString().Trim(); + string col3 = pds.Rows[i][3].ToString().Trim(); + if (!string.IsNullOrEmpty(col0) || !string.IsNullOrEmpty(col1) || !string.IsNullOrEmpty(col2)) + { + if (string.IsNullOrEmpty(col0) || string.IsNullOrEmpty(col1) || string.IsNullOrEmpty(col2)) + { + result += "第" + (i + 2).ToString() + "行," + "导入项" + "," + "此项为必填项!" + "|"; + } + else + { + Model.View_EduTrain_TrainRecordDetail newViewTrainRecordDetail = new Model.View_EduTrain_TrainRecordDetail + { + TrainDetailId = SQLHelper.GetNewID(typeof(Model.View_EduTrain_TrainRecordDetail)), + TrainingId = trainRecord.TrainingId, + UnitName = col0, + PersonName = col1, + CheckResult = false, + CheckScore=Funs.GetNewDecimal(col3), + }; + + if (col2 == "合格") + { + newViewTrainRecordDetail.CheckResult = true; + } + var unit = units.FirstOrDefault(x => x.UnitName == col0); + if (unit != null) + { + newViewTrainRecordDetail.UnitId = unit.UnitId; + var person = persons.FirstOrDefault(x => x.PersonName == col1 && x.UnitId == unit.UnitId); + if (person != null) + { + newViewTrainRecordDetail.PersonId = person.PersonId; + } + else + { + result += "第" + (i + 2).ToString() + "行," + "在现场人员信息中不存在!" + "|"; + } + + } + else + { + result += "第" + (i + 2).ToString() + "行," + "在单位信息中不存在!" + "|"; + } + + + ///判断是否已存在 + var addItem = Funs.DB.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.TrainingId == newViewTrainRecordDetail.TrainingId && x.PersonId == newViewTrainRecordDetail.PersonId); + if (addItem == null) + { + if (string.IsNullOrEmpty(result)) + { + Model.EduTrain_TrainRecordDetail newTrainRecordDetail = new Model.EduTrain_TrainRecordDetail + { + TrainDetailId = newViewTrainRecordDetail.TrainDetailId, + TrainingId = newViewTrainRecordDetail.TrainingId, + PersonId = newViewTrainRecordDetail.PersonId, + CheckResult = newViewTrainRecordDetail.CheckResult, + CheckScore= newViewTrainRecordDetail.CheckScore, + }; + + BLL.EduTrain_TrainRecordDetailService.AddTrainDetail(newTrainRecordDetail); + ///加入 + viewTrainRecordDetails.Add(newViewTrainRecordDetail); + } + } + else + { + result += "第" + (i + 2).ToString() + "行," + "导入数据重复" + "|"; + } + + + if (!string.IsNullOrEmpty(result)) + { + results += result; + } + } + } + } + if (viewTrainRecordDetails.Count > 0) + { + viewTrainRecordDetails = viewTrainRecordDetails.Distinct().ToList(); + this.Grid1.Hidden = false; + this.Grid1.DataSource = viewTrainRecordDetails; + this.Grid1.DataBind(); + } + + if (!string.IsNullOrEmpty(results)) + { + viewTrainRecordDetails.Clear(); + results = "数据导入完成,未成功数据:" + results.Substring(0, results.LastIndexOf("|")); + errorInfos = results; + Alert.ShowInParent(results, MessageBoxIcon.Warning); + } + else + { + errorInfos = string.Empty; + ShowNotify("导入成功!", MessageBoxIcon.Success); + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + } + else + { + Alert.ShowInTop("培训数据为空!", MessageBoxIcon.Warning); + } + } + else + { + Alert.ShowInTop("导入数据为空!", MessageBoxIcon.Warning); + } + + BLL.UploadFileService.DeleteFile(Funs.RootPath, initPath + this.hdFileName.Text); + return true; + } + #endregion + #endregion + + #region 关闭弹出窗口 + /// + /// 关闭导入弹出窗口 + /// + /// + /// + protected void Window1_Close(object sender, WindowCloseEventArgs e) + { + if (Session["trainRecordDetails"] != null) + { + viewTrainRecordDetails = Session["trainRecordDetails"] as List; + } + if (viewTrainRecordDetails.Count > 0) + { + this.Grid1.Hidden = false; + this.Grid1.DataSource = viewTrainRecordDetails; + this.Grid1.DataBind(); + } + } + + #endregion + + #region 下载模板 + /// + /// 下载模板按钮 + /// + /// + /// + protected void btnDownLoad_Click(object sender, EventArgs e) + { + PageContext.RegisterStartupScript(Confirm.GetShowReference("确定下载导入模板吗?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel"))); + } + + /// + /// 下载导入模板 + /// + /// + /// + protected void PageManager1_CustomEvent(object sender, CustomEventArgs e) + { + if (e.EventArgument == "Confirm_OK") + { + string rootPath = Server.MapPath("~/"); + string filePath = Const.TrainRecordTemplateUrl; + string uploadfilepath = rootPath + filePath; + string fileName = Path.GetFileName(filePath); + FileInfo info = new FileInfo(uploadfilepath); + long fileSize = info.Length; + Response.ClearContent(); + Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); + Response.ContentType = "excel/plain"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + Response.AddHeader("Content-Length", fileSize.ToString().Trim()); + Response.TransmitFile(uploadfilepath, 0, fileSize); + Response.End(); + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordIn.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordIn.aspx.designer.cs new file mode 100644 index 00000000..8a6dda48 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordIn.aspx.designer.cs @@ -0,0 +1,143 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainRecordIn + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// btnAudit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAudit; + + /// + /// btnDownLoad 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDownLoad; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + + /// + /// fuAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FileUpload fuAttachUrl; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Label2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label2; + + /// + /// hdFileName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdFileName; + + /// + /// hdCheckResult 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdCheckResult; + + /// + /// lblBottom 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lblBottom; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx new file mode 100644 index 00000000..e356f8be --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx @@ -0,0 +1,200 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainRecordView.aspx.cs" + Inherits="FineUIPro.Web.Person.EduTrain.TrainRecordView" %> + +<%@ Register Src="~/Controls/FlowOperateControl.ascx" TagName="FlowOperateControl" + TagPrefix="uc1" %> + + + + 查看培训记录 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- --%> + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + <%----%> + + + <%-- --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.cs new file mode 100644 index 00000000..d2f493a6 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.cs @@ -0,0 +1,296 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TrainRecordView : PageBase + { + #region 定义变量 + /// + /// 主键 + /// + public string TrainingId + { + get + { + return (string)ViewState["TrainingId"]; + } + set + { + ViewState["TrainingId"] = value; + } + } + /// + /// 考试计划ID + /// + public string TestPlanId + { + get + { + return (string)ViewState["TestPlanId"]; + } + set + { + ViewState["TestPlanId"] = value; + } + } + /// + /// 定义集合 + /// + private static List trainRecordDetails = new List(); + #endregion + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + trainRecordDetails.Clear(); + this.TrainingId = Request.Params["TrainingId"]; + var trainRecord = BLL.EduTrain_TrainRecordService.GetTrainingByTrainingId(this.TrainingId); + if (trainRecord != null) + { + this.txtTrainingCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.TrainingId); + Model.Base_TrainType trainType = BLL.TrainTypeService.GetTrainTypeById(trainRecord.TrainTypeId); + if (trainType != null) + { + this.txtTrainType.Text = trainType.TrainTypeName; + } + Model.Base_TrainLevel trainLevel = BLL.TrainLevelService.GetTrainLevelById(trainRecord.TrainLevelId); + if (trainLevel != null) + { + this.txtTrainLevel.Text = trainLevel.TrainLevelName; + } + this.txtTrainTitle.Text = trainRecord.TrainTitle; + if (!string.IsNullOrEmpty(trainRecord.UnitIds)) + { + string unitNames = string.Empty; + string[] unitIds = trainRecord.UnitIds.Split(','); + foreach (var item in unitIds) + { + Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(item); + if (unit != null) + { + unitNames += unit.UnitName + ","; + } + } + if (!string.IsNullOrEmpty(unitNames)) + { + unitNames = unitNames.Substring(0, unitNames.LastIndexOf(",")); + } + this.txtUnits.Text = unitNames; + } + + if (!string.IsNullOrEmpty(trainRecord.WorkPostIds)) + { + string WorkPostNames = string.Empty; + string[] WorkPostIds = trainRecord.WorkPostIds.Split(','); + foreach (var item in WorkPostIds) + { + Model.Base_WorkPost WorkPost = BLL.WorkPostService.GetWorkPostById(item); + if (WorkPost != null) + { + WorkPostNames += WorkPost.WorkPostName + ","; + } + } + if (!string.IsNullOrEmpty(WorkPostNames)) + { + WorkPostNames = WorkPostNames.Substring(0, WorkPostNames.LastIndexOf(",")); + } + this.txtWorkPostIds.Text = WorkPostNames; + } + + this.txtTeachMan.Text = trainRecord.TeachMan; + this.txtTeachAddress.Text = trainRecord.TeachAddress; + if (trainRecord.TeachHour != null) + { + this.txtTeachHour.Text = trainRecord.TeachHour.ToString(); + } + if (trainRecord.TrainStartDate != null) + { + this.txtTrainStartDate.Text = string.Format("{0:yyyy-MM-dd}", trainRecord.TrainStartDate); + } + if (trainRecord.TrainPersonNum != null) + { + this.txtTrainPersonNum.Text = Convert.ToString(trainRecord.TrainPersonNum); + } + this.txtTrainContent.Text = trainRecord.TrainContent; + var getTestPlan = TestPlanService.GetTestPlanByPlanId(trainRecord.PlanId); + if (getTestPlan != null) + { + this.TestPlanId = getTestPlan.TestPlanId; + } + } + + this.Grid1DataBind(); + ///初始化审核菜单 + this.ctlAuditFlow.MenuId = BLL.Const.ProjectTrainRecordMenuId; + this.ctlAuditFlow.DataId = this.TrainingId; + } + } + #endregion + + #region 绑定 Grid1 + /// + /// 绑定 Grid1 + /// + private void Grid1DataBind() + { + trainRecordDetails = (from x in Funs.DB.View_EduTrain_TrainRecordDetail + where x.TrainingId == this.TrainingId + orderby x.UnitName, x.PersonName + select x).ToList(); + Grid1.DataSource = trainRecordDetails; + Grid1.DataBind(); + for (int i = 0; i < Grid1.Rows.Count; i++) + { + bool isRed = true; + string trainDetailId = Grid1.Rows[i].DataKeys[0].ToString(); + var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == trainDetailId); + if (getAtt != null) + { + isRed = false; + } + if (isRed) + { + var getRecordDetail = trainRecordDetails.FirstOrDefault(x => x.TrainDetailId == trainDetailId); + if (getRecordDetail != null && !string.IsNullOrEmpty(this.TestPlanId)) + { + var getTestRecord = Funs.DB.Training_TestRecord.FirstOrDefault(x => x.TestManId == getRecordDetail.PersonId && x.TestPlanId == this.TestPlanId); + if (getTestRecord != null) + { + isRed = false; + } + } + } + if (isRed) + { + Grid1.Rows[i].RowCssClass = "Red"; + } + } + } + #endregion + + #region 附件上传 + /// + /// 上传附件 + /// + /// + /// + protected void btnAttachUrl_Click(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(this.TrainingId)) + { + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/TrainRecord&menuId={1}&type=-1", this.TrainingId, BLL.Const.ProjectTrainRecordMenuId))); + } + } + #endregion + + /// + /// 培训试题 + /// + /// + /// + protected void btnTrainTest_Click(object sender, EventArgs e) + { + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("TrainTest.aspx?TrainingId={0}", this.TrainingId, "查看 - "))); + } + + /// + /// 查看 + /// + /// + /// + protected void btnMenuView_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + var trainDetailId = Grid1.SelectedRowID; + var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == trainDetailId); + if (getAtt != null) + { + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/TrainRecord&menuId={1}&type=-1", trainDetailId, BLL.Const.ProjectTrainRecordMenuId))); + } + else + { + var getRecordDetail = trainRecordDetails.FirstOrDefault(x => x.TrainDetailId == trainDetailId); + if (getRecordDetail != null && !string.IsNullOrEmpty(this.TestPlanId)) + { + var getTestRecord = Funs.DB.Training_TestRecord.Where(x => x.TestManId == getRecordDetail.PersonId + && x.TestPlanId == this.TestPlanId); + if (getTestRecord.Count() > 0) + { ////及格分数 + int getPassScores = SysConstSetService.getPassScore(); + var getOK = getTestRecord.FirstOrDefault(x => x.TestScores >= getPassScores); + if (getOK != null) + { + PrinterDocService.PrinterDocMethod(Const.ProjectTestRecordMenuId, getOK.TestRecordId, "试卷"); + } + else + { + PrinterDocService.PrinterDocMethod(Const.ProjectTestRecordMenuId, getTestRecord.FirstOrDefault().TestRecordId, "试卷"); + } + } + else + { + } + } + } + } + + #region 格式化字符串 + /// + /// 格式化受伤情况 + /// + /// + /// + protected string GetCheckScore(object TrainDetailId) + { + string values = string.Empty; + var getTrainRecordDetail = Funs.DB.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.TrainDetailId == TrainDetailId.ToString()); + if (getTrainRecordDetail != null) + { + var getTrainRecord = Funs.DB.EduTrain_TrainRecord.FirstOrDefault(x => x.TrainingId == getTrainRecordDetail.TrainingId); + if (getTrainRecord != null) + { + var getTestPlan = Funs.DB.Training_TestPlan.FirstOrDefault(x => x.PlanId == getTrainRecord.PlanId); + if (getTestPlan != null) + { + decimal? scors = 0; + var getTestRecord = Funs.DB.Training_TestRecord.Where(x => x.TestPlanId == getTestPlan.TestPlanId && x.TestManId == getTrainRecordDetail.PersonId); + foreach (var item in getTestRecord) + { + if (scors == 0) + { + scors = item.TestScores; + } + else + { + if (item.TestScores < scors) + { + scors = item.TestScores ?? 0; + } + } + } + + values = scors.ToString(); + } + } + } + return values; + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.designer.cs new file mode 100644 index 00000000..33be0477 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.designer.cs @@ -0,0 +1,305 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainRecordView + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtTrainingCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainingCode; + + /// + /// txtTrainType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainType; + + /// + /// txtTrainLevel 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainLevel; + + /// + /// txtTeachHour 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtTeachHour; + + /// + /// txtTrainTitle 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainTitle; + + /// + /// txtTeachAddress 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTeachAddress; + + /// + /// txtTrainStartDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainStartDate; + + /// + /// txtTrainPersonNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainPersonNum; + + /// + /// txtTeachMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTeachMan; + + /// + /// txtUnits 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtUnits; + + /// + /// trWorkPost 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FormRow trWorkPost; + + /// + /// txtWorkPostIds 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtWorkPostIds; + + /// + /// txtTrainContent 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtTrainContent; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// btnTrainTest 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnTrainTest; + + /// + /// lbTrainDetailId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbTrainDetailId; + + /// + /// txtCheckScore 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtCheckScore; + + /// + /// ContentPanel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ContentPanel ContentPanel1; + + /// + /// ctlAuditFlow 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Web.Controls.FlowOperateControl ctlAuditFlow; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// lbTemp 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbTemp; + + /// + /// btnAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAttachUrl; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + + /// + /// Window2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window2; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuView 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuView; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTest.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTest.aspx new file mode 100644 index 00000000..03bf2793 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTest.aspx @@ -0,0 +1,68 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainTest.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TrainTest" %> + + + + + + 培训试题 + + + +
+ + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTest.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTest.aspx.cs new file mode 100644 index 00000000..3d7c1dae --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTest.aspx.cs @@ -0,0 +1,94 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TrainTest : PageBase + { + /// + /// 加载 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + // ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + BindGrid(); + } + } + + /// + /// 绑定数据 + /// + private void BindGrid() + { + string strSql = @"SELECT TrainTestId,TrainingId,QsnCode,COrder,QsnContent,QsnAnswer,QsnCategory,QsnKind,QsnImportant,QsnCategoryName" + + @",QsnKindName,QsnImportantName,Analysis,Description,UploadTime" + + @" FROM View_EduTrain_TrainTest WHERE TrainingId=@TrainingId "; + List listStr = new List + { + new SqlParameter("@TrainingId", Request.Params["TrainingId"]) + }; + if (!string.IsNullOrEmpty(this.txtQsnContent.Text.Trim())) + { + strSql += " AND QsnContent LIKE @QsnContent"; + listStr.Add(new SqlParameter("@QsnContent", "%" + this.txtQsnContent.Text.Trim() + "%")); + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + Grid1.RecordCount = tb.Rows.Count; + //tb = GetFilteredTable(Grid1.FilteredData, tb); + var table = this.GetPagedDataTable(Grid1, tb); + + Grid1.DataSource = table; + Grid1.DataBind(); + } + + /// + /// 改变索引事件 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + + #region 导出按钮 + /// 导出按钮 + /// + /// + /// + protected void btnOut_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("考试试题" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid1.PageSize = this.Grid1.RecordCount; + BindGrid(); + Response.Write(GetGridTableHtml(Grid1)); + Response.End(); + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTest.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTest.aspx.designer.cs new file mode 100644 index 00000000..1e4417f1 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTest.aspx.designer.cs @@ -0,0 +1,89 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainTest + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar3; + + /// + /// txtQsnContent 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtQsnContent; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// lblNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblNumber; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDB.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDB.aspx new file mode 100644 index 00000000..0e52fb6c --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDB.aspx @@ -0,0 +1,143 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainTestDB.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TrainTestDB" %> + + + + + + 安全试题库 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%----%> + + + + + + + + + + + + + + + + + + + + + <%----%> + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDB.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDB.aspx.cs new file mode 100644 index 00000000..b33fb7d1 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDB.aspx.cs @@ -0,0 +1,523 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.IO; +using System.Linq; +using System.Text; +using System.Web.UI; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TrainTestDB : PageBase + { + public string TrainTestId + { + get + { + return (string)ViewState["TrainTestId"]; + } + set + { + ViewState["TrainTestId"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.GetButtonPower(); + btnSelectColumns.OnClientClick = Window1.GetShowReference("TrainTestDBSelectCloumn.aspx"); + InitTreeMenu(); + } + } + + private void InitTreeMenu() + { + this.trTrainTestDB.Nodes.Clear(); + this.trTrainTestDB.ShowBorder = false; + this.trTrainTestDB.ShowHeader = false; + this.trTrainTestDB.EnableIcons = true; + this.trTrainTestDB.AutoScroll = true; + this.trTrainTestDB.EnableSingleClickExpand = true; + TreeNode rootNode = new TreeNode + { + Text = "安全试题库", + NodeID = "0", + Expanded = true + }; + this.trTrainTestDB.Nodes.Add(rootNode); + BoundTree(rootNode.Nodes, "0"); + } + + /// + /// 加载树 + /// + /// + /// + private void BoundTree(TreeNodeCollection nodes, string menuId) + { + var dt = BLL.TrainTestDBService.GetTrainTestDBBySupTrainTestId(menuId); + if (dt.Count() > 0) + { + TreeNode tn = null; + foreach (var dr in dt) + { + tn = new TreeNode + { + Text = dr.TrainTestName, + NodeID = dr.TrainTestId, + EnableClickEvent = true, + ToolTip = dr.TrainTestName + }; + nodes.Add(tn); + BoundTree(tn.Nodes, dr.TrainTestId); + } + } + } + + /// + /// 添加安全试题类型按钮 + /// + /// + /// + protected void btnNew_Click(object sender, EventArgs e) + { + if (this.trTrainTestDB.SelectedNode != null) + { + Model.Training_TrainTestDB trainTestDB = BLL.TrainTestDBService.GetTrainTestDBById(this.trTrainTestDB.SelectedNode.NodeID); + if ((trainTestDB != null && trainTestDB.IsEndLever == false) || this.trTrainTestDB.SelectedNode.NodeID == "0") //根节点或者非末级节点,可以增加 + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TrainTestDBEdit.aspx?SupTrainingId={0}", this.trTrainTestDB.SelectedNode.NodeID, "编辑 - "))); + } + else + { + ShowNotify("选择的项已是末级!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + /// + /// 修改安全试题类型 + /// + /// + /// + protected void btnEdit_Click(object sender, EventArgs e) + { + if (this.trTrainTestDB.SelectedNode != null) + { + if (this.trTrainTestDB.SelectedNode.NodeID != "0") //非根节点可以编辑 + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TrainTestDBEdit.aspx?TrainTestId={0}", this.trTrainTestDB.SelectedNode.NodeID, "编辑 - "))); + } + else + { + ShowNotify("根节点无法编辑!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + /// + /// 删除安全试题类型 + /// + /// + /// + protected void btnDelete_Click(object sender, EventArgs e) + { + if (this.trTrainTestDB.SelectedNode != null) + { + var q = BLL.TrainTestDBService.GetTrainTestDBById(this.trTrainTestDB.SelectedNode.NodeID); + + if (q != null && BLL.TrainTestDBService.IsDeleteTrainTestDB(this.trTrainTestDB.SelectedNode.NodeID)) + { + BLL.TrainTestDBItemService.DeleteTrainTestDBItemList(this.trTrainTestDB.SelectedNode.NodeID); + BLL.TrainTestDBService.DeleteTrainTestDB(this.trTrainTestDB.SelectedNode.NodeID); + InitTreeMenu(); + } + else + { + ShowNotify("存在下级菜单或已增加资源数据或者为内置项,不允许删除!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择删除项!", MessageBoxIcon.Warning); + } + } + + /// + /// 加载tree + /// + /// + /// + protected void trTrainTestDB_NodeCommand(object sender, TreeCommandEventArgs e) + { + BindGrid(); + } + + private void BindGrid() + { + string strSql = @"SELECT M.TrainTestItemId,M.TrainTestId,M.TrainTestItemCode,M.TraiinTestItemName,M.AttachUrl,M.AuditMan,M.AuditDate,M.IsPass,M.CompileMan,M.CompileDate,UR.UserName AS AuditManName, + SUBSTRING(M.AttachUrl, CHARINDEX('~', M.AttachUrl) + 1, LEN(M.AttachUrl)) AS AttachUrlName + FROM dbo.Training_TrainTestDBItem AS M + LEFT JOIN dbo.Sys_User AS UR ON UR.UserId = M.AuditMan + WHERE TrainTestId = @TrainTestId "; + List listStr = new List + { + new SqlParameter("@TrainTestId", this.trTrainTestDB.SelectedNode.NodeID) + }; + if (!string.IsNullOrEmpty(this.TrainTestItemCode.Text.Trim())) + { + strSql += " AND TrainTestItemCode LIKE @TrainTestItemCode"; + listStr.Add(new SqlParameter("@TrainTestItemCode", "%" + this.TrainTestItemCode.Text.Trim() + "%")); + } + if (!string.IsNullOrEmpty(this.TraiinTestItemName.Text.Trim())) + { + strSql += " AND TraiinTestItemName LIKE @TraiinTestItemName"; + listStr.Add(new SqlParameter("@TraiinTestItemName", "%" + this.TraiinTestItemName.Text.Trim() + "%")); + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + } + + /// + /// 增加安全试题库明细 + /// + /// + /// + protected void btnNewDetail_Click(object sender, EventArgs e) + { + if (this.trTrainTestDB.SelectedNode != null) + { + if (this.trTrainTestDB.SelectedNode.Nodes.Count == 0 && this.trTrainTestDB.SelectedNode.NodeID != "0") + { + + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("TrainTestItemEdit.aspx?TrainTestId={0}", this.trTrainTestDB.SelectedNode.NodeID, "编辑 - "))); + + } + else + { + ShowNotify("请选择末级节点!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + + /// + /// 编辑安全试题库明细 + /// + /// + /// + protected void btnEditDetail_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuEdit_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑数据方法 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + + string trainTestItemId = Grid1.SelectedRowID; + + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("TrainTestItemEdit.aspx?TrainTestItemId={0}", trainTestItemId, "编辑 - "))); + + } + + + /// + /// 删除安全试题库明细 + /// + /// + /// + protected void btnDeleteDetail_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 删除方法 + /// + private void DeleteData() + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + var getV = BLL.TrainTestDBItemService.GetTrainTestDBItemById(rowID); + if (getV != null) + { + BLL.LogService.AddSys_Log(this.CurrUser, getV.TrainTestItemCode, getV.TrainTestItemId, BLL.Const.TrainTestDBMenuId, BLL.Const.BtnDelete); + BLL.TrainTestDBItemService.DeleteTrainTestDBItemById(rowID); + + } } + + BindGrid(); + ShowNotify("删除数据成功!"); + } + } + + /// + /// + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + /// + /// Grid1行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// Grid1排序 + /// + /// + /// + protected void Grid1_Sort(object sender, GridSortEventArgs e) + { + Grid1.SortDirection = e.SortDirection; + Grid1.SortField = e.SortField; + BindGrid(); + } + + /// + /// 分页下拉选择事件 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// 关闭弹出窗口1 + /// + /// + /// + protected void Window1_Close(object sender, WindowCloseEventArgs e) + { + InitTreeMenu(); + } + + /// + /// 关闭弹出窗口2 + /// + /// + /// + protected void Window2_Close(object sender, WindowCloseEventArgs e) + { + BindGrid(); + } + + #region 导出 + /// + /// 关闭导出窗口 + /// + /// + /// + protected void Window5_Close(object sender, WindowCloseEventArgs e) + { + Response.ClearContent(); + Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + Response.Write(GetGridTableHtml(Grid1, e.CloseArgument.Split('#'))); + Response.End(); + } + + /// + /// 导出 + /// + /// + /// + /// + private string GetGridTableHtml(Grid grid, string[] columns) + { + StringBuilder sb = new StringBuilder(); + sb.Append(""); + List columnHeaderTexts = new List(columns); + List columnIndexs = new List(); + sb.Append(""); + sb.Append(""); + foreach (GridColumn column in grid.Columns) + { + if (columnHeaderTexts.Contains(column.HeaderText)) + { + sb.AppendFormat("", column.HeaderText); + columnIndexs.Add(column.ColumnIndex); + } + } + sb.Append(""); + foreach (GridRow row in grid.Rows) + { + sb.Append(""); + int columnIndex = 0; + foreach (object value in row.Values) + { + if (columnIndexs.Contains(columnIndex)) + { + string html = value.ToString(); + if (html.StartsWith(Grid.TEMPLATE_PLACEHOLDER_PREFIX)) + { + // 模板列 + string templateID = html.Substring(Grid.TEMPLATE_PLACEHOLDER_PREFIX.Length); + Control templateCtrl = row.FindControl(templateID); + html = GetRenderedHtmlSource(templateCtrl); + } + //else + //{ + // // 处理CheckBox + // if (html.Contains("f-grid-static-checkbox")) + // { + // if (!html.Contains("f-checked")) + // { + // html = "×"; + // } + // else + // { + // html = "√"; + // } + // } + // // 处理图片 + // if (html.Contains("{0}", html); + } + columnIndex++; + } + sb.Append(""); + } + sb.Append("
{0}
"); + return sb.ToString(); + } + + /// + /// 获取控件渲染后的HTML源代码 + /// + /// + /// + private string GetRenderedHtmlSource(Control ctrl) + { + if (ctrl != null) + { + using (StringWriter sw = new StringWriter()) + { + using (HtmlTextWriter htw = new HtmlTextWriter(sw)) + { + ctrl.RenderControl(htw); + return sw.ToString(); + } + } + } + return String.Empty; + } + #endregion + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TrainTestDBMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnAdd)) + { + this.btnNew.Hidden = false; + this.btnNewDetail.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnModify)) + { + this.btnEdit.Hidden = false; + this.btnMenuEdit.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnDelete.Hidden = false; + this.btnMenuDelete.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnOut)) + { + this.btnSelectColumns.Hidden = false; + } + } + } + #endregion + + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDB.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDB.aspx.designer.cs new file mode 100644 index 00000000..e6797648 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDB.aspx.designer.cs @@ -0,0 +1,260 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainTestDB + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// panelLeftRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelLeftRegion; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// btnEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnEdit; + + /// + /// btnDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDelete; + + /// + /// trTrainTestDB 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tree trTrainTestDB; + + /// + /// panelCenterRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelCenterRegion; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar3; + + /// + /// TrainTestItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox TrainTestItemCode; + + /// + /// TraiinTestItemName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox TraiinTestItemName; + + /// + /// btnNewDetail 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNewDetail; + + /// + /// btnSelectColumns 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSelectColumns; + + /// + /// lblTrainTestItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblTrainTestItemCode; + + /// + /// lblTraiinTestItemName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblTraiinTestItemName; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Window2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window2; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuEdit; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBEdit.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBEdit.aspx new file mode 100644 index 00000000..233f7ee6 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBEdit.aspx @@ -0,0 +1,51 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainTestDBEdit.aspx.cs" + Inherits="FineUIPro.Web.Person.EduTrain.TrainTestDBEdit" %> + + + + + 编辑安全试题库 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBEdit.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBEdit.aspx.cs new file mode 100644 index 00000000..98034ba7 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBEdit.aspx.cs @@ -0,0 +1,159 @@ +using BLL; +using System; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TrainTestDBEdit : PageBase + { + #region 定义变量 + public string TrainTestId + { + get + { + return (string)ViewState["TrainTestId"]; + } + set + { + ViewState["TrainTestId"] = value; + } + } + + public string SupTrainingId + { + get + { + return (string)ViewState["SupTrainingId"]; + } + set + { + ViewState["SupTrainingId"] = value; + } + } + #endregion + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.GetButtonPower(); + LoadData(); + + this.drpIsEndLever.DataTextField = "TypeName"; + drpIsEndLever.DataValueField = "TypeId"; + drpIsEndLever.DataSource = BLL.TrainingService.GetIsEndLeverList(); + drpIsEndLever.DataBind(); + + this.TrainTestId = Request.Params["TrainTestId"]; + this.SupTrainingId = Request.QueryString["SupTrainingId"]; + if (!string.IsNullOrEmpty(this.TrainTestId)) + { + Model.Training_TrainTestDB trainTestDB = BLL.TrainTestDBService.GetTrainTestDBById(this.TrainTestId); + if (trainTestDB != null) + { + this.txtTrainTestCode.Text = trainTestDB.TrainTestCode; + this.txtTrainTestName.Text = trainTestDB.TrainTestName; + if (trainTestDB.IsEndLever == true) + { + this.drpIsEndLever.SelectedValue = "true"; + } + else + { + this.drpIsEndLever.SelectedValue = "false"; + } + } + } + } + } + + private void LoadData() + { + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + } + #endregion + + #region 保存 + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + Model.Training_TrainTestDB trainTestDB = new Model.Training_TrainTestDB + { + TrainTestCode = this.txtTrainTestCode.Text.Trim(), + TrainTestName = this.txtTrainTestName.Text.Trim() + }; + if (this.drpIsEndLever.SelectedValue == "true") + { + trainTestDB.IsEndLever = true; + } + else + { + trainTestDB.IsEndLever = false; + } + if (string.IsNullOrEmpty(this.TrainTestId)) + { + trainTestDB.TrainTestId = SQLHelper.GetNewID(typeof(Model.Training_TrainTestDB)); + trainTestDB.SupTrainTestId = this.SupTrainingId; + BLL.TrainTestDBService.AddTrainTestDB(trainTestDB); + BLL.LogService.AddSys_Log(this.CurrUser, trainTestDB.TrainTestCode, trainTestDB.TrainTestId, BLL.Const.TrainTestDBMenuId, BLL.Const.BtnAdd); + } + else + { + Model.Training_TrainTestDB t = BLL.TrainTestDBService.GetTrainTestDBById(this.TrainTestId); + if (t != null) + { + trainTestDB.SupTrainTestId = t.SupTrainTestId; + } + trainTestDB.TrainTestId = this.TrainTestId; + BLL.TrainTestDBService.UpdateTrainTestDB(trainTestDB); + BLL.LogService.AddSys_Log(this.CurrUser, trainTestDB.TrainTestCode, trainTestDB.TrainTestId, BLL.Const.TrainTestDBMenuId, BLL.Const.BtnModify); + } + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + #endregion + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TrainTestDBMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnSave)) + { + this.btnSave.Hidden = false; + } + } + } + #endregion + + #region 验证名称是否存在 + /// + /// 验证名称是否存在 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + var q = Funs.DB.Training_TrainTestDB.FirstOrDefault(x => x.SupTrainTestId == this.SupTrainingId && x.TrainTestName == this.txtTrainTestName.Text.Trim() && (x.TrainTestId != this.TrainTestId || (this.TrainTestId == null && x.TrainTestId != null))); + if (q != null) + { + ShowNotify("输入的名称已存在!", MessageBoxIcon.Warning); + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBEdit.aspx.designer.cs new file mode 100644 index 00000000..002faa76 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBEdit.aspx.designer.cs @@ -0,0 +1,98 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainTestDBEdit + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtTrainTestCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainTestCode; + + /// + /// txtTrainTestName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainTestName; + + /// + /// drpIsEndLever 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpIsEndLever; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBSelectCloumn.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBSelectCloumn.aspx new file mode 100644 index 00000000..4367a1a6 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBSelectCloumn.aspx @@ -0,0 +1,34 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainTestDBSelectCloumn.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TrainTestDBSelectCloumn" %> + + + + + + 安全试题库导出选择列 + + + +
+ + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBSelectCloumn.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBSelectCloumn.aspx.cs new file mode 100644 index 00000000..beec4044 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBSelectCloumn.aspx.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TrainTestDBSelectCloumn : PageBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + LoadData(); + } + } + + private void LoadData() + { + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + } + + /// + /// 导出按钮 + /// + /// + /// + protected void btnImport_Click(object sender, EventArgs e) + { + // 1. 这里放置保存窗体中数据的逻辑 + // 2. 关闭本窗体,然后回发父窗体 + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference(String.Join("#", cblColumns.SelectedValueArray))); + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBSelectCloumn.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBSelectCloumn.aspx.designer.cs new file mode 100644 index 00000000..957c88cc --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestDBSelectCloumn.aspx.designer.cs @@ -0,0 +1,80 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainTestDBSelectCloumn + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + + /// + /// btnImport 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnImport; + + /// + /// cblColumns 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBoxList cblColumns; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestItemEdit.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestItemEdit.aspx new file mode 100644 index 00000000..a82f238a --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestItemEdit.aspx @@ -0,0 +1,54 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainTestItemEdit.aspx.cs" + Inherits="FineUIPro.Web.Person.EduTrain.TrainTestItemEdit" Async="true" %> + + + + + 编辑安全试题库明细 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestItemEdit.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestItemEdit.aspx.cs new file mode 100644 index 00000000..9bb9d7af --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestItemEdit.aspx.cs @@ -0,0 +1,178 @@ +using BLL; +using System; +using System.Linq; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TrainTestItemEdit :PageBase + { + #region 定义变量 + public string TrainTestId + { + get + { + return (string)ViewState["TrainTestId"]; + } + set + { + ViewState["TrainTestId"] = value; + } + } + + public string TrainTestItemId + { + get + { + return (string)ViewState["TrainTestItemId"]; + } + set + { + ViewState["TrainTestItemId"] = value; + } + } + + #endregion + + #region 加载页面 + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.GetButtonPower(); + this.TrainTestId = Request.Params["TrainTestId"]; + this.TrainTestItemId = Request.Params["TrainTestItemId"]; + if (!string.IsNullOrEmpty(this.TrainTestItemId)) + { + Model.Training_TrainTestDBItem trainTestDBItem = BLL.TrainTestDBItemService.GetTrainTestDBItemById(this.TrainTestItemId); + if (trainTestDBItem!=null) + { + this.TrainTestId = trainTestDBItem.TrainTestId; + this.txtTrainTestItemCode.Text = trainTestDBItem.TrainTestItemCode; + this.txtTrainTestItemName.Text = trainTestDBItem.TraiinTestItemName; + if (!string.IsNullOrEmpty(trainTestDBItem.AttachUrl)) + { + //this.FullAttachUrl = trainTestDBItem.AttachUrl; + //this.lbAttachUrl.Text = trainTestDBItem.AttachUrl.Substring(trainTestDBItem.AttachUrl.IndexOf("~") + 1); + } + } + } + } + } + #endregion + + #region 保存数据 + /// + /// 保存数据 + /// + private void SaveData( bool isClose) + { + Model.Training_TrainTestDBItem trainTestDBItem = new Model.Training_TrainTestDBItem + { + TrainTestItemCode = this.txtTrainTestItemCode.Text.Trim(), + TraiinTestItemName = this.txtTrainTestItemName.Text.Trim(), + //trainTestDBItem.AttachUrl = this.FullAttachUrl; + }; + if (string.IsNullOrEmpty(this.TrainTestItemId)) + { + trainTestDBItem.IsPass = true; + trainTestDBItem.CompileMan = this.CurrUser.UserName; + trainTestDBItem.UnitId = this.CurrUser.UnitId; + trainTestDBItem.CompileDate = DateTime.Now; + trainTestDBItem.TrainTestId = this.TrainTestId; + trainTestDBItem.TrainTestItemId = SQLHelper.GetNewID(typeof(Model.Training_TrainTestDBItem)); + TrainTestItemId = trainTestDBItem.TrainTestItemId; + BLL.TrainTestDBItemService.AddTrainTestDBItem(trainTestDBItem); + BLL.LogService.AddSys_Log(this.CurrUser, trainTestDBItem.TrainTestItemCode, trainTestDBItem.TrainTestItemId, BLL.Const.TrainTestDBMenuId, BLL.Const.BtnAdd); + } + else + { + Model.Training_TrainTestDBItem t = BLL.TrainTestDBItemService.GetTrainTestDBItemById(this.TrainTestItemId); + if (t != null) + { + trainTestDBItem.TrainTestId = t.TrainTestId; + } + trainTestDBItem.TrainTestItemId = this.TrainTestItemId; + BLL.TrainTestDBItemService.UpdateTrainTestDBItem(trainTestDBItem); + BLL.LogService.AddSys_Log(this.CurrUser, trainTestDBItem.TrainTestItemCode, trainTestDBItem.TrainTestItemId, BLL.Const.TrainTestDBMenuId, BLL.Const.BtnModify); + } + if (isClose) + { + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + } + + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + SaveData(true); + } + #endregion + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + if (Request.Params["value"] == "0") + { + return; + } + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TrainTestDBMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnSave)) + { + this.btnSave.Hidden = false; + //this.btnUpFile.Hidden = false; + //this.btnDelete.Hidden = false; + } + } + } + #endregion + + #region 验证试题名称是否存在 + /// + /// 验证试题名称是否存在 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + var q = Funs.DB.Training_TrainTestDBItem.FirstOrDefault(x => x.IsPass == true && x.TrainTestId == this.TrainTestId && x.TraiinTestItemName == this.txtTrainTestItemName.Text.Trim() && (x.TrainTestItemId != this.TrainTestItemId || (this.TrainTestItemId == null && x.TrainTestItemId != null))); + if (q != null) + { + ShowNotify("输入的试题名称已存在!", MessageBoxIcon.Warning); + } + } + #endregion + + /// + /// 上传附件资源 + /// + /// + /// + protected void btnUploadResources_Click(object sender, EventArgs e) + { + if (this.btnSave.Hidden) + { + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/TrainTestDB&type=-1", TrainTestItemId))); + } + else + { + if (string.IsNullOrEmpty(this.TrainTestItemId)) + { + SaveData( false); + } + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/TrainTestDB&menuId={1}", TrainTestItemId, BLL.Const.TrainTestDBMenuId))); + } + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestItemEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestItemEdit.aspx.designer.cs new file mode 100644 index 00000000..21b441c3 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestItemEdit.aspx.designer.cs @@ -0,0 +1,125 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainTestItemEdit + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtTrainTestItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainTestItemCode; + + /// + /// txtTrainTestItemName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainTestItemName; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// lbTemp 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbTemp; + + /// + /// btnAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAttachUrl; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// hdCompileMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdCompileMan; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecord.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecord.aspx new file mode 100644 index 00000000..8e05678f --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecord.aspx @@ -0,0 +1,139 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainTestRecord.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TrainTestRecord" %> + + + + + + 考试记录 + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + <%-- + --%> + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecord.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecord.aspx.cs new file mode 100644 index 00000000..4f3cf81a --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecord.aspx.cs @@ -0,0 +1,270 @@ +using Aspose.Words; +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.IO; +using System.Linq; +using System.Text; +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TrainTestRecord : PageBase + { + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + this.btnMenuDelete.Hidden = false; + + btnNew.OnClientClick = Window1.GetShowReference("TrainTestRecordEdit.aspx") + "return false;"; + + ///更新没有结束时间且超时的考试记录 + GetDataService.UpdateTestPlanStates(); + // 绑定表格 + BindGrid(); + } + else + { + if (GetRequestEventArgument() == "reloadGrid") + { + BindGrid(); + } + } + } + #endregion + + #region 绑定数据 + /// + /// 绑定数据 + /// + private void BindGrid() + { + string strSql = @"select TrainingTestRecordId, + TrainingName, + UnitId, + DateA, + DateZ, + TrainingType, + PeopleNum + from Training_TrainTestRecord where ProjectId is null "; + List listStr = new List(); + if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) + { + strSql += " AND TrainingName LIKE @name "; + listStr.Add(new SqlParameter("@name", "%" + this.txtName.Text.Trim() + "%")); + } + + + + if (!string.IsNullOrEmpty(this.txtStartDate.Text)) + { + strSql += " AND TestRecord.TestStartTime >= @StartDate"; + listStr.Add(new SqlParameter("@StartDate", Funs.GetNewDateTime(this.txtStartDate.Text))); + } + if (!string.IsNullOrEmpty(this.txtEndDate.Text)) + { + strSql += " AND TestRecord.TestEndTime <= @EndDate "; + listStr.Add(new SqlParameter("@EndDate", Funs.GetNewDateTime(this.txtEndDate.Text))); + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + + Grid1.DataSource = table; + Grid1.DataBind(); + + } + #endregion + + #region 分页、关闭窗口 + /// + /// 分页 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + BindGrid(); + } + + #endregion + + #region 编辑 + /// + /// Grid行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuView_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑数据方法 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + return; + } + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TrainTestRecordEdit.aspx?TrainingTestRecordId={0}", Grid1.SelectedRowID, "编辑 - "))); + } + #endregion + + + #region 查询事件 + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + + protected void IsTemp_CheckedChanged(object sender, CheckedEventArgs e) + { + this.BindGrid(); + } + #endregion + + #region 删除 + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 删除方法 + /// + private void DeleteData() + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + + BLL.LogService.AddSys_Log(this.CurrUser, "培训考试记录", rowID, BLL.Const.ProjectTrainTestRecordMenuId1, BLL.Const.BtnDelete); + BLL.TrainTestRecordService.DeleteTrainTestRecordById(rowID); + + } + BindGrid(); + ShowNotify("删除数据成功!"); + } + } + #endregion + + #region 导出按钮 + /// + /// 导出事件 + /// + /// + /// + protected void btnMenuOut_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("考试记录" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid1.PageSize = Grid1.RecordCount; + BindGrid(); + Response.Write(GetGridTableHtml(Grid1)); + Response.End(); + } + #endregion + + //protected void btnPrint_Click(object sender, EventArgs e) + //{ + // if (Grid1.SelectedRowIndexArray.Length == 0) + // { + // Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + // return; + // } + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TestRecordPrint.aspx?TestRecordId={0}", Grid1.SelectedRowID, "编辑 - "), "考试试卷", 900, 650)); + //} + public string ConvertUnit(object id) + { + return UnitService.GetUnitNameByUnitId(id.ToString()); + } + public string ConvertTrainingType(object id) + { + var type = Funs.DB.Base_TrainType.FirstOrDefault(x=>x.TrainTypeId == id.ToString()); + if (type != null) + return type.TrainTypeName; + return ""; + } + protected void btnPrint_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + + PrinterDocService.PrinterDocMethod(Const.ProjectTestRecordMenuId, Grid1.SelectedRowID, "试卷"); + } + /// + /// 关闭弹出窗 + /// + /// + /// + protected void Window1_Close(object sender, WindowCloseEventArgs e) + { + BindGrid(); + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecord.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecord.aspx.designer.cs new file mode 100644 index 00000000..8681eae6 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecord.aspx.designer.cs @@ -0,0 +1,206 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainTestRecord + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// txtName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtName; + + /// + /// txtStartDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtStartDate; + + /// + /// txtEndDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtEndDate; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// labNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label labNumber; + + /// + /// Label2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label2; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label1; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuView 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuView; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecordEdit.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecordEdit.aspx new file mode 100644 index 00000000..2bf514e6 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecordEdit.aspx @@ -0,0 +1,153 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainTestRecordEdit.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TrainTestRecordEdit" %> + + + + + +质量巡检 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecordEdit.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecordEdit.aspx.cs new file mode 100644 index 00000000..938e7055 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecordEdit.aspx.cs @@ -0,0 +1,221 @@ + +using BLL; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Globalization; +using System.Linq; +using System.Threading.Tasks; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TrainTestRecordEdit : PageBase + { + #region 公共字段 + /// + /// 主键 + /// + public string TrainingTestRecordId + { + get + { + return (string)ViewState["TrainingTestRecordId"]; + } + set + { + ViewState["TrainingTestRecordId"] = value; + } + } + #endregion + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpUnit, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, false); + var trainType = Funs.DB.Base_TrainType.OrderBy(u => u.TrainTypeCode).ToList(); + drpType.DataValueField = "TrainTypeId"; + drpType.DataTextField = "TrainTypeName"; + this. drpType.DataSource = trainType; + this. drpType.DataBind(); + Funs.FineUIPleaseSelect(drpType); + TrainingTestRecordId = Request.Params["TrainingTestRecordId"]; + + if (!string.IsNullOrEmpty(TrainingTestRecordId)) + { + this.hdCheckControlCode.Text = TrainingTestRecordId; + + var dt = CheckControlApproveService.getListData(TrainingTestRecordId); + + Model.Training_TrainTestRecord trainTestRecord = TrainTestRecordService.GetTrainTestRecordById(TrainingTestRecordId); + this.txtTrainingName.Text = trainTestRecord.TrainingName; + if (!string.IsNullOrEmpty(trainTestRecord.UnitId)) + { + this.drpUnit.SelectedValue = trainTestRecord.UnitId; + } + if (trainTestRecord.DateA.HasValue) + { + this.txtDateA.Text = trainTestRecord.DateA.Value.ToString("yyyy-MM-dd HH:mm:ss"); + } + if (trainTestRecord.DateZ.HasValue) + { + this.txtDateZ.Text = trainTestRecord.DateZ.Value.ToString("yyyy-MM-dd HH:mm:ss"); + } + if (!string.IsNullOrEmpty(trainTestRecord.TrainingType)) + { + this.drpType.SelectedValue = trainTestRecord.TrainingType; + } + this.txtPeopleNum.Text = trainTestRecord.PeopleNum; + } + + } + } + + + #region 附件上传 + /// + /// 上传附件 + /// + /// + /// + protected void btnAttach_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(this.hdCheckControlCode.Text)) //新增记录 + { + this.hdCheckControlCode.Text = SQLHelper.GetNewID(typeof(Model.Training_TrainTestRecord)); + } + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/CheckControl&menuId={2}", "1", this.hdCheckControlCode.Text + "r", BLL.Const.CheckListMenuId))); + } + #endregion + + + + protected void imgBtnFile_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(this.hdCheckControlCode.Text)) //新增记录 + { + this.hdCheckControlCode.Text = SQLHelper.GetNewID(typeof(Model.Training_TrainTestRecord)); + } + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/CheckControl&menuId={2}", "1", this.hdCheckControlCode.Text + "re", BLL.Const.CheckListMenuId))); + } + + protected void btnSave_Click(object sender, EventArgs e) + { + //string projectId, string userId, string menuId, string buttonName) + if (BLL.CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectTrainTestRecordMenuId1, BLL.Const.BtnSave)) + { + if (string.IsNullOrEmpty(txtTrainingName.Text.ToString())) + { + Alert.ShowInTop("培训名称必填!", MessageBoxIcon.Warning); + return; + } + if (drpUnit.SelectedValue == null || drpUnit.SelectedValue == BLL.Const._Null) + { + Alert.ShowInTop("培训名称必填!", MessageBoxIcon.Warning); + return; + } + if (string.IsNullOrEmpty(txtDateA.Text.ToString())) + { + Alert.ShowInTop("开始时间必填!", MessageBoxIcon.Warning); + return; + } + if (string.IsNullOrEmpty(txtDateA.Text.ToString())) + { + Alert.ShowInTop("结束时间必填!", MessageBoxIcon.Warning); + return; + } + if (drpType.SelectedValue==null||drpType.SelectedValue == BLL.Const._Null) + { + Alert.ShowInTop("培训类型必填!", MessageBoxIcon.Warning); + return; + } + if (string.IsNullOrEmpty(txtPeopleNum.Text.ToString())) + { + Alert.ShowInTop("培训人数必填!", MessageBoxIcon.Warning); + return; + } + SavePauseNotice("save"); + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + //Response.Redirect("/check/CheckList.aspx"); + + } + else + { + Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); + } + } + + + #region 保存处理 + /// + /// 保存方法 + /// + private void SavePauseNotice(string saveType) + { + Model.Training_TrainTestRecord checkControl = new Model.Training_TrainTestRecord(); + checkControl.TrainingName = this.txtTrainingName.Text.Trim(); + checkControl.ProjectId = this.CurrUser.LoginProjectId; + if (this.drpUnit.SelectedValue != Const._Null) + { + checkControl.UnitId = this.drpUnit.SelectedValue; + } + if (this.drpType.SelectedValue != Const._Null) + { + checkControl.TrainingType = this.drpType.SelectedValue; + } + + if (!string.IsNullOrEmpty(this.txtDateA.Text.Trim())) + { + DateTimeFormatInfo dtFormat = new DateTimeFormatInfo(); + + dtFormat.ShortDatePattern = "yyyy-MM-dd HH:mm:ss"; + checkControl.DateA = Convert.ToDateTime(this.txtDateA.Text.Trim(), dtFormat); + } + if (!string.IsNullOrEmpty(this.txtDateZ.Text.Trim())) + { + DateTimeFormatInfo dtFormat = new DateTimeFormatInfo(); + + dtFormat.ShortDatePattern = "yyyy-MM-dd HH:mm:ss"; + checkControl.DateZ = Convert.ToDateTime(this.txtDateZ.Text.Trim(), dtFormat); + } + if (!string.IsNullOrEmpty(this.txtPeopleNum.Text.Trim())) + { + checkControl.PeopleNum =this.txtPeopleNum.Text.Trim(); + } + //checkControl.AttachUrl = this.hdFilePath.Value; + + if (!string.IsNullOrEmpty(TrainingTestRecordId) && BLL.TrainTestRecordService.GetTrainTestRecordById(Request.Params["TrainingTestRecordId"]) != null) + { + + checkControl.TrainingTestRecordId = TrainingTestRecordId; + BLL.TrainTestRecordService.UpdateTrainTestRecord(checkControl); + } + else + { + checkControl.TrainingTestRecordId = Guid.NewGuid().ToString(); + BLL.TrainTestRecordService.AddTestRecord(checkControl); + + } + + + BLL.LogService.AddSys_Log(this.CurrUser, checkControl.TrainingTestRecordId, TrainingTestRecordId, BLL.Const.CheckListMenuId, "编辑质量巡检记录"); + //BLL.LogService.AddLog(this.CurrUser.UserId, "编辑质量巡检记录", this.CurrUser.LoginProjectId); + } + #endregion + + + + + + + + protected void WindowAtt_Close(object sender, WindowCloseEventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecordEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecordEdit.aspx.designer.cs new file mode 100644 index 00000000..b6db8716 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestRecordEdit.aspx.designer.cs @@ -0,0 +1,251 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainTestRecordEdit + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// Form2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form Form2; + + /// + /// txtTrainingName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainingName; + + /// + /// drpUnit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpUnit; + + /// + /// txtDateA 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtDateA; + + /// + /// txtDateZ 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtDateZ; + + /// + /// drpType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpType; + + /// + /// txtPeopleNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtPeopleNum; + + /// + /// Panel2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel2; + + /// + /// lblAttach 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lblAttach; + + /// + /// btnAttach 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAttach; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// imgBtnFile 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button imgBtnFile; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// hdCheckControlCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdCheckControlCode; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// hdId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdId; + + /// + /// hdAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdAttachUrl; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuEdit; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestView.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestView.aspx new file mode 100644 index 00000000..c9ff55e6 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestView.aspx @@ -0,0 +1,68 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainTestView.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TrainTestView" %> + + + + + + 培训试题 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestView.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestView.aspx.cs new file mode 100644 index 00000000..e17eb33f --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestView.aspx.cs @@ -0,0 +1,103 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TrainTestView : PageBase + { + /// + /// 加载 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + // ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + BindGrid(); + } + } + + /// + /// 绑定数据 + /// + private void BindGrid() + { + string trainDetailId = Request.Params["TrainDetailId"]; + var trainRecordDetail = BLL.EduTrain_TrainRecordDetailService.GetTrainDetailByTrainDetailId(trainDetailId); + if (trainRecordDetail != null) + { + var person = BLL.PersonService.GetPersonById(trainRecordDetail.PersonId); + var trainRecord = BLL.EduTrain_TrainRecordService.GetTrainingByTrainingId(trainRecordDetail.TrainingId); + if (person != null && trainRecord != null) + { + List viewList = new List(); + var trainTest = from x in Funs.DB.View_EduTrain_TrainTest + where x.TrainingId == trainRecord.TrainingId + orderby x.COrder + select x; + var trainPersonRecord = Funs.DB.EduTrain_TrainPersonRecord.FirstOrDefault(x => x.RecordId == trainRecord.FromRecordId && x.IdentifyId == person.IdentityCard); + if (trainPersonRecord != null && !string.IsNullOrEmpty(trainPersonRecord.Answers)) + { + List listAnswers = Funs.GetStrListByStr(trainPersonRecord.Answers, '|'); + foreach(var item in trainTest) + { + if (listAnswers.Count() > item.COrder) + { + item.Description = listAnswers[item.COrder.Value]; + } + + viewList.Add(item); + } + } + + Grid1.DataSource = viewList; + Grid1.DataBind(); + } + } + + for (int i = 0; i < Grid1.Rows.Count; i++) + { + if (Grid1.Rows[i].Values[2].ToString() != Grid1.Rows[i].Values[3].ToString()) + { + Grid1.Rows[i].RowCssClass = "Red"; + } + } + } + + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + + + #region 导出按钮 + /// 导出按钮 + /// + /// + /// + protected void btnOut_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("考试试题" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid1.PageSize = this.Grid1.Rows.Count(); + BindGrid(); + Response.Write(GetGridTableHtml(Grid1)); + Response.End(); + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestView.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestView.aspx.designer.cs new file mode 100644 index 00000000..4e75c409 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainTestView.aspx.designer.cs @@ -0,0 +1,80 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainTestView + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar3; + + /// + /// txtQsnContent 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtQsnContent; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainingItemSave.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainingItemSave.aspx new file mode 100644 index 00000000..641072d3 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainingItemSave.aspx @@ -0,0 +1,68 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainingItemSave.aspx.cs" + Inherits="FineUIPro.Web.Person.EduTrain.TrainingItemSave" Async="true" %> + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainingItemSave.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainingItemSave.aspx.cs new file mode 100644 index 00000000..e124b0c2 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainingItemSave.aspx.cs @@ -0,0 +1,200 @@ +using BLL; +using Model; +using System; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TrainingItemSave : PageBase + { + #region 定义变量 + /// + /// 主键 + /// + public string TrainingItemId + { + get + { + return (string)ViewState["TrainingItemId"]; + } + set + { + ViewState["TrainingItemId"] = value; + } + } + + /// + /// 主表主键 + /// + public string TrainingId + { + get + { + return (string)ViewState["TrainingId"]; + } + set + { + ViewState["TrainingId"] = value; + } + } + #endregion + + #region 加载页面 + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.GetButtonPower(); + LoadData(); + + this.TrainingItemId = Request.QueryString["TrainingItemId"]; + this.TrainingId = Request.QueryString["TrainingId"]; + if (!String.IsNullOrEmpty(this.TrainingItemId)) + { + var q = BLL.TrainingItemService.GetTrainingItemByTrainingItemId(this.TrainingItemId); + if (q != null) + { + txtTrainingItemCode.Text = q.TrainingItemCode; + txtTrainingItemName.Text = q.TrainingItemName; + txtCompileMan.Text = q.CompileMan; + hdCompileMan.Text = q.CompileMan; + if (q.CompileDate != null) + { + txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", q.CompileDate); + } + } + } + else + { + txtCompileMan.Text = this.CurrUser.UserName; + hdCompileMan.Text = this.CurrUser.UserName; + txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); + } + } + } + + private void LoadData() + { + + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + + } + #endregion + + #region 保存 + /// + /// 保存数据 + /// + private void SaveData(bool isClose) + { + Model.Training_TrainingItem trainingItem = new Training_TrainingItem + { + //TrainingItemId = Request.QueryString["TrainingItemId"]; + + TrainingItemCode = txtTrainingItemCode.Text.Trim(), + TrainingItemName = txtTrainingItemName.Text.Trim(), + CompileMan = hdCompileMan.Text.Trim(), + UnitId = this.CurrUser.UnitId + }; + if (!string.IsNullOrEmpty(txtCompileDate.Text.Trim())) + { + trainingItem.CompileDate = Convert.ToDateTime(txtCompileDate.Text.Trim()); + } + if (String.IsNullOrEmpty(TrainingItemId)) + { + trainingItem.IsPass = true; + trainingItem.TrainingItemId = SQLHelper.GetNewID(typeof(Model.Training_TrainingItem)); + trainingItem.TrainingId = this.TrainingId; + this.TrainingItemId = trainingItem.TrainingItemId; + BLL.TrainingItemService.AddTrainingItem(trainingItem); + BLL.LogService.AddSys_Log(this.CurrUser, trainingItem.TrainingItemCode, trainingItem.TrainingItemId, BLL.Const.TrainDBMenuId, BLL.Const.BtnAdd); + } + else + { + Model.Training_TrainingItem t = BLL.TrainingItemService.GetTrainingItemByTrainingItemId(TrainingItemId); + trainingItem.TrainingItemId = TrainingItemId; + if (t != null) + { + trainingItem.TrainingId = t.TrainingId; + } + BLL.TrainingItemService.UpdateTrainingItem(trainingItem); + BLL.LogService.AddSys_Log(this.CurrUser, trainingItem.TrainingItemCode, trainingItem.TrainingItemId, BLL.Const.TrainDBMenuId, BLL.Const.BtnModify); + } + if (isClose) + { + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + } + + /// + /// + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + SaveData(true); + } + #endregion + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + if (Request.Params["value"] == "0") + { + return; + } + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TrainDBMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnSave)) + { + this.btnSave.Hidden = false; + } + } + } + #endregion + + #region 验证教材名称是否存在 + /// + /// 验证教材名称是否存在 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + var q = Funs.DB.Training_TrainingItem.FirstOrDefault(x => x.IsPass == true && x.TrainingId == this.TrainingId && x.TrainingItemName == this.txtTrainingItemName.Text.Trim() && (x.TrainingItemId != this.TrainingItemId || (this.TrainingItemId == null && x.TrainingItemId != null))); + if (q != null) + { + ShowNotify("输入的教材名称已存在!", MessageBoxIcon.Warning); + } + } + #endregion + + /// + /// 上传附件资源 + /// + /// + /// + protected void btnUploadResources_Click(object sender, EventArgs e) + { + if (this.btnSave.Hidden) + { + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Training&type=-1", TrainingItemId))); + } + else + { + if (string.IsNullOrEmpty(this.TrainingItemId)) + { + SaveData(false); + } + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Training&menuId={1}", TrainingItemId, BLL.Const.TrainDBMenuId))); + } + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainingItemSave.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainingItemSave.aspx.designer.cs new file mode 100644 index 00000000..0fc6eb90 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainingItemSave.aspx.designer.cs @@ -0,0 +1,152 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainingItemSave + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtTrainingItemCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainingItemCode; + + /// + /// txtTrainingItemName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainingItemName; + + /// + /// txtCompileMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCompileMan; + + /// + /// txtCompileDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtCompileDate; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// lbTemp 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbTemp; + + /// + /// btnAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAttachUrl; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + + /// + /// hdCompileMan 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdCompileMan; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + } +} diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainingSave.aspx b/SGGL/FineUIPro.Web/Person/EduTrain/TrainingSave.aspx new file mode 100644 index 00000000..561f1599 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainingSave.aspx @@ -0,0 +1,48 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainingSave.aspx.cs" Inherits="FineUIPro.Web.Person.EduTrain.TrainingSave" %> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainingSave.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainingSave.aspx.cs new file mode 100644 index 00000000..68912934 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainingSave.aspx.cs @@ -0,0 +1,153 @@ +using BLL; +using Model; +using System; +using System.Linq; + +namespace FineUIPro.Web.Person.EduTrain +{ + public partial class TrainingSave : PageBase + { + /// + /// 主键 + /// + public string TrainingId + { + get + { + return (string)ViewState["TrainingId"]; + } + set + { + ViewState["TrainingId"] = value; + } + } + + public string SupTrainingId + { + get + { + return (string)ViewState["SupTrainingId"]; + } + set + { + ViewState["SupTrainingId"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.GetButtonPower(); + LoadData(); + + + this.drpIsEndLever.DataTextField = "TypeName"; + drpIsEndLever.DataValueField = "TypeId"; + drpIsEndLever.DataSource = BLL.TrainingService.GetIsEndLeverList(); + drpIsEndLever.DataBind(); + + TrainingId = Request.QueryString["TrainingId"]; + this.SupTrainingId = Request.QueryString["SupTrainingId"]; + if (!String.IsNullOrEmpty(TrainingId)) + { + var q = BLL.TrainingService.GetTrainingByTrainingId(TrainingId); + if (q != null) + { + txtTrainingCode.Text = q.TrainingCode; + txtTrainingName.Text = q.TrainingName; + if (q.IsEndLever == true) + { + this.drpIsEndLever.SelectedValue = "true"; + } + else + { + this.drpIsEndLever.SelectedValue = "false"; + } + } + } + } + } + + private void LoadData() + { + + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + + } + + protected void btnSave_Click(object sender, EventArgs e) + { + Model.Training_Training training = new Training_Training + { + //string trainingId = Request.QueryString["TrainingId"]; + + TrainingCode = txtTrainingCode.Text.Trim(), + TrainingName = txtTrainingName.Text.Trim(), + + IsEndLever = Convert.ToBoolean(drpIsEndLever.SelectedValue) + }; + if (String.IsNullOrEmpty(TrainingId)) + { + TrainingId = SQLHelper.GetNewID(typeof(Model.Training_Training)); + training.TrainingId = TrainingId; + training.SupTrainingId = this.SupTrainingId; + BLL.TrainingService.AddTraining(training); + BLL.LogService.AddSys_Log(this.CurrUser, training.TrainingCode, training.TrainingId, BLL.Const.TrainDBMenuId, BLL.Const.BtnAdd); + } + else + { + Model.Training_Training t = BLL.TrainingService.GetTrainingByTrainingId(TrainingId); + training.TrainingId = TrainingId; + if (t != null) + { + training.SupTrainingId = t.SupTrainingId; + } + training.IsBuild = t.IsBuild; + BLL.TrainingService.UpdateTraining(training); + BLL.LogService.AddSys_Log(this.CurrUser, training.TrainingCode, training.TrainingId, BLL.Const.TrainDBMenuId, BLL.Const.BtnModify); + } + // 2. 关闭本窗体,然后刷新父窗体 + // PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + // 2. 关闭本窗体,然后回发父窗体 + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + //PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(trainingId) + ActiveWindow.GetHideReference()); + + } + + #region 按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TrainDBMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnSave)) + { + this.btnSave.Hidden = false; + } + } + } + #endregion + + #region 验证培训教材库名称是否存在 + /// + /// 验证培训教材库名称是否存在 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + var standard = Funs.DB.Training_Training.FirstOrDefault(x => x.SupTrainingId == this.SupTrainingId && x.TrainingName == this.txtTrainingName.Text.Trim() && (x.TrainingId != this.TrainingId || (this.TrainingId == null && x.TrainingId != null))); + if (standard != null) + { + ShowNotify("输入的名称已存在!", MessageBoxIcon.Warning); + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainingSave.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainingSave.aspx.designer.cs new file mode 100644 index 00000000..4906b8b9 --- /dev/null +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainingSave.aspx.designer.cs @@ -0,0 +1,98 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Person.EduTrain +{ + + + public partial class TrainingSave + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtTrainingCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainingCode; + + /// + /// txtTrainingName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTrainingName; + + /// + /// drpIsEndLever 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpIsEndLever; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + } +} diff --git a/SGGL/FineUIPro.Web/index.aspx b/SGGL/FineUIPro.Web/index.aspx index 9b415d1b..a30beb0f 100644 --- a/SGGL/FineUIPro.Web/index.aspx +++ b/SGGL/FineUIPro.Web/index.aspx @@ -695,6 +695,23 @@ $(".bgbtn,.bgbtntop").removeClass("activeClick") }); + $(".t-head-set").click(function () { + var $item = $('.f-tabstrip-header') + $item.attr('style', ";display:block !important;") + }); + + $(".t-head-nav").click(function () { + var $item = $('.f-tabstrip-header') + $item.attr('style', ";display:block !important;") + }); + + $(".t-head-log").click(function () { + var $item = $('.f-tabstrip-header') + $item.attr('style', ";display:none !important;") + $(".bgbtn,.bgbtntop").removeClass("activeClick") + }); + + $(".bgbtn,.bgbtntop").click(function () { // 切换下tab样式 var $this = $(this) diff --git a/SGGL/Model/APIItem/CQMSItem.cs b/SGGL/Model/APIItem/CQMSItem.cs new file mode 100644 index 00000000..eb5b2e05 --- /dev/null +++ b/SGGL/Model/APIItem/CQMSItem.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public class CQMSItem + { + /// + /// Id + /// + public string Id { get; set; } + /// + /// 单位id + /// + public string UnitId { get; set; } + + /// + /// 社会统一信用码 + /// + public string CollCropCode { get; set; } + /// + /// 单位名称 + /// + public string UnitName { get; set; } + /// + /// 上报日期 + /// + public string ReportDate { get; set; } + /// + /// 质量培训人次数 + /// + public int? TrainPersonNum { get; set; } + /// + /// 技术交底人次数 + /// + public int? TechnicalDisclosePersonNum { get; set; } + /// + /// 在用计量器具数 + /// + public int? UseNum { get; set; } + /// + /// 校准合格数 + /// + public int? OKNum { get; set; } + /// + /// 企业总部人数 + /// + public int? CompanyPersonNum { get; set; } + /// + /// 分支机构人数 + /// + public int? BranchPersonNum { get; set; } + /// + /// 项目部人数 + /// + public int? ProjectPersonNum { get; set; } + /// + /// 问题个数 + /// + public int? ProblemNum { get; set; } + /// + /// 整改完成数 + /// + public int? ProblemCompletedNum { get; set; } + /// + /// 未整改数 + /// + public int? ProblemNotCompletedNum { get; set; } + /// + /// S级数 + /// + public int? SNum { get; set; } + /// + /// A级数 + /// + public int? ANum { get; set; } + /// + /// B级数 + /// + public int? BNum { get; set; } + /// + /// C级数 + /// + public int? CNum { get; set; } + /// + /// 关键工序验收数 + /// + public int? KeyProcessNum { get; set; } + /// + /// 关键工序验收合格数 + /// + public int? KeyProcessOKNum { get; set; } + /// + /// 特殊过程验收数 + /// + public int? SpecialProcessNum { get; set; } + /// + /// 特殊过程验收合格数 + /// + public int? SpecialProcessOKNum { get; set; } + /// + /// 隐蔽工程验收数 + /// + public int? ConcealedWorksNum { get; set; } + /// + /// 隐蔽工程验收合格数 + /// + public int? ConcealedWorksOKNum { get; set; } + /// + /// 单位工程一次验收数 + /// + public int? UnitProjectOnesNum { get; set; } + /// + /// 单位工程一次验收合格数 + /// + public int? UnitProjectOnesOKNum { get; set; } + /// + /// 材料进场复验数 + /// + public int? MaterialInRecheckNum { get; set; } + /// + /// 材料进场复验合格数 + /// + public int? MaterialInRecheckOKNum { get; set; } + /// + /// 单项工程个数 + /// + public int? SingleProjectNum { get; set; } + /// + /// 单位工程个数 + /// + public int? UnitProjectNum { get; set; } + /// + /// 分部工程个数 + /// + public int? SubProjectNum { get; set; } + /// + /// 分项工程个数 + /// + public int? SubdivisionalWorksNum { get; set; } + /// + /// 检验批个数 + /// + public int? InspectionLotNum { get; set; } + } +} diff --git a/SGGL/Model/APIItem/DefectItem.cs b/SGGL/Model/APIItem/DefectItem.cs new file mode 100644 index 00000000..9bfe8439 --- /dev/null +++ b/SGGL/Model/APIItem/DefectItem.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public class DefectItem + { + /// + /// Id + /// + public string Id { get; set; } + /// + /// 单位id + /// + public string UnitId { get; set; } + + /// + /// 社会统一信用码 + /// + public string CollCropCode { get; set; } + /// + /// 单位名称 + /// + public string UnitName { get; set; } + /// + /// 上报日期 + /// + public DateTime? ReportDate { get; set; } + /// + /// 缺陷名称 + /// + public string DefectName { get; set; } + /// + /// 缺陷数量 + /// + public int? DefectNum { get; set; } + } +} diff --git a/SGGL/Model/APIItem/HJGLItem.cs b/SGGL/Model/APIItem/HJGLItem.cs new file mode 100644 index 00000000..ca3f66b6 --- /dev/null +++ b/SGGL/Model/APIItem/HJGLItem.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public class HJGLItem + { + /// + /// Id + /// + public string Id { get; set; } + /// + /// 单位id + /// + public string UnitId { get; set; } + /// + /// 社会统一信用码 + /// + public string CollCropCode { get; set; } + /// + /// 单位名称 + /// + public string UnitName { get; set; } + /// + /// 上报日期 + /// + public DateTime? ReportDate { get; set; } + /// + /// 焊工总数 + /// + public int? WelderNum { get; set; } + /// + /// 总达因数 + /// + public int? TotalDineNum { get; set; } + /// + /// 完成达因数 + /// + public int? CompleteDineNum { get; set; } + /// + /// 总片数 + /// + public int? TotalFilmNum { get; set; } + /// + /// 合格片数 + /// + public int? OKFilmNum { get; set; } + + } +} diff --git a/SGGL/Model/APIItem/HSSE/PersonItem.cs b/SGGL/Model/APIItem/HSSE/PersonItem.cs index e306a909..e9367884 100644 --- a/SGGL/Model/APIItem/HSSE/PersonItem.cs +++ b/SGGL/Model/APIItem/HSSE/PersonItem.cs @@ -395,5 +395,9 @@ namespace Model get; set; } + /// + /// 部门ID + /// + public string DepartId { get; set; } } } diff --git a/SGGL/Model/APIItem/HSSE/TestPlanItem.cs b/SGGL/Model/APIItem/HSSE/TestPlanItem.cs index 6afc1889..5427c84c 100644 --- a/SGGL/Model/APIItem/HSSE/TestPlanItem.cs +++ b/SGGL/Model/APIItem/HSSE/TestPlanItem.cs @@ -179,6 +179,24 @@ namespace Model get; set; } + + /// + /// 考试部门ID + /// + public string DepartIds + { + get; + set; + } + /// + /// 考试部门名称 + /// + public string DepartNames + { + get; + set; + } + /// /// 考试二维码 /// diff --git a/SGGL/Model/APIItem/HSSE/TrainingPlanItem.cs b/SGGL/Model/APIItem/HSSE/TrainingPlanItem.cs index 83ac81df..cf6d3aeb 100644 --- a/SGGL/Model/APIItem/HSSE/TrainingPlanItem.cs +++ b/SGGL/Model/APIItem/HSSE/TrainingPlanItem.cs @@ -210,5 +210,22 @@ namespace Model get; set; } + + /// + /// 培训部门ID + /// + public string DepartIds + { + get; + set; + } + /// + /// 培训部门 + /// + public string DepartNames + { + get; + set; + } } } diff --git a/SGGL/Model/APIItem/HSSE/TrainingTaskItem.cs b/SGGL/Model/APIItem/HSSE/TrainingTaskItem.cs index 1a8b852a..7f1ed7de 100644 --- a/SGGL/Model/APIItem/HSSE/TrainingTaskItem.cs +++ b/SGGL/Model/APIItem/HSSE/TrainingTaskItem.cs @@ -48,6 +48,14 @@ namespace Model set; } /// + /// 培训任务状态 + /// + public string TaskStatesName + { + get; + set; + } + /// /// 培训计划时间 /// public string TrainStartDate @@ -111,5 +119,10 @@ namespace Model get; set; } + public string TrainingItemCode + { + get; + set; + } } } diff --git a/SGGL/Model/APIItem/HSSEItem.cs b/SGGL/Model/APIItem/HSSEItem.cs new file mode 100644 index 00000000..2aae78df --- /dev/null +++ b/SGGL/Model/APIItem/HSSEItem.cs @@ -0,0 +1,313 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public class HSSEItem + { + /// + /// Id + /// + public string Id { get; set; } + /// + /// 单位id + /// + public string UnitId { get; set; } + + /// + /// 社会统一信用码 + /// + public string CollCropCode { get; set; } + /// + /// 单位名称 + /// + public string UnitName { get; set; } + /// + /// 上报日期 + /// + public DateTime? ReportDate { get; set; } + /// + /// 在建项目数 + /// + public int? BeUnderConstructionNum { get; set; } + /// + /// 停工项目数 + /// + public int? ShutdownNum { get; set; } + /// + /// 参建人数 + /// + public int? JoinConstructionPersonNum { get; set; } + /// + /// 在施危大工程数 + /// + public int? MajorProjectsUnderConstructionNum { get; set; } + /// + /// 总工时数 + /// + public int? TotalWorkingHour { get; set; } + /// + /// 损失工时数 + /// + public int? LostWorkingHour { get; set; } + /// + /// 安全工时数 + /// + public int? SafeWorkingHour { get; set; } + /// + /// 三级安全教育培训数 + /// + public int? SafeTrainNum { get; set; } + /// + /// 专项培训数 + /// + public int? SpecialTrainNum { get; set; } + /// + /// 特种作业培训数 + /// + public int? SpecialOperationTrainNum { get; set; } + /// + /// 能耗总量 + /// + public decimal? TotalEnergyConsumption { get; set; } + /// + /// 万元营业收入综合能耗 + /// + public decimal? IncomeComprehensiveEnergyConsumption { get; set; } + /// + /// 用新水量 + /// + public decimal? NewWaterConsumption { get; set; } + /// + /// 企业总部总监人数 + /// + public int? HeadOfficeInspectorGeneralNum { get; set; } + /// + /// 企业总部专职人数 + /// + public int? HeadOfficeFullTimeNum { get; set; } + /// + /// 分支机构总监人数 + /// + public int? BranchInspectorGeneralNum { get; set; } + /// + /// 分支机构专职人数 + /// + public int? BranchFullTimeNum { get; set; } + /// + /// 项目总监人数 + /// + public int? ProjectInspectorGeneralNum { get; set; } + /// + /// 项目专职人数 + /// + public int? ProjectFullTimeNum { get; set; } + /// + /// 项目安全监护人数 + /// + public int? ProjectSafetyMonitorNum { get; set; } + /// + /// 在岗执业注安师 + /// + public int? SafetyInjectionEngineer { get; set; } + /// + /// A证人员 + /// + public int? CertificateANum { get; set; } + /// + /// B证人员 + /// + public int? CertificateBNum { get; set; } + /// + /// C证人员 + /// + public int? CertificateCNum { get; set; } + /// + /// 企业安委会会议数 + /// + public int? SafetyCommitteeMeetingNum { get; set; } + /// + /// 企业专题会议数 + /// + public int? EnterpriseTopicsMeetingNum { get; set; } + /// + /// 项目安全领导小组会议数 + /// + public int? ProjectSafetyLeadingGroupMeetingNum { get; set; } + /// + /// 项目安全例会数 + /// + public int? ProjectSafetyMeetingNum { get; set; } + /// + /// 企业负责人带班检查次数 + /// + public int? CompanyLeadShiftCheckNum { get; set; } + /// + /// 企业综合检查次数 + /// + public int? CompanyComprehensiveCheckNum { get; set; } + /// + /// 企业专项检查次数 + /// + public int? CompanySpecialCheckNum { get; set; } + /// + /// 项目负责人带班检查次数 + /// + public int? ProjectLeadShiftCheckNum { get; set; } + /// + /// 项目专项检查次数 + /// + public int? ProjectSpecialCheckNum { get; set; } + /// + /// 项目专业检查次数 + /// + public int? ProjectMajorCheckNum { get; set; } + /// + /// 未遂事件数 + /// + public int? NearMissNum { get; set; } + /// + /// 可记录事件数 + /// + public int? RecordableEventNum { get; set; } + /// + /// 一般事故数 + /// + public int? GeneralAccidentNum { get; set; } + /// + /// 较大事故数 + /// + public int? MajorAccidentNum { get; set; } + /// + /// 重大事故数 + /// + public int? SeriousAccidentNum { get; set; } + /// + /// 特别重大事故数 + /// + public int? SpecialSeriousAccidentNum { get; set; } + /// + /// 企业级综合预案数 + /// + public int? CompanyComprehensivePlanNum { get; set; } + /// + /// 企业级专项预案数 + /// + public int? CompanySpecialPlanNum { get; set; } + /// + /// 企业级现场处置预案 + /// + public int? CompanyOnSiteDisposalPlan { get; set; } + /// + /// 企业级演练次数 + /// + public int? CompanyDrillNum { get; set; } + /// + /// 项目级综合预案 + /// + public int? ProjectComprehensivePlanNum { get; set; } + /// + /// 项目级专项预案数 + /// + public int? ProjectSpecialPlanNum { get; set; } + /// + /// 项目级现场处置预案 + /// + public int? ProjectOnSiteDisposalPlan { get; set; } + /// + /// 项目级演练次数 + /// + public int? ProjectDrillNum { get; set; } + /// + /// 费用提取(万元) + /// + public int? CostExtract { get; set; } + /// + /// 费用使用(万元) + /// + public int? CostUse { get; set; } + /// + /// 施工机具在用数 + /// + public int? UseEquipmentNum { get; set; } + /// + /// 施工机具特种设备数 + /// + public int? SpecialEquipmentNum { get; set; } + /// + /// 作业许可项数 + /// + public int? LicensesNum { get; set; } + /// + /// 作业许可关闭项数 + /// + public int? LicensesCloseNum { get; set; } + /// + /// 一般隐患整改闭环项 + /// + public int? GeneralClosedNum { get; set; } + /// + /// 一般隐患未整改完成项 + /// + public int? GeneralNotClosedNum { get; set; } + /// + /// 重大隐患整改闭环项 + /// + public int? MajorClosedNum { get; set; } + /// + /// 重大隐患未整改完成项 + /// + public int? MajorNotClosedNum { get; set; } + /// + /// 一般风险数 + /// + public int? GeneralRiskNum { get; set; } + /// + /// 低风险数 + /// + public int? LowRiskNum { get; set; } + /// + /// 中风险数 + /// + public int? MediumRiskNum { get; set; } + /// + /// 高风险数 + /// + public int? HighRiskNum { get; set; } + /// + /// 危大工程审批完成数 + /// + public int? CompletedNum { get; set; } + /// + /// 危大工程培训人次数 + /// + public int? TrainPersonNum { get; set; } + /// + /// 危大工程施工个数 + /// + public int? ConstructionNum { get; set; } + /// + /// 危大工程完工个数 + /// + public int? FinishedNum { get; set; } + /// + /// 超危大工程审批完成数 + /// + public int? SuperCompletedNum { get; set; } + /// + /// 超危大工程培训人次数 + /// + public int? SuperTrainPersonNum { get; set; } + /// + /// 超危大工程施工个数 + /// + public int? SuperConstructionNum { get; set; } + /// + /// 超危大工程完工个数 + /// + public int? SuperFinishedNum { get; set; } + } +} diff --git a/SGGL/Model/APIItem/HiddenDangerItem.cs b/SGGL/Model/APIItem/HiddenDangerItem.cs new file mode 100644 index 00000000..19d68000 --- /dev/null +++ b/SGGL/Model/APIItem/HiddenDangerItem.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public class HiddenDangerItem + { + /// + /// Id + /// + public string Id { get; set; } + /// + /// 单位id + /// + public string UnitId { get; set; } + + /// + /// 社会统一信用码 + /// + public string CollCropCode { get; set; } + /// + /// 单位名称 + /// + public string UnitName { get; set; } + /// + /// 上报日期 + /// + public DateTime? ReportDate { get; set; } + + /// + /// 类别名称 + /// + public string TypeName { get; set; } + /// + /// 全部数量 + /// + public int? TotalNum { get; set; } + /// + /// 待整改数量 + /// + public int? NeedRectifyNum { get; set; } + } +} diff --git a/SGGL/Model/APIItem/SYHSEItem.cs b/SGGL/Model/APIItem/SYHSEItem.cs new file mode 100644 index 00000000..ededaeb6 --- /dev/null +++ b/SGGL/Model/APIItem/SYHSEItem.cs @@ -0,0 +1,169 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + public class SYHSEItem + { + /// + /// Id + /// + public string Id { get; set; } + /// + /// 单位id + /// + public string UnitId { get; set; } + + /// + /// 社会统一信用码 + /// + public string CollCropCode { get; set; } + /// + /// 单位名称 + /// + public string UnitName { get; set; } + /// + /// 上报日期 + /// + public DateTime? ReportDate { get; set; } + /// + /// 一般风险数 + /// + public int? GeneralRiskNum { get; set; } + /// + /// 低风险数 + /// + public int? LowRiskNum { get; set; } + /// + /// 中风险数 + /// + public int? MediumRiskNum { get; set; } + /// + /// 高风险数 + /// + public int? HighRiskNum { get; set; } + /// + /// 分级责任人数 + /// + public int? GradedResponsiblePersonNum { get; set; } + /// + /// 包保责任人数 + /// + public int? ChargeInsurancePersonNum { get; set; } + /// + /// 设计量 + /// + public int? DesignQuantity { get; set; } + /// + /// 运行量 + /// + public int? RunningCapacity { get; set; } + /// + /// 联锁设定值 + /// + public int? InterlockSettingValue { get; set; } + /// + /// 视频监控数 + /// + public int? VideoSurveillanceNum { get; set; } + /// + /// 总工时数 + /// + public int? TotalWorkinghours { get; set; } + /// + /// 安全工时数 + /// + public int? SafeWorkinghours { get; set; } + /// + /// 损失工时数 + /// + public int? LostWorkinghours { get; set; } + /// + /// 能耗总量 + /// + public int? TotalEnergyConsumption { get; set; } + /// + /// 万元营业收入综合能耗 + /// + public int? IncomeComprehensiveEnergyConsumption { get; set; } + /// + /// 用新水量 + /// + public int? NewWaterConsumption { get; set; } + /// + /// 一般隐患整改闭环项 + /// + public int? GeneralClosedNum { get; set; } + /// + /// 一般隐患未整改完成项 + /// + public int? GeneralNotClosedNum { get; set; } + /// + /// 重大隐患整改闭环项 + /// + public int? MajorClosedNum { get; set; } + /// + /// 重大隐患未整改完成项 + /// + public int? MajorNotClosedNum { get; set; } + /// + /// 动火许可项数 + /// + public int? HotWorkPermitNum { get; set; } + /// + /// 动火关闭项数 + /// + public int? HotWorkClosedNum { get; set; } + /// + /// 高处许可项数 + /// + public int? HighPermitNum { get; set; } + /// + /// 高处关闭项数 + /// + public int? HighClosedNum { get; set; } + /// + /// 临电许可项数 + /// + public int? TemporaryElectricityPermitNum { get; set; } + /// + /// 临电关闭项数 + /// + public int? TemporaryElectricityClosedNum { get; set; } + /// + /// 盲板许可项数 + /// + public int? BlindPlatePermitNum { get; set; } + /// + /// 盲板关闭项数 + /// + public int? BlindPlateClosedNum { get; set; } + /// + /// 动土许可项数 + /// + public int? GroundbreakingPermitNum { get; set; } + /// + /// 动土关闭项数 + /// + public int? GroundbreakingClosedNum { get; set; } + /// + /// 断路许可项数 + /// + public int? OpenCircuitPermitNum { get; set; } + /// + /// 断路关闭项数 + /// + public int? OpenCircuitClosedNum { get; set; } + /// + /// 吊装许可项数 + /// + public int? HoistingPermitNum { get; set; } + /// + /// 吊装关闭项数 + /// + public int? HoistingClosedNum { get; set; } + } +} diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index 1fb0017e..73b8bf9b 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -394714,6 +394714,10 @@ namespace Model private string _WorkPostIds; + private System.Nullable _LearningTime; + + private string _TestTrainingIds; + private EntitySet _Person_TrainingTask; private EntityRef _Training_CompanyTraining; @@ -394738,6 +394742,10 @@ namespace Model partial void OnCompileDateChanged(); partial void OnWorkPostIdsChanging(string value); partial void OnWorkPostIdsChanged(); + partial void OnLearningTimeChanging(System.Nullable value); + partial void OnLearningTimeChanged(); + partial void OnTestTrainingIdsChanging(string value); + partial void OnTestTrainingIdsChanged(); #endregion public Training_CompanyTrainingItem() @@ -394911,6 +394919,46 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LearningTime", DbType="Int")] + public System.Nullable LearningTime + { + get + { + return this._LearningTime; + } + set + { + if ((this._LearningTime != value)) + { + this.OnLearningTimeChanging(value); + this.SendPropertyChanging(); + this._LearningTime = value; + this.SendPropertyChanged("LearningTime"); + this.OnLearningTimeChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TestTrainingIds", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)] + public string TestTrainingIds + { + get + { + return this._TestTrainingIds; + } + set + { + if ((this._TestTrainingIds != value)) + { + this.OnTestTrainingIdsChanging(value); + this.SendPropertyChanging(); + this._TestTrainingIds = value; + this.SendPropertyChanged("TestTrainingIds"); + this.OnTestTrainingIdsChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Person_TrainingTask_Training_CompanyTrainingItem", Storage="_Person_TrainingTask", ThisKey="CompanyTrainingItemId", OtherKey="CompanyTrainingItemId", DeleteRule="NO ACTION")] public EntitySet Person_TrainingTask { @@ -395679,6 +395727,10 @@ namespace Model private string _Cycle; + private string _DepartIds; + + private string _DepartNames; + private EntitySet _EduTrain_TrainRecord; private EntityRef _Base_Project; @@ -395741,6 +395793,10 @@ namespace Model partial void OnQRCodeUrlChanged(); partial void OnCycleChanging(string value); partial void OnCycleChanged(); + partial void OnDepartIdsChanging(string value); + partial void OnDepartIdsChanged(); + partial void OnDepartNamesChanging(string value); + partial void OnDepartNamesChanged(); #endregion public Training_Plan() @@ -396173,6 +396229,46 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DepartIds", DbType="NVarChar(2000)")] + public string DepartIds + { + get + { + return this._DepartIds; + } + set + { + if ((this._DepartIds != value)) + { + this.OnDepartIdsChanging(value); + this.SendPropertyChanging(); + this._DepartIds = value; + this.SendPropertyChanged("DepartIds"); + this.OnDepartIdsChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DepartNames", DbType="NVarChar(2000)")] + public string DepartNames + { + get + { + return this._DepartNames; + } + set + { + if ((this._DepartNames != value)) + { + this.OnDepartNamesChanging(value); + this.SendPropertyChanging(); + this._DepartNames = value; + this.SendPropertyChanged("DepartNames"); + this.OnDepartNamesChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_EduTrain_TrainRecord_Training_Plan", Storage="_EduTrain_TrainRecord", ThisKey="PlanId", OtherKey="PlanId", DeleteRule="NO ACTION")] public EntitySet EduTrain_TrainRecord { @@ -397162,6 +397258,8 @@ namespace Model private System.Nullable _VideoProgress; + private string _CompanyTrainingItemId; + private EntityRef _SitePerson_Person; private EntityRef _Training_Plan; @@ -397194,6 +397292,8 @@ namespace Model partial void OnLearnTimeChanged(); partial void OnVideoProgressChanging(System.Nullable value); partial void OnVideoProgressChanged(); + partial void OnCompanyTrainingItemIdChanging(string value); + partial void OnCompanyTrainingItemIdChanged(); #endregion public Training_TaskItem() @@ -397436,6 +397536,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompanyTrainingItemId", DbType="NVarChar(100)")] + public string CompanyTrainingItemId + { + get + { + return this._CompanyTrainingItemId; + } + set + { + if ((this._CompanyTrainingItemId != value)) + { + this.OnCompanyTrainingItemIdChanging(value); + this.SendPropertyChanging(); + this._CompanyTrainingItemId = value; + this.SendPropertyChanged("CompanyTrainingItemId"); + this.OnCompanyTrainingItemIdChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Training_TaskItem_SitePerson_Person", Storage="_SitePerson_Person", ThisKey="PersonId", OtherKey="PersonId", IsForeignKey=true)] public SitePerson_Person SitePerson_Person { @@ -397613,6 +397733,8 @@ namespace Model private int _JValue; + private string _TrainTypeId; + private EntityRef _Base_Project; private EntityRef _Sys_User; @@ -397675,6 +397797,8 @@ namespace Model partial void OnMValueChanged(); partial void OnJValueChanging(int value); partial void OnJValueChanged(); + partial void OnTrainTypeIdChanging(string value); + partial void OnTrainTypeIdChanged(); #endregion public Training_TestPlan() @@ -398179,6 +398303,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TrainTypeId", DbType="NVarChar(50)")] + public string TrainTypeId + { + get + { + return this._TrainTypeId; + } + set + { + if ((this._TrainTypeId != value)) + { + this.OnTrainTypeIdChanging(value); + this.SendPropertyChanging(); + this._TrainTypeId = value; + this.SendPropertyChanged("TrainTypeId"); + this.OnTrainTypeIdChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Training_TestPlan_Base_Project", Storage="_Base_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)] public Base_Project Base_Project { @@ -398644,6 +398788,10 @@ namespace Model private int _Duration; + private string _Signature; + + private string _Fingerprint; + private EntityRef _Base_Project; private EntityRef _SitePerson_Person; @@ -398678,6 +398826,10 @@ namespace Model partial void OnIsFiledChanged(); partial void OnDurationChanging(int value); partial void OnDurationChanged(); + partial void OnSignatureChanging(string value); + partial void OnSignatureChanged(); + partial void OnFingerprintChanging(string value); + partial void OnFingerprintChanged(); #endregion public Training_TestRecord() @@ -398921,6 +399073,46 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Signature", DbType="NVarChar(1000)")] + public string Signature + { + get + { + return this._Signature; + } + set + { + if ((this._Signature != value)) + { + this.OnSignatureChanging(value); + this.SendPropertyChanging(); + this._Signature = value; + this.SendPropertyChanged("Signature"); + this.OnSignatureChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Fingerprint", DbType="NVarChar(1000)")] + public string Fingerprint + { + get + { + return this._Fingerprint; + } + set + { + if ((this._Fingerprint != value)) + { + this.OnFingerprintChanging(value); + this.SendPropertyChanging(); + this._Fingerprint = value; + this.SendPropertyChanged("Fingerprint"); + this.OnFingerprintChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Training_TestRecord_Base_Project", Storage="_Base_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)] public Base_Project Base_Project { @@ -399969,6 +400161,10 @@ namespace Model private string _EItemEng; + private string _DepartNames; + + private string _DepartIds; + private EntityRef _Training_TestTraining; private EntityRef _Training; @@ -400021,6 +400217,10 @@ namespace Model partial void OnDItemEngChanged(); partial void OnEItemEngChanging(string value); partial void OnEItemEngChanged(); + partial void OnDepartNamesChanging(string value); + partial void OnDepartNamesChanged(); + partial void OnDepartIdsChanging(string value); + partial void OnDepartIdsChanged(); #endregion public Training_TestTrainingItem() @@ -400474,6 +400674,46 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DepartNames", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)] + public string DepartNames + { + get + { + return this._DepartNames; + } + set + { + if ((this._DepartNames != value)) + { + this.OnDepartNamesChanging(value); + this.SendPropertyChanging(); + this._DepartNames = value; + this.SendPropertyChanged("DepartNames"); + this.OnDepartNamesChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DepartIds", DbType="NVarChar(4000)")] + public string DepartIds + { + get + { + return this._DepartIds; + } + set + { + if ((this._DepartIds != value)) + { + this.OnDepartIdsChanging(value); + this.SendPropertyChanging(); + this._DepartIds = value; + this.SendPropertyChanged("DepartIds"); + this.OnDepartIdsChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Training_TestTrainingItem_Training_TestTraining", Storage="_Training_TestTraining", ThisKey="TrainingId", OtherKey="TrainingId", IsForeignKey=true)] public Training_TestTraining Training_TestTraining { @@ -400887,6 +401127,8 @@ namespace Model private string _UpState; + private System.Nullable _LearningTime; + private EntitySet _Training_PlanItem; private EntityRef _Sys_User; @@ -400929,6 +401171,8 @@ namespace Model partial void OnUnitIdChanged(); partial void OnUpStateChanging(string value); partial void OnUpStateChanged(); + partial void OnLearningTimeChanging(System.Nullable value); + partial void OnLearningTimeChanged(); #endregion public Training_TrainingItem() @@ -401267,6 +401511,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LearningTime", DbType="Int")] + public System.Nullable LearningTime + { + get + { + return this._LearningTime; + } + set + { + if ((this._LearningTime != value)) + { + this.OnLearningTimeChanging(value); + this.SendPropertyChanging(); + this._LearningTime = value; + this.SendPropertyChanged("LearningTime"); + this.OnLearningTimeChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Training_PlanItem_Training_TrainingItem", Storage="_Training_PlanItem", ThisKey="TrainingItemId", OtherKey="TrainingEduItemId", DeleteRule="NO ACTION")] public EntitySet Training_PlanItem { @@ -456705,6 +456969,10 @@ namespace Model private string _AnswerItems; + private string _DepartIds; + + private string _DepartNames; + public View_Training_TestTrainingItem() { } @@ -457092,6 +457360,38 @@ namespace Model } } } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DepartIds", DbType="NVarChar(4000)")] + public string DepartIds + { + get + { + return this._DepartIds; + } + set + { + if ((this._DepartIds != value)) + { + this._DepartIds = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DepartNames", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)] + public string DepartNames + { + get + { + return this._DepartNames; + } + set + { + if ((this._DepartNames != value)) + { + this._DepartNames = value; + } + } + } } [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_Training_TrainingItem")] diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index 70d6f664..c64f0c50 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -73,10 +73,14 @@ + + + + @@ -86,6 +90,7 @@ + @@ -172,6 +177,7 @@ + diff --git a/SGGL/WebAPI/Controllers/HJGL/ReportQueryController.cs b/SGGL/WebAPI/Controllers/HJGL/ReportQueryController.cs index 3cdba93e..92ac300c 100644 --- a/SGGL/WebAPI/Controllers/HJGL/ReportQueryController.cs +++ b/SGGL/WebAPI/Controllers/HJGL/ReportQueryController.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; using System.Linq; using System.Net; using System.Net.Http; @@ -184,5 +186,95 @@ namespace WebAPI.Controllers return responeData; } #endregion + + public Model.ResponeData GetReportQueryByProjectId(string projectId, string unitId) + { + var responeData = new Model.ResponeData(); + try + { + List> res = new List>(); + Dictionary> tempDic = new Dictionary>(); + + string sql31 = @"SELECT WorkArea.WorkAreaId, WorkArea.WorkAreaName, SUM(JOT_Size) total_jot, SUM(JOT_DoneDin) finished_total_jot + FROM pw_jointinfo + LEFT JOIN pw_isoinfo ON pw_jointinfo.ISO_ID = pw_isoinfo.ISO_ID + LEFT JOIN ProjectData_WorkArea WorkArea ON WorkArea.WorkAreaId = pw_isoinfo.WorkAreaId + WHERE pw_jointinfo.ProjectId = @projectId"; + if (!string.IsNullOrEmpty(unitId) || unitId != CommonService.GetThisUnitId()) + { + sql31 += " AND pw_isoinfo.UnitId = @unitId"; + } + sql31 += " GROUP BY WorkArea.WorkAreaId, WorkArea.WorkAreaName"; + + SqlCommand command = new SqlCommand(sql31); + command.Parameters.AddWithValue("@projectId", projectId); + if (!string.IsNullOrEmpty(unitId)) + { + command.Parameters.AddWithValue("@unitId", unitId); + } + + DataTable tb31 = SQLHelper.GetDataTableRunCommand(command); + if (tb31 != null) + { + foreach (DataRow row in tb31.Rows) + { + Dictionary dic = new Dictionary(); + dic.Add("WorkAreaName", row["WorkAreaName"].ToString()); + dic.Add("finishRate", (100.0 * Funs.GetNewDoubleOrZero(row["finished_total_jot"].ToString()) / Funs.GetNewDoubleOrZero(row["total_jot"].ToString())).ToString("#0.00")); + tempDic.Add(row["WorkAreaName"].ToString(), dic); + res.Add(dic); + } + } + + string sql41 = @"SELECT WorkArea.WorkAreaId, WorkArea.WorkAreaName, SUM(cht_totalfilm) total_film, SUM(cht_passfilm) pass_film + FROM CH_CheckItem ch_checkitem + LEFT JOIN PW_JointInfo JointInfo ON JointInfo.JOT_ID = ch_checkitem.JOT_ID + LEFT JOIN PW_IsoInfo IsoInfo ON IsoInfo.ISO_ID = JointInfo.ISO_ID + LEFT JOIN ProjectData_WorkArea WorkArea ON WorkArea.WorkAreaId = IsoInfo.WorkAreaId + WHERE JointInfo.ProjectId = @projectId"; + if (!string.IsNullOrEmpty(unitId) || unitId != CommonService.GetThisUnitId()) + { + sql41 += " AND IsoInfo.UnitId = @unitId"; + } + sql41 += " GROUP BY WorkArea.WorkAreaId, WorkArea.WorkAreaName"; + + SqlCommand command2 = new SqlCommand(sql41); + command2.Parameters.AddWithValue("@projectId", projectId); + if (!string.IsNullOrEmpty(unitId)) + { + command2.Parameters.AddWithValue("@unitId", unitId); + } + + DataTable tb41 = SQLHelper.GetDataTableRunCommand(command2); + if (tb41 != null) + { + foreach (DataRow row in tb41.Rows) + { + Dictionary dic; + if (tempDic.TryGetValue(row["WorkAreaName"].ToString(), out dic)) + { + dic.Add("passRate", (100.0 * Funs.GetNewDoubleOrZero(row["pass_film"].ToString()) / Funs.GetNewDoubleOrZero(row["total_film"].ToString())).ToString("#0.00")); + } + else + { + dic = new Dictionary(); + dic.Add("WorkAreaName", row["WorkAreaName"].ToString()); + dic.Add("finishRate", "0"); + dic.Add("passRate", (100.0 * Funs.GetNewDoubleOrZero(row["pass_film"].ToString()) / Funs.GetNewDoubleOrZero(row["total_film"].ToString())).ToString("#0.00")); + res.Add(dic); + } + } + } + + responeData.data = res; + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } } } \ No newline at end of file diff --git a/SGGL/WebAPI/Controllers/HSSE/ChartAnalysisController.cs b/SGGL/WebAPI/Controllers/HSSE/ChartAnalysisController.cs index 310cefd5..d2daf425 100644 --- a/SGGL/WebAPI/Controllers/HSSE/ChartAnalysisController.cs +++ b/SGGL/WebAPI/Controllers/HSSE/ChartAnalysisController.cs @@ -35,5 +35,84 @@ namespace WebAPI.Controllers return responeData; } #endregion + + #region 根据项目ID 获取整改单数据 + /// + /// 根据项目ID 获取整改单数据 + /// + /// 项目ID + /// + public Model.ResponeData getHSSERectifyNoticesChartAnalysis(string projectId) + { + var responeData = new Model.ResponeData(); + try + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + int allCount = 0, uCount = 0, cCount = 0; + double rate = 1; + var getRectifyNotices = from x in db.Check_RectifyNotices + where x.States != Const.State_0 && x.States != null && x.ProjectId == projectId + select x; + if (!string.IsNullOrEmpty(projectId) && projectId != "") + { + getRectifyNotices = getRectifyNotices.Where(x => x.ProjectId == projectId); + } + //// 整改总数 + allCount = getRectifyNotices.Count(); + if (allCount > 0) + { + //// 已闭环 + cCount = getRectifyNotices.Where(x => x.States == "5").Count(); + uCount = allCount - cCount; + rate = Math.Round(uCount * 1.0 / allCount * 100, 1); + } + + responeData.data = new { allCount, uCount, rate }; + } + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + #endregion + + #region 根据项目ID 获取资质预警数据 + /// + /// 根据项目ID 获取整改单数据 + /// + /// 项目ID + /// + public Model.ResponeData getHSSEPersonQualityChartAnalysis(string projectId) + { + var responeData = new Model.ResponeData(); + try + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + int allCount = 0; + var getPersonQualitys = from x in db.QualityAudit_PersonQuality + join y in db.SitePerson_Person on x.PersonId equals y.PersonId + where (projectId == null || projectId == "" || y.ProjectId == projectId) + && x.LimitDate.HasValue && x.LimitDate < DateTime.Now + select x; + //// 预警人数 + allCount = getPersonQualitys.Count(); + responeData.data = new { allCount }; + } + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + #endregion } } diff --git a/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs b/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs index ef06ef1c..18ebbe69 100644 --- a/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs +++ b/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs @@ -218,18 +218,33 @@ namespace WebAPI.Controllers /// 0-未通过;1通过;空所有 /// 页码 /// 考试记录列表 - public Model.ResponeData getTrainingTestRecordListQuery(string projectId, string unitId, string workPostId, string strPass, int pageIndex) + public Model.ResponeData getTrainingTestRecordListQuery(string projectId, string unitId, string workPostId, string departId, string strPass, int pageIndex) { var responeData = new Model.ResponeData(); try { - var getDataLists = APITestRecordService.getTrainingTestRecordListByProjectId(projectId, unitId, workPostId, strPass, string.Empty); - int pageCount = getDataLists.Count; - if (pageCount > 0 && pageIndex > 0) + if (!string.IsNullOrEmpty(departId)) { - getDataLists = getDataLists.OrderByDescending(x => x.TestStartTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); + var getDataLists = APITestRecordService.getTrainingTestRecordListByDepartId(unitId, departId, strPass, string.Empty); + int pageCount = getDataLists.Count; + if (pageCount > 0 && pageIndex > 0) + { + getDataLists = getDataLists.OrderByDescending(x => x.TestStartTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); + } + responeData.data = new { pageCount, getDataLists }; + } + else + { + + var getDataLists = APITestRecordService.getTrainingTestRecordListByProjectId(projectId, unitId, workPostId, strPass, string.Empty); + int pageCount = getDataLists.Count; + if (pageCount > 0 && pageIndex > 0) + { + getDataLists = getDataLists.OrderByDescending(x => x.TestStartTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); + } + responeData.data = new { pageCount, getDataLists }; + } - responeData.data = new { pageCount, getDataLists }; } catch (Exception ex) { @@ -240,38 +255,6 @@ namespace WebAPI.Controllers } #endregion - #region 根据ProjectId获取所有考试记录列表 - /// - /// 根据ProjectId获取所有考试记录列表 - /// - /// 项目ID - /// 单位ID - /// 岗位ID - /// 0-未通过;1通过;空所有 - /// 参数 - /// 页码 - /// 考试记录列表 - public Model.ResponeData getTrainingTestRecordListQuery(string projectId, string unitId, string workPostId, string strPass,string strParam, int pageIndex) - { - var responeData = new Model.ResponeData(); - try - { - var getDataLists = APITestRecordService.getTrainingTestRecordListByProjectId(projectId, unitId, workPostId, strPass, strParam); - int pageCount = getDataLists.Count; - if (pageCount > 0 && pageIndex > 0) - { - getDataLists = getDataLists.OrderByDescending(x => x.TestStartTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); - } - responeData.data = new { pageCount, getDataLists }; - } - catch (Exception ex) - { - responeData.code = 0; - responeData.message = ex.Message; - } - return responeData; - } - #endregion #region 根据TestRecordItemId、selectedItem 考生答题 /// diff --git a/SGGL/WebAPI/Controllers/PersonController.cs b/SGGL/WebAPI/Controllers/PersonController.cs index affd0c06..cf640146 100644 --- a/SGGL/WebAPI/Controllers/PersonController.cs +++ b/SGGL/WebAPI/Controllers/PersonController.cs @@ -352,18 +352,32 @@ namespace WebAPI.Controllers /// 培训类型ID(可为空) /// 分页 /// - public Model.ResponeData getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId, int pageIndex) + public Model.ResponeData getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string departIds, string trainTypeId, int pageIndex, string strParam, string InTime) { var responeData = new Model.ResponeData(); try { - var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(projectId, unitIds, workPostIds, trainTypeId).OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); - int pageCount = getDataList.Count; - if (pageCount > 0 && pageIndex > 0) + if (string.IsNullOrEmpty(projectId)) { - getDataList = getDataList.OrderBy(u => u.UnitName).ThenBy(u => u.PersonName).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); ////200 ->Funs.PageSize + var getDataList = APIPersonService.getTrainingPersonListByDepartAndTrainTypeId(unitIds, departIds, trainTypeId).OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); + int pageCount = getDataList.Count; + if (pageCount > 0 && pageIndex > 0) + { + getDataList = getDataList.OrderBy(u => u.UnitName).ThenBy(u => u.PersonName).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); ////200 ->Funs.PageSize + } + responeData.data = new { pageCount, getDataList }; + } + else + { + var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(projectId, unitIds, workPostIds, departIds, trainTypeId, InTime, strParam).OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); + + int pageCount = getDataList.Count; + if (pageCount > 0 && pageIndex > 0) + { + getDataList = getDataList.OrderBy(u => u.UnitName).ThenBy(u => u.PersonName).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); ////200 ->Funs.PageSize + } + responeData.data = new { pageCount, getDataList }; } - responeData.data = new { pageCount, getDataList }; } catch (Exception ex) { diff --git a/SGGL/WebAPI/Controllers/ShouYeController.cs b/SGGL/WebAPI/Controllers/ShouYeController.cs new file mode 100644 index 00000000..f919fcb4 --- /dev/null +++ b/SGGL/WebAPI/Controllers/ShouYeController.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Http; +using System.Web.Mvc; + +namespace WebAPI.Controllers +{ + public class ShouYeController : ApiController + { + #region 获取HSSE首页数据 + /// + /// 获取HSSE首页数据 + /// + /// + public Model.ResponeData getHsse( ) + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = BLL.API.APIIndexService.hsse(); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + #endregion + + #region 获取HSSE首页隐患排查治理数据明细 + /// + /// 获取HSSE首页隐患排查治理数据明细 + /// + /// + public Model.ResponeData getHiddenDanger() + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = BLL.API.APIIndexService.hiddenDanger(); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + #endregion + + #region 获取CQMS首页 + /// + /// 获取CQMS首页 + /// + /// + public Model.ResponeData getCqms() + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = BLL.API.APIIndexService.cqms(); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + #endregion + + #region 获取HJGL首页 + /// + /// 获取HJGL首页 + /// + /// + public Model.ResponeData getHjgl() + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = BLL.API.APIIndexService.hjgl(); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + #endregion + + #region 获取焊接缺陷 + /// + /// 获取焊接缺陷 + /// + /// + public Model.ResponeData getDefect() + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = BLL.API.APIIndexService.defect(); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + #endregion + + #region 获取SHIYE首页 + /// + /// 获取SHIYE首页 + /// + /// + public Model.ResponeData getShiye() + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = BLL.API.APIIndexService.shiye(); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml b/SGGL/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml index 8298118b..fd96ea1d 100644 --- a/SGGL/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml +++ b/SGGL/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml @@ -4,13 +4,13 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - false - false - true + False + False + True Release Any CPU FileSystem - D:\发布 + G:\发布 FileSystem <_TargetId>Folder diff --git a/SGGL/WebAPI/WebAPI.csproj b/SGGL/WebAPI/WebAPI.csproj index 362e85c1..c5d0747b 100644 --- a/SGGL/WebAPI/WebAPI.csproj +++ b/SGGL/WebAPI/WebAPI.csproj @@ -229,6 +229,7 @@ +