Ejemplo n.º 1
0
        public PagedLocations GetAllPages(int itemsPerPage, string orderBy = "", string searchTerm = "", string sortOrder = "ASC")
        {
            //var allPages = (PagingCollection<IndexedLocation>)_requestCache.GetCacheItem("paged-locations-search-pages", () => locationService.GetAllPages(itemsPerPage, orderBy, searchTerm, sortOrder.ToUpper()));

            var allPages = locationService.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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public PageOfLocations GetAllPaged(long pageNum, long itemsPerPage)
        {
            var allPages = locationService.GetAllPages(Convert.ToInt32(itemsPerPage), "", "");

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

            return(result);
        }
Ejemplo n.º 4
0
        public PageOfLocations GetAllPaged(int pageNum, int itemsPerPage, string orderBy, string searchTerm = "", string sortOrder = "ASC")
        {
            //var allPages = (PagingCollection<IndexedLocation>)_requestCache.GetCacheItem("paged-locations-search", () => locationService.GetAllPages(itemsPerPage, orderBy, searchTerm, sortOrder.ToUpper()));

            var allPages = locationService.GetAllPages(itemsPerPage, orderBy, searchTerm, sortOrder.ToUpper());

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

            return(result);
        }