protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get <string>("id"); switch (RequestActionString) { case "update": IList <string> entStrList = RequestData.GetList <string>("data"); IList <ExamineStageDeptDetail> esddEnts = ExamineStageDeptDetail.FindAllByProperty(ExamineStageDeptDetail.Prop_ExamineStageId, id); foreach (ExamineStageDeptDetail esddEnt in esddEnts) { esddEnt.DoDelete(); } esddEnts = entStrList.Select(tent => JsonHelper.GetObject <ExamineStageDeptDetail>(tent) as ExamineStageDeptDetail).ToList(); foreach (ExamineStageDeptDetail esddEnt in esddEnts) { esddEnt.ExamineStageId = id; esddEnt.DoCreate(); } break; default: DoSelect(); break; } }
private void SaveDeptDetail(ExamineStage esEnt) { IList <string> entStrList = RequestData.GetList <string>("data"); IList <ExamineStageDeptDetail> esddEnts = ExamineStageDeptDetail.FindAllByProperty(ExamineStageDeptDetail.Prop_ExamineStageId, id); foreach (ExamineStageDeptDetail esddEnt in esddEnts) { esddEnt.DoDelete(); } if (entStrList != null && entStrList.Count > 0) { esddEnts = entStrList.Select(tent => JsonHelper.GetObject <ExamineStageDeptDetail>(tent) as ExamineStageDeptDetail).ToList(); foreach (ExamineStageDeptDetail esddEnt in esddEnts) { esddEnt.ExamineStageId = esEnt.Id; esddEnt.DoCreate(); } } }
private string[] GetBeUsersInfo(ExamineStageDetail esdEnt) { string beUserIds = string.Empty;//存储被考核对象具体的人 string beUserNames = string.Empty; string beDeptIds = string.Empty; string beDeptNames = string.Empty; if (esdEnt.BeRoleCode == "BeDeputyDirector")//副院级领导 { IList <PersonConfig> pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupCode, "DeputyDirector"); if (pcEnts.Count > 0) { if (!string.IsNullOrEmpty(pcEnts[0].ClerkIds)) { beUserIds = pcEnts[0].ClerkIds; beUserNames = pcEnts[0].ClerkNames; beDeptIds = pcEnts[0].ClerkGroupIds; beDeptNames = pcEnts[0].ClerkGroupNames; } } } if (esdEnt.BeRoleCode == "BeExecutiveDeptLeader")//职能服务部门正职 +分管工作的副职也被当做中层干部来考核 { sql = @"select (isnull(FirstLeaderIds,null)+','+isnull(ChargeSecondLeaderIds,'')) as beUserIds, (isnull(FirstLeaderNames,'')+','+isnull(ChargeSecondLeaderNames,'')) as beUserNames, (isnull(FirstLeaderGroupIds,'')+','+isnull(ChargeSecondLeaderGroupIds,'')) as beDeptIds, (isnull(FirstLeaderGroupNames,'')+','+isnull(ChargeSecondLeaderGroupNames,'')) as beDeptNames from BJKY_Examine..PersonConfig where GroupType='职能服务部门' and Id in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; IList <EasyDictionary> dics = DataHelper.QueryDictList(sql); foreach (EasyDictionary dic in dics) { beUserIds += dic.Get <string>("beUserIds") + ","; beUserNames += dic.Get <string>("beUserNames") + ","; beDeptIds += dic.Get <string>("beDeptIds") + ","; beDeptNames += dic.Get <string>("beDeptNames") + ","; } } if (esdEnt.BeRoleCode == "BeBusinessDeptLeader")//经营目标单位正职 { sql = @"select (isnull(FirstLeaderIds,'')+','+isnull(ChargeSecondLeaderIds,'')) as beUserIds, (isnull(FirstLeaderNames,'')+','+isnull(ChargeSecondLeaderNames,'')) as beUserNames, (isnull(FirstLeaderGroupIds,'')+','+isnull(ChargeSecondLeaderGroupIds,'')) as beDeptIds, (isnull(FirstLeaderGroupNames,'')+','+isnull(ChargeSecondLeaderGroupNames,'')) as beDeptNames from BJKY_Examine..PersonConfig where GroupType='经营目标单位' and Id in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; IList <EasyDictionary> dics = DataHelper.QueryDictList(sql); foreach (EasyDictionary dic in dics) { beUserIds += dic.Get <string>("beUserIds") + ","; beUserNames += dic.Get <string>("beUserNames") + ","; beDeptIds += dic.Get <string>("beDeptIds") + ","; beDeptNames += dic.Get <string>("beDeptNames") + ","; } } if (esdEnt.BeRoleCode == "FunctionDept")//如果考核职能部门 直接把需要考核的部门当成 UserId .UserName { esddEnts = ExamineStageDeptDetail.FindAllByProperties("ExamineStageId", id, "GroupType", "职能服务部门"); foreach (ExamineStageDeptDetail esddEnt in esddEnts) { beUserIds += esddEnt.GroupID + ","; beUserNames += esddEnt.GroupName + ","; beDeptIds += esddEnt.GroupID + ","; beDeptNames += esddEnt.GroupName + ","; } } if (esdEnt.BeRoleCode == "BusinessObjectiveDept")//如果考核职能部门 直接把需要考核的部门当成 UserId .UserName { esddEnts = ExamineStageDeptDetail.FindAllByProperties("ExamineStageId", id, "GroupType", "经营目标单位"); foreach (ExamineStageDeptDetail esddEnt in esddEnts) { beUserIds += esddEnt.GroupID; beUserNames += esddEnt.GroupName; beDeptIds += esddEnt.GroupID; beDeptNames += esddEnt.GroupName; } } return(new string[] { beUserIds, beUserNames, beDeptIds, beDeptNames }); }
protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get <string>("id"); if (!string.IsNullOrEmpty(id)) { esEnt = ExamineStage.Find(id); } switch (RequestActionString) { case "UpdatePathLevel": IList <SysGroup> sgEnts = SysGroup.FindAll(); foreach (SysGroup sgEnt in sgEnts) { if (!string.IsNullOrEmpty(sgEnt.Path)) { string[] array = sgEnt.Path.Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries); sgEnt.PathLevel = array.Length; sgEnt.DoUpdate(); } } break; case "CreateTask": esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, id); bool allowStart = true; //确认考核对象 考核关系 考核指标 配置是否齐全 if (esdEnts.Count == 0) { allowStart = false; } else { foreach (ExamineStageDetail esdEnt in esdEnts) { if (string.IsNullOrEmpty(esdEnt.ExamineRelationId) || string.IsNullOrEmpty(esdEnt.ExamineIndicatorId)) { allowStart = false; break; } } } if (allowStart) { CreateTask(); //生成考核任务 esEnt.State = 1; //更新考核阶段状态为 etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ExamineStageId, id); esEnt.TaskQuan = etEnts.Count; esEnt.DoUpdate(); PageState.Add("Result", "考核任务生成成功!"); } else { PageState.Add("Result", "考核任务生成失败!请检查考核对象、考核关系、考核指标是否配置完整!"); } break; case "TakeBack": etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ExamineStageId, id); foreach (ExamineTask etEnt in etEnts) { etEnt.DoDelete(); } //删除所有的自定义指标 sql = "delete BJKY_Examine..CustomIndicator where ExamineStageId='" + id + "'"; DataHelper.ExecSql(sql); esEnt.State = 0; esEnt.TaskQuan = 0; esEnt.DoUpdate(); PageState.Add("Result", "T"); break; case "JudgeCustomIndicator": if (esEnt.ExamineType == "部门级考核") { sql = @"select A.* from BJKY_Examine..DeptExamineRelation as A left join BJKY_Examine..ExamineStageDetail as B on A.Id=B.ExamineRelationId where B.ExamineStageId='" + esEnt.Id + "'";//找到部门考核关系里面的所有被考核人 查找他们的自定义指标 IList <EasyDictionary> dicsRelation = DataHelper.QueryDictList(sql); string beUserIds = ""; string beUserNames = ""; foreach (EasyDictionary dic in dicsRelation) { beUserIds += dic.Get <string>("BeUserIds") + ","; beUserNames += dic.Get <string>("BeUserNames") + ","; } string[] userIdArray = null; if (!string.IsNullOrEmpty(beUserIds)) { userIdArray = beUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } bool allowLaunch = true; for (int i = 0; i < userIdArray.Length; i++) { IList <CustomIndicator> ciEnts = CustomIndicator.FindAllByProperties("CreateId", userIdArray[i], "Year", esEnt.Year, "StageType", esEnt.StageType, "Result", "同意"); if (ciEnts.Count == 0) { allowLaunch = false; break; } } PageState.Add("Result", allowLaunch == true ? "T" : "F"); } else { PageState.Add("Result", "T"); } break; case "Launch": //生成考核任务 LaunchExamine(); break; case "CancelLaunch": CancelLaunch(); break; case "EndExamine": EndExamine(); break; case "delete": IList <ExamineStageDeptDetail> esddEnts = ExamineStageDeptDetail.FindAllByProperty(ExamineStageDeptDetail.Prop_ExamineStageId, id); foreach (ExamineStageDeptDetail esddEnt in esddEnts) { esddEnt.DoDelete(); } esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, id); foreach (ExamineStageDetail esdEnt in esdEnts) { esdEnt.DoDelete(); } esEnt.DoDelete(); break; default: DoSelect(); break; } }