예제 #1
0
 public ItemsDTO(IEnumerable <T> items, TotalsDTO totals, PagerDTO pager,
                 IEnumerable <T> originalItems, IEnumerable <T> allFilteredItems)
 {
     Items            = items;
     Totals           = totals;
     Pager            = pager;
     OriginalItems    = originalItems;
     AllFilteredItems = allFilteredItems;
 }
예제 #2
0
        protected virtual async Task OnPagerChanged()
        {
            PagerEventArgs args     = new PagerEventArgs();
            PagerDTO       pagerDTO = new PagerDTO(Grid.EnablePaging, Grid.Pager.PageSize, Grid.Pager.CurrentPage,
                                                   Grid.Pager.ItemsCount);

            args.Pager = pagerDTO;

            if (PagerChanged != null)
            {
                await PagerChanged.Invoke(this, args);
            }
        }
예제 #3
0
 public ItemsDTO(IEnumerable <T> items, PagerDTO pager)
 {
     Items = items;
     Pager = pager;
 }
예제 #4
0
        public PagerDTO<UserDTO> GetUserPage(string searchString, int page, int pageSize, int roleId)
        {
            List<User> users = new List<User>();

            if (!String.IsNullOrEmpty(searchString))
            {
                users.AddRange(
                    uOW.UserRepo.Get()
                        .Where(s => (s.UserName.ToLower()).Contains(searchString.ToLower())
                                    || (s.Email.ToLower()).Contains(searchString.ToLower()))
                    );
            }
            else
            {
                users.AddRange(uOW.UserRepo.Get());
            }

            if (roleId > 0)
            {
                users = users.Where(s => (s.RoleId == roleId)).ToList();
            }

            var pageCount = (double) users.Count()/pageSize;

            var model = new PagerDTO<UserDTO>
            {
                CurrentPage = page,
                PageCount = (int) Math.Ceiling(pageCount)
            };

            // if asked page is greater then avilable ones
            if (model.PageCount < page)
            {
                return model;
            }

            var skip = pageSize*(page - 1);
            var resultList = Mapper.Map<IEnumerable<UserDTO>>(users.Skip(skip).Take(pageSize)).ToList();

            model.Data = resultList;

            return model;
        }
예제 #5
0
 public ItemsDTO(IEnumerable <T> items, TotalsDTO totals, PagerDTO pager)
 {
     Items  = items;
     Totals = totals;
     Pager  = pager;
 }