diff --git a/SGGL/BLL/API/HSSE/APITrainRecordService.cs b/SGGL/BLL/API/HSSE/APITrainRecordService.cs index a6036d0a..ab0588d3 100644 --- a/SGGL/BLL/API/HSSE/APITrainRecordService.cs +++ b/SGGL/BLL/API/HSSE/APITrainRecordService.cs @@ -129,11 +129,11 @@ namespace BLL ////及格分数 int passScore = 80; - var testRule = db.Sys_TestRule.FirstOrDefault(); - if (testRule != null) - { - passScore = testRule.PassingScore; - } + //var testRule = db.Sys_TestRule.FirstOrDefault(); + //if (testRule != null) + //{ + // passScore = testRule.PassingScore; + //} foreach (var item in getTrainingTasks) { diff --git a/SGGL/BLL/SysManage/SysConstSetService.cs b/SGGL/BLL/SysManage/SysConstSetService.cs index d4983918..b281ee4e 100644 --- a/SGGL/BLL/SysManage/SysConstSetService.cs +++ b/SGGL/BLL/SysManage/SysConstSetService.cs @@ -159,11 +159,11 @@ public static int getPassScore() { int passScore = 80; - var testRule = Funs.DB.Sys_TestRule.FirstOrDefault(); - if (testRule != null) - { - passScore = testRule.PassingScore; - } + //var testRule = Funs.DB.Sys_TestRule.FirstOrDefault(); + //if (testRule != null) + //{ + // passScore = testRule.PassingScore; + //} return passScore; } diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/Plan.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/Plan.aspx.cs index 26b62232..7c720b81 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/Plan.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/Plan.aspx.cs @@ -94,10 +94,10 @@ namespace FineUIPro.Web.HSSE.EduTrain this.BindGrid(); this.GetButtonPower(); - if (string.IsNullOrEmpty(this.ProjectId)) - { - btnNew.Hidden = true; - } + //if (string.IsNullOrEmpty(this.ProjectId)) + //{ + this.btnNew.Hidden = true; + //} } #region 编制 /// diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/PlanEdit.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/PlanEdit.aspx.cs index 26e92d9e..f268d597 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/PlanEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/PlanEdit.aspx.cs @@ -55,7 +55,10 @@ namespace FineUIPro.Web.HSSE.EduTrain { this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.ProjectId = this.CurrUser.LoginProjectId; - this.InitDropDownList(); + if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId) + { + this.ProjectId = Request.Params["projectId"]; + } this.PlanId = Request.Params["PlanId"]; if (!string.IsNullOrEmpty(PlanId)) @@ -63,6 +66,8 @@ namespace FineUIPro.Web.HSSE.EduTrain var trainingPlan = TrainingPlanService.GetPlanById(PlanId); if (trainingPlan != null) { + this.ProjectId = trainingPlan.ProjectId; + this.InitDropDownList(); this.txtPlanCode.Text = trainingPlan.PlanCode; this.txtPlanName.Text = trainingPlan.PlanName; @@ -91,7 +96,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { 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(); + var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(this.ProjectId, trainingPlan.UnitIds, trainingPlan.WorkPostId, "", trainingPlan.TrainTypeId, "", "").OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); dpSysUser.DataTextField = "PersonName"; dpSysUser.DataValueField = "PersonId"; dpSysUser.DataSource = getDataList; @@ -107,8 +112,9 @@ namespace FineUIPro.Web.HSSE.EduTrain } else { - string code = ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId).ProjectCode + "-"; - txtPlanCode.Text = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Training_Plan", "PlanCode", this.CurrUser.LoginProjectId, code); + this.InitDropDownList(); + string code = ProjectService.GetProjectByProjectId(this.ProjectId).ProjectCode + "-"; + txtPlanCode.Text = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Training_Plan", "PlanCode", this.ProjectId, code); } } } @@ -120,8 +126,8 @@ namespace FineUIPro.Web.HSSE.EduTrain { TrainTypeService.InitTrainTypeDropDownList(drpTrainType, true); TrainLevelService.InitTrainLevelDropDownList(drpTrainLevel, true); - UnitService.InitUnitByProjectIdUnitTypeDropDownList1(dpUnit, this.CurrUser.LoginProjectId, false); - WorkPostService.InitWorkPostByProjectIdDropDownList(dpWorkPost, this.CurrUser.LoginProjectId, false); + UnitService.InitUnitByProjectIdUnitTypeDropDownList1(dpUnit, this.ProjectId, false); + WorkPostService.InitWorkPostByProjectIdDropDownList(dpWorkPost, this.ProjectId, false); //var postIds = (from u in Funs.DB.SitePerson_Person // where u.ProjectId == CurrUser.LoginProjectId // select u.WorkPostId).Distinct(); @@ -273,7 +279,7 @@ namespace FineUIPro.Web.HSSE.EduTrain var db = Funs.DB; Model.Training_Plan trainingPlan = new Model.Training_Plan(); - trainingPlan.ProjectId = this.CurrUser.LoginProjectId; + trainingPlan.ProjectId = this.ProjectId; trainingPlan.PlanName = this.txtPlanName.Text; trainingPlan.PlanCode = this.txtPlanCode.Text; trainingPlan.TrainContent = this.txtTrainContent.Text; @@ -296,8 +302,8 @@ namespace FineUIPro.Web.HSSE.EduTrain } if (string.IsNullOrEmpty(PlanId)) { - //string code = ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId).ProjectCode + "-"; - //trainingPlan.PlanCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Training_Plan", "PlanCode", this.CurrUser.LoginProjectId, code); + //string code = ProjectService.GetProjectByProjectId(this.ProjectId).ProjectCode + "-"; + //trainingPlan.PlanCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Training_Plan", "PlanCode", this.ProjectId, code); //trainingPlan.PlanCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectTrainingPlanMenuId, CurrUser.LoginProjectId, CurrUser.UnitId); trainingPlan.PlanId = SQLHelper.GetNewID(); @@ -474,7 +480,7 @@ namespace FineUIPro.Web.HSSE.EduTrain dpSysUser.Items.Clear(); string unitIds = string.Join(",", dpUnit.SelectedValueArray); string workPostIds = string.Join(",", dpWorkPost.SelectedValueArray); - var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(this.CurrUser.LoginProjectId, unitIds, workPostIds, "", drpTrainType.SelectedValue, "", "").OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); + var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(this.ProjectId, unitIds, workPostIds, "", drpTrainType.SelectedValue, "", "").OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); dpSysUser.DataTextField = "PersonName"; dpSysUser.DataValueField = "PersonId"; dpSysUser.DataSource = getDataList; diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs index d6c78728..4cded1f8 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs @@ -629,13 +629,13 @@ namespace FineUIPro.Web.HSSE.EduTrain 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; - } + //var testRule = Funs.DB.Sys_TestRule.FirstOrDefault(); + //if (testRule != null) + //{ + // passScore = testRule.PassingScore; + //} foreach (var item in getTrainingTasks) { bool isInsert = true; diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecordView.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecordView.aspx.cs index 5341de73..10b570b2 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecordView.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecordView.aspx.cs @@ -231,8 +231,9 @@ namespace FineUIPro.Web.HSSE.EduTrain var getTestRecord = Funs.DB.Training_TestRecord.Where(x => x.TestManId == getRecordDetail.PersonId && x.TestPlanId == this.TestPlanId); if (getTestRecord.Count() > 0) - { ////及格分数 - int getPassScores = SysConstSetService.getPassScore(); + { ////及格分数 + int getPassScores = 80; + //int getPassScores = SysConstSetService.getPassScore(); var getOK = getTestRecord.FirstOrDefault(x => x.TestScores >= getPassScores); if (getOK != null) { diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.cs index 9f250bcf..1bb4b4ff 100644 --- a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.cs +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecord.aspx.cs @@ -520,11 +520,11 @@ namespace FineUIPro.Web.Person.EduTrain select x; ////及格分数 int passScore = 80; - var testRule = Funs.DB.Sys_TestRule.FirstOrDefault(); - if (testRule != null) - { - passScore = testRule.PassingScore; - } + //var testRule = Funs.DB.Sys_TestRule.FirstOrDefault(); + //if (testRule != null) + //{ + // passScore = testRule.PassingScore; + //} foreach (var item in getTrainingTasks) { bool isInsert = true; diff --git a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.cs b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.cs index d2f493a6..e5c918d9 100644 --- a/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.cs +++ b/SGGL/FineUIPro.Web/Person/EduTrain/TrainRecordView.aspx.cs @@ -232,7 +232,8 @@ namespace FineUIPro.Web.Person.EduTrain && x.TestPlanId == this.TestPlanId); if (getTestRecord.Count() > 0) { ////及格分数 - int getPassScores = SysConstSetService.getPassScore(); + int getPassScores = 80; + //int getPassScores = SysConstSetService.getPassScore(); var getOK = getTestRecord.FirstOrDefault(x => x.TestScores >= getPassScores); if (getOK != null) { diff --git a/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs b/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs index 1195f1ad..4e51fcdb 100644 --- a/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs +++ b/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs @@ -255,7 +255,7 @@ namespace WebAPI.Controllers /// 参数 /// 页码 /// 考试记录列表 - public Model.ResponeData getTrainingTestRecordListQuery(string projectId, string unitId, string workPostId, string strPass,string strParam, int pageIndex) + public Model.ResponeData getTrainingTestRecordListQuery(string projectId, string unitId, string workPostId, string strPass, string strParam, int pageIndex) { var responeData = new Model.ResponeData(); try @@ -336,7 +336,8 @@ namespace WebAPI.Controllers ////考试分数 decimal getTestScores = APITestRecordService.getSubmitTestRecord(getTestRecord); ////及格分数 - int getPassScores = SysConstSetService.getPassScore(); + int getPassScores = 80; + //int getPassScores = SysConstSetService.getPassScore(); if (getTestScores <= getPassScores) { int testCount = Funs.DB.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count(); @@ -388,7 +389,6 @@ namespace WebAPI.Controllers #region 将答题记录保存到数据库 RedisHelper redis = new RedisHelper(); var trainingTestRecordItems = redis.GetObjString>(testRecordId); - if (trainingTestRecordItems != null) { var modeltestRecordItem = from x in db.Training_TestRecordItem @@ -403,7 +403,6 @@ namespace WebAPI.Controllers } #endregion - var getTestRecord = db.Training_TestRecord.FirstOrDefault(e => e.TestRecordId == testRecordId); if (getTestRecord != null) { @@ -431,17 +430,13 @@ namespace WebAPI.Controllers if (!string.IsNullOrEmpty(Fingerprint)) { Fingerprint = Fingerprint.Replace("data:image/svg+xml;base64,", "").Replace("data:image/png;base64,", "").Replace("data:image/jgp;base64,", "").Replace("data:image/jpg;base64,", "").Replace("data:image/jpeg;base64,", "");//将base64头部信息替换 - byte[] bytes = Convert.FromBase64String(Fingerprint); - MemoryStream memStream = new MemoryStream(bytes); Image mImage = Image.FromStream(memStream); Bitmap bp = new Bitmap(mImage); MemoryStream ms = new MemoryStream(); bp.Save(Fingerprintfilename, System.Drawing.Imaging.ImageFormat.Png); - getTestRecord.Fingerprint = Fingerprintfilename.Replace(rootUrl, ""); - } db.SubmitChanges(); // APITestRecordService.updateTestRecord(getTestRecord); @@ -449,14 +444,14 @@ namespace WebAPI.Controllers ////考试分数 decimal getTestScores = APITestRecordService.getSubmitTestRecord(getTestRecord); + int getPassScores = 80; if (!string.IsNullOrEmpty(getTestRecord.TestPlanId)) - { ////及格分数 - int getPassScores = 80; - var testRule = db.Sys_TestRule.FirstOrDefault(); - if (testRule != null) - { - getPassScores = testRule.PassingScore; - } + {////及格分数 + //var testRule = db.Sys_TestRule.FirstOrDefault(); + //if (testRule != null) + //{ + // getPassScores = testRule.PassingScore; + //} if (getTestScores <= getPassScores) { int testCount = db.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count(); @@ -478,14 +473,11 @@ namespace WebAPI.Controllers responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。"; } responeData.data = new { getTestScores, getPassScores, returnTestRecordId }; - } else { - responeData.data = new { getTestScores }; - + responeData.data = new { getTestScores, getPassScores }; } - } } }