Пример #1
0
        /// <summary>
        /// 根据接收者类型,来获取角色用户树的数据
        /// </summary>
        /// <param name="roleIDs">角色ID</param>
        /// <param name="curUserID">当前用户ID</param>
        /// <param name="receiverType">接收者类型</param>
        /// <returns>用户列表</returns>
        public IList <User> GetUserListByRoleReceiverType(string[] roleIDs, string curUserID, int receiverType)
        {
            IList <User> userList = null;

            using (var session = SessionFactory.CreateSession())
            {
                if (receiverType == 0)
                {
                    //直接根据角色查询
                    var rum = new RoleUserManager();
                    userList = rum.GetUserListByRoles(roleIDs, session);
                }
                else
                {
                    //根据用户级别关系查询
                    // 上司:1, 同事:2, 下属:3
                    IDeptService deptService = DeptServiceFactory.CreateDeptService();
                    userList = deptService.GetUserListByDeptRank(roleIDs, curUserID, receiverType);
                }
            }
            return(userList);
        }