Esempio n. 1
0
        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 <ExamineStageDetail> esdEnts    = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, id);
                foreach (ExamineStageDetail esdEnt in esdEnts)
                {
                    esdEnt.DoDelete();
                }
                esdEnts = entStrList.Select(tent => JsonHelper.GetObject <ExamineStageDetail>(tent) as ExamineStageDetail).ToList();
                foreach (ExamineStageDetail esdEnt in esdEnts)
                {
                    esdEnt.ExamineStageId = id;
                    esdEnt.DoCreate();
                }
                break;

            default:
                DoSelect();
                break;
            }
        }
Esempio n. 2
0
        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 CreateTask()
        {
            IList <ExamineStageDetail> esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, esEnt.Id);

            foreach (ExamineStageDetail esdEnt in esdEnts)
            {
                DeptExamineRelation derEnt = DeptExamineRelation.Find(esdEnt.ExamineRelationId);
                string[]            beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { };
                if (!string.IsNullOrEmpty(derEnt.BeUserIds))
                {
                    beUserIdArray   = derEnt.BeUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    beUserNameArray = derEnt.BeUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                }
                string   toUserIds = derEnt.UpLevelUserIds + "," + derEnt.SameLevelUserIds + "," + derEnt.DownLevelUserIds;
                string   toUserNames = derEnt.UpLevelUserNames + "," + derEnt.SameLevelUserNames + "," + derEnt.DownLevelUserNames;
                string[] toUserIdArray = new string[] { }; string[] toUserNameArray = new string[] { };
                if (!string.IsNullOrEmpty(toUserIds))
                {
                    toUserIdArray   = toUserIds.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    toUserNameArray = toUserNames.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                }
                for (int i = 0; i < beUserIdArray.Length; i++)
                {
                    //2013-12-5追加功能 生成考核任务的时候针对每一个考核对象,自动创建本阶段考核的自定义考核指标
                    CreateCustomIndicator(beUserIdArray[i], beUserNameArray[i], esEnt, esdEnt);
                    for (int j = 0; j < toUserIdArray.Length; j++)
                    {
                        if (beUserIdArray[i] != toUserIdArray[j])//防止一个人身兼两职。自己对自己不能打分
                        {
                            ExamineTask etEnt = new ExamineTask();
                            etEnt.ExamineStageId = esEnt.Id;
                            etEnt.BeUserId       = beUserIdArray[i];
                            etEnt.BeUserName     = beUserNameArray[i];
                            string[] bedept = Utility.GetDeptInfo(beUserIdArray[i]);
                            etEnt.BeDeptId   = bedept[0];
                            etEnt.BeDeptName = bedept[1];
                            etEnt.ToUserId   = toUserIdArray[j];
                            etEnt.ToUserName = toUserNameArray[j];
                            string[] todept = Utility.GetDeptInfo(toUserIdArray[j]);
                            etEnt.ToDeptId           = todept[0];
                            etEnt.ToDeptName         = todept[1];
                            etEnt.ExamineRelationId  = esdEnt.ExamineRelationId;
                            etEnt.ExamineIndicatorId = esdEnt.ExamineIndicatorId;
                            etEnt.State = "0";
                            etEnt.DoCreate();
                        }
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            id = RequestData.Get <string>("id");
            switch (RequestActionString)
            {
            case "update":
                string             did = RequestData.Get <string>("did");
                string             ExamineIndicatorId = RequestData.Get <string>("ExamineIndicatorId");
                ExamineStageDetail esdEnt             = ExamineStageDetail.Find(did);
                esdEnt.ExamineIndicatorId = ExamineIndicatorId;
                esdEnt.DoUpdate();
                break;

            default:
                DoSelect();
                break;
            }
        }
Esempio n. 5
0
        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();
                }
            }
        }
Esempio n. 6
0
        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 GroupId 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 GroupId 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 == "BeDeptSecondLeader")//部门副职
            {
                IList <PersonConfig> pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupID, esEnt.LaunchDeptId);
                if (pcEnts.Count > 0)
                {
                    beUserIds   = pcEnts[0].SecondLeaderIds;
                    beUserNames = pcEnts[0].SecondLeaderNames;
                    beDeptIds   = pcEnts[0].SecondLeaderGroupIds;
                    beDeptNames = pcEnts[0].SecondLeaderGroupNames;
                }
            }
            if (esdEnt.BeRoleCode == "BeDeptClerk")//部门员工
            {
                IList <PersonConfig> pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupID, esEnt.LaunchDeptId);
                if (pcEnts.Count > 0)
                {
                    beUserIds   = pcEnts[0].ClerkIds;
                    beUserNames = pcEnts[0].ClerkNames;
                    beDeptIds   = pcEnts[0].ClerkGroupIds;
                    beDeptNames = pcEnts[0].ClerkGroupNames;
                }
            }
            return(new string[] { beUserIds, beUserNames, beDeptIds, beDeptNames });
        }
Esempio n. 7
0
 private void CreateSpecialTask(string beUserIds, string beUserNames, string beDeptIds, string beDeptNames, ExamineStageDetail esdEnt) //特例  如果被考对象经营目标单位正职  还需要推送一部分任务到 人力资源部 工作业绩打分人
 {
     if (esdEnt.BeRoleCode == "BeBusinessDeptLeader")
     {
         IList <PersonConfig>   pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupCode, "HRAchievementWritor");
         IList <IndicatorFirst> ifEnts = IndicatorFirst.FindAllByProperty(IndicatorFirst.Prop_InsteadColumn, "T");//配置考核项中。 确实有人力资源打分项
         if (pcEnts.Count > 0 && ifEnts.Count > 0)
         {
             if (!string.IsNullOrEmpty(pcEnts[0].ClerkIds))
             {
                 string[] beUserIdArray = new string[] { };
                 if (!string.IsNullOrEmpty(beUserIds))
                 {
                     beUserIdArray = beUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                 }
                 string[] beUserNameArray = new string[] { };
                 if (!string.IsNullOrEmpty(beUserNames))
                 {
                     beUserNameArray = beUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                 }
                 string[] beDeptIdArray = new string[] { };
                 if (!string.IsNullOrEmpty(beDeptIds))
                 {
                     beDeptIdArray = beDeptIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                 }
                 string[] beDeptNameArray = new string[] { };
                 if (!string.IsNullOrEmpty(beDeptNames))
                 {
                     beDeptNameArray = beDeptNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                 }
                 string[] toUserIdArray = new string[] { };
                 if (!string.IsNullOrEmpty(pcEnts[0].ClerkIds))
                 {
                     toUserIdArray = pcEnts[0].ClerkIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                 }
                 string[] toUserNameArray = new string[] { };
                 if (!string.IsNullOrEmpty(pcEnts[0].ClerkNames))
                 {
                     toUserNameArray = pcEnts[0].ClerkNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                 }
                 for (int i = 0; i < beUserIdArray.Length; i++)
                 {
                     for (int j = 0; j < toUserIdArray.Length; j++)
                     {
                         if (beUserIdArray[i] != toUserIdArray[j])//防止一个人身兼两职。自己对自己不能打分
                         {
                             TempTask etEnt = new TempTask();
                             etEnt.ExamineStageId = esEnt.Id;
                             etEnt.BeRoleCode     = esdEnt.BeRoleCode;
                             etEnt.BeRoleName     = esdEnt.BeRoleName;
                             etEnt.BeUserId       = beUserIdArray[i];
                             etEnt.BeUserName     = beUserNameArray[i];
                             if (i <= beDeptIdArray.Length - 1)
                             {
                                 etEnt.BeDeptId = beDeptIdArray[i];
                             }
                             if (i <= beDeptNameArray.Length - 1)
                             {
                                 etEnt.BeDeptName = beDeptNameArray[i];
                             }
                             etEnt.ToRoleCode = "HRAchievementWritor";
                             etEnt.ToRoleName = ifEnts[0].IndicatorFirstName + "填报人";
                             etEnt.ToUserId   = toUserIdArray[j];
                             etEnt.ToUserName = toUserNameArray[j];
                             sql = @"select GroupID,Name  from SysGroup where PathLevel='4' and 
                               PatIndex('%'+GroupID+'%',(select Path from SysGroup where GroupID=(select top 1 GroupID from SysUserGroup where UserID='" + toUserIdArray[j] + "') ))>0";//通过人直接找4级部门
                             IList <EasyDictionary> dics3 = DataHelper.QueryDictList(sql);
                             if (dics3.Count > 0)
                             {
                                 etEnt.ToDeptId   = dics3[0].Get <string>("GroupID");
                                 etEnt.ToDeptName = dics3[0].Get <string>("Name");
                             }
                             etEnt.ExamineRelationId  = esdEnt.ExamineRelationId;
                             etEnt.ExamineIndicatorId = esdEnt.ExamineIndicatorId;
                             etEnt.State = "0";
                             etEnt.Tag   = "1";
                             etEnt.DoCreate();
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 8
0
        private void CreateTask(string beUserIds, string beUserNames, string beDeptIds, string beDeptNames, ExamineStageDetail esdEnt, string toRoleCode, string toRoleName)
        {
            string toUserIds   = "";
            string toUserNames = "";
            string sql         = "";

            string[]             array  = null;
            DataTable            dt     = new DataTable();
            IList <PersonConfig> pcEnts = null;

            switch (toRoleCode)        //对所有的考核对象进行判断 确定参与考核打分的人员
            {
            case "DirectorSecretary":  //院长书记
            case "DeputyDirector":     //副院长
            case "EnterpriseDirector": //如果上级里面有控股企业董事长和监事长
            case "EnterpriseDeputyDirector":
                pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupCode, toRoleCode);
                if (pcEnts.Count > 0)
                {
                    if (!string.IsNullOrEmpty(pcEnts[0].ClerkIds))
                    {
                        toUserIds   = pcEnts[0].ClerkIds;
                        toUserNames = pcEnts[0].ClerkNames;
                    }
                }
                break;

            case "ExcutiveDeptLeader":    //职能服务部门正职
                sql         = @"select FirstLeaderIds as UserIds,FirstLeaderNames as UserNames  from BJKY_Examine..PersonConfig where GroupType='职能服务部门' and GroupID in 
                         (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')";
                array       = GetUserIdAndName(DataHelper.QueryDictList(sql));
                toUserIds   = array[0];
                toUserNames = array[1];
                break;

            case "BusinessDeptLeader":    //经营目标单位正职
                sql         = @"select FirstLeaderIds as UserIds, FirstLeaderNames as UserNames from BJKY_Examine..PersonConfig where GroupType='经营目标单位' and GroupID in 
                          (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')";
                array       = GetUserIdAndName(DataHelper.QueryDictList(sql));
                toUserIds   = array[0];
                toUserNames = array[1];
                break;

            case "ExcutiveDeptClerkDelegate":    //职能部门员工代表
                sql         = @"select InstituteClerkDelegateIds as UserIds,InstituteClerkDelegateNames as UserNames from BJKY_Examine..PersonConfig
                    where GroupType='职能服务部门' and GroupID in  (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')";
                array       = GetUserIdAndName(DataHelper.QueryDictList(sql));
                toUserIds   = array[0];
                toUserNames = array[1];
                break;

            case "BusinessDeptClerkDelegate":    //经营单位员工代表
                sql         = @"select  InstituteClerkDelegateIds as UserIds, InstituteClerkDelegateNames as UserNames from BJKY_Examine..PersonConfig
                    where GroupType='经营目标单位' and GroupID in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')";
                array       = GetUserIdAndName(DataHelper.QueryDictList(sql));
                toUserIds   = array[0];
                toUserNames = array[1];
                break;

            case "DeptFirstLeader":                                                                     //部门正职    只有部门内考核的时候才会有此考核对象编号
                pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupID, esEnt.LaunchDeptId); //这个时候需要取考核阶段里面的启动部门
                if (pcEnts.Count > 0)
                {
                    toUserIds   = pcEnts[0].FirstLeaderIds;
                    toUserNames = pcEnts[0].FirstLeaderNames;
                }
                break;

            case "DeptSecondLeader":                                                                    //部门副职
                pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupID, esEnt.LaunchDeptId); //这个时候需要取考核阶段里面的启动部门
                if (pcEnts.Count > 0)
                {
                    toUserIds   = pcEnts[0].SecondLeaderIds;
                    toUserNames = pcEnts[0].SecondLeaderNames;
                }
                break;

            case "DeptClerkDelegate":
                pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupID, esEnt.LaunchDeptId);    //这个时候需要取考核阶段里面的启动部门
                if (pcEnts.Count > 0)
                {
                    toUserIds   = pcEnts[0].DeptClerkDelegateIds;
                    toUserNames = pcEnts[0].DeptClerkDelegateNames;
                }
                break;

            case "DeptClerk":
                pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupID, esEnt.LaunchDeptId);    //这个时候需要取考核阶段里面的启动部门
                if (pcEnts.Count > 0)
                {
                    toUserIds   = pcEnts[0].ClerkIds;
                    toUserNames = pcEnts[0].ClerkNames;
                }
                break;
            }
            string[] beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { };
            string[] beDeptIdArray = new string[] { }; string[] beDeptNameArray = new string[] { };
            string[] toUserIdArray = new string[] { }; string[] toUserNameArray = new string[] { };
            if (!string.IsNullOrEmpty(beUserIds))
            {
                beUserIdArray = beUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            }
            if (!string.IsNullOrEmpty(beUserNames))
            {
                beUserNameArray = beUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            }
            if (!string.IsNullOrEmpty(beDeptIds))
            {
                beDeptIdArray = beDeptIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            }
            if (!string.IsNullOrEmpty(beDeptNames))
            {
                beDeptNameArray = beDeptNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            }
            if (!string.IsNullOrEmpty(toUserIds))
            {
                toUserIdArray = toUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            }
            if (!string.IsNullOrEmpty(toUserNames))
            {
                toUserNameArray = toUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            }
            #region
            for (int i = 0; i < beUserIdArray.Length; i++)
            {
                for (int j = 0; j < toUserIdArray.Length; j++)
                {
                    if (beUserIdArray[i] != toUserIdArray[j])//防止一个人身兼两职。自己对自己不能打分
                    {
                        TempTask etEnt = new TempTask();
                        etEnt.ExamineStageId = esEnt.Id;
                        etEnt.BeRoleCode     = esdEnt.BeRoleCode;
                        etEnt.BeRoleName     = esdEnt.BeRoleName;
                        etEnt.BeUserId       = beUserIdArray[i];
                        etEnt.BeUserName     = beUserNameArray[i];
                        if (i <= beDeptIdArray.Length - 1)
                        {
                            etEnt.BeDeptId = beDeptIdArray[i];
                        }
                        if (i <= beDeptNameArray.Length - 1)
                        {
                            etEnt.BeDeptName = beDeptNameArray[i];
                        }
                        etEnt.ToRoleCode = toRoleCode;
                        etEnt.ToRoleName = toRoleName;
                        etEnt.ToUserId   = toUserIdArray[j];
                        etEnt.ToUserName = toUserNameArray[j];                                                                                                                                  //考核人的部门获取有待更新  to do
                        sql = @"select GroupID,Name  from SysGroup where PathLevel='4' and 
                                      PatIndex('%'+GroupID+'%',(select Path from SysGroup where GroupID=(select top 1 GroupID from SysUserGroup where UserID='" + toUserIdArray[j] + "') ))>0"; //通过人直接找4级部门
                        IList <EasyDictionary> dics3 = DataHelper.QueryDictList(sql);
                        if (dics3.Count > 0)
                        {
                            etEnt.ToDeptId   = dics3[0].Get <string>("GroupID");
                            etEnt.ToDeptName = dics3[0].Get <string>("Name");
                        }
                        etEnt.ExamineRelationId  = esdEnt.ExamineRelationId;
                        etEnt.ExamineIndicatorId = esdEnt.ExamineIndicatorId;
                        etEnt.State = "0";
                        etEnt.DoCreate();
                    }
                }
            }
            #endregion
        }
Esempio n. 9
0
        private void ConfirmPara(string beUserIds, string beUserNames, string beDeptIds, string beDeptNames, ExamineStageDetail esdEnt, ExamineRelation erEnt)
        {
            string toRoleCodes = erEnt.UpLevelCode + "," + erEnt.SameLevelCode + "," + erEnt.DownLevelCode;  //考核关系知道后  找到所有考核对象
            string toRoleNames = erEnt.UpLevelName + "," + erEnt.SameLevelName + "," + erEnt.DownLevelName;

            if (!string.IsNullOrEmpty(toRoleCodes))
            {
                string[] toRoleCodeArray = toRoleCodes.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                string[] toRoleNameArray = toRoleNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                for (int f = 0; f < toRoleCodeArray.Length; f++)
                {
                    CreateTask(beUserIds, beUserNames, beDeptIds, beDeptNames, esdEnt, toRoleCodeArray[f], toRoleNameArray[f]);
                }
            }
        }
Esempio n. 10
0
        private void StartExamine()
        {
            IList <ExamineStageDetail> esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, esEnt.Id);

            if (esEnt.ExamineType == "院级考核")
            {
                foreach (ExamineStageDetail esdEnt in esdEnts)
                {
                    string   beUserIds   = string.Empty;//存储被考核对象具体的人
                    string   beUserNames = string.Empty;
                    string   beDeptIds   = string.Empty;
                    string   beDeptNames = string.Empty;
                    string[] array       = GetBeUsersInfo(esdEnt);
                    beUserIds   = array[0];
                    beUserNames = array[1];
                    beDeptIds   = array[2];
                    beDeptNames = array[3];
                    ExamineRelation erEnt = ExamineRelation.Find(esdEnt.ExamineRelationId);
                    ConfirmPara(beUserIds, beUserNames, beDeptIds, beDeptNames, esdEnt, erEnt);
                    CreateSpecialTask(beUserIds, beUserNames, beDeptIds, beDeptNames, esdEnt);
                }
            }
            else//部门级考核
            {
                foreach (ExamineStageDetail esdEnt in esdEnts)
                {
                    DeptExamineRelation derEnt = DeptExamineRelation.Find(esdEnt.ExamineRelationId);
                    string[]            beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { };
                    if (!string.IsNullOrEmpty(derEnt.BeUserIds))
                    {
                        beUserIdArray   = derEnt.BeUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                        beUserNameArray = derEnt.BeUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    }
                    string   toUserIds = derEnt.UpLevelUserIds + "," + derEnt.SameLevelUserIds + "," + derEnt.DownLevelUserIds;
                    string   toUserNames = derEnt.UpLevelUserNames + "," + derEnt.SameLevelUserNames + "," + derEnt.DownLevelUserNames;
                    string[] toUserIdArray = new string[] { }; string[] toUserNameArray = new string[] { };
                    if (!string.IsNullOrEmpty(toUserIds))
                    {
                        toUserIdArray   = toUserIds.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                        toUserNameArray = toUserNames.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    }
                    for (int i = 0; i < beUserIdArray.Length; i++)
                    {
                        for (int j = 0; j < toUserIdArray.Length; j++)
                        {
                            if (beUserIdArray[i] != toUserIdArray[j]) //防止一个人身兼两职。自己对自己不能打分
                            {
                                TempTask etEnt = new TempTask();      //部门级考核不存在角色的概念。直接对人生成任务
                                etEnt.ExamineStageId     = esEnt.Id;
                                etEnt.BeUserId           = beUserIdArray[i];
                                etEnt.BeUserName         = beUserNameArray[i];
                                etEnt.BeDeptId           = esEnt.LaunchDeptId;
                                etEnt.BeDeptName         = esEnt.LaunchDeptName;
                                etEnt.ToUserId           = toUserIdArray[j];
                                etEnt.ToUserName         = toUserNameArray[j];
                                etEnt.ToDeptId           = esEnt.LaunchDeptId;
                                etEnt.ToDeptName         = esEnt.LaunchDeptName;
                                etEnt.ExamineRelationId  = esdEnt.ExamineRelationId;
                                etEnt.ExamineIndicatorId = esdEnt.ExamineIndicatorId;
                                etEnt.State = "0";
                                etEnt.DoCreate();
                            }
                        }
                    }
                }
            }
        }
Esempio n. 11
0
        private void EndExamine()
        {
            IList <ExamineStageDetail> esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, id);

            #region 院级考核算分
            if (esEnt.ExamineType == "院级考核")
            {
                string beUserIds   = string.Empty;//存储被考核对象具体的人
                string beUserNames = string.Empty;
                string beDeptIds   = string.Empty;
                string beDeptNames = string.Empty;
                foreach (ExamineStageDetail esdEnt in esdEnts)//循环考核对象
                {
                    string[] array = GetBeUsersInfo(esdEnt);
                    beUserIds   = array[0];
                    beUserNames = array[1];
                    beDeptIds   = array[2];
                    beDeptNames = array[3];
                    //人+部门+被考核对象CODE就可以找到这个其下所有的任务 不能单纯按人查。因为有特例。一个人在在多个部门任职
                    string[] beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { };
                    string[] beDeptIdArray = new string[] { }; string[] beDeptNameArray = new string[] { };
                    if (!string.IsNullOrEmpty(beUserIds))//防止部分角色下无人
                    {
                        beUserIdArray = beUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    }
                    if (!string.IsNullOrEmpty(beUserNames))
                    {
                        beUserNameArray = beUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    }
                    if (!string.IsNullOrEmpty(beDeptIds))
                    {
                        beDeptIdArray = beDeptIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    }
                    if (!string.IsNullOrEmpty(beDeptNames))
                    {
                        beDeptNameArray = beDeptNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    }
                    ExamineRelation erEnt = ExamineRelation.Find(esdEnt.ExamineRelationId);
                    string          UpLevelCode = ""; string SameLevelCode = ""; string DownLevelCode = "";
                    if (!string.IsNullOrEmpty(erEnt.UpLevelCode))
                    {
                        string[] upArray = erEnt.UpLevelCode.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                        for (int n = 0; n < upArray.Length; n++)
                        {
                            if (n != upArray.Length - 1)
                            {
                                UpLevelCode += "'" + upArray[n] + "',";
                            }
                            else
                            {
                                UpLevelCode += "'" + upArray[n] + "'";
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(erEnt.SameLevelCode))
                    {
                        string[] sameArray = erEnt.SameLevelCode.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                        for (int n = 0; n < sameArray.Length; n++)
                        {
                            if (n != sameArray.Length - 1)
                            {
                                SameLevelCode += "'" + sameArray[n] + "',";
                            }
                            else
                            {
                                SameLevelCode += "'" + sameArray[n] + "'";
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(erEnt.DownLevelCode))
                    {
                        string[] downArray = erEnt.DownLevelCode.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                        for (int n = 0; n < downArray.Length; n++)
                        {
                            if (n != downArray.Length - 1)
                            {
                                DownLevelCode += "'" + downArray[n] + "',";
                            }
                            else
                            {
                                DownLevelCode += "'" + downArray[n] + "'";
                            }
                        }
                    }
                    #region 开始计算个人成绩
                    for (int i = 0; i < beUserIdArray.Length; i++)
                    {
                        ExamineStageResult esrEnt = new ExamineStageResult();
                        esrEnt.ExamineStageId = esEnt.Id;
                        esrEnt.BeRoleCode     = esdEnt.BeRoleCode;
                        esrEnt.BeRoleName     = esdEnt.BeRoleName;
                        esrEnt.UserId         = beUserIdArray[i];
                        esrEnt.UserName       = beUserNameArray[i];
                        esrEnt.DeptId         = beDeptIdArray[i];
                        esrEnt.DeptName       = beDeptNameArray[i];
                        esrEnt.StageType      = esEnt.StageType;
                        esrEnt.Year           = esEnt.Year;
                        //分别计算上级  同级  下级评分
                        decimal tempScore = 0; string subBalanceUserIds = ""; int subBalanceWeightTotal = 0;
                        if (esdEnt.BeRoleCode == "BeBusinessDeptLeader")//经营目标单位正职 (有一部分特殊任务)   需要计算特殊分   Tag='1'
                        {
                            sql       = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeRoleCode='{1}'
                            and BeDeptId='{2}' and BeUserId='{3}' and Tag='1'";
                            sql       = string.Format(sql, esEnt.Id, esdEnt.BeRoleCode, beDeptIdArray[i], beUserIdArray[i]);
                            tempScore = DataHelper.QueryValue <decimal>(sql);
                        }
                        if (!string.IsNullOrEmpty(UpLevelCode))//如果有上级考核对象
                        {
                            //因为考核关系有时候需要把级别权重拆分到人分权重   不能单独取所有上级的平均分 //20130430  已更新到如下代码
                            IList <UserBalance> ubEnts = UserBalance.FindAllByProperties("ExamineRelationId", erEnt.Id, "ToRoleCode", "UpLevel");//该考核关系下 上级考核的人员权重明细
                            foreach (UserBalance ubEnt in ubEnts)
                            {
                                if (ubEnt.Balance > 0)
                                {
                                    subBalanceUserIds     += ubEnt.ToUserId + ",";
                                    subBalanceWeightTotal += ubEnt.Balance.Value;
                                }
                            }
                            decimal subScore = 0;
                            if (subBalanceWeightTotal < 100)                                                                                        //如果人员权重没有将100的总权重分配完
                            {
                                sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeRoleCode='{1}'
                                and BeDeptId='{2}' and BeUserId='{3}' and ToRoleCode in (" + UpLevelCode + ") and PatIndex('%ToUserId%','{4}')= 0"; //去掉已分配人员权重的人
                                sql = string.Format(sql, esEnt.Id, esdEnt.BeRoleCode, beDeptIdArray[i], beUserIdArray[i], subBalanceUserIds);
                                if (DataHelper.QueryValue <decimal>(sql) > 0)
                                {
                                    foreach (UserBalance ubEnt in ubEnts)
                                    {
                                        if (ubEnt.Balance > 0)
                                        {
                                            sql       = @"select top 1 Score from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeRoleCode='{1}'
                                            and BeDeptId='{2}' and BeUserId='{3}' and  ToUserId='{4}'";
                                            sql       = string.Format(sql, esEnt.Id, esdEnt.BeRoleCode, beDeptIdArray[i], beUserIdArray[i], ubEnt.ToUserId);
                                            subScore += DataHelper.QueryValue <decimal>(sql) * (ubEnt.Balance.Value / 100);
                                        }
                                    }
                                    esrEnt.UpAvgScore = subScore + (DataHelper.QueryValue <decimal>(sql) * (100 - subBalanceWeightTotal) / 100) + tempScore;
                                }
                                else //如果没有其他的分数,但权重又没有分配完
                                {
                                    foreach (UserBalance ubEnt in ubEnts)
                                    {
                                        if (ubEnt.Balance > 0)
                                        {
                                            sql       = @"select top 1 Score from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeRoleCode='{1}'
                                            and BeDeptId='{2}' and BeUserId='{3}' and  ToUserId='{4}'";
                                            sql       = string.Format(sql, esEnt.Id, esdEnt.BeRoleCode, beDeptIdArray[i], beUserIdArray[i], ubEnt.ToUserId);
                                            subScore += DataHelper.QueryValue <decimal>(sql) * (ubEnt.Balance.Value / subBalanceWeightTotal);
                                        }
                                    }
                                    esrEnt.UpAvgScore = subScore + tempScore;
                                }
                            }
                            else//如果人员权重已经满100,这个时候不计算已打分但未分配子权重的人员提交的考核任务
                            {
                                esrEnt.UpAvgScore = subScore + tempScore;
                            }
                        }
                        if (!string.IsNullOrEmpty(SameLevelCode))//如果有同级考核对象
                        {
                            sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeRoleCode='{1}'
                            and BeDeptId='{2}' and BeUserId='{3}' and ToRoleCode in (" + SameLevelCode + ")";
                            sql = string.Format(sql, esEnt.Id, esdEnt.BeRoleCode, beDeptIdArray[i], beUserIdArray[i]);
                            esrEnt.SameAvgScore = DataHelper.QueryValue <decimal>(sql) + tempScore;
                        }
                        if (!string.IsNullOrEmpty(DownLevelCode))//如果有下级考核对象
                        {
                            sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeRoleCode='{1}'
                            and BeDeptId='{2}' and BeUserId='{3}' and ToRoleCode in (" + DownLevelCode + ")";
                            sql = string.Format(sql, esEnt.Id, esdEnt.BeRoleCode, beDeptIdArray[i], beUserIdArray[i]);
                            esrEnt.DownAvgScore = DataHelper.QueryValue <decimal>(sql) + tempScore;
                        }
                        decimal score = 0;
                        //这里需要考虑一种特例就是  权重配好了 但可能没人给他打分   就是有权重  无分的现象  这个时候该权重不计入总权重
                        int upWeight = 0; int sameWeight = 0; int downWeight = 0;
                        if (erEnt.UpLevelWeight > 0 && esrEnt.UpAvgScore > 0)
                        {
                            upWeight = erEnt.UpLevelWeight.Value;
                        }
                        if (erEnt.SameLevelWeight > 0 && esrEnt.SameAvgScore > 0)
                        {
                            sameWeight = erEnt.SameLevelWeight.Value;
                        }
                        if (erEnt.DownLevelWeight > 0 && esrEnt.DownAvgScore > 0)
                        {
                            downWeight = erEnt.DownLevelWeight.Value;
                        }
                        int totalWeight = upWeight + sameWeight + downWeight;
                        if (upWeight > 0 && esrEnt.UpAvgScore > 0)
                        {
                            score += (((decimal)upWeight / (decimal)totalWeight) * esrEnt.UpAvgScore).Value;
                        }
                        if (sameWeight > 0 && esrEnt.SameAvgScore > 0)
                        {
                            score += (((decimal)sameWeight / (decimal)totalWeight) * esrEnt.SameAvgScore).Value;
                        }
                        if (downWeight > 0 && esrEnt.DownAvgScore > 0)
                        {
                            score += (((decimal)downWeight / (decimal)totalWeight) * esrEnt.DownAvgScore).Value;
                        }
                        esrEnt.Score     = score;
                        esrEnt.SortIndex = i + 1;
                        esrEnt.DoCreate();
                    }
                    #endregion
                }
            }
            #endregion
            #region 部门级考核
            else  //部门级考核关联的是部门级考核关系
            {
                foreach (ExamineStageDetail esdEnt in esdEnts)
                {
                    DeptExamineRelation derEnt = DeptExamineRelation.Find(esdEnt.ExamineRelationId);
                    string[]            beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { };
                    if (!string.IsNullOrEmpty(derEnt.BeUserIds))
                    {
                        beUserIdArray   = derEnt.BeUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                        beUserNameArray = derEnt.BeUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    }
                    for (int i = 0; i < beUserIdArray.Length; i++)
                    {
                        ExamineStageResult esrEnt = new ExamineStageResult();
                        esrEnt.ExamineStageId = esEnt.Id;
                        esrEnt.UserId         = beUserIdArray[i];
                        esrEnt.UserName       = beUserNameArray[i];
                        esrEnt.DeptId         = esEnt.LaunchDeptId;
                        esrEnt.DeptName       = esEnt.LaunchDeptName;
                        esrEnt.StageType      = esEnt.StageType;
                        esrEnt.Year           = esEnt.Year;
                        //分别计算上级  同级  下级评分
                        if (!string.IsNullOrEmpty(derEnt.UpLevelUserIds))//如果有上级考核人
                        {
                            // IList<UserBalance> ubEnts = UserBalance.FindAllByProperties("ExamineRelationId", derEnt.Id, "ToRoleCode", "UpLevel");//该考核关系下 上级考核的人员权重明细
                            decimal subScore = 0;
                            //                            if (ubEnts.Count > 0)//如果存在人员权重
                            //                            {
                            //                                foreach (UserBalance ubEnt in ubEnts)
                            //                                {
                            //                                    if (ubEnt.Balance > 0)
                            //                                    {
                            //                                        sql = @"select top 1 Score from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}'
                            //                                                                        and BeUserId='{1}' and  ToUserId ='{2}'";
                            //                                        sql = string.Format(sql, esEnt.Id, beUserIdArray[i], ubEnt.ToUserId);
                            //                                        subScore += DataHelper.QueryValue<decimal>(sql) * (ubEnt.Balance.Value / 100);
                            //                                    }
                            //                                }
                            //                            }
                            //                            else
                            //                            {
                            sql      = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}'  
                                and BeUserId='{1}' and PatIndex('%'+ToUserId+'%','{2}')>0";
                            sql      = string.Format(sql, esEnt.Id, beUserIdArray[i], derEnt.UpLevelUserIds);
                            subScore = DataHelper.QueryValue <decimal>(sql);
                            // }
                            esrEnt.UpAvgScore = subScore;
                        }
                        if (!string.IsNullOrEmpty(derEnt.SameLevelUserIds))//如果有同级考核人
                        {
                            sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}'  
                            and BeUserId='{1}' and PatIndex('%'+ToUserId+'%','{2}')>0";
                            sql = string.Format(sql, esEnt.Id, beUserIdArray[i], derEnt.SameLevelUserIds);
                            esrEnt.SameAvgScore = DataHelper.QueryValue <decimal>(sql);
                        }
                        if (!string.IsNullOrEmpty(derEnt.DownLevelUserIds))//如果有下级考核人
                        {
                            sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}'  
                            and BeUserId='{1}' and PatIndex('%'+ToUserId+'%','{2}')>0";
                            sql = string.Format(sql, esEnt.Id, beUserIdArray[i], derEnt.DownLevelUserIds);
                            esrEnt.DownAvgScore = DataHelper.QueryValue <decimal>(sql);
                        }
                        decimal score = 0;
                        //这里需要考虑一种特例就是  权重配好了 但可能没人给他打分   就是有权重  无分的现象  这个时候该权重不计入总权重
                        int upWeight = 0; int sameWeight = 0; int downWeight = 0;
                        if (derEnt.UpLevelWeight > 0 && esrEnt.UpAvgScore > 0)
                        {
                            upWeight = derEnt.UpLevelWeight.Value;
                        }
                        if (derEnt.SameLevelWeight > 0 && esrEnt.SameAvgScore > 0)
                        {
                            sameWeight = derEnt.SameLevelWeight.Value;
                        }
                        if (derEnt.DownLevelWeight > 0 && esrEnt.DownAvgScore > 0)
                        {
                            downWeight = derEnt.DownLevelWeight.Value;
                        }
                        int totalWeight = upWeight + sameWeight + downWeight;
                        if (upWeight > 0 && esrEnt.UpAvgScore > 0)
                        {
                            score += (((decimal)upWeight / (decimal)totalWeight) * esrEnt.UpAvgScore).Value;
                        }
                        if (sameWeight > 0 && esrEnt.SameAvgScore > 0)
                        {
                            score += (((decimal)sameWeight / (decimal)totalWeight) * esrEnt.SameAvgScore).Value;
                        }
                        if (downWeight > 0 && esrEnt.DownAvgScore > 0)
                        {
                            score += (((decimal)downWeight / (decimal)totalWeight) * esrEnt.DownAvgScore).Value;
                        }
                        esrEnt.Score     = score;
                        esrEnt.SortIndex = i + 1;
                        esrEnt.DoCreate();
                    }
                }
            }
            #endregion
            IList <ExamineTask> etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ExamineStageId, esEnt.Id); //更改任务状态
            foreach (ExamineTask etEnt in etEnts)
            {                                                                                                      //0  表示已生成的任务   1  表示已启动的任务 可以打分
                if (etEnt.State == "2")                                                                            //提交的任务
                {
                    etEnt.State = "3";                                                                             //已结束的任务
                }
                else
                {
                    etEnt.State = "4";//已作废的任务
                }
                etEnt.DoUpdate();
            }
            if (esEnt.StageType == "4")
            {
                CaculateYearResult();
            }
            esEnt.State = 3; // 0: '已创建', 1: '已生成', 2: '已启动', 3: '已结束'
            esEnt.DoUpdate();
            PageState.Add("Result", "T");
        }
Esempio n. 12
0
        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();
                }
            }
        }
Esempio n. 13
0
 private void CreateSpecialTask(string beUserIds, string beUserNames, string beDeptIds, string beDeptNames, ExamineStageDetail esdEnt) //特例  如果被考对象经营目标单位正职  还需要推送一部分任务到 人力资源部 工作业绩打分人
 {
     if (esdEnt.BeRoleCode == "BeBusinessDeptLeader")
     {
         IList <PersonConfig>   pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupCode, "HRAchievementWritor");
         IList <IndicatorFirst> ifEnts = IndicatorFirst.FindAllByProperty(IndicatorFirst.Prop_InsteadColumn, "T");//配置考核项中。 确实有人力资源打分项
         if (pcEnts.Count > 0 && ifEnts.Count > 0)
         {
             if (!string.IsNullOrEmpty(pcEnts[0].ClerkIds))
             {
                 string[] beUserIdArray = new string[] { };
                 if (!string.IsNullOrEmpty(beUserIds))
                 {
                     beUserIdArray = beUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                 }
                 string[] beUserNameArray = new string[] { };
                 if (!string.IsNullOrEmpty(beUserNames))
                 {
                     beUserNameArray = beUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                 }
                 string[] beDeptIdArray = new string[] { };
                 if (!string.IsNullOrEmpty(beDeptIds))
                 {
                     beDeptIdArray = beDeptIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                 }
                 string[] beDeptNameArray = new string[] { };
                 if (!string.IsNullOrEmpty(beDeptNames))
                 {
                     beDeptNameArray = beDeptNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                 }
                 string[] toUserIdArray = new string[] { };
                 if (!string.IsNullOrEmpty(pcEnts[0].ClerkIds))
                 {
                     toUserIdArray = pcEnts[0].ClerkIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                 }
                 string[] toUserNameArray = new string[] { };
                 if (!string.IsNullOrEmpty(pcEnts[0].ClerkNames))
                 {
                     toUserNameArray = pcEnts[0].ClerkNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                 }
                 for (int i = 0; i < beUserIdArray.Length; i++)
                 {
                     for (int j = 0; j < toUserIdArray.Length; j++)
                     {
                         if (beUserIdArray[i] != toUserIdArray[j])//防止一个人身兼两职。自己对自己不能打分
                         {
                             ExamineTask etEnt = new ExamineTask();
                             etEnt.ExamineStageId = esEnt.Id;
                             etEnt.BeRoleCode     = esdEnt.BeRoleCode;
                             etEnt.BeRoleName     = esdEnt.BeRoleName;
                             etEnt.BeUserId       = beUserIdArray[i];
                             etEnt.BeUserName     = beUserNameArray[i];
                             if (i <= beDeptIdArray.Length - 1)
                             {
                                 etEnt.BeDeptId = beDeptIdArray[i];
                             }
                             if (i <= beDeptNameArray.Length - 1)
                             {
                                 etEnt.BeDeptName = beDeptNameArray[i];
                             }
                             etEnt.ToRoleCode = "HRAchievementWritor";
                             etEnt.ToRoleName = ifEnts[0].IndicatorFirstName + "填报人";
                             etEnt.ToUserId   = toUserIdArray[j];
                             etEnt.ToUserName = toUserNameArray[j];
                             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, toUserIdArray[j]);
                             IList <EasyDictionary> dics3 = DataHelper.QueryDictList(sql);
                             if (dics3.Count > 0)
                             {
                                 etEnt.ToDeptId   = dics3[0].Get <string>("Id");
                                 etEnt.ToDeptName = dics3[0].Get <string>("GroupName");
                             }
                             etEnt.ExamineRelationId  = esdEnt.ExamineRelationId;
                             etEnt.ExamineIndicatorId = esdEnt.ExamineIndicatorId;
                             etEnt.State = "0";
                             etEnt.Tag   = "1";
                             etEnt.DoCreate();
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 14
0
        private void CreateTask(string beUserIds, string beUserNames, string beDeptIds, string beDeptNames, ExamineStageDetail esdEnt, string toRoleCode, string toRoleName)
        {
            string toUserIds   = "";
            string toUserNames = "";
            string toDeptIds   = "";
            string toDeptNames = "";
            string sql         = "";

            string[]             array  = null;
            DataTable            dt     = new DataTable();
            IList <PersonConfig> pcEnts = null;

            switch (toRoleCode)        //对所有的考核对象进行判断 确定参与考核打分的人员
            {
            case "DirectorSecretary":  //院长书记
            case "DeputyDirector":     //副院长
            case "EnterpriseDirector": //如果上级里面有控股企业董事长和监事长
            case "EnterpriseDeputyDirector":
                pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupCode, toRoleCode);
                if (pcEnts.Count > 0)
                {
                    if (!string.IsNullOrEmpty(pcEnts[0].ClerkIds))
                    {
                        toUserIds   = pcEnts[0].ClerkIds;
                        toUserNames = pcEnts[0].ClerkNames;
                        toDeptIds   = pcEnts[0].ClerkGroupIds;
                        toDeptNames = pcEnts[0].ClerkGroupNames;
                    }
                }
                break;

            case "ExcutiveDeptLeader":    //职能服务部门正职
                sql       = @"select FirstLeaderIds as UserIds,FirstLeaderNames as UserNames,FirstLeaderGroupIds as DeptIds,FirstLeaderGroupNames as DeptNames
                    from BJKY_Examine..PersonConfig where GroupType='职能服务部门' and Id in 
                    (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')";
                array     = GetUserIdAndName(DataHelper.QueryDictList(sql));
                toUserIds = array[0]; toUserNames = array[1];
                toDeptIds = array[2]; toDeptNames = array[3];
                break;

            case "BusinessDeptLeader":    //经营目标单位正职
                sql       = @"select FirstLeaderIds as UserIds, FirstLeaderNames as UserNames,FirstLeaderGroupIds as DeptIds,FirstLeaderGroupNames as DeptNames
                    from BJKY_Examine..PersonConfig where GroupType='经营目标单位' and Id in 
                    (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')";
                array     = GetUserIdAndName(DataHelper.QueryDictList(sql));
                toUserIds = array[0]; toUserNames = array[1];
                toDeptIds = array[2]; toDeptNames = array[3];
                break;

            case "ExcutiveDeptClerkDelegate":    //职能部门员工代表
                sql       = @"select InstituteClerkDelegateIds as UserIds,InstituteClerkDelegateNames as UserNames,InstituteClerkDelegateGroupIds as DeptIds,InstituteClerkDelegateGroupNames as DeptNames
                    from BJKY_Examine..PersonConfig
                    where GroupType='职能服务部门' and Id in  (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')";
                array     = GetUserIdAndName(DataHelper.QueryDictList(sql));
                toUserIds = array[0]; toUserNames = array[1];
                toDeptIds = array[2]; toDeptNames = array[3];
                break;

            case "BusinessDeptClerkDelegate":    //经营单位员工代表
                sql       = @"select  InstituteClerkDelegateIds as UserIds, InstituteClerkDelegateNames as UserNames,InstituteClerkDelegateGroupIds as DeptIds,InstituteClerkDelegateGroupNames as DeptNames
                    from BJKY_Examine..PersonConfig
                    where GroupType='经营目标单位' and Id in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')";
                array     = GetUserIdAndName(DataHelper.QueryDictList(sql));
                toUserIds = array[0]; toUserNames = array[1];
                toDeptIds = array[2]; toDeptNames = array[3];
                break;
            }
            string[] beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { };
            string[] beDeptIdArray = new string[] { }; string[] beDeptNameArray = new string[] { };
            string[] toUserIdArray = new string[] { }; string[] toUserNameArray = new string[] { };
            string[] toDeptIdArray = new string[] { }; string[] toDeptNameArray = new string[] { };
            if (!string.IsNullOrEmpty(beUserIds))
            {
                beUserIdArray = beUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            }
            if (!string.IsNullOrEmpty(beUserNames))
            {
                beUserNameArray = beUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            }
            if (!string.IsNullOrEmpty(beDeptIds))
            {
                beDeptIdArray = beDeptIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            }
            if (!string.IsNullOrEmpty(beDeptNames))
            {
                beDeptNameArray = beDeptNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            }
            if (!string.IsNullOrEmpty(toUserIds))
            {
                toUserIdArray = toUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            }
            if (!string.IsNullOrEmpty(toUserNames))
            {
                toUserNameArray = toUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            }
            if (!string.IsNullOrEmpty(toDeptIds))
            {
                toDeptIdArray = toDeptIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            }
            if (!string.IsNullOrEmpty(toDeptNames))
            {
                toDeptNameArray = toDeptNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            }
            #region
            for (int i = 0; i < beUserIdArray.Length; i++)
            {
                for (int j = 0; j < toUserIdArray.Length; j++)
                {
                    if (beUserIdArray[i] != toUserIdArray[j])//防止一个人身兼两职。自己对自己不能打分
                    {
                        ExamineTask etEnt = new ExamineTask();
                        etEnt.ExamineStageId = esEnt.Id;
                        etEnt.BeRoleCode     = esdEnt.BeRoleCode;
                        etEnt.BeRoleName     = esdEnt.BeRoleName;
                        etEnt.BeUserId       = beUserIdArray[i];
                        etEnt.BeUserName     = beUserNameArray[i];
                        if (i <= beDeptIdArray.Length - 1)
                        {
                            etEnt.BeDeptId = beDeptIdArray[i];
                        }
                        if (i <= beDeptNameArray.Length - 1)
                        {
                            etEnt.BeDeptName = beDeptNameArray[i];
                        }
                        etEnt.ToRoleCode         = toRoleCode;
                        etEnt.ToRoleName         = toRoleName;
                        etEnt.ToUserId           = toUserIdArray[j];
                        etEnt.ToUserName         = toUserNameArray[j];
                        etEnt.ToDeptId           = toDeptIdArray[j];
                        etEnt.ToDeptName         = toDeptNameArray[j];
                        etEnt.ExamineRelationId  = esdEnt.ExamineRelationId;
                        etEnt.ExamineIndicatorId = esdEnt.ExamineIndicatorId;
                        etEnt.State = "0";
                        etEnt.DoCreate();
                    }
                }
            }
            #endregion
        }
Esempio n. 15
0
        private void EndExamine()
        {
            IList <ExamineStageDetail> esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, id);

            foreach (ExamineStageDetail esdEnt in esdEnts)
            {
                DeptExamineRelation derEnt = DeptExamineRelation.Find(esdEnt.ExamineRelationId);
                string[]            beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { };
                if (!string.IsNullOrEmpty(derEnt.BeUserIds))
                {
                    beUserIdArray   = derEnt.BeUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    beUserNameArray = derEnt.BeUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                }
                for (int i = 0; i < beUserIdArray.Length; i++)
                {
                    ExamineStageResult esrEnt = new ExamineStageResult();
                    esrEnt.ExamineStageId = esEnt.Id;
                    esrEnt.UserId         = beUserIdArray[i];
                    esrEnt.UserName       = beUserNameArray[i];
                    string[] bedept = Utility.GetDeptInfo(beUserIdArray[i]);
                    esrEnt.DeptId    = bedept[0];
                    esrEnt.DeptName  = bedept[1];
                    esrEnt.StageType = esEnt.StageType;
                    esrEnt.Year      = esEnt.Year;
                    //分别计算上级  同级  下级评分
                    if (!string.IsNullOrEmpty(derEnt.UpLevelUserIds))//如果有上级考核人
                    {
                        // IList<UserBalance> ubEnts = UserBalance.FindAllByProperties("ExamineRelationId", derEnt.Id, "ToRoleCode", "UpLevel");//该考核关系下 上级考核的人员权重明细
                        decimal subScore = 0;
                        //                            if (ubEnts.Count > 0)//如果存在人员权重
                        //                            {
                        //                                foreach (UserBalance ubEnt in ubEnts)
                        //                                {
                        //                                    if (ubEnt.Balance > 0)
                        //                                    {
                        //                                        sql = @"select top 1 Score from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}'
                        //                                            and BeUserId='{1}' and  ToUserId ='{2}'";
                        //                                        sql = string.Format(sql, esEnt.Id, beUserIdArray[i], ubEnt.ToUserId);
                        //                                        subScore += DataHelper.QueryValue<decimal>(sql) * (ubEnt.Balance.Value / 100);
                        //                                    }
                        //                                }
                        //                            }
                        //                            else
                        //                            {
                        sql      = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}'  
                                and BeUserId='{1}' and PatIndex('%'+ToUserId+'%','{2}')>0";
                        sql      = string.Format(sql, esEnt.Id, beUserIdArray[i], derEnt.UpLevelUserIds);
                        subScore = DataHelper.QueryValue <decimal>(sql);
                        // }
                        esrEnt.UpAvgScore = subScore;
                    }
                    if (!string.IsNullOrEmpty(derEnt.SameLevelUserIds))//如果有同级考核人
                    {
                        sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}'  
                            and BeUserId='{1}' and PatIndex('%'+ToUserId+'%','{2}')>0";
                        sql = string.Format(sql, esEnt.Id, beUserIdArray[i], derEnt.SameLevelUserIds);
                        esrEnt.SameAvgScore = DataHelper.QueryValue <decimal>(sql);
                    }
                    if (!string.IsNullOrEmpty(derEnt.DownLevelUserIds))//如果有下级考核人
                    {
                        sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}'  
                            and BeUserId='{1}' and PatIndex('%'+ToUserId+'%','{2}')>0";
                        sql = string.Format(sql, esEnt.Id, beUserIdArray[i], derEnt.DownLevelUserIds);
                        esrEnt.DownAvgScore = DataHelper.QueryValue <decimal>(sql);
                    }
                    decimal score = 0;
                    //这里需要考虑一种特例就是  权重配好了 但可能没人给他打分   就是有权重  无分的现象  这个时候该权重不计入总权重
                    int upWeight = 0; int sameWeight = 0; int downWeight = 0;
                    if (derEnt.UpLevelWeight > 0 && esrEnt.UpAvgScore > 0)
                    {
                        upWeight = derEnt.UpLevelWeight.Value;
                    }
                    if (derEnt.SameLevelWeight > 0 && esrEnt.SameAvgScore > 0)
                    {
                        sameWeight = derEnt.SameLevelWeight.Value;
                    }
                    if (derEnt.DownLevelWeight > 0 && esrEnt.DownAvgScore > 0)
                    {
                        downWeight = derEnt.DownLevelWeight.Value;
                    }
                    int totalWeight = upWeight + sameWeight + downWeight;
                    if (upWeight > 0 && esrEnt.UpAvgScore > 0)
                    {
                        score += (((decimal)upWeight / (decimal)totalWeight) * esrEnt.UpAvgScore).Value;
                    }
                    if (sameWeight > 0 && esrEnt.SameAvgScore > 0)
                    {
                        score += (((decimal)sameWeight / (decimal)totalWeight) * esrEnt.SameAvgScore).Value;
                    }
                    if (downWeight > 0 && esrEnt.DownAvgScore > 0)
                    {
                        score += (((decimal)downWeight / (decimal)totalWeight) * esrEnt.DownAvgScore).Value;
                    }
                    esrEnt.Score     = score;
                    esrEnt.SortIndex = i + 1;
                    esrEnt.DoCreate();
                }
            }
            IList <ExamineTask> etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ExamineStageId, esEnt.Id);//更改任务状态

            foreach (ExamineTask etEnt in etEnts)
            {                           //0  表示已生成的任务   1  表示已启动的任务 可以打分
                if (etEnt.State == "2") //提交的任务
                {
                    etEnt.State = "3";  //已结束的任务
                }
                else
                {
                    etEnt.State = "4";//已作废的任务
                }
                etEnt.DoUpdate();
            }
            if (esEnt.StageType == "4")
            {
                CaculateYearResult();
            }
            esEnt.State = 3; // 0: '已创建', 1: '已生成', 2: '已启动', 3: '已结束'
            esEnt.DoUpdate();
            PageState.Add("Result", "T");
        }
Esempio n. 16
0
        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;
            }
        }