protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); ExamineType = Server.HtmlDecode(RequestData.Get <string>("ExamineType")); switch (RequestActionString) { case "update": ent = GetMergedData <ExamineStage>(); ent.DoUpdate(); SaveExamineStageDetail(ent); break; case "create": ent = GetPostedData <ExamineStage>(); ent.State = 0; ent.DoCreate(); SaveExamineStageDetail(ent); break; case "delete": ent = GetTargetData <ExamineStage>(); ent.DoDelete(); break; default: DoSelect(); break; } }
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; } }