コード例 #1
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
        }
コード例 #2
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();
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #3
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();
                            }
                        }
                    }
                }
            }
        }