Esempio n. 1
0
 /// <summary>
 /// 绑定对应部门到DropDownList
 /// </summary>
 /// <param name="ddl">下拉菜单ID</param>
 /// <param name="strDeptID">部门ID</param>
 public static void BindDeptByDeptID(DropDownList ddl, string strDeptID)
 {
     ddl.Items.Clear();
     if (string.IsNullOrEmpty(strDeptID) == false)
     {
         ddl.Items.Add(new ListItem(OADept.GetDeptName(strDeptID), strDeptID));
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 根据部门的ID获取子部门ID字符串以","分隔
        /// </summary>
        /// <param name="strDeptID">部门ID</param>
        /// <param name="iFloorCode">层级(0:自己 -1:所有 >0:层数)</param>
        /// <returns>String</returns>
        public static String GetChildDeptIDString(string strDeptID, int iFloorCode)
        {
            string   strIDS = string.Empty;
            ViewBase vb     = OADept.GetChildDept(strDeptID, iFloorCode);

            if (vb != null)
            {
                strIDS = vb.GetFieldVals("ID", ",");
            }
            return(strIDS);
        }
Esempio n. 3
0
        /// <summary>
        /// 根据部门ID取出部门负责人、部门领导和大于某职位的人
        /// </summary>
        /// <param name="strDeptID">部门ID</param>
        /// <param name="strPost">职位名称</param>
        /// <param name="enmuType">职务类型枚举</param>
        /// <param name="iFloorCode">层级(0自己,>0 子部门层数,-1所有)</param>
        /// <returns></returns>
        private static ViewBase GetUserByDeptPost(string strDeptID, string strPost, Common.LeaderType enmuType, int iFloorCode)
        {
            ViewBase   vb   = null;
            Department dept = Department.GetDepartment(OADept.ConvertInt(strDeptID));

            if (dept != null)
            {
                vb = OAUser.FilterUser(dept.GetManagerOrLeader(iFloorCode, enmuType, strPost));
            }
            return(vb);
        }
Esempio n. 4
0
        /// <summary>
        ///  根据部门的ID和职位名称取出大于这个职位的人(向下遍历)
        /// </summary>
        /// <param name="strDeptID">部门ID</param>
        /// <param name="strPostName">职位名称</param>
        /// <param name="iFloorCode">层级(0自己,>0 子部门层数,-1所有)</param>
        /// <returns >ViewBase</returns>
        private static ViewBase GetSupUserByPost(string strDeptID, string strPostName, int iFloorCode)
        {
            ViewBase   vb   = null;
            Department dept = Department.GetDepartment(OADept.ConvertInt(strDeptID));

            if (dept != null)
            {
                vb = OAUser.FilterUser(dept.GetUserByPosition(strPostName, iFloorCode));
            }
            return(vb);
        }
Esempio n. 5
0
        /// <summary>
        /// 根据部门ID获取部门领导
        /// </summary>
        /// <param name="strDeptID">部门ID</param>
        /// <param name="iFloorCode">层级(0.自己;-1.所有)</param>
        /// <returns>ViewBase</returns>
        public static ViewBase GetDeptLeader(String strDeptID, int iFloorCode)
        {
            ViewBase   vb   = null;
            Department dept = Department.GetDepartment(OADept.ConvertInt(strDeptID));

            if (dept != null)
            {
                vb = OAUser.FilterUser(dept.GetLeaders(iFloorCode));
            }
            return(vb);
        }
Esempio n. 6
0
        /// <summary>
        /// 根据部门的ID和角色的名称获取用户的信息
        /// </summary>
        /// <param name="strDeptID"> 部门ID</param>
        /// <param name="strRoleName">角色名称</param>
        /// <param name="iFloorCode">向下遍历的层级(0.自己 ;-1.所有)</param>
        /// <returns>ViewBase</returns>
        public static ViewBase GetUserByDeptIDRole(String strDeptID, String strRoleName, int iFloorCode)
        {
            ViewBase vb = null;

            if (String.IsNullOrEmpty(strDeptID) == false && String.IsNullOrEmpty(strRoleName) == false)
            {
                Role role = Role.GetRole(strRoleName);
                if (role != null)
                {
                    vb = OAUser.FilterUser(role.GetUserByDept(OADept.ConvertInt(strDeptID)));
                }
            }
            return(vb);
        }
Esempio n. 7
0
        /// <summary>
        /// 根据部门的ID和职位名称取人支持多个职位以逗号分隔
        /// </summary>
        /// <param name="strDeptID">部门ID</param>
        /// <param name="strPostName">职位名称</param>
        /// <param name="iFloorCode">层级</param>
        /// <returns >ViewBase</returns>
        public static ViewBase GetUserByPost(string strDeptID, string strPostName, int iFloorCode)
        {
            ViewBase vb     = null;
            int      deptID = OADept.ConvertInt(strDeptID);

            if (deptID != int.MinValue && string.IsNullOrEmpty(strPostName) == false)
            {
                Department dept = Department.GetDepartment(deptID);
                if (dept != null)
                {
                    vb = OAUser.FilterUser(dept.GetUserByPostNames(strPostName, iFloorCode));
                }
            }
            return(vb);
        }
Esempio n. 8
0
        /// <summary>
        /// 根据部门的ID获取子部门ID字符串包括自己以","分隔
        /// </summary>
        /// <param name="strDeptID">部门ID</param>
        /// <param name="iFloorCode">层级(0:自己 -1:所有 >0:层数)</param>
        /// <returns>String</returns>
        public static String GetChildDeptIDSConSelf(string strDeptID, int iFloorCode)
        {
            ViewBase vb     = null;
            string   strIDS = string.Empty;

            vb = OADept.GetChildDeptsConSelf(strDeptID, iFloorCode);
            if (vb != null)
            {
                strIDS = vb.GetFieldVals("ID", ",");
            }
            else
            {
                strIDS = strDeptID;
            }
            return(strIDS);
        }
Esempio n. 9
0
        /// <summary>
        /// 根据部门ID获取部门人员信息
        /// </summary>
        /// <param name="strDeptID">部门ID</param>
        /// <param name="iFloorCode">向下遍历的层级(0.自己 ;-1.所有)</param>
        /// <returns>ViewBase</returns>
        public static ViewBase GetUserByDeptID(String strDeptID, int iFloorCode)
        {
            ViewBase vb    = null;
            int      index = OADept.ConvertInt(strDeptID);

            if (index != int.MinValue)
            {
                Department dept = OADept.GetDeptByDeptID(strDeptID);
                if (dept != null)
                {
                    vb = OAUser.FilterUser(dept.GetChildDeptUsers(iFloorCode));
                }
                vb.Sort = "e.SortNum,a.Userid";
            }
            return(vb);
        }
Esempio n. 10
0
        /// <summary>
        /// 根据处室部门的ID和用户账号找出用户所属该处室下的科室
        /// </summary>
        /// <param name="strDeptID">部门ID</param>
        /// <param name="strUserID">用户账号</param>
        /// <param name="iFloorCode">层级(1.处室,2.科室……)</param>
        /// <returns>ViewBase</returns>
        public static ViewBase GetDeptByDeptUser(string strDeptID, string strUserID, int iFloorCode)
        {
            ViewBase vb = null;

            if (string.IsNullOrEmpty(strUserID) == false)
            {
                vb = OADept.GetDeptByUser(strUserID, iFloorCode);
                if (string.IsNullOrEmpty(strDeptID) == false && OADept.ConvertInt(strDeptID) != int.MinValue)
                {
                    if (vb != null)
                    {
                        vb.Condition = "a.ParentID=" + OADept.ConvertInt(strDeptID);
                    }
                }
            }
            return(vb);
        }
Esempio n. 11
0
        /// <summary>
        /// 根据部门的Name返回部门ID
        /// </summary>
        /// <param name="strDeptName">部门Name</param>
        /// <returns>部门名称</returns>
        public static string GetDeptID(string strDeptName)
        {
            Department dept = OADept.GetDeptByDeptName(strDeptName);

            return(dept != null?dept.ID.ToString() : string.Empty);
        }
Esempio n. 12
0
 /// <summary>
 /// 根据部门的ID获取子部门
 /// </summary>
 /// <param name="ddl" >下拉菜单ID</param >
 /// <param name="strDeptID">部门的ID</param>
 /// <param name="iFloorCode" >层级(>0 子部门层数, -1所有)</param>
 public static void GetChildDept(DropDownList ddl, string strDeptID, int iFloorCode)
 {
     OADept.BindDropDownList(ddl, OADept.GetChildDept(strDeptID, iFloorCode));
 }
Esempio n. 13
0
        /// <summary>
        /// 根据用户的账号(不包含域名)和职位名获取可交办和传阅的部门的ID以","分隔
        /// </summary>
        /// <param name="strUserID">用户账号</param>
        /// <param name="strPostName">职位名称</param>
        /// <returns></returns>
        private static string GetDeptIDByUser(string strUserID, string strPostName)
        {
            string    strIDS           = string.Empty;
            int       iCount           = 0;
            ViewBase  vbDept           = null;
            string    strDeptIDS       = string.Empty;
            ArrayList arrDepts         = new ArrayList();
            ArrayList strPostNames     = OAUser.GetSupPostNameAarray(strPostName);
            ViewBase  vbCompanyLeaders = OAUser.GetUserByRole(OUConstString.RoleName.COMPANY_LEADER);

            if (vbCompanyLeaders != null && vbCompanyLeaders.Count > 0)
            {
                vbCompanyLeaders.Condition = "a.userid=" + "'" + strUserID + "'";
            }
            if (vbCompanyLeaders != null && vbCompanyLeaders.DtTable != null)
            {
                iCount = vbCompanyLeaders.DtTable.Rows.Count;
            }
            if (iCount == 0)
            {
                User user = OAUser.GetUser(strUserID);
                if (user != null)
                {
                    ViewBase vbDeptPost = user.DeptPosts;
                    if (vbDeptPost != null)
                    {
                        foreach (DeptPost deptpost in vbDeptPost.Ens)
                        {
                            if (deptpost.Dept != null && deptpost.Post != null)
                            {
                                if (strPostNames.Contains(deptpost.Post.Name))
                                {
                                    arrDepts.Add(deptpost.Dept.ID);
                                }
                            }
                        }
                    }
                    ViewBase vbDeptManger = user.ManagerDepts;
                    if (vbDeptManger != null)
                    {
                        foreach (Department dept in vbDeptManger.Ens)
                        {
                            arrDepts.Add(dept.ID);
                        }
                    }
                    ViewBase vbDeptLeader = user.LeaderDepts;
                    if (vbDeptLeader != null)
                    {
                        foreach (Department dept in vbDeptLeader.Ens)
                        {
                            arrDepts.Add(dept.ID);
                        }
                    }
                    strDeptIDS = OADept.GetStringFormatForArrayList(arrDepts, ",");
                    vbDept     = OADept.GetChildDeptsConSelf(strDeptIDS, -1);
                    if (vbDept != null)
                    {
                        strIDS = vbDept.GetFieldVals("ID", ",");
                    }
                    else
                    {
                        strIDS = "-1";
                    }
                }
            }
            return(strIDS);
        }
Esempio n. 14
0
 /// <summary>
 /// 根据用户的账号(不包含域名)获取可交办和传阅的部门的ID以","分隔
 /// </summary>
 /// <param name="strUserID">用户账号</param>
 /// <returns>string</returns>
 public static string GetDeptIDByUser2(string strUserID)
 {
     return(OADept.GetDeptIDByUser(strUserID, OUConstString.PostName.YUANGONG));
 }
Esempio n. 15
0
 /// <summary>
 /// 根据部门的ID获取子部门
 /// </summary>
 /// <param name="ddl" >下拉菜单ID</param >
 /// <param name="strDeptID">部门的ID</param>
 /// <param name="iFloorCode" >层级(>0 子部门层数, -1所有)</param>
 /// <param name="bClear" >是否清除(true:清除,false :追加)</param>
 /// <param name="bBlank" >是否加空行(true:加空行 false:反之)</param>
 public static void GetChildDept(DropDownList ddl, string strDeptID, int iFloorCode, bool bClear, bool bBlank)
 {
     OADept.BindDropDownList(ddl, OADept.GetChildDept(strDeptID, iFloorCode), bClear, bBlank);
 }
Esempio n. 16
0
 /// <summary>
 /// 根据用户账号获取他所在部门信息绑定到DropDownList
 /// </summary>
 /// <param name="ddl">下拉菜单ID</param>
 /// <param name="strUserID">用户账号</param>
 /// <param name="iFloorCode">层级(0.自己所在部门;1.处级部门;2.科级部门;-1.所有部门)</param>
 /// <param name="bIsNeedBlank">是否需要空行</param>
 public static void GetDeptByUser(DropDownList ddl, string strUserID, int iFloorCode, bool bIsNeedBlank)
 {
     OADept.BindDropDownList(ddl, OADept.GetDeptByUser(strUserID, iFloorCode), bIsNeedBlank);
 }
Esempio n. 17
0
 /// <summary>
 /// 获取指定层级的部门信息绑定到DropDownList
 /// </summary>
 /// <param name="ddl" >下拉菜单ID</param>
 /// <param name="iFloorCode">层级(1.处级部门;2.科级部门;-1.所有部门)</param>
 public static void GetDeptByIfloor(DropDownList ddl, int iFloorCode)
 {
     OADept.BindDropDownList(ddl, OADept.GetDeptByIfloor(iFloorCode));
 }