Beispiel #1
0
        public static bool UserRelation(string userId, string workFlowId, string workTaskId, string workFlowInstanceId,
                                      string WorkTaskInstanceId, OperParameter operParam)
        {

            switch (operParam.OperRelation)
            {
                case 1://本部门领导
                    //获得用户所属部门
                    DataTable dtArch = UserData.ArchOfUserTable(operParam.OperContent);//获得用户所属部门
                    foreach (DataRow drArch in dtArch.Rows)//可能一个人属于多个部门
                    {
                        string archId = drArch["OrgID"].ToString();
                        //获取部门主管岗位
                        DataTable dtDuty = mOrgData.GetLeaderOfArch(archId);//获得部门主管岗位
                        foreach (DataRow drDuty in dtDuty.Rows)//可能一个部门有多个主管岗位
                        {
                            //获取岗位对应的用户
                            string dutyId = drDuty["OrgID"].ToString();
                            DataTable dtUser = mOrgData.GetUserList(dutyId);
                            foreach (DataRow drUser in dtUser.Rows)
                            {
                                string ldruserId=drUser["UserID"].ToString();
                                string ldruserName=drUser["UserName"].ToString();
                                operParam.OperContent = ldruserId;
                                operParam.OperContenText = ldruserName;
                                AssignUser(userId, workFlowId, workTaskId, workFlowInstanceId, WorkTaskInstanceId, operParam);
                            }
                        }
                    }
                    break;
                case 2://所在部门
                    DataTable dtinArch = UserData.ArchOfUserTable(operParam.OperContent);//获得用户所属部门
                    foreach (DataRow drArch in dtinArch.Rows)//可能一个人属于多个部门
                    {
                        string archId = drArch["OrgID"].ToString();
                        string archName = drArch["OrgName"].ToString();
                        operParam.OperContent = archId;
                        operParam.OperContenText = archName;
                        AssignArchitecture(userId, workFlowId, workTaskId, workFlowInstanceId, WorkTaskInstanceId, operParam);
                    }
                    break;
                case 3://上级部门
                    DataTable dthigArch = UserData.HigherArchOfUserTable(operParam.OperContent);//获得用户上级部门
                    foreach (DataRow drhigArch in dthigArch.Rows)//可能有多个上级部门
                    {
                        string archId = drhigArch["OrgID"].ToString();
                        string archName = drhigArch["OrgName"].ToString();
                        operParam.OperContent = archId;
                        operParam.OperContenText = archName;
                        AssignArchitecture(userId, workFlowId, workTaskId, workFlowInstanceId, WorkTaskInstanceId, operParam);
                    }
                    break;
                case 4://下级部门
                    DataTable dtlowArch = UserData.LowerArchOfUserTable(operParam.OperContent);//获得用户下级部门
                    foreach (DataRow drlowArch in dtlowArch.Rows)//可能有多个下级部门
                    {
                        string archId = drlowArch["OrgID"].ToString();
                        string archName = drlowArch["OrgName"].ToString();
                        operParam.OperContent = archId;
                        operParam.OperContenText = archName;
                        AssignArchitecture(userId, workFlowId, workTaskId, workFlowInstanceId, WorkTaskInstanceId, operParam);
                    }
                    break;
                case 5://上级领导
                    //获得用户上级部门
                    DataTable dthigldrArch = UserData.HigherArchOfUserTable(operParam.OperContent);//获得用户上级部门
                    foreach (DataRow drhigldrArch in dthigldrArch.Rows)//可能有多个上级部门(一人多部门的情况)
                    {
                        string archId = drhigldrArch["OrgID"].ToString();
                        //获取部门主管岗位
                        DataTable dtDuty = mOrgData.GetLeaderOfArch(archId);//获得部门主管岗位
                        foreach (DataRow drDuty in dtDuty.Rows)//可能一个部门有多个主管岗位
                        {
                            //获取岗位对应的用户
                            string dutyId = drDuty["OrgID"].ToString();
                            DataTable dtUser = mOrgData.GetUserList(dutyId);
                            foreach (DataRow drUser in dtUser.Rows)
                            {
                                string ldruserId = drUser["UserID"].ToString();
                                string ldruserName = drUser["UserName"].ToString();
                                operParam.OperContent = ldruserId;
                                operParam.OperContenText = ldruserName;
                                AssignUser(userId, workFlowId, workTaskId, workFlowInstanceId, WorkTaskInstanceId, operParam);
                            }
                        }
                    }
                    break;
                case 6://下级领导
                    //获得用户下级部门
                    DataTable dtlowldrArch = UserData.LowerArchOfUserTable(operParam.OperContent);//获得用户下级部门
                    foreach (DataRow drlowldrArch in dtlowldrArch.Rows)//可能有多个下级部门(一人多部门的情况)
                    {
                        string archId = drlowldrArch["OrgID"].ToString();
                        //获取部门主管岗位
                        DataTable dtDuty = mOrgData.GetLeaderOfArch(archId);//获得部门主管岗位
                        foreach (DataRow drDuty in dtDuty.Rows)//可能一个部门有多个主管岗位
                        {
                            //获取岗位对应的用户
                            string dutyId = drDuty["OrgID"].ToString();
                            DataTable dtUser = mOrgData.GetUserList(dutyId);
                            foreach (DataRow drUser in dtUser.Rows)
                            {
                                string ldruserId = drUser["UserID"].ToString();
                                string ldruserName = drUser["UserName"].ToString();
                                operParam.OperContent = ldruserId;
                                operParam.OperContenText = ldruserName;
                                AssignUser(userId, workFlowId, workTaskId, workFlowInstanceId, WorkTaskInstanceId, operParam);
                            }
                        }
                    }
                    break;
            }
            return true;
        }
Beispiel #2
0
 public static bool ArchRelation(string userId, string workFlowId, string workTaskId, string workFlowInstanceId,
                               string WorkTaskInstanceId, OperParameter operParam)
 {
     switch (operParam.OperRelation)
     {
         case 1://本部门领导
             DataTable dtDuty = mOrgData.GetLeaderOfArch(operParam.OperContent);//获得部门主管岗位
             foreach (DataRow drDuty in dtDuty.Rows)//可能一个部门有多个主管岗位
             {
                 //获取岗位对应的用户
                 string dutyId = drDuty["OrgID"].ToString();
                 DataTable dtUser = mOrgData.GetUserList(dutyId);
                 foreach (DataRow drUser in dtUser.Rows)
                 {
                     string ldruserId = drUser["UserID"].ToString();
                     string ldruserName = drUser["UserName"].ToString();
                     operParam.OperContent = ldruserId;
                     operParam.OperContenText = ldruserName;
                     AssignUser(userId, workFlowId, workTaskId, workFlowInstanceId, WorkTaskInstanceId, operParam);
                 }
             }
             break;
         case 2://无此情况
             break;
         case 3://上级部门,一个部门只有一个上级部门
             string fatherId = mOrgData.GetFatherArchId(operParam.OperContent);
             mOrgData arh = new mOrgData();
             arh.GetArchitecture(fatherId);
             operParam.OperContent = fatherId;
             operParam.OperContenText = arh.ArchCaption;
             AssignArchitecture(userId, workFlowId, workTaskId, workFlowInstanceId, WorkTaskInstanceId, operParam);
             break;
         case 4://下级部门
             DataTable dtlowArch = mOrgData.GetLowerArch(operParam.OperContent);
             
             foreach (DataRow drlowArch in dtlowArch.Rows)//可能有多个下级部门
             {
                 string archId = drlowArch["OrgID"].ToString();
                 mOrgData arhcp = new mOrgData();
                 arhcp.GetArchitecture(archId);
                 operParam.OperContent = archId;
                 operParam.OperContenText = arhcp.ArchCaption;
                 AssignArchitecture(userId, workFlowId, workTaskId, workFlowInstanceId, WorkTaskInstanceId, operParam);
             }
             break;
         case 5://上级部门领导
             fatherId = mOrgData.GetFatherArchId(operParam.OperContent);
             dtDuty = mOrgData.GetLeaderOfArch(fatherId);//获得部门主管岗位
             foreach (DataRow drDuty in dtDuty.Rows)//可能一个部门有多个主管岗位
             {
                 //获取岗位对应的用户
                 string dutyId = drDuty["OrgID"].ToString();
                 DataTable dtUser = mOrgData.GetUserList(dutyId);
                 foreach (DataRow drUser in dtUser.Rows)
                 {
                     string ldruserId = drUser["UserID"].ToString();
                     string ldruserName = drUser["UserName"].ToString();
                     operParam.OperContent = ldruserId;
                     operParam.OperContenText = ldruserName;
                     AssignUser(userId, workFlowId, workTaskId, workFlowInstanceId, WorkTaskInstanceId, operParam);
                 }
             }
             break;
         case 6://下级部门领导
             dtlowArch = mOrgData.GetLowerArch(operParam.OperContent);
             foreach (DataRow drlowArch in dtlowArch.Rows)//可能有多个下级部门
             {
                 string archId = drlowArch["OrgID"].ToString();
                 //获取部门主管岗位
                 dtDuty = mOrgData.GetLeaderOfArch(archId);//获得部门主管岗位
                 foreach (DataRow drDuty in dtDuty.Rows)//可能一个部门有多个主管岗位
                 {
                     //获取岗位对应的用户
                     string dutyId = drDuty["OrgID"].ToString();
                     DataTable dtUser = mOrgData.GetUserList(dutyId);
                     foreach (DataRow drUser in dtUser.Rows)
                     {
                         string ldruserId = drUser["OrgID"].ToString();
                         string ldruserName = drUser["UserName"].ToString();
                         operParam.OperContent = ldruserId;
                         operParam.OperContenText = ldruserName;
                         AssignUser(userId, workFlowId, workTaskId, workFlowInstanceId, WorkTaskInstanceId, operParam);
                     }
                 }
             }
             break;
     }
     return true;
 }
Beispiel #3
0
        /**//// <summary>
        /// 角色处理者
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="workFlowId">流程模板Id</param>
        /// <param name="workTaskId">任务模板Id</param>
        /// <param name="workFlowInstanceId">流程实例Id</param>
        /// <param name="WorkTaskInstanceId">任务实例Id</param>
        /// <param name="operContent">处理者</param>
        /// <param name="operRule">处理策略</param>
        /// <param name="operRealtion">处理关系</param>
        /// <returns>是否成功</returns>
        public static bool AssignGroup(string userId, string workFlowId, string workTaskId, string workFlowInstanceId,
                                      string WorkTaskInstanceId, OperParameter operParam)
        {

            //DebugHF.WriteErrorLog("AssignGroup处理者类型:operContent= " + operParam.OperContent, workFlowInstanceId);
            
            string tmpUser = "";
            string tmpUserName = "";
            if (operParam.OperContent == null || operParam.OperContent == "") return false;
            if (operParam.OperRule == "1")//只产生处理者实例
            {
                //创建处理人实例
                AssignUser(userId, workFlowId, workTaskId, workFlowInstanceId, WorkTaskInstanceId, operParam);
            }
            else
                if (operParam.OperRule == "2")//为每个处理者产生一个任务实例
                {
                    DataTable archUser = UserRoleViewData.ListUserOfGroup(operParam.OperContent);
                    if (archUser == null || archUser.Rows.Count <= 0)
                    {
                        //throw new Exception("引擎没有找到处理者,请检查是否配置处理者。");
                        //DebugHF.WriteErrorLog("角色[" + operParam.OperContenText + "]没有配置处理人!!!", workFlowInstanceId);
                    }
                    foreach (DataRow dr in archUser.Rows)
                    {
                        tmpUser = dr["UserID"].ToString();
                        tmpUserName = dr["UserName"].ToString();
                        operParam.OperContent = tmpUser;
                        operParam.OperContenText = tmpUserName;
                        AssignUser(userId, workFlowId, workTaskId, workFlowInstanceId, WorkTaskInstanceId, operParam);

                    }
                }
            return true;
        }
        /**//// <summary>
        /// 所有人
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="workFlowId">流程模板Id</param>
        /// <param name="workTaskId">任务模板Id</param>
        /// <param name="workFlowInstanceId">流程实例Id</param>
        /// <param name="WorkTaskInstanceId">任务实例Id</param>
        /// <param name="operContent">处理者</param>
        /// <param name="operRule">处理策略</param>
        /// <param name="operRealtion">处理关系</param>
        /// <returns>是否成功</returns>
        public static bool AssignAll(string userId, string workFlowId, string workTaskId, string workFlowInstanceId,
                                      string WorkTaskInstanceId, OperParameter operParam)
        {

            //DebugHF.WriteErrorLog("AssignAll处理者类型:operContent= " + operParam.OperContent, workFlowInstanceId);

            string tmpUser = "";
            string tmpUserName="";
            if (operParam.OperContent == null || operParam.OperContent == "") return false;
            if (operParam.OperRule == "1")//只产生处理者实例
            {
                //创建处理人实例
                operParam.OperContent = "ALL";
                AssignUser(userId, workFlowId, workTaskId, workFlowInstanceId, WorkTaskInstanceId, operParam);
            }
            else
                if (operParam.OperRule == "2")//为每个处理者产生一个任务实例
                {
                    DataTable dtAllUser = UserData.GetAllUser();
                    if (dtAllUser == null || dtAllUser.Rows.Count <= 0)
                    {
                        //throw new Exception("引擎没有找到处理者,请检查是否配置处理者。");
                       // DebugHF.WriteErrorLog("所有人" + operParam.OperContenText + "]没有配置处理人!!!", workFlowInstanceId);
                    }
                    foreach (DataRow dr in dtAllUser.Rows)
                    {
                        tmpUser = dr["UserID"].ToString();
                        tmpUserName = dr["UserName"].ToString();
                        operParam.OperContent = tmpUser;
                        operParam.OperContenText = tmpUserName;
                        AssignUser(userId, workFlowId, workTaskId, workFlowInstanceId, WorkTaskInstanceId, operParam);

                    }
                }
            return true;
        }