コード例 #1
0
        public async Task <Pager <VendorDto> > GetVendorPager(PagerFilter filter)
        {
            var sortby = "Id";

            Expression <Func <VendorEntity, bool> > where = x =>
                                                            (true) &&
                                                            (string.IsNullOrEmpty(filter.Search) ||
                                                             x.Name.ToLower().Contains(filter.Search.ToLower()) ||
                                                             x.No.ToLower().Contains(filter.Search.ToLower()) ||
                                                             x.Description.ToLower().Contains(filter.Search.ToLower()));

            string[] include = new string[] { "Fields" };

            var tuple = await _vendorManager.Pager <VendorEntity>(where, sortby, filter.Start, filter.Length, include);

            var list  = tuple.Item1;
            var count = tuple.Item2;

            if (count == 0)
            {
                return(new Pager <VendorDto>(new List <VendorDto>(), 0, filter.Length, filter.Start));
            }

            var page = (filter.Start + filter.Length) / filter.Length;

            var result = _mapper.Map <List <VendorDto> >(list);

            return(new Pager <VendorDto>(result, count, page, filter.Length));
        }
コード例 #2
0
        public async Task <Pager <UccountDto> > GetUccountPage(PagerFilter filter)
        {
            var sortby = "Id";

            Expression <Func <UccountEntity, bool> > where = x =>
                                                             (true);
            //&& (string.IsNullOrEmpty(filter.Search) || (x.No.ToLower().Contains(filter.Search.ToLower()) || x.Name.ToLower().Contains(filter.Search.ToLower())));

            string[] include = new string[] { "Company", "Vendor", "Services" };

            var tuple = await _uccountManager.Pager <UccountEntity>(where, sortby, filter.Start, filter.Length, include);

            var list  = tuple.Item1;
            var count = tuple.Item2;

            if (count == 0)
            {
                return(new Pager <UccountDto>(new List <UccountDto>(), 0, filter.Start, filter.Length));
            }

            var page = (filter.Start + filter.Length) / filter.Length;

            var result = _mapper.Map <List <UccountDto> >(list);

            return(new Pager <UccountDto>(result, count, page, filter.Length));
        }
コード例 #3
0
ファイル: PersonBusinessManager.cs プロジェクト: anrmk/margo
        public async Task <Pager <PersonDto> > GetPersonPager(PagerFilter filter)
        {
            var sortby = "Id";

            Expression <Func <PersonEntity, bool> > where = x =>
                                                            (string.IsNullOrEmpty(filter.Search) ||
                                                             x.Name.ToLower().Contains(filter.Search.ToLower()) ||
                                                             x.Description.ToLower().Contains(filter.Search.ToLower()));

            string[] include = new string[] { "Accounts" };

            var(list, count) = await _personManager.Pager <PersonEntity>(where, sortby, filter.Start, filter.Length, include);

            if (count == 0)
            {
                return(new Pager <PersonDto>(new List <PersonDto>(), 0, filter.Start, filter.Length));
            }

            var page = (filter.Start + filter.Length) / filter.Length;

            var result = _mapper.Map <List <PersonDto> >(list);

            return(new Pager <PersonDto>(result, count, page, filter.Length));
        }
コード例 #4
0
        public async Task <Pager <SectionDto> > GetSectionPage(PagerFilter filter)
        {
            var sortby = "Name";

            Expression <Func <SectionEntity, bool> > where = x =>
                                                             (true) &&
                                                             (string.IsNullOrEmpty(filter.Search) || x.Name.ToLower().Contains(filter.Search.ToLower()));

            var tuple = await _sectionManager.Pager <SectionEntity>(where, sortby, filter.Start, filter.Length);

            var list  = tuple.Item1;
            var count = tuple.Item2;

            if (count == 0)
            {
                return(new Pager <SectionDto>(new List <SectionDto>(), 0, filter.Start, filter.Length));
            }

            var page = (filter.Start + filter.Length) / filter.Length;

            var result = _mapper.Map <List <SectionDto> >(list);

            return(new Pager <SectionDto>(result, count, page, filter.Length));
        }