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(); } } }
private void DoSelect() { sql = @"select Id as IndicatorFirstId ,IndicatorFirstName from BJKY_Examine..IndicatorFirst where ExamineIndicatorId = '" + ExamineIndicatorId + "' order by SortIndex asc "; EasyDictionary dic = DataHelper.QueryDict(sql, "IndicatorFirstId", "IndicatorFirstName"); PageState.Add("IndictorFirstEnum", dic);//Combo数据集 if (op != "c" && op != "cs") { if (!String.IsNullOrEmpty(id)) { ent = IndicatorSecond.Find(id); } SetFormData(ent); SearchCriterion.AddSearch(ScoreStandard.Prop_IndicatorSecondId, id); SearchCriterion.SetOrder("SortIndex", true); ents = ScoreStandard.FindAll(SearchCriterion); PageState.Add("DataList", ents); } else { if (!string.IsNullOrEmpty(IndicatorFirstId)) { IndicatorFirst ifEnt = IndicatorFirst.Find(IndicatorFirstId); sql = "select isnull(max(SortIndex),0) from BJKY_Examine..IndicatorSecond where IndicatorFirstId='" + IndicatorFirstId + "'"; var obj = new { SortIndex = DataHelper.QueryValue <int>(sql) + 1, ExamineIndicatorId = ExamineIndicatorId }; SetFormData(obj); } } }
private void SaveDetail(IndicatorSecond isEnt) { IList <ScoreStandard> ssEnts = ScoreStandard.FindAllByProperty(ScoreStandard.Prop_IndicatorSecondId, id); foreach (ScoreStandard ssEnt in ssEnts) { ssEnt.DoDelete(); } IList <string> entStrList = RequestData.GetList <string>("data"); string temp = string.Empty; if (entStrList != null && entStrList.Count > 0) { IList <ScoreStandard> pfiEnts = entStrList.Select(tent => JsonHelper.GetObject <ScoreStandard>(tent) as ScoreStandard).ToList(); foreach (ScoreStandard ifItem in pfiEnts) { ifItem.IndicatorSecondId = isEnt.Id; ifItem.IndicatorThirdName = ifItem.IndicatorThirdName.Replace("\"", "'");//去除双引号 temp += temp + ifItem.SortIndex.ToString() + ":" + ifItem.IndicatorThirdName + "@" + ifItem.MaxScore + "$"; ifItem.DoCreate(); } } if (temp.Length > 0) { isEnt.ToolTip = temp.Substring(0, temp.Length - 1); } else { isEnt.ToolTip = temp; } isEnt.DoUpdate(); }
protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); IndicatorFirstId = RequestData.Get <string>("IndicatorFirstId"); ExamineIndicatorId = RequestData.Get <string>("ExamineIndicatorId"); switch (RequestActionString) { case "update": ent = GetMergedData <IndicatorSecond>(); ent.DoUpdate(); SaveDetail(ent); break; case "create": ent = this.GetPostedData <IndicatorSecond>(); ent.DoCreate(); SaveDetail(ent); break; default: DoSelect(); break; } }
private void DoBatchDelete() //批量删除 { IList <object> idList = RequestData.GetList <object>("IdList"); if (idList != null && idList.Count > 0) { foreach (string item in idList) { IList <IndicatorFirst> ifEnts = IndicatorFirst.FindAllByProperty(IndicatorFirst.Prop_ExamineIndicatorId, item); foreach (IndicatorFirst ifEnt in ifEnts) { IList <IndicatorSecond> isEnts = IndicatorSecond.FindAllByProperty(IndicatorSecond.Prop_IndicatorFirstId, ifEnt.Id); foreach (IndicatorSecond isEnt in isEnts) { IList <ScoreStandard> ssEnts = ScoreStandard.FindAllByProperty(ScoreStandard.Prop_IndicatorSecondId, isEnt.Id); foreach (ScoreStandard ssEnt in ssEnts) { ssEnt.DoDelete(); } isEnt.DoDelete(); } ifEnt.DoDelete(); } } ExamineIndicator.DoBatchDelete(idList.ToArray()); } }
private void DoBatchDelete() { IList <object> idList = RequestData.GetList <object>("IdList"); if (idList != null && idList.Count > 0) { foreach (string item in idList) { IList <ScoreStandard> ssEnts = ScoreStandard.FindAllByProperty(ScoreStandard.Prop_IndicatorSecondId, item); foreach (ScoreStandard ssEnt in ssEnts) { ssEnt.DoDelete(); } } IndicatorSecond.DoBatchDelete(idList.ToArray()); } }
protected void Page_Load(object sender, EventArgs e) { IndicatorFirstId = RequestData.Get <string>("IndicatorFirstId"); IndicatorFirstName = RequestData.Get <string>("IndicatorFirstName"); switch (RequestActionString) { case "JudgeRepeat": string IndicatorSecondName = RequestData.Get <string>("IndicatorSecondName"); if (!string.IsNullOrEmpty(IndicatorSecondName)) { IList <IndicatorSecond> pfiEnts = IndicatorSecond.FindAllByProperties(IndicatorSecond.Prop_IndicatorSecondName, IndicatorSecondName, IndicatorSecond.Prop_IndicatorFirstId, IndicatorFirstId); if (pfiEnts.Count > 0) { PageState.Add("Result", true); } } break; case "Save": IList <string> entStrList = RequestData.GetList <string>("data"); if (entStrList != null && entStrList.Count > 0) { IList <IndicatorSecond> psiEnts = entStrList.Select(tent => JsonHelper.GetObject <IndicatorSecond>(tent) as IndicatorSecond).ToList(); foreach (IndicatorSecond isItem in psiEnts) { isItem.DoSave(); PageState.Add("Id", isItem.Id); } } break; case "batchdelete": DoBatchDelete(); break; default: DoSelect(); break; } }
private void DoCopy(ExamineIndicator eiNEnt, string oid) { IList <IndicatorFirst> ifOEnts = IndicatorFirst.FindAllByProperty(IndicatorFirst.Prop_SortIndex, IndicatorFirst.Prop_ExamineIndicatorId, oid); foreach (IndicatorFirst ifOEnt in ifOEnts) { IndicatorFirst ifNEnt = new IndicatorFirst(null, eiNEnt.Id, ifOEnt.IndicatorFirstName, "F", "F", ifOEnt.MaxScore, ifOEnt.SortIndex); ifNEnt.DoCreate(); IList <IndicatorSecond> isOEnts = IndicatorSecond.FindAllByProperty(IndicatorSecond.Prop_SortIndex, IndicatorSecond.Prop_IndicatorFirstId, ifOEnt.Id); foreach (IndicatorSecond isOEnt in isOEnts) { IndicatorSecond isNEnt = new IndicatorSecond(null, ifNEnt.Id, ifNEnt.IndicatorFirstName, isOEnt.IndicatorSecondName, isOEnt.MaxScore, isOEnt.SortIndex, isOEnt.ToolTip); isNEnt.DoCreate(); IList <ScoreStandard> ssOEnts = ScoreStandard.FindAllByProperty(ScoreStandard.Prop_SortIndex, ScoreStandard.Prop_IndicatorSecondId, isOEnt.Id); foreach (ScoreStandard ssOEnt in ssOEnts) { ScoreStandard ssNEnt = new ScoreStandard("", isNEnt.Id, ssOEnt.IndicatorThirdName, ssOEnt.MaxScore, ssOEnt.SortIndex); ssNEnt.DoCreate(); } } } }
private void SaveSubScore() { string ExamineTaskId = RequestData.Get <string>("ExamineTaskId"); ExamineTask etEnt = ExamineTask.Find(ExamineTaskId); string IndicatorSecondId = RequestData.Get <string>("IndicatorSecondId"); decimal SubScore = RequestData.Get <decimal>("SubScore"); //decimal Score = RequestData.Get<decimal>("Score"); IList <IndicatorScore> insEnts = IndicatorScore.FindAllByProperties(IndicatorScore.Prop_ExamineTaskId, ExamineTaskId, IndicatorScore.Prop_IndicatorSecondId, IndicatorSecondId); if (insEnts.Count > 0)//更新 { insEnts[0].SubScore = SubScore; insEnts[0].DoUpdate(); } else//创建 { IndicatorScore insEnt = new IndicatorScore(); IndicatorSecond isEnt = IndicatorSecond.Find(IndicatorSecondId); IndicatorFirst ifEnt = IndicatorFirst.Find(isEnt.IndicatorFirstId); string tooltip = "!" + ifEnt.CustomColumn + "#" + isEnt.ToolTip;//加入#号前面的字符是为了标识该指标下有自定义指标,有明细分 insEnt.ExamineTaskId = ExamineTaskId; insEnt.IndicatorFirstId = isEnt.IndicatorFirstId; insEnt.IndicatorFirstName = isEnt.IndicatorFirstName; insEnt.FirstMaxScore = ifEnt.MaxScore; insEnt.FirstSortIndex = ifEnt.SortIndex; insEnt.IndicatorSecondId = isEnt.Id; insEnt.IndicatorSecondName = isEnt.IndicatorSecondName; insEnt.SecondMaxScore = isEnt.MaxScore; insEnt.SecondSortIndex = isEnt.SortIndex; insEnt.SubScore = SubScore; insEnt.ToolTip = tooltip; insEnt.DoCreate(); } sql = "select isnull(SUM(SubScore),0) FROM BJKY_Examine..IndicatorScore WHERE ExamineTaskId = '" + ExamineTaskId + "'"; etEnt.Score = DataHelper.QueryValue <decimal>(sql); etEnt.DoUpdate(); PageState.Add("Score", etEnt.Score); }
private void SaveSubScore() { string ExamineTaskId = RequestData.Get <string>("ExamineTaskId"); ExamineTask etEnt = ExamineTask.Find(ExamineTaskId); string IndicatorSecondId = RequestData.Get <string>("IndicatorSecondId"); decimal SubScore = RequestData.Get <decimal>("SubScore"); decimal Score = RequestData.Get <decimal>("Score"); IList <IndicatorScore> insEnts = IndicatorScore.FindAllByProperties(IndicatorScore.Prop_ExamineTaskId, ExamineTaskId, IndicatorScore.Prop_IndicatorSecondId, IndicatorSecondId); if (insEnts.Count > 0)//更新 { insEnts[0].SubScore = SubScore; insEnts[0].DoUpdate(); } else//创建 { IndicatorScore insEnt = new IndicatorScore(); IndicatorSecond isEnt = IndicatorSecond.Find(IndicatorSecondId); IndicatorFirst ifEnt = IndicatorFirst.Find(isEnt.IndicatorFirstId); string tooltip = "!" + ifEnt.InsteadColumn + "#" + isEnt.ToolTip;//加入#号前面的字符是为了验证经营开发正职 部分要素分是由人力资源部打的 insEnt.ExamineTaskId = ExamineTaskId; insEnt.IndicatorFirstId = isEnt.IndicatorFirstId; insEnt.IndicatorFirstName = isEnt.IndicatorFirstName; insEnt.FirstMaxScore = ifEnt.MaxScore; insEnt.FirstSortIndex = ifEnt.SortIndex; insEnt.IndicatorSecondId = isEnt.Id; insEnt.IndicatorSecondName = isEnt.IndicatorSecondName; insEnt.SecondMaxScore = isEnt.MaxScore; insEnt.SecondSortIndex = isEnt.SortIndex; insEnt.SubScore = SubScore; insEnt.ToolTip = tooltip; insEnt.DoCreate(); etEnt.Score = Score; etEnt.DoUpdate(); } etEnt.Score = Score; etEnt.DoUpdate(); }
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 + "考核评分表"); } }