コード例 #1
0
        private uint initNumberOfPages()
        {
            uint numberOfPages = _collection != null?
                                 _pagination.PageCount(Convert.ToUInt32(_collection.Count())) :
                                     0;

            return(numberOfPages);
        }
コード例 #2
0
        public PaginatedResults(T[] pageOfResults, int totalResults, Pagination pagination)
        {
            Pagination = pagination;

            var totalCount = Convert.ToUInt32(totalResults);

            CurrentPage   = pagination.PageNumber == 0 ? 1 : pagination.PageNumber;
            PageOfResults = pageOfResults;
            TotalResults  = totalCount;
            TotalPages    = pagination.PageCount(totalCount);

            uint lastRecord = 0;

            if (CurrentPage <= TotalPages)
            {
                lastRecord = PageNotComplete(pageOfResults, pagination) ?
                             Convert.ToUInt32(pagination.FirstRecord + pageOfResults.Length - 1) :
                             pagination.LastRecord;
            }

            RecordNumbers = lastRecord > 0 ? new Range <uint>(pagination.FirstRecord, lastRecord) : new Range <uint>(0, 0);
        }