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