using System; namespace HealthMonitor.Util.QueryObjects { public class Paging { private int _curPage = 1; /// /// 当前页 /// public int CurPage { get { return Math.Min(Math.Max(1, this._curPage), this.PageCount); } set { this._curPage = value; } } private int _pageSize = 10; /// /// 每页记录数 /// public int PageSize { get { return Math.Max(1, this._pageSize); } set { this._pageSize = value; } } private int _totalCount = 0; /// /// 总记录数 /// public int TotalCount { get { return this._totalCount; } set { this._totalCount = value; } } /// /// 总页数 /// public int PageCount { get { int cnt = (int)Math.Ceiling((double)_totalCount / _pageSize); return Math.Max(1, cnt); } } ///// ///// 计算排号 ///// ///// 索引,以0开始计算 ///// //public int CalcSerialNum(int idx) //{ // if (IsAscendSort) // { // return (CurPage - 1) * PageSize + idx + 1; // } // else // { // return TotalCount - (CurPage - 1) * PageSize - idx; // } //} } }