zoukankan      html  css  js  c++  java
  • 分页服务类

    主要做分页服务的帮助类

    附上分页服务代码

      1     /// <summary>
      2     /// 分页类
      3     /// </summary>
      4     [Serializable]
      5     [DataContract]
      6     public class Paging
      7     {
      8         /// <summary>
      9         /// 页码
     10         /// </summary>
     11         [DataMember]
     12         public int PageIndex { get; set; }
     13 
     14         /// <summary>
     15         /// 页大小
     16         /// </summary>
     17         private int pageSize = 10;
     18 
     19         /// <summary>
     20         /// 页大小(默认10页)
     21         /// </summary>
     22         [DataMember]
     23         public int PageSize
     24         {
     25             get
     26             {
     27                 return this.pageSize;
     28             }
     29 
     30             set
     31             {
     32                 this.pageSize = value;
     33             }
     34         }
     35 
     36         /// <summary>
     37         /// 总条数
     38         /// </summary>
     39         [DataMember]
     40         public int RowsCount { get; set; }
     41 
     42         /// <summary>
     43         /// 总页数
     44         /// </summary>
     45         private int pageCount;
     46 
     47         /// <summary>
     48         /// 总页数
     49         /// </summary>
     50         [DataMember]
     51         public int PageCount
     52         {
     53             get
     54             {
     55                 this.pageCount = (this.RowsCount % this.PageSize) == 0
     56                                      ? this.RowsCount / this.PageSize
     57                                      : (this.RowsCount / this.PageSize) + 1;
     58                 return this.pageCount;
     59             }
     60 
     61             set
     62             {
     63                 this.pageCount = value;
     64             }
     65         }
     66 
     67         /// <summary>
     68         /// 是否获取总条数
     69         /// </summary>
     70         private bool getRowsCount = true;
     71 
     72         /// <summary>
     73         /// 是否获取总条数
     74         /// </summary>
     75         [DataMember]
     76         public bool GetRowsCount
     77         {
     78             get
     79             {
     80                 return this.getRowsCount;
     81             }
     82 
     83             set
     84             {
     85                 this.getRowsCount = value;
     86             }
     87         }
     88 
     89         /// <summary>
     90         /// 开始索引
     91         /// </summary>
     92         public int StratRows
     93         {
     94             get
     95             {
     96                 if (this.PageIndex <= 0)
     97                 {
     98                     return 0;
     99                 }
    100 
    101                 return this.PageSize * (this.PageIndex - 1);
    102             }
    103         }
    104     }
    View Code
  • 相关阅读:
    20150805-20150807 tradeDate-----python
    nutz_web应用中主页跳转到登录页面的方式
    nutz中实现登录验证
    C#之继承
    C#中Page执行顺序:OnPreInit()、OnInit()……
    利用堆栈实现走迷宫算法
    对数组结构体按照K值翻转
    实现多项式的加法和乘法运算
    两个有序链表的合并
    队列的比较和存储方式
  • 原文地址:https://www.cnblogs.com/liuxiaoji/p/4290509.html
Copyright © 2011-2022 走看看