Beispiel #1
0
        public void ParseIndicatorScoreParameterNull_Test()
        {
            // Arrange
            IndicatorScoreDTO indicatorScoreDTO = null;

            // Act
            IndicatorScore indicatorScore = factory.Parse(indicatorScoreDTO);
        }
Beispiel #2
0
 public IndicatorScoreDTO Create(IndicatorScore indicatorScore)
 {
     return(new IndicatorScoreDTO()
     {
         Id = indicatorScore.Id,
         Name = indicatorScore.Name,
         Weight = indicatorScore.Weight
     });
 }
Beispiel #3
0
        private IndicatorScore ParseForAdd(IndicatorScoreDTO indicatorScoreDTO)
        {
            if (indicatorScoreDTO != null)
            {
                var indicatorScore = new IndicatorScore()
                {
                    Id     = indicatorScoreDTO.Id,
                    Name   = indicatorScoreDTO.Name,
                    Weight = indicatorScoreDTO.Weight
                };

                return(indicatorScore);
            }
            else
            {
                throw new NotSupportedException(String.Format("BAD GATEWAY!!! {0} ADD operation temporary NOT SUPPORTED for IndicatorScore table...", Environment.NewLine));
            }
        }
Beispiel #4
0
        public void ParseIndicatorScoreIdNotZero_Test()
        {
            // Arrange
            IndicatorScoreDTO indicatorScoreDTO = new IndicatorScoreDTO()
            {
                Id     = 2,
                Name   = "TestName",
                Weight = 10
            };

            // Act
            IndicatorScore indicatorScore = factory.Parse(indicatorScoreDTO);

            // Assert
            Assert.True(indicatorScore != null &&
                        indicatorScore.Id == indicatorScoreDTO.Id &&
                        indicatorScore.Name == indicatorScoreDTO.Name &&
                        indicatorScore.Weight == indicatorScoreDTO.Weight);
        }
        private void CancelLaunch()                                     //撤销启动
        {
            if (esEnt.ExamineType == "部门级考核")                           //撤销启动的时候 如果是部门级考核 需要将考核对象的自定义指标状态设置为2  也就是可以还填写自我评价
            {
                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);
                }
                for (int j = 0; j < userIdArray.Length; j++)
                {
                    IList <CustomIndicator> ciEnts = CustomIndicator.FindAllByProperties("CreateId", userIdArray[j], "Year", esEnt.Year, "StageType", esEnt.StageType);
                    if (ciEnts.Count > 0)
                    {
                        ciEnts[0].State = "2";
                        ciEnts[0].DoUpdate();
                    }
                }
            }
            IList <ExamineTask> etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ExamineStageId, esEnt.Id);

            foreach (ExamineTask etEnt in etEnts)
            {
                IList <IndicatorScore> isEnts = IndicatorScore.FindAllByProperty(IndicatorScore.Prop_ExamineTaskId, etEnt.Id);
                foreach (IndicatorScore isEnt in isEnts)
                {
                    isEnt.DoDelete();
                }
                etEnt.DoDelete();
            }
            esEnt.TaskQuan = 0;
            esEnt.State    = 0;
            esEnt.DoUpdate();
        }
Beispiel #6
0
        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);
        }
Beispiel #7
0
        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();
        }
Beispiel #8
0
        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 + "考核评分表");
            }
        }