public ActionResult SavePersonalAssessmentResult(string assessment_id) { using (var db = new RepositoryBase().BeginTrans()) { string checker = OperatorProvider.Provider.GetCurrent().UserId; AssessmentEntity assessmentEntity = assessmentApp.GetForm(assessment_id); if (assessmentEntity == null) { return(Error("系统未知错误。")); } if (assessmentEntity.assessment_statue != 1) { return(Error("只有处于待归档的考核才能进行归档。")); } //将本次考核状态设置为已归档 2 assessmentEntity.assessment_statue = 2; assessmentEntity.last_modify_time = DateTime.Now; db.Update <AssessmentEntity>(assessmentEntity); //将自己“归档”任务状态设置为已完成 SelfTaskDetailEntity selfTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachTaskObjTaskType(assessment_id, assessment_id, 4); selfTaskDetailEntity.task_statue = 2; selfTaskDetailEntity.last_modify_time = DateTime.Now; db.Update <SelfTaskDetailEntity>(selfTaskDetailEntity); db.Commit(); } return(Success("操作成功。", null)); }
public void EditAssessment(AssessmentDto input) { _userService.CheckUserPermissions(new List <Enum.RoleType> { Enum.RoleType.Administrator }); var userClaim = _userService.UserClaim(); if (input.Id.HasValue) { var assessment = _assessmentRepository.FirstOrDefault(t => t.Id == input.Id && t.IsDeleted == false); if (assessment != null) { if (assessment.SchoolYear != input.SchoolYear && _assessmentRepository.Count(t => t.SchoolYear == input.SchoolYear) > 0) { throw new UserFriendlyException("学年[" + input.SchoolYear + "]的考核已经存在"); } assessment.SchoolYear = input.SchoolYear; assessment.StartTime = input.RangeTime[0].Date; assessment.EndTime = input.RangeTime[1].Date; assessment.Deadline = input.Deadline; assessment.UpdateTime = Clock.Now; assessment.UpdateUserId = userClaim.UserId; _assessmentRepository.UpdateAsync(assessment); } } else { if (_assessmentRepository.Count(t => t.SchoolYear == input.SchoolYear) > 0) { throw new UserFriendlyException("学年[" + input.SchoolYear + "]的考核已经存在"); } var assessment = new AssessmentEntity { Id = Guid.NewGuid(), CreateUserId = userClaim.UserId, SchoolYear = input.SchoolYear, StartTime = input.RangeTime[0].Date, EndTime = input.RangeTime[1].Date, Deadline = input.Deadline }; _assessmentRepository.InsertAsync(assessment); input.DepartmentList.ForEach(t => { _assessmentDepartmentRepository.InsertAsync(new AssessmentDepartmentEntity { Id = Guid.NewGuid(), CreateUserId = userClaim.UserId, AssessmentId = assessment.Id, DepartmentId = t.Id }); }); } }
public void SubmitForm(AssessmentEntity assessmentEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { assessmentEntity.Modify(keyValue); service.Update(assessmentEntity); } else { assessmentEntity.Create(); service.Insert(assessmentEntity); } }
public static void insert(AssessmentEntity ass) { DbHelper.ExecuteNonQuery("P_Assessment_insert", ass.qualityAssessment, ass.priceAssessment, ass.deliveryAssessment, ass.payAssessment, ass.packagingAssessment, ass.serviceAssessment, ass.notes, ass.sellerId, ass.adminId ); }
public List <AssessmentEntity> GetAllAsseementsDetails() { List <AssessmentEntity> listAssessmentDetailsEntity = new List <AssessmentEntity>(); IQuestionPaperRepository questionPaperRepository = DataFactory.DataFactory.CreateQuestionPaperRepositoryInstance(); var AllAssessmentsData = questionPaperRepository.GetAllAssessmentDetails(); foreach (var assessmentData in AllAssessmentsData) { AssessmentEntity assessmentEntity = new AssessmentEntity(); assessmentEntity.AssessmentId = assessmentData.Id; assessmentEntity.AssessmentName = assessmentData.AssessmentName; listAssessmentDetailsEntity.Add(assessmentEntity); } return(listAssessmentDetailsEntity); }
public AssessmentEntity GetAssessmentForEvaluation(int assessmentId, int userid) { AssessmentEntity assessmentEntity = new AssessmentEntity(); List <QuestionEntity> listQuestionEntity = new List <QuestionEntity>(); try { var result = DataFactory.DataFactory.CreateQuestionPaperRepositoryInstance().GetAssessmentForEvaluation(assessmentId, userid); assessmentEntity.QuestionPaperId = result.QuestionPaperId; assessmentEntity.AssessmentId = result.Id; foreach (var questiondata in result.QuestionPaper) { QuestionEntity quesEntity = new QuestionEntity(); quesEntity.ID = questiondata.ID; quesEntity.Number = questiondata.Number; quesEntity.OptionType = questiondata.OptionType; quesEntity.WrittenAnswer = questiondata.WrittenAnswer; quesEntity.Options = new List <OptionsEntity>(); int optionID = 100;///option id starts from 100 foreach (var optionData in questiondata.Options) { OptionsEntity optionEntity = new OptionsEntity(); optionEntity.ID = optionData.ID; optionEntity.OptionText = optionData.OptionText; quesEntity.Options.Add(optionEntity); } quesEntity.QuestionText = questiondata.QuestionText; quesEntity.RightOptionId = questiondata.RightOptionId; listQuestionEntity.Add(quesEntity); } } catch (Exception ex) { } assessmentEntity.QuestionPaper = listQuestionEntity; return(assessmentEntity); }
public bool CreateAssessment(AssessmentEntity assessmentEntity) { try { AssessmentData assessmentData = new AssessmentData(); assessmentData.AssessmentName = assessmentEntity.AssessmentName; assessmentData.AssessmentDescription = assessmentEntity.AssessmentDescription; assessmentData.QuestionPaperData = new QuestionpaperDetails(); assessmentData.QuestionPaperData.Id = assessmentEntity.QuestionPaperDetails.Id; assessmentData.StartTime = assessmentEntity.StartTime; assessmentData.EndTime = assessmentEntity.EndTime; assessmentData.CreatedBy = assessmentEntity.CreatedBy; IQuestionPaperRepository questionPaperRepository = DataFactory.DataFactory.CreateQuestionPaperRepositoryInstance(); return(questionPaperRepository.CreateAssessment(assessmentData)); } catch (Exception ex) { return(false); } }
public async Task <HttpResponseMessage> CreateAssessment(AssessmentModel assesmentModel) { try { AssessmentEntity assessmentEntity = new AssessmentEntity(); assessmentEntity.AssessmentName = assesmentModel.AssessmentName; assessmentEntity.AssessmentDescription = assesmentModel.AssessmentDescription; assessmentEntity.QuestionPaperDetails = new QuestionPaperDetailsEntity(); assessmentEntity.QuestionPaperDetails.Id = assesmentModel.QuestionPaperId; assessmentEntity.StartTime = assesmentModel.StartTime; assessmentEntity.EndTime = assesmentModel.EndTime; assessmentEntity.CreatedBy = assesmentModel.CreatedBy; BusinessFactory.CreateQuestionPaperBusinessInstance().CreateAssessment(assessmentEntity); return(Request.CreateResponse(HttpStatusCode.OK)); } catch (System.Exception e) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e)); } }
public ActionResult LaunchPersonalAssessment(string assessment_name, string start_time, string end_time, string templete_id, string checker_object_list, int?need_self_check, double?self_check_weight, string checker_list, string filling_people, string file_name) { if (assessmentApp.IsExists(assessment_name)) { return(Error("考核名称已存在。")); } using (var db = new RepositoryBase().BeginTrans()) { List <string> checkerObjectList = KPI.Code.Json.ToObject <List <string> >(checker_object_list); FileLog.Debug(checker_object_list); List <PersonalAssessmentCheckerModel> checkerList = KPI.Code.Json.ToObject <List <PersonalAssessmentCheckerModel> >(checker_list); #region 插入考核发起表 AssessmentEntity assessmentEntity = new AssessmentEntity(); string assessmentId = Common.GuId(); assessmentEntity.id = assessmentId; assessmentEntity.assessment_name = assessment_name; assessmentEntity.templete_id = templete_id; assessmentEntity.start_time = DateTime.Parse(start_time); assessmentEntity.end_time = DateTime.Parse(end_time); assessmentEntity.assessment_sponsor = OperatorProvider.Provider.GetCurrent().UserId; assessmentEntity.assessment_count = checkerObjectList.Count; assessmentEntity.need_self_check = need_self_check.HasValue ? need_self_check.Value : 0; assessmentEntity.assessment_statue = 0; assessmentEntity.assessment_type = 0; assessmentEntity.filing_people = filling_people; assessmentEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; assessmentEntity.create_time = DateTime.Now; db.Insert <AssessmentEntity>(assessmentEntity); #endregion #region 插入考核发起详细表 AssessmentDetailEntity assessmentDetailEntity = null; //如果需要自评 if (assessmentEntity.need_self_check == 1) { for (int i = 0; i < checkerObjectList.Count; i++) { string checkObject = checkerObjectList[i]; assessmentDetailEntity = new AssessmentDetailEntity(); assessmentDetailEntity.id = Common.GuId(); assessmentDetailEntity.assessment_id = assessmentId; assessmentDetailEntity.check_object = checkObject; assessmentDetailEntity.checker = checkObject; assessmentDetailEntity.check_order = 1; assessmentDetailEntity.finished = 0; assessmentDetailEntity.checker_weight = self_check_weight; assessmentDetailEntity.check_total_count = checkerList.Count; assessmentDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; assessmentDetailEntity.create_time = DateTime.Now; db.Insert <AssessmentDetailEntity>(assessmentDetailEntity); //插入“自评”任务并且激活 SelfTaskDetailEntity selfTaskDetailEntity = new SelfTaskDetailEntity(); selfTaskDetailEntity.id = Common.GuId(); selfTaskDetailEntity.task_statue = 1; selfTaskDetailEntity.task_type = 3; selfTaskDetailEntity.person = checkObject; selfTaskDetailEntity.task_object = checkObject; selfTaskDetailEntity.attach = assessmentId; selfTaskDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; selfTaskDetailEntity.create_time = DateTime.Now; db.Insert <SelfTaskDetailEntity>(selfTaskDetailEntity); } } for (int i = 0; i < checkerList.Count; i++) { for (int j = 0; j < checkerObjectList.Count; j++) { PersonalAssessmentCheckerModel checker = checkerList[i]; string checkObject = checkerObjectList[j]; assessmentDetailEntity = new AssessmentDetailEntity(); assessmentDetailEntity.id = Common.GuId(); assessmentDetailEntity.assessment_id = assessmentId; assessmentDetailEntity.check_object = checkObject; assessmentDetailEntity.checker = checker.checker_id; assessmentDetailEntity.check_order = checker.checker_order; assessmentDetailEntity.finished = 0; assessmentDetailEntity.checker_weight = checker.checker_weight; assessmentDetailEntity.check_total_count = checkerList.Count; assessmentDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; assessmentDetailEntity.create_time = DateTime.Now; db.Insert <AssessmentDetailEntity>(assessmentDetailEntity); //给所有“考评人”插入考评任务 SelfTaskDetailEntity selfTaskDetailEntity = new SelfTaskDetailEntity(); selfTaskDetailEntity.id = Common.GuId(); if (checker.checker_order == 1)//第一个人直接激活任务 { selfTaskDetailEntity.task_statue = 1; } else //剩下的人暂时先不激活任务,等待上一个人完成任务后激活下一个人的任务 { selfTaskDetailEntity.task_statue = 0; } selfTaskDetailEntity.task_type = 1; selfTaskDetailEntity.person = checker.checker_id; selfTaskDetailEntity.task_object = checkObject; selfTaskDetailEntity.attach = assessmentId; selfTaskDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; selfTaskDetailEntity.create_time = DateTime.Now; db.Insert <SelfTaskDetailEntity>(selfTaskDetailEntity); } } #endregion //给“考核结果审核人插入归档任务” SelfTaskDetailEntity fillingSelfTaskDetailEntity = new SelfTaskDetailEntity(); fillingSelfTaskDetailEntity.id = Common.GuId(); fillingSelfTaskDetailEntity.task_statue = 0; fillingSelfTaskDetailEntity.task_type = 4; fillingSelfTaskDetailEntity.person = filling_people; fillingSelfTaskDetailEntity.task_object = assessmentId; fillingSelfTaskDetailEntity.attach = assessmentId; fillingSelfTaskDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; fillingSelfTaskDetailEntity.create_time = DateTime.Now; db.Insert <SelfTaskDetailEntity>(fillingSelfTaskDetailEntity); PersonalAssessmentImportApp personalAssessmentImportApp = new PersonalAssessmentImportApp(db); var data = personalAssessmentImportApp.Scan(file_name, new string[] { assessmentId }); if (data.Count > 0) { return(Error("导入数据存在未处理的错误!")); } else { personalAssessmentImportApp.Import(file_name, assessmentId); } db.Commit(); } return(Success("操作成功。", null)); }
public ActionResult CheckAssessment(string assessment_id, string check_object, string checker_result_list, double?fixed_score, double?unfixed_score, double?total_score, double?checker_weight) { AssessmentEntity assessmentEntity = assessmentApp.GetForm(assessment_id); if (assessmentEntity == null) { return(Error("此考核不存在。")); } //if (assessmentEntity.need_self_check == 0) return Error("此考核不需要自评。"); List <SelfCheckResultModel> resultList = KPI.Code.Json.ToObject <List <SelfCheckResultModel> >(checker_result_list); string checker = OperatorProvider.Provider.GetCurrent().UserId; using (var db = new RepositoryBase().BeginTrans()) { AssessmentDetailEntity assessmentDetailEntity = assessmentDetailApp.GetByAssessmentIdCheckerCheckObj(assessment_id, checker, check_object); assessmentDetailEntity.finished = 1; assessmentDetailEntity.last_modify_time = DateTime.Now; db.Update <AssessmentDetailEntity>(assessmentDetailEntity); //更新自己的考核任务为已完成 SelfTaskDetailEntity curTaskDetailEntity = null; if (checker == check_object && assessmentDetailApp.IsSelfCheck(assessment_id, checker, check_object))//自评 { curTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachPersonTaskObjTaskType(assessment_id, checker, check_object, 3); } else { curTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachPersonTaskObjTaskType(assessment_id, checker, check_object, 1); } curTaskDetailEntity.task_statue = 2; curTaskDetailEntity.last_modify_time = DateTime.Now; db.Update <SelfTaskDetailEntity>(curTaskDetailEntity); //保存此考核人对此考核对象的分数 AssessmentResultCountEntity assessmentResultCountEntity = new AssessmentResultCountEntity(); assessmentResultCountEntity.id = Common.GuId(); assessmentResultCountEntity.assessment_id = assessment_id; assessmentResultCountEntity.checker = checker; assessmentResultCountEntity.checker_weight = checker_weight; assessmentResultCountEntity.check_object = check_object; assessmentResultCountEntity.fixed_score = fixed_score; assessmentResultCountEntity.unfixed_score = unfixed_score; assessmentResultCountEntity.total_score = fixed_score + unfixed_score; assessmentResultCountEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; assessmentResultCountEntity.create_time = DateTime.Now; db.Insert <AssessmentResultCountEntity>(assessmentResultCountEntity); //如果自己不是该考核对象的最后一个考核人激活下一个人对该考核对象的任务 if (!assessmentDetailApp.IsLastCheckerToObject(assessment_id, checker, check_object)) { int nextCheckOrder = assessmentDetailEntity.check_order + 1; AssessmentDetailEntity nextAssessmentDetailEntity = assessmentDetailApp.GetByAssessmentIdCheckOrderCheckObj(assessment_id, check_object, nextCheckOrder); SelfTaskDetailEntity selfTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachPersonTaskObjTaskType(assessment_id, nextAssessmentDetailEntity.checker, check_object, 1); //激活任务 selfTaskDetailEntity.task_statue = 1; selfTaskDetailEntity.last_modify_time = DateTime.Now; db.Update <SelfTaskDetailEntity>(selfTaskDetailEntity); } //如果是整个考核的最后一条 if (assessmentDetailApp.IsLastChecker(assessment_id)) { //更新整个考核为待归档 AssessmentEntity curAssessmentEntity = assessmentApp.GetForm(assessment_id); if (curAssessmentEntity == null) { return(Error("系统未知错误。")); } curAssessmentEntity.assessment_statue = 1; curAssessmentEntity.last_modify_time = DateTime.Now; db.Update <AssessmentEntity>(curAssessmentEntity); //激活“考核结果审核人”的归档任务 SelfTaskDetailEntity selfTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachTaskObjTaskType(assessment_id, assessment_id, 4); selfTaskDetailEntity.task_statue = 1; selfTaskDetailEntity.last_modify_time = DateTime.Now; db.Update <SelfTaskDetailEntity>(selfTaskDetailEntity); } //更新自评项分数 for (int i = 0; i < resultList.Count; i++) { SelfCheckResultModel model = resultList[i]; model.indicator_id = indicatorsDefineApp.GetIndicatorByName(model.indicator_name).id; AssessmentResultEntity assessmentResultEntity = assessmentResultApp.GetByAssessmentIdObjIndicatorId(assessment_id, check_object, model.indicator_id); assessmentResultEntity.indicator_value = model.indicator_value; assessmentResultEntity.last_modify_time = DateTime.Now; db.Update <AssessmentResultEntity>(assessmentResultEntity); } db.Commit(); } return(Success("操作成功。")); }
public ActionResult ReLaunchPersonalAssessment(string assessment_id, string file_name) { AssessmentEntity assessmentEntity = assessmentApp.GetForm(assessment_id); if (assessmentEntity == null) { return(Error("系统未知错误。")); } //if (assessmentEntity.assessment_statue != 1) return Error("只有处于待归档的考核才能重新发起。"); List <AssessmentDetailEntity> assessmentDetailList = assessmentDetailApp.GetListByAssessmentId(assessment_id); if (assessmentDetailList == null || assessmentDetailList.Count <= 0) { return(Error("系统未知错误。")); } List <SelfTaskDetailEntity> selfTaskDetailList = selfTaskDetailApp.GetListByAttach(assessment_id); if (selfTaskDetailList == null || selfTaskDetailList.Count <= 0) { return(Error("系统未知错误。")); } List <AssessmentResultCountEntity> assessmentResultCountList = assessmentResultCountApp.GetByAssessmentId(assessment_id); if (assessmentResultCountList == null || assessmentResultCountList.Count <= 0) { return(Error("系统未知错误。")); } using (var db = new RepositoryBase().BeginTrans()) { //将本次考核状态设置为初始状态 0 assessmentEntity.assessment_statue = 0; db.Update <AssessmentEntity>(assessmentEntity); //更新考核发起详细表 assessmentDetailList.ForEach((t) => { t.finished = 0; t.last_modify_time = DateTime.Now; db.Update <AssessmentDetailEntity>(t); }); //1.更新所有任务表状态为未激活 selfTaskDetailList.ForEach((t) => { t.task_statue = 0; t.last_modify_time = DateTime.Now; db.Update <SelfTaskDetailEntity>(t); }); //2.更新check_order为1的任务状态为已激活 selfTaskDetailList.ForEach((t) => { List <AssessmentDetailEntity> list = assessmentDetailApp.GetFirstCheckerList(assessment_id); list.ForEach((tt) => { if (t.person == tt.checker) { t.task_statue = 1; } }); }); //删除上次考核成绩 assessmentResultCountList.ForEach((t) => { db.Delete <AssessmentResultCountEntity>(t); }); //导入考核数据 PersonalAssessmentImportApp personalAssessmentImportApp = new PersonalAssessmentImportApp(db); var data = personalAssessmentImportApp.Scan(file_name, new string[] { assessment_id }); if (data.Count > 0) { return(Error("导入数据存在未处理的错误!")); } else { personalAssessmentImportApp.Import(file_name, assessment_id); } db.Commit(); } return(Success("操作成功。", null)); }
public ActionResult LaunchBranchAssessment(string assessment_name, string start_time, string end_time, string templete_id, string checker_list, string filling_people, string file_name) { if (assessmentApp.IsExists(assessment_name)) { return(Error("考核名称已存在。")); } using (var db = new RepositoryBase().BeginTrans()) { //获取“中安金控集团id” OrganizeEntity org = organizeApp.GetForm(BlocId); //获取所有子公司 List <OrganizeEntity> branchList = organizeApp.GetListByParentIdOrderById(org.F_Id, CompanyId); List <BranchAssessmentCheckerModel> checkerList = KPI.Code.Json.ToObject <List <BranchAssessmentCheckerModel> >(checker_list); #region 插入考核发起表 AssessmentEntity assessmentEntity = new AssessmentEntity(); string assessmentId = Common.GuId(); assessmentEntity.id = assessmentId; assessmentEntity.assessment_name = assessment_name; assessmentEntity.templete_id = templete_id; assessmentEntity.start_time = DateTime.Parse(start_time); assessmentEntity.end_time = DateTime.Parse(end_time); assessmentEntity.assessment_sponsor = OperatorProvider.Provider.GetCurrent().UserId; assessmentEntity.assessment_count = branchList.Count; assessmentEntity.assessment_statue = 0; assessmentEntity.assessment_type = 1; assessmentEntity.filing_people = filling_people; assessmentEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; assessmentEntity.create_time = DateTime.Now; db.Insert <AssessmentEntity>(assessmentEntity); #endregion #region 插入考核发起详细表 AssessmentDetailEntity assessmentDetailEntity = new AssessmentDetailEntity(); for (int i = 0; i < checkerList.Count; i++) { for (int j = 0; j < branchList.Count; j++) { BranchAssessmentCheckerModel checker = checkerList[i]; OrganizeEntity check_object = branchList[j]; assessmentDetailEntity = new AssessmentDetailEntity(); assessmentDetailEntity.id = Common.GuId(); assessmentDetailEntity.assessment_id = assessmentId; assessmentDetailEntity.check_object = check_object.F_Id; assessmentDetailEntity.checker = checker.checker_id; assessmentDetailEntity.check_order = checker.checker_order; assessmentDetailEntity.finished = 0; assessmentDetailEntity.checker_weight = 0; assessmentDetailEntity.check_total_count = checkerList.Count; assessmentDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; assessmentDetailEntity.create_time = DateTime.Now; db.Insert <AssessmentDetailEntity>(assessmentDetailEntity); //给所有“考评人”插入考评任务并且激活第一个考评人的任务 SelfTaskDetailEntity selfTaskDetailEntity = new SelfTaskDetailEntity(); selfTaskDetailEntity.id = Common.GuId(); if (checker.checker_order == 1)//第一个人直接激活任务 { selfTaskDetailEntity.task_statue = 1; } else //剩下的人暂时先不激活任务,等待上一个人完成任务后激活下一个人的任务 { selfTaskDetailEntity.task_statue = 0; } selfTaskDetailEntity.task_type = 1; selfTaskDetailEntity.person = checker.checker_id; selfTaskDetailEntity.task_object = check_object.F_Id; selfTaskDetailEntity.attach = assessmentId; selfTaskDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; selfTaskDetailEntity.create_time = DateTime.Now; db.Insert <SelfTaskDetailEntity>(selfTaskDetailEntity); } } //给“考核结果审核人插入归档任务” SelfTaskDetailEntity fillingSelfTaskDetailEntity = new SelfTaskDetailEntity(); fillingSelfTaskDetailEntity.id = Common.GuId(); fillingSelfTaskDetailEntity.task_statue = 0; fillingSelfTaskDetailEntity.task_type = 4; fillingSelfTaskDetailEntity.person = filling_people; fillingSelfTaskDetailEntity.task_object = assessmentId; fillingSelfTaskDetailEntity.attach = assessmentId; fillingSelfTaskDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; fillingSelfTaskDetailEntity.create_time = DateTime.Now; db.Insert <SelfTaskDetailEntity>(fillingSelfTaskDetailEntity); //导入考核数据 BranchAssessmentImportApp branchAssessmentImportApp = new BranchAssessmentImportApp(db); var data = branchAssessmentImportApp.Scan(file_name, new string[] { assessmentId }); if (data.Count > 0) { return(Error("导入数据存在未处理的错误!")); } else { branchAssessmentImportApp.Import(file_name, assessmentId); } db.Commit(); } #endregion return(Success("操作成功。", null)); }
public ActionResult CheckAssessment(string assessment_id, string check_object, double?fixed_score, double?unfixed_score, double?toatal_score, double?checker_weight) { using (var db = new RepositoryBase().BeginTrans()) { string checker = OperatorProvider.Provider.GetCurrent().UserId; // AssessmentDetailEntity assessmentDetailEntity = assessmentDetailApp.GetByAssessmentIdCheckerCheckObj(assessment_id, checker, check_object); assessmentDetailEntity.finished = 1; assessmentDetailEntity.last_modify_time = DateTime.Now; db.Update <AssessmentDetailEntity>(assessmentDetailEntity); //保存此考核人对此考核对象的分数 AssessmentResultCountEntity assessmentResultCountEntity = new AssessmentResultCountEntity(); assessmentResultCountEntity.id = Common.GuId(); assessmentResultCountEntity.assessment_id = assessment_id; assessmentResultCountEntity.checker = checker; assessmentResultCountEntity.checker_weight = checker_weight; assessmentResultCountEntity.check_object = check_object; assessmentResultCountEntity.fixed_score = fixed_score; assessmentResultCountEntity.unfixed_score = unfixed_score; assessmentResultCountEntity.total_score = fixed_score + unfixed_score; assessmentResultCountEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; assessmentResultCountEntity.create_time = DateTime.Now; db.Insert <AssessmentResultCountEntity>(assessmentResultCountEntity); //更新自己的考核任务为已完成 SelfTaskDetailEntity curTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachPersonTaskObjTaskType(assessment_id, checker, check_object, 1); curTaskDetailEntity.task_statue = 2; curTaskDetailEntity.last_modify_time = DateTime.Now; db.Update <SelfTaskDetailEntity>(curTaskDetailEntity); //如果自己不是该考核对象的最后一个考核人激活下一个人对该考核对象的任务 if (!assessmentDetailApp.IsLastCheckerToObject(assessment_id, checker, check_object)) { int nextCheckOrder = assessmentDetailEntity.check_order + 1; AssessmentDetailEntity nextAssessmentDetailEntity = assessmentDetailApp.GetByAssessmentIdCheckOrderCheckObj(assessment_id, check_object, nextCheckOrder); SelfTaskDetailEntity curSelfTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachPersonTaskObjTaskType(assessment_id, nextAssessmentDetailEntity.checker, check_object, 1); //激活任务 curSelfTaskDetailEntity.task_statue = 1; curSelfTaskDetailEntity.last_modify_time = DateTime.Now; db.Update <SelfTaskDetailEntity>(curSelfTaskDetailEntity); } //如果是整个考核的最后一条 if (assessmentDetailApp.IsLastChecker(assessment_id))//如果是最后一个人对最后一个对象考核 { //更新整个考核为待归档 AssessmentEntity assessmentEntity = assessmentApp.GetForm(assessment_id); if (assessmentEntity == null) { return(Error("系统未知错误。")); } assessmentEntity.assessment_statue = 1; assessmentEntity.last_modify_time = DateTime.Now; db.Update <AssessmentEntity>(assessmentEntity); //激活“考核结果审核人”的归档任务 SelfTaskDetailEntity selfTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachTaskObjTaskType(assessment_id, assessment_id, 4); selfTaskDetailEntity.task_statue = 1; selfTaskDetailEntity.last_modify_time = DateTime.Now; db.Update <SelfTaskDetailEntity>(selfTaskDetailEntity); } db.Commit(); } return(Success("操作成功。", null)); }