/// <summary>
        /// 按部门获取用户列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="departmentId">部门主键</param>
        /// <param name="containChildren">含子部门</param>
        /// <returns>数据表</returns>
        public List <BaseUserEntity> GetListByDepartment(BaseUserInfo userInfo, string departmentId, bool containChildren)
        {
            var entityList = new List <BaseUserEntity>();

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) =>
            {
                var userManager = new BaseUserManager(dbHelper, userInfo);
                if (string.IsNullOrEmpty(departmentId))
                {
                    entityList = userManager.GetList <BaseUserEntity>(new KeyValuePair <string, object>(BaseUserEntity.FieldDeleted, 0)
                                                                      , 200, BaseUserEntity.FieldSortCode);
                }
                else
                {
                    if (containChildren)
                    {
                        entityList = userManager.GetChildrenUserList(departmentId);
                    }
                    else
                    {
                        entityList = userManager.GetListByDepartment(departmentId);
                    }
                }
            });
            return(entityList);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 按主键获取列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">主键数组</param>
        /// <returns>数据表</returns>
        public List <BaseUserEntity> GetListByIds(BaseUserInfo userInfo, string[] ids)
        {
            List <BaseUserEntity> result = new List <BaseUserEntity>();

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) =>
            {
                var userManager = new BaseUserManager(dbHelper, userInfo);
                result          = userManager.GetList <BaseUserEntity>(BaseUserEntity.FieldId, ids, BaseUserEntity.FieldSortCode);
            });

            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取用户列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <returns>数据表</returns>
        public List <BaseUserEntity> GetList(BaseUserInfo userInfo)
        {
            List <BaseUserEntity> result = new List <BaseUserEntity>();

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) =>
            {
                var userManager = new BaseUserManager(dbHelper, userInfo);
                // 获取允许登录列表
                List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();
                parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldDeletionStateCode, 0));
                result = userManager.GetList <BaseUserEntity>(parameters, BaseUserEntity.FieldSortCode);
            });

            return(result);
        }