예제 #1
0
        public PageOfLocations GetAllPaged(int pageNum, int itemsPerPage, string orderBy, string searchTerm = "", string sortOrder = "ASC")
        {
            var locService = new LocationService();

            var allPages = (PagingCollection<JsonLocation>)_requestCache.GetCacheItem("paged-locations-search", () => locService.GetAllPages(itemsPerPage, orderBy, searchTerm, sortOrder.ToUpper()));

            ////var allPages = locService.GetAllPages(ItemsPerPage, OrderBy, SearchTerm);

            var result = new PageOfLocations()
            {
                Locations = allPages.GetData(pageNum),
                PageNum = pageNum,
                ItemsPerPage = itemsPerPage,
                TotalItems = allPages.TotalCount,
                TotalPages = allPages.PagesCount
            };

            return result;
        }
예제 #2
0
        public PagedLocations GetAllPages(int itemsPerPage, string orderBy = "", string searchTerm = "", string sortOrder = "ASC")
        {
            var locService = new LocationService();

            var allPages = (PagingCollection<JsonLocation>)_requestCache.GetCacheItem("paged-locations-search-pages", () => locService.GetAllPages(itemsPerPage, orderBy, searchTerm, sortOrder.ToUpper()));

            var result = new PagedLocations()
            {
                ItemsPerPage = itemsPerPage,
                TotalItems = allPages.TotalCount,
                TotalPages = allPages.PagesCount
            };

            var listOfPages = new List<PageOfLocations>();
            for (var i = 0; i < allPages.PagesCount; i++)
            {
                var page = new PageOfLocations()
                               {
                                   Locations = allPages.GetData(i + 1),
                                   PageNum = i,
                                   ItemsPerPage = allPages.GetCount(i + 1),
                                   TotalItems = allPages.TotalCount,
                                   TotalPages = allPages.PagesCount
                               };

                listOfPages.Add(page);
            }

            result.Pages = listOfPages;
            return result;
        }
예제 #3
0
 public PageOfLocations GetAllPaged(long pageNum, long itemsPerPage)
 {
     var paged = Repositories.LocationRepo.GetPaged(pageNum + 1, itemsPerPage, string.Empty);
     var totalCount = Repositories.LocationRepo.GetCount();
     var result = new PageOfLocations()
                     {
                          Locations = paged,
                          PageNum = pageNum,
                          ItemsPerPage = itemsPerPage,
                          TotalItems = Convert.ToInt64(totalCount)
                      };
     return result;
 }