private void DoSelect() { string where = ""; foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches) { if (!string.IsNullOrEmpty(item.Value.ToString())) { switch (item.PropertyName) { case "StartTime": where += " and StartTime>='" + item.Value + "' "; break; case "EndTime": where += " and EndTime<='" + (item.Value.ToString()).Replace(" 0:00:00", " 23:59:59") + "' "; break; default: where += " and " + item.PropertyName + " like '%" + item.Value + "%'"; break; } } } string sql = @"select * from BJKY_Examine..ExamineTask where ExamineStageId='" + ExamineStageId + "' and ToUserId='" + ToUserId + "'" + where + " order by ToDeptName,BeDeptName,BeUserName asc"; PageState.Add("DataList", DataHelper.QueryDictList(sql)); var Obj = new { ExamineStageName = ExamineStage.Find(ExamineStageId).StageName, ToUserName = SysUser.Find(ToUserId).Name }; PageState.Add("Obj", Obj); }
protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get <string>("id"); switch (RequestActionString) { case "launch": if (!string.IsNullOrEmpty(id)) { esEnt = ExamineStage.Find(id); if (esEnt.State == 1) { esEnt.State = 2; esEnt.DoUpdate(); sql = "update BJKY_Examine..ExamineTask set State='1' where ExamineStageId='" + esEnt.Id + "'"; DataHelper.ExecSql(sql); PageState.Add("Id", esEnt.Id); } } break; default: DoSelect(); break; } }
private void DoSelect() { string where = ""; foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches) { if (!string.IsNullOrEmpty(item.Value.ToString())) { switch (item.PropertyName) { //case "StartTime": // where += " and StartTime>'" + item.Value + "' "; // break; //case "EndTime": // where += " and EndTime<='" + (item.Value.ToString()).Replace(" 0:00:00", " 23:59:59") + "' "; // break; default: where += " and " + item.PropertyName + " like '%" + item.Value + "%'"; break; } } } sql = @"select *,(select count(Id) from BJKY_Examine..CustomIndicator where IndicatorSecondId=IndicatorScore.IndicatorSecondId and Year='{0}' and StageType='{1}' and CreateId='{2}') as SubQuan from BJKY_Examine..IndicatorScore where ExamineTaskId='{3}' " + where; ExamineTask etEnt = ExamineTask.Find(TaskId); ExamineStage esEnt = ExamineStage.Find(etEnt.ExamineStageId); sql = string.Format(sql, esEnt.Year, esEnt.StageType, etEnt.BeUserId, TaskId); PageState.Add("DataList", GetPageData(sql, SearchCriterion)); PageState.Add("TaskInfo", etEnt); }
protected void Page_Load(object sender, EventArgs e) { ExamineStageId = RequestData.Get <string>("ExamineStageId"); ToUserId = RequestData.Get <string>("ToUserId"); if (!string.IsNullOrEmpty(ExamineStageId)) { esEnt = ExamineStage.Find(ExamineStageId); } switch (RequestActionString) { case "delete": IList <string> taskIds = RequestData.GetList <string>("taskIds"); foreach (string taskId in taskIds) { ExamineTask etEnt = ExamineTask.Find(taskId); etEnt.DoDelete(); } esEnt.TaskQuan = esEnt.TaskQuan - taskIds.Count; esEnt.DoUpdate(); break; default: DoSelect(); break; } }
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) { Index = RequestData.Get <string>("Index"); ExamineStageId = RequestData.Get <string>("ExamineStageId"); if (!string.IsNullOrEmpty(ExamineStageId)) { esEnt = ExamineStage.Find(ExamineStageId); } id = RequestData.Get <string>("id"); ExamineRelationId = RequestData.Get <string>("ExamineRelationId"); switch (RequestActionString) { case "SaveSubScore": SaveSubScore(); break; case "Submit": SubmitTask(); break; default: DoSelect(); break; } }
private void DoSelect() { if (op != "c" && op != "cs") { if (!String.IsNullOrEmpty(id)) { ent = ExamineStage.Find(id); } SetFormData(ent); sql = @"select A.*,B.BeUserNames,B.UpLevelUserNames,B.SameLevelUserNames,B.DownLevelUserNames,B.RelationName, C.IndicatorName from BJKY_Examine..ExamineStageDetail as A left join BJKY_Examine..DeptExamineRelation as B on A.ExamineRelationId=B.Id left join BJKY_Examine..ExamineIndicator as C on C.Id=A.ExamineIndicatorId where A.ExamineStageId='" + id + "'"; PageState.Add("DataList", DataHelper.QueryDictList(sql)); } if (op == "c") { var obj = new { ExamineType = ExamineType, LaunchUserName = UserInfo.Name, LaunchUserId = UserInfo.UserID }; SetFormData(obj); } sql = @"select Id,GroupName from BJKY_Examine..PersonConfig where (ClerkIds like '%{0}%' or SecondLeaderIds like '%{0}%' or FirstLeaderIds like '%{0}%') and (GroupType='职能服务部门' or GroupType='经营目标单位')"; sql = string.Format(sql, UserInfo.UserID); EasyDictionary dic1 = DataHelper.QueryDict(sql, "Id", "GroupName"); PageState.Add("enumDept", dic1); PageState.Add("EnumYear", SysEnumeration.GetEnumDict("Year")); }
private void DoSelect() { ExamineStageResult esrEnt = ExamineStageResult.Find(ExamineStageResultId); string where = ""; if (SearchCriterion.Orders.Count == 0) { SearchCriterion.SetOrder("ToUserName", true); where = " ExamineStageId='{0}' and State='3' and BeUserId='{1}'"; } else { where = " ExamineStageId='{0}' and State='3' and BeUserId='{1}'"; } where = string.Format(where, esrEnt.ExamineStageId, esrEnt.UserId); IList <ExamineTask> etEnts = ExamineTask.FindAll(SearchCriterion, Expression.Sql(where)); PageState.Add("DataList", etEnts); if (!string.IsNullOrEmpty(esrEnt.ExamineStageId))//有些考核结果是手动填报的 因此需要加判断 有无考核阶段和明细 { ExamineStage esEnt = ExamineStage.Find(esrEnt.ExamineStageId); PageState.Add("ExamineStage", esEnt); } PageState.Add("BeUserName", esrEnt.UserName); }
protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); JsonString = RequestData.Get <string>("JsonString"); switch (RequestActionString) { case "update": ent = JsonHelper.GetObject <ExamineStage>(JsonString); ent.DoUpdate(); PageState.Add("Id", ent.Id); break; case "create": ent = JsonHelper.GetObject <ExamineStage>(JsonString); ent.CreateId = UserInfo.UserID; ent.CreateName = UserInfo.Name; ent.CreateTime = DateTime.Now; ent.State = 0; ent.DoCreate(); PageState.Add("Id", ent.Id); break; default: DoSelect(); break; } }
private void CreateCustomIndicator(string beUserId, string beUserName, ExamineStage esEnt, ExamineStageDetail esdEnt) { ExamineIndicator eiEnt = ExamineIndicator.Find(esdEnt.ExamineIndicatorId); IList <IndicatorFirst> ifEnts = IndicatorFirst.FindAllByProperties(IndicatorFirst.Prop_ExamineIndicatorId, eiEnt.Id, IndicatorFirst.Prop_CustomColumn, "T"); if (ifEnts.Count > 0)//只有当考核指标下指定了需要自定义的指标后,才有必要创建自定义指标 如果没有直接生成考核任务即可 { IList <IndicatorSecond> isEnts = IndicatorSecond.FindAllByProperty(IndicatorSecond.Prop_IndicatorFirstId, ifEnts[0].Id); if (isEnts.Count > 0) { CustomIndicator ciEnt = new CustomIndicator(); ciEnt.ExamineStageId = esEnt.Id; ciEnt.CreateId = beUserId; ciEnt.CreateName = beUserName; ciEnt.CreateTime = DateTime.Now; ciEnt.DeptId = esEnt.LaunchDeptId; ciEnt.DeptName = esEnt.LaunchDeptName; ciEnt.IndicatorNo = DataHelper.QueryValue <string>("select BJKY_Examine.dbo.fun_getIndicatorNo()"); ciEnt.DeptIndicatorName = eiEnt.IndicatorName; ciEnt.DeptIndicatorId = eiEnt.Id; ciEnt.IndicatorSecondId = isEnts[0].Id; ciEnt.IndicatorSecondName = ifEnts[0].IndicatorFirstName; ciEnt.Weight = ifEnts[0].MaxScore; ciEnt.Year = esEnt.Year; ciEnt.StageType = esEnt.StageType; ciEnt.State = "0"; ciEnt.DoCreate(); } } }
protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get <string>("id"); if (!string.IsNullOrEmpty(id)) { pcEnt = PersonConfig.Find(id); } ExamineStageId = RequestData.Get <string>("ExamineStageId"); switch (RequestActionString) { case "AutoSave": int ExcellentQuan = RequestData.Get <int>("ExcellentQuan"); int GoodQuan = RequestData.Get <int>("GoodQuan"); if (ExcellentQuan > 0 && pcEnt.PeopleQuan > 0) { pcEnt.ExcellentRate = Math.Round(((decimal)ExcellentQuan / (decimal)pcEnt.PeopleQuan) * 100, 2); pcEnt.ExcellentQuan = ExcellentQuan; PageState.Add("ExcellentRate", pcEnt.ExcellentRate); } if (GoodQuan > 0 && pcEnt.PeopleQuan > 0) { pcEnt.GoodRate = Math.Round(((decimal)GoodQuan / (decimal)pcEnt.PeopleQuan) * 100, 2); pcEnt.GoodQuan = GoodQuan; PageState.Add("GoodRate", pcEnt.GoodRate); } pcEnt.DoUpdate(); break; case "delete": IList <string> strList = RequestData.GetList <string>("ids"); foreach (string str in strList) { if (!string.IsNullOrEmpty(str)) { pcEnt = PersonConfig.Find(str); pcEnt.DoDelete(); } } break; case "CreateTaskAgain": if (!string.IsNullOrEmpty(ExamineStageId)) { esEnt = ExamineStage.Find(ExamineStageId); IList <ExamineStageDetail> esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, ExamineStageId); //从这个入口进来生成任务 说明考核阶段的各条件都是满足的 StartExamine(); //临时任务创建完毕以后 把该考核阶段对应的两个任务集合进行对比 AmendTask(); } break; default: DoSelect(); break; } }
private void DoSelect() { sql = @"select A.*, B.RelationName from BJKY_Examine..ExamineStageDetail as A left join BJKY_Examine..ExamineRelation as B on A.ExamineRelationId=B.Id where A.ExamineStageId='" + id + "' order by RelationName asc"; PageState.Add("DataList", DataHelper.QueryDictList(sql)); ent = ExamineStage.Find(id); SetFormData(ent); }
private void DoSelect() { sql = @"select A.*,B.BeUserNames,B.UpLevelUserNames,B.SameLevelUserNames,B.DownLevelUserNames,B.RelationName, C.IndicatorName from BJKY_Examine..ExamineStageDetail as A left join BJKY_Examine..DeptExamineRelation as B on A.ExamineRelationId=B.Id left join BJKY_Examine..ExamineIndicator as C on C.Id=A.ExamineIndicatorId where A.ExamineStageId='" + id + "' order by RelationName asc"; PageState.Add("DataList", DataHelper.QueryDictList(sql)); ent = ExamineStage.Find(id); SetFormData(ent); }
protected void Page_Load(object sender, EventArgs e) { ExamineStageId = RequestData.Get <string>("ExamineStageId"); if (!string.IsNullOrEmpty(ExamineStageId)) { esEnt = ExamineStage.Find(ExamineStageId); //如果考核阶段的状态是已生成 任务状态是0 如果是已启动 任务状态为1 state = esEnt.State == 1 ? "0" : "1"; } switch (RequestActionString) { case "AmendTask": //需要添加的任务 ttEnts = TempTask.FindAllByProperties(TempTask.Prop_ExamineStageId, ExamineStageId, TempTask.Prop_AmendState, "+"); int addQuan = ttEnts.Count; foreach (TempTask ttEnt in ttEnts) //特殊任务也连同判断了 { ExamineTask etEnt = new ExamineTask("", ttEnt.ExamineStageId, ttEnt.ToUserId, ttEnt.ToUserName, ttEnt.ToDeptId, ttEnt.ToDeptName, ttEnt.ToRoleCode, ttEnt.ToRoleName, ttEnt.BeUserId, ttEnt.BeUserName, ttEnt.BeDeptId, ttEnt.BeDeptName, ttEnt.BeRoleCode, ttEnt.BeRoleName, null, state, ttEnt.Tag, null, UserInfo.UserID, UserInfo.Name, System.DateTime.Now, ttEnt.ExamineIndicatorId, ttEnt.ExamineRelationId); etEnt.DoCreate(); ttEnt.DoDelete(); } etEnts = ExamineTask.FindAllByProperties(ExamineTask.Prop_ExamineStageId, ExamineStageId, ExamineTask.Prop_AmendState, "-"); int reduceQuan = etEnts.Count; foreach (ExamineTask etEnt in etEnts) { etEnt.DoDelete(); } esEnt.TaskQuan = esEnt.TaskQuan + addQuan - reduceQuan; esEnt.DoUpdate(); PageState.Add("Result", "增补任务数量:【" + addQuan.ToString() + "】 删除任务数量:【" + reduceQuan.ToString() + "】!"); break; case "CancelAmendTask": ttEnts = TempTask.FindAllByProperties(TempTask.Prop_ExamineStageId, ExamineStageId, TempTask.Prop_AmendState, "+"); foreach (TempTask ttEnt in ttEnts) //特殊任务也连同判断了 { ttEnt.DoDelete(); } etEnts = ExamineTask.FindAllByProperties(ExamineTask.Prop_ExamineStageId, ExamineStageId, ExamineTask.Prop_AmendState, "-"); foreach (ExamineTask etEnt in etEnts) { etEnt.AmendState = null; etEnt.DoUpdate(); } 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) { default: DoSelect(); break; } }
private void DoSelect() { if (op == "c") { if (!String.IsNullOrEmpty(ExamYearResultId)) { ExamYearResult eyrEnt = ExamYearResult.Find(ExamYearResultId); ExamineStage esEnt = ExamineStage.Find(eyrEnt.ExamineStageId); IList <PersonConfig> pcEnts1 = PersonConfig.FindAllByProperty("GroupCode", "HRAppealAcceptor"); IList <PersonConfig> pcEnts2 = PersonConfig.FindAllByProperty("GroupCode", "HRAppealCharger"); IList <PersonConfig> pcEnts3 = PersonConfig.FindAllByProperty("Id", eyrEnt.DeptId); var obj = new { ExamYearResultId = ExamYearResultId, ExamineStageId = eyrEnt.ExamineStageId, ExamineType = esEnt.ExamineType, AppealUserId = eyrEnt.UserId, AppealUserName = eyrEnt.UserName, OriginalScore = eyrEnt.ApproveScore.HasValue ? eyrEnt.ApproveScore : eyrEnt.IntegrationScore, OriginalLevel = String.IsNullOrEmpty(eyrEnt.ApproveLevel) ? eyrEnt.ApproveLevel : eyrEnt.AdviceLevel, //有可能是部门级考核 没有角色编号和角色名称 BeRoleCode = !string.IsNullOrEmpty(eyrEnt.BeRoleCode) ? eyrEnt.BeRoleCode : "", BeRoleName = !string.IsNullOrEmpty(eyrEnt.BeRoleCode) ? SysEnumeration.FindAllByProperty(SysEnumeration.Prop_Code, eyrEnt.BeRoleCode).First <SysEnumeration>().Name : "", DeptId = eyrEnt.DeptId, DeptName = eyrEnt.DeptName, AppealTime = System.DateTime.Now.ToShortDateString(), AcceptUserId = pcEnts1.Count > 0 ? pcEnts1[0].ClerkIds.Replace(",", "") : "", AcceptUserName = pcEnts1.Count > 0 ? pcEnts1[0].ClerkNames : "", DeptLeaderId = pcEnts3.Count > 0 ? pcEnts3[0].FirstLeaderIds.Replace(",", "") : "", DeptLeaderName = pcEnts3.Count > 0 ? pcEnts3[0].FirstLeaderNames : "", HrUserId = pcEnts2.Count > 0 ? pcEnts2[0].ClerkIds.Replace(",", "") : "", HrUserName = pcEnts2.Count > 0 ? pcEnts2[0].ClerkNames : "" }; SetFormData(obj); } } else { if (!string.IsNullOrEmpty(id)) { ent = ExamineAppeal.Find(id); SetFormData(ent); } } PageState.Add("ExamineLevel", SysEnumeration.GetEnumDict("ExamineLevel")); }
protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get <string>("id"); if (!string.IsNullOrEmpty(id)) { esEnt = ExamineStage.Find(id); } switch (RequestActionString) { case "delete": string ids = RequestData.Get <string>("ids"); sql = "delete BJKY_Examine..ExamineTask where PatIndex('%'+id+'%','" + ids + "')>0"; DataHelper.ExecSql(sql); break; case "canceltask": if (esEnt.State == 1) { sql = "delete BJKY_Examine..ExamineTask where ExamineStageId='" + id + "'"; DataHelper.ExecSql(sql); sql = "delete BJKY_Examine..CustomIndicator where ExamineStageId='" + id + "'"; DataHelper.ExecSql(sql); esEnt.TaskQuan = 0; esEnt.State = 0; esEnt.DoUpdate(); } break; case "createtask": if (esEnt.State == 0) { CreateExamineTask(); //同时创建自定义的考核指标 esEnt.State = 1; //更新考核阶段状态为1 已生成 etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ExamineStageId, id); esEnt.TaskQuan = etEnts.Count; esEnt.DoUpdate(); } break; default: DoSelect(); break; } }
protected void Page_Load(object sender, EventArgs e) { ExamineStageId = RequestData.Get <string>("ExamineStageId"); ToUserId = RequestData.Get <string>("ToUserId"); if (!string.IsNullOrEmpty(ExamineStageId)) { esEnt = ExamineStage.Find(ExamineStageId); } switch (RequestActionString) { case "SendMessage": SendMessage(); break; default: DoSelect(); break; } }
protected void Page_Load(object sender, EventArgs e) { ExamineStageId = RequestData.Get <string>("ExamineStageId"); if (!string.IsNullOrEmpty(ExamineStageId)) { esEnt = ExamineStage.Find(ExamineStageId); } IList <String> entStrList = RequestData.GetList <string>("data"); switch (RequestActionString) { case "Submit": if (entStrList.Count > 0) { IList <ExamYearResult> eyrEnts = entStrList.Select(tent => JsonHelper.GetObject <ExamYearResult>(tent) as ExamYearResult).ToList(); foreach (ExamYearResult eyrEnt in eyrEnts) { eyrEnt.ApproveUserId = UserInfo.UserID; eyrEnt.ApproveUserName = UserInfo.Name; eyrEnt.ApproveTime = System.DateTime.Now; eyrEnt.DoUpdate(); } } esEnt.State = 5; esEnt.DoUpdate(); break; case "TempSave": if (entStrList.Count > 0) { IList <ExamYearResult> eyrEnts = entStrList.Select(tent => JsonHelper.GetObject <ExamYearResult>(tent) as ExamYearResult).ToList(); foreach (ExamYearResult eyrEnt in eyrEnts) { eyrEnt.DoUpdate(); } } break; default: DoSelect(); break; } }
private void SaveExamineStageDetail(ExamineStage esEnt) { IList <string> entStrList = RequestData.GetList <string>("data"); IList <ExamineStageDetail> esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, id); foreach (ExamineStageDetail esdEnt in esdEnts) { esdEnt.DoDelete(); } if (entStrList != null && entStrList.Count > 0) { esdEnts = entStrList.Select(tent => JsonHelper.GetObject <ExamineStageDetail>(tent) as ExamineStageDetail).ToList(); foreach (ExamineStageDetail esdEnt in esdEnts) { esdEnt.ExamineStageId = esEnt.Id; esdEnt.DoCreate(); } } }
protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get <string>("id"); ToUserId = RequestData.Get <string>("ToUserId"); if (!string.IsNullOrEmpty(id)) { esEnt = ExamineStage.Find(id); } switch (RequestActionString) { case "endexamine": EndExamine(); PageState.Add("Id", esEnt.Id); break; default: DoSelect(); break; } }
protected void Page_Load(object sender, EventArgs e) { ExamineStageId = RequestData.Get <string>("ExamineStageId"); if (!string.IsNullOrEmpty(ExamineStageId)) { esEnt = ExamineStage.Find(ExamineStageId); } IList <string> YearResultIds = RequestData.GetList <string>("YearResultIds"); switch (RequestActionString) { case "Submit": esEnt.State = 4; esEnt.DoUpdate(); break; case "AutoSave": string id = RequestData.Get <string>("id"); string AdviceLevel = RequestData.Get <string>("AdviceLevel"); if (!string.IsNullOrEmpty(id)) { ExamYearResult eyrEnt = ExamYearResult.Find(id); eyrEnt.AdviceLevel = AdviceLevel; eyrEnt.ApproveLevel = AdviceLevel; eyrEnt.DoUpdate(); } break; case "FindExamineStageResultId": IList <ExamineStageResult> esrEnts = ExamineStageResult.FindAllByProperties("Year", RequestData.Get <string>("Year"), "StageType", RequestData.Get <string>("StageType"), "UserId", RequestData.Get <string>("UserId")); if (esrEnts.Count > 0) { PageState.Add("FindExamineStageResultId", esrEnts[0].Id); } break; default: DoSelect(); break; } }
protected void Page_Load(object sender, EventArgs e) { ExamineStageId = RequestData.Get <string>("ExamineStageId"); if (!string.IsNullOrEmpty(ExamineStageId)) { esEnt = ExamineStage.Find(ExamineStageId); } IList <string> YearResultIds = RequestData.GetList <string>("YearResultIds"); switch (RequestActionString) { case "Submit": esEnt.State = 4; esEnt.DoUpdate(); break; case "AutoSave": string id = RequestData.Get <string>("id"); string AdviceLevel = RequestData.Get <string>("AdviceLevel"); if (!string.IsNullOrEmpty(id)) { ExamYearResult eyrEnt = ExamYearResult.Find(id); eyrEnt.AdviceLevel = AdviceLevel; //副院长和部门员工不需要人力资源部评定等级 if (eyrEnt.BeRoleCode != "BeDeptClerk" && eyrEnt.BeRoleCode != "BeDeputyDirector") { eyrEnt.ApproveLevel = AdviceLevel; } eyrEnt.DoUpdate(); } break; default: DoSelect(); break; } }
private void DoSelect() { if (string.IsNullOrEmpty(id)) { var obj = new { LaunchUserName = UserInfo.Name, LaunchUserId = UserInfo.UserID }; SetFormData(obj); } else { ent = ExamineStage.Find(id); SetFormData(ent); } sql = @"select Id,GroupName from BJKY_Examine..PersonConfig where (ClerkIds like '%{0}%' or SecondLeaderIds like '%{0}%' or FirstLeaderIds like '%{0}%') and (GroupType='职能服务部门' or GroupType='经营目标单位')"; sql = string.Format(sql, UserInfo.UserID); EasyDictionary dic1 = DataHelper.QueryDict(sql, "Id", "GroupName"); PageState.Add("enumDept", dic1); PageState.Add("EnumYear", SysEnumeration.GetEnumDict("Year")); }
private void DoSelect() { sql = @"select A.Id,A.PersonFirstIndicatorId, A.PersonSecondIndicatorName,A.Weight,A.SortIndex, A.ToolTip,A.SelfRemark, B.IndicatorType,B.PersonFirstIndicatorName, B.Weight as FirstWeight, B.SortIndex as FirstIndex ,C.Summary, (select top 1 CustomScore from BJKY_Examine..CustomFirstIndicatorScore where ExamineTaskId='{5}' and PersonFirstIndicatorId=B.Id) as Score from BJKY_Examine..PersonSecondIndicator as A left join BJKY_Examine..PersonFirstIndicator as B on A.PersonFirstIndicatorId=B.Id left join BJKY_Examine..CustomIndicator as C on B.CustomIndicatorId=C.Id where C.CreateId='{0}' and C.Year='{1}' and C.StageType='{2}' and C.DeptId='{3}' and C.IndicatorSecondId='{4}' and C.Result='同意' order by B.IndicatorType desc ,B.Id asc,A.SortIndex asc"; ExamineTask etEnt = ExamineTask.Find(ExamineTaskId); ExamineStage esEnt = ExamineStage.Find(etEnt.ExamineStageId); sql = string.Format(sql, etEnt.BeUserId, esEnt.Year, esEnt.StageType, esEnt.LaunchDeptId, IndicatorSecondId, ExamineTaskId); IList <EasyDictionary> dics0 = DataHelper.QueryDictList(sql); IList <EasyDictionary> dics1 = new List <EasyDictionary>(); string temp = ""; foreach (EasyDictionary dic0 in dics0) { EasyDictionary dic1 = new EasyDictionary(); if (temp != dic0.Get <string>("PersonFirstIndicatorId")) { temp = dic0.Get <string>("PersonFirstIndicatorId"); dic1.Add("PersonFirstIndicatorId", dic0.Get <string>("PersonFirstIndicatorId")); dic1.Add("IndicatorType", dic0.Get <string>("IndicatorType")); dic1.Add("PersonFirstIndicatorName", dic0.Get <string>("PersonFirstIndicatorName")); dic1.Add("FirstWeight", dic0.Get <string>("FirstWeight")); dic1.Add("Id", dic0.Get <string>("Id")); dic1.Add("PersonSecondIndicatorName", dic0.Get <string>("PersonSecondIndicatorName")); dic1.Add("Weight", dic0.Get <string>("Weight")); dic1.Add("ToolTip", dic0.Get <string>("ToolTip")); dic1.Add("SelfRemark", dic0.Get <string>("SelfRemark")); dic1.Add("Score", dic0.Get <string>("Score")); dic1.Add("Summary", dic0.Get <string>("Summary")); } else { dic1.Add("PersonFirstIndicatorId", ""); dic1.Add("IndicatorType", ""); dic1.Add("PersonFirstIndicatorName", ""); dic1.Add("FirstWeight", ""); dic1.Add("Id", dic0.Get <string>("Id")); dic1.Add("PersonSecondIndicatorName", dic0.Get <string>("PersonSecondIndicatorName")); dic1.Add("Weight", dic0.Get <string>("Weight")); dic1.Add("ToolTip", dic0.Get <string>("ToolTip")); dic1.Add("SelfRemark", dic0.Get <string>("SelfRemark")); dic1.Add("Score", ""); dic1.Add("Summary", dic0.Get <string>("Summary")); } dics1.Add(dic1); } PageState.Add("DataList", dics1); IndicatorSecond isEnt = IndicatorSecond.Find(IndicatorSecondId); var obj = new { DeptName = etEnt.BeDeptName, IndicatorSecondName = isEnt.IndicatorSecondName, MaxScore = isEnt.MaxScore, BeUserName = etEnt.BeUserName }; PageState.Add("BaseInfo", obj); }
private void DoSelect() { string sequence = ""; DeptExamineRelation derEnt = DeptExamineRelation.TryFind(ExamineRelationId);//根据阶段取得部门 if (derEnt != null) { sequence = derEnt.BeUserNames; } if (Index == "0") { sql = @"select *,CharIndex(BeUserName,'{0}') as SortIndex from BJKY_Examine..ExamineTask where State='1' and ExamineStageId='{1}' and ToUserId='{2}' and ExamineRelationId='{3}' order by SortIndex "; sql = string.Format(sql, sequence, ExamineStageId, UserInfo.UserID, ExamineRelationId); } if (Index == "1") { sql = @"select *,CharIndex(BeUserName,'{0}') as SortIndex from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{1}' and ToUserId='{2}' and ExamineRelationId='{3}'"; sql = string.Format(sql, sequence, ExamineStageId, UserInfo.UserID, ExamineRelationId); } if (Index == "2") { sql = @"select *,CharIndex(BeUserName,'{0}') as SortIndex from BJKY_Examine..ExamineTask where State='3' and ExamineStageId='{1}' and ToUserId='{2}' and ExamineRelationId='{3}' order by SortIndex "; sql = string.Format(sql, sequence, ExamineStageId, UserInfo.UserID, ExamineRelationId); } if (!string.IsNullOrEmpty(id))//单任务查看明细 { sql = @"select * from BJKY_Examine..ExamineTask where Id='" + id + "'"; } IList <EasyDictionary> dics = DataHelper.QueryDictList(sql);//找到所有符合条件的任务 if (dics.Count > 0) { if (Index != "2") { DataTable dt = new DataTable(); DataColumn dc = new DataColumn("Id"); dt.Columns.Add(dc); dc = new DataColumn("BeUserName"); dt.Columns.Add(dc); dc = new DataColumn("BeDeptName"); dt.Columns.Add(dc); dc = new DataColumn("Score"); dt.Columns.Add(dc); dc = new DataColumn("Tag"); dt.Columns.Add(dc); DataTable dt1 = new DataTable();//这个表专门用来存储一级指标名称和各2级指标数量 DataColumn dc1 = new DataColumn("IndicatorFirstName"); dt1.Columns.Add(dc1); dc1 = new DataColumn("SecondCount"); dt1.Columns.Add(dc1); ExamineIndicator eiEnt = ExamineIndicator.Find(dics[0].Get <string>("ExamineIndicatorId")); IList <IndicatorFirst> ifEnts = IndicatorFirst.FindAllByProperty("SortIndex", IndicatorFirst.Prop_ExamineIndicatorId, eiEnt.Id); foreach (IndicatorFirst ifEnt in ifEnts) { IList <IndicatorSecond> isEnts = IndicatorSecond.FindAllByProperty("SortIndex", IndicatorSecond.Prop_IndicatorFirstId, ifEnt.Id); DataRow dr1 = dt1.NewRow(); dr1["IndicatorFirstName"] = ifEnt.IndicatorFirstName + "(" + ifEnt.MaxScore + ")"; dr1["SecondCount"] = isEnts.Count; if (isEnts.Count > 0) { dt1.Rows.Add(dr1);//防止只有一级指标无2级指标。 } foreach (IndicatorSecond isEnt in isEnts) { string standard = "!" + ifEnt.CustomColumn + "#" + isEnt.ToolTip; //加入#号前面的字符是为了验证自定义指标列 dc = new DataColumn(isEnt.Id + isEnt.IndicatorSecondName + "(" + isEnt.MaxScore + ")" + standard); //列名有多种信息组合而成。便于前台取对应的值 dt.Columns.Add(dc); //循环2级指标构建剩余列 } } IList <EasyDictionary> secDics = null; if (dics.Count > 0)//通过任务的指标Id找到其下所有 的二级指标 { sql = @"select A.Id, a.IndicatorSecondName,B.CustomColumn,A.ToolTip,A.MaxScore from BJKY_Examine..IndicatorSecond A left join BJKY_Examine..IndicatorFirst B on A.IndicatorFirstId=B.Id where B.ExamineIndicatorid='{0}' " ; sql = string.Format(sql, dics[0].Get <string>("ExamineIndicatorId")); secDics = DataHelper.QueryDictList(sql); } foreach (EasyDictionary dic in dics)//通过任务构建行记录 { DataRow dr = dt.NewRow(); dr["Id"] = dic.Get <string>("Id"); dr["BeUserName"] = dic.Get <string>("BeUserName"); dr["BeDeptName"] = dic.Get <string>("BeDeptName"); dr["Score"] = dic.Get <string>("Score"); dr["Tag"] = dic.Get <string>("Tag"); foreach (EasyDictionary secDic in secDics) { string standard = "!" + secDic.Get <string>("CustomColumn") + "#" + secDic.Get <string>("ToolTip"); IList <IndicatorScore> insEnts = IndicatorScore.FindAllByProperties(IndicatorScore.Prop_ExamineTaskId, dic.Get <string>("Id"), IndicatorScore.Prop_IndicatorSecondId, secDic.Get <string>("Id")); if (insEnts.Count > 0) { dr[secDic.Get <string>("Id") + secDic.Get <string>("IndicatorSecondName") + "(" + secDic.Get <string>("MaxScore") + ")" + standard] = insEnts[0].SubScore; } } dt.Rows.Add(dr); } PageState.Add("DataList", dt); PageState.Add("ColumnData", dt.Columns); PageState.Add("DataList1", dt1); } else { InitialHistoryScore(dics); } esEnt = ExamineStage.Find(ExamineStageId); string stageType = ""; if (esEnt.StageType != "4") { stageType = "第" + esEnt.StageType + "季度"; } else { stageType = "年度"; } PageState.Add("Title", esEnt.Year + stageType + "考核评分表"); } }
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; } }