Ejemplo n.º 1
0
        public PaginationList <DepartmentContract> Get(string createdBy, string searchString, string[] properties, int page, int pageSize, string sort,
                                                       string orderBy = "desc")
        {
            Expression <Func <V_DEPT_DEPT, bool> > condition = p => p.DEPT_INFO_ISDEL == 0 && p.DEPT_INFO_ISSUP == 0;

            if (!string.IsNullOrEmpty(searchString))
            {
                condition = (p => p.DEPT_INFO_ISDEL == 0 && p.DEPT_INFO_ISSUP == 0 && (p.DEPT_INFO_NAME.Contains(searchString) || p.DEPT_INFO_PARENTNAME.Contains(searchString) || p.DEPT_INFO_ADDRESS.Contains(searchString) || p.GEO_INFO_NAME.Contains(searchString)));
            }

            var sortMap = QueryableBuilderExtensions.GetMappingPropertyName <DepartmentContract, V_DEPT_DEPT>(sort);

            if (properties != null && properties.Length > 0)
            {
                var selector = QueryableBuilderExtensions.BuildSelectorClause <V_DEPT_DEPT, DepartmentContract>(properties);
                return(_depDepAuthorizeRepository.GetPagerByUser(createdBy, selector, condition, sortMap ?? "DEPT_INFO_CREATEDDATE", orderBy ?? "desc",
                                                                 Math.Max(page - 1, 0) * pageSize, pageSize));
            }
            var pager = _depDepAuthorizeRepository.GetPagerByUser(createdBy, condition, sortMap ?? "DEPT_INFO_CREATEDDATE", orderBy ?? "desc", Math.Max(page - 1, 0) * pageSize, pageSize);

            return(new PaginationList <DepartmentContract>(pager.Items.ConvertAll(p => p.ToContract()))
            {
                TotalCount = pager.TotalCount,
                PageSize = pageSize
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 供应商账号分页列表
        /// </summary>
        /// <param name="searchString"></param>
        /// <param name="properties"></param>
        /// <param name="page"></param>
        /// <param name="pageSize"></param>
        /// <param name="sort"></param>
        /// <param name="orderBy"></param>
        /// <returns></returns>
        public PaginationList <UserContract> GetSup(string searchString, string[] properties, int page, int pageSize, string sort, string orderBy = "desc")
        {
            Expression <Func <V_USER_ROLE_DEPT, bool> > condition = p => p.USER_INFO_ISDEL == 0 && p.DEPT_INFO_ISDEL == 0 &&
                                                                    p.DEPT_INFO_ISSUP == 1 && p.USER_INFO_ISSUP == 1 && p.USER_INFO_STATE == "0";

            if (!string.IsNullOrEmpty(searchString))
            {
                condition = (p => p.USER_INFO_ISDEL == 0 && p.DEPT_INFO_ISSUP == 1 && p.USER_INFO_ISSUP == 1 &&
                             p.DEPT_INFO_ISDEL == 0 && p.USER_INFO_STATE == "0" && (p.USER_INFO_NICKNAME.Contains(searchString) || p.DEPT_INFO_NAME.Contains(searchString)));
            }

            var sortMap = QueryableBuilderExtensions.GetMappingPropertyName <UserContract, V_USER_ROLE_DEPT>(sort);

            if (properties != null && properties.Length > 0)
            {
                var selector = QueryableBuilderExtensions.BuildSelectorClause <V_USER_ROLE_DEPT, UserContract>(properties);
                return(_userRoleDepartmentViewRepository.GetPager(selector, condition, sortMap ?? "USER_INFO_CREATEDDATE", orderBy ?? "desc", Math.Max(page - 1, 0) * pageSize, pageSize));
            }
            var pager = _userRoleDepartmentViewRepository.GetPager(condition, sortMap ?? "USER_INFO_CREATEDDATE", orderBy ?? "desc", Math.Max(page - 1, 0) * pageSize, pageSize);

            return(new PaginationList <UserContract>(pager.Items.ConvertAll(p => p.ToUserContract()))
            {
                TotalCount = pager.TotalCount,
                PageSize = pageSize
            });
        }
Ejemplo n.º 3
0
        public List <DepartmentContract> Get(string createdBy, ExpressionCriteriaBase[] criteria = null, string[] properties = null)
        {
            Expression <Func <V_DEPT_DEPT, bool> > condition = ExpressionUtils.BuildCondition <V_DEPT_DEPT>(criteria);

            if (properties != null && properties.Length > 0)
            {
                Expression <Func <V_DEPT_DEPT, DepartmentContract> > selector =
                    QueryableBuilderExtensions.BuildSelectorClause <V_DEPT_DEPT, DepartmentContract>(properties);
                return(_depDepAuthorizeRepository.GetByUser(createdBy, selector, condition).ToList());
            }
            return(_depDepAuthorizeRepository.GetByUser(createdBy, condition, p => p.DEPT_INFO_CREATEDDATE).ConvertAll(p => p.ToContract()));
        }
Ejemplo n.º 4
0
        public List <DepartmentContract> Get(ExpressionCriteriaBase[] criteria = null, string[] properties = null)
        {
            Expression <Func <V_DEPT_DEPT, bool> > condition = (p => p.DEPT_INFO_ISDEL == 0 && p.DEPT_INFO_ISSUP == 0);

            if (properties != null && properties.Length > 0)
            {
                Expression <Func <V_DEPT_DEPT, DepartmentContract> > selector =
                    QueryableBuilderExtensions.BuildSelectorClause <V_DEPT_DEPT, DepartmentContract>(properties);
                return(_depDepRepository.Get(selector, condition));
            }
            return(_depDepRepository.GetAll(condition, p => p.DEPT_INFO_CREATEDDATE).ConvertAll(p => p.ToContract()));
        }
Ejemplo n.º 5
0
        public List <AreaContract> Get(ExpressionCriteriaBase[] criteria = null, string[] properties = null)
        {
            Expression <Func <BASE_GEO_INFO, bool> > condition = ExpressionUtils.BuildCondition <BASE_GEO_INFO>(criteria);

            if (properties != null && properties.Length > 0)
            {
                Expression <Func <BASE_GEO_INFO, AreaContract> > selector =
                    QueryableBuilderExtensions.BuildSelectorClause <BASE_GEO_INFO, AreaContract>(properties);
                return(_areaRepository.Get(selector, condition));
            }
            return(_areaRepository.GetAll(condition, p => p.GEO_INFO_ORDER).ConvertAll(p => p.ToContract()));
        }
Ejemplo n.º 6
0
        public List <UserContract> Get(string userName, ExpressionCriteriaBase[] criteria = null, string[] properties = null)
        {
            Expression <Func <V_USER_ROLE_DEPT, bool> > condition = ExpressionUtils.BuildCondition <V_USER_ROLE_DEPT>(criteria);

            if (properties != null && properties.Length > 0)
            {
                Expression <Func <V_USER_ROLE_DEPT, UserContract> > selector =
                    QueryableBuilderExtensions.BuildSelectorClause <V_USER_ROLE_DEPT, UserContract>(properties);
                return(_userRoleDepartmentViewRepository.Get(selector, condition).Where(p => p.CreatedBy == userName).ToList());
            }
            return(_userRoleDepartmentViewRepository.GetAll(condition, p => p.USER_INFO_ID).Where(p => p.USER_INFO_CREATEDBY == userName).ToList().ConvertAll(p => p.ToUserContract()));
        }
Ejemplo n.º 7
0
        public List <RoleContract> GetByUser(string createBy, ExpressionCriteriaBase[] criteria = null, string[] properties = null)
        {
            Expression <Func <BASE_ROLE_INFO, bool> > condition = ExpressionUtils.BuildCondition <BASE_ROLE_INFO>(criteria);

            if (properties != null && properties.Length > 0)
            {
                Expression <Func <BASE_ROLE_INFO, RoleContract> > selector =
                    QueryableBuilderExtensions.BuildSelectorClause <BASE_ROLE_INFO, RoleContract>(properties);
                return(_roleAuthorizeRepository.GetByUser(createBy, selector, condition));
            }
            return(_roleAuthorizeRepository.GetByUser(createBy, condition, p => p.ROLE_INFO_CREATEDDATE).ConvertAll(p => p.ToContract()));
        }
Ejemplo n.º 8
0
        public List <SelectValueContract> GetContains(string belong, string[] properties = null)
        {
            Expression <Func <BASE_SELECTE_VALUE_INFO, bool> > condition = null;

            if (!string.IsNullOrEmpty(belong))
            {
                condition =
                    (p => p.Belong.ToLower().Contains(belong.ToLower()));
            }

            if (properties != null && properties.Length > 0)
            {
                properties = new[] { "Id", "Name", "Code", "SOrder" };
                Expression <Func <BASE_SELECTE_VALUE_INFO, SelectValueContract> > selector =
                    QueryableBuilderExtensions.BuildSelectorClause <BASE_SELECTE_VALUE_INFO, SelectValueContract>(properties);
                return(_selectBaseRepository.Get(selector, condition).OrderBy(p => p.SOrder).ToList());
            }
            return(_selectBaseRepository.GetAll(condition, p => p.SOrder).OrderBy(p => p.SOrder).ToList().ConvertAll(p => p.ToContract()));
        }
Ejemplo n.º 9
0
        public PaginationList <UserContract> Get(ExpressionCriteriaBase[] criteria, string[] properties, int page, int pageSize, string sort, string orderBy = "desc")
        {
            Expression <Func <V_USER_ROLE_DEPT, bool> > condition = ExpressionUtils.BuildCondition <V_USER_ROLE_DEPT>(criteria);
            var sortMap = QueryableBuilderExtensions.GetMappingPropertyName <UserContract, V_USER_ROLE_DEPT>(sort);

            if (properties != null && properties.Length > 0)
            {
                Expression <Func <V_USER_ROLE_DEPT, UserContract> > selector =
                    QueryableBuilderExtensions.BuildSelectorClause <V_USER_ROLE_DEPT, UserContract>(properties);
                return(_userRoleDepartmentViewRepository.GetPager(selector, condition, sortMap ?? "USER_INFO_CREATEDDATE", orderBy ?? "desc",
                                                                  Math.Max(page - 1, 0) * pageSize, pageSize));
            }
            var pager = _userRoleDepartmentViewRepository.GetPager(condition, sortMap ?? "USER_INFO_CREATEDDATE", orderBy ?? "desc", Math.Max(page - 1, 0) * pageSize, pageSize);

            return(new PaginationList <UserContract>(pager.Items.ConvertAll(p => p.ToUserContract()))
            {
                TotalCount = pager.TotalCount,
                PageSize = pageSize
            });
        }