Ejemplo n.º 1
0
 public override int GetHashCode()
 {
     return(
         PagingResult.GetHashCode() ^
         RecordCount.GetHashCode() ^
         TotalRecordCount.GetHashCode()
         );
 }
Ejemplo n.º 2
0
 public override int GetHashCode()
 {
     return(
         PagingResult.GetHashCode() ^
         PageCount.GetHashCode() ^
         PageSize.GetHashCode() ^
         TotalRecordCount.GetHashCode() ^
         LastPageRecordCount.GetHashCode() ^
         IsLastPagePartial.GetHashCode()
         );
 }
Ejemplo n.º 3
0
        public Pagination(PagingResult pagingResult)
        {
            if (pagingResult == null)
            {
                throw new ArgumentNullException("pagingResult");
            }

            _pagingResult = pagingResult;


            int totalRecords = pagingResult.TotalRecordCount;

            int pageSize = pagingResult.PagingParams.PageSize;


            if (totalRecords < 1)
            {
                _pageCount           = 0;
                _isLastPagePartial   = false;
                _lastPageRecordCount = 0;
            }
            else
            {
                _pageCount = totalRecords / pageSize;

                int lastPageRemainder = totalRecords % pageSize;

                _isLastPagePartial = lastPageRemainder > 0;

                if (_isLastPagePartial)       // less than a full page of records on the last page...

                {
                    _lastPageRecordCount = lastPageRemainder;

                    // ...so we add one more page at the end for the partial page
                    _pageCount++;
                }
                else
                {
                    _lastPageRecordCount = pageSize;
                }
            }
        }
Ejemplo n.º 4
0
        public bool Equals(Pagination other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(false);
            }
            if (Object.ReferenceEquals(other, this))
            {
                return(true);
            }


            if (!PagingResult.Equals(other.PagingResult))
            {
                return(false);
            }

            if (PageCount != other.PageCount)
            {
                return(false);
            }
            if (PageSize != other.PageSize)
            {
                return(false);
            }
            if (TotalRecordCount != other.TotalRecordCount)
            {
                return(false);
            }
            if (LastPageRecordCount != other.LastPageRecordCount)
            {
                return(false);
            }
            if (IsLastPagePartial != other.IsLastPagePartial)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 5
0
        public bool Equals(IPagedEnumerable other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(false);
            }
            if (Object.ReferenceEquals(other, this))
            {
                return(true);
            }


            if (!PagingResult.Equals(other.PagingResult))
            {
                return(false);
            }

            if (PageSize != other.PageSize)
            {
                return(false);
            }
            if (PageNumber != other.PageNumber)
            {
                return(false);
            }
            if (RecordCount != other.RecordCount)
            {
                return(false);
            }
            if (TotalRecordCount != other.TotalRecordCount)
            {
                return(false);
            }

            return(true);
        }