using System.Collections.Generic;

namespace Oyang.Tool
{
public interface IPagination
{
int PageIndex { get; set; }
int PageSize { get; set; }
int TotalCount { get; set; }
string SortField { get; set; }
bool IsAsc { get; set; }
} public interface IFullPagination : IPagination
{
int PageCount { get; }
int ButtonCount { get; set; }
List<int> ListPageButton { get; }
List<int> CalcPageButton();
} public class Pagination : IPagination
{
public int PageIndex { get; set; }
public int PageSize { get; set; }
public int TotalCount { get; set; }
public string SortField { get; set; }
public bool IsAsc { get; set; }
} public class FullPagination : Pagination, IFullPagination
{
public int PageCount
{
get { return TotalCount % PageSize == ? TotalCount / PageSize : TotalCount / PageSize + ; }
}
public int ButtonCount { get; set; } = ; List<int> _listPageButton = null;
public List<int> ListPageButton { get; } public List<int> CalcPageButton()
{
_listPageButton = new List<int>();
int temp1 = (ButtonCount - ) / ;
int temp2 = ButtonCount - - temp1;
int startPageIndex = ;
int endPageIndex = ;
if (PageCount <= ButtonCount)
{
startPageIndex = ;
endPageIndex = PageCount;
}
else if (PageIndex <= temp1)
{
startPageIndex = ;
endPageIndex = startPageIndex + ButtonCount - ;
}
else if (PageIndex + temp2 > PageCount)
{
endPageIndex = PageCount;
startPageIndex = endPageIndex - ButtonCount + ;
}
else
{
startPageIndex = PageIndex - temp1;
endPageIndex = PageIndex + temp2;
} for (int i = startPageIndex; i <= endPageIndex; i++)
{
_listPageButton.Add(i);
}
return _listPageButton;
}
} }

Pagination的更多相关文章

  1. pagination 分页

    <!DOCTYPE html> <html> <head> <title>pagination</title> <style type ...

  2. salesforce 零基础学习(四十九)自定义列表分页之使用Pagination实现分页效果 ※※※

    上篇内容为Pagination基类的封装,此篇接上篇内容描述如何调用Pagination基类. 首先先创建一个sObject,起名Company info,此object字段信息如下: 为了国际化考虑 ...

  3. salesforce 零基础学习(四十八)自定义列表分页之Pagination基类封装 ※※※

    我们知道,salesforce中系统标准列表页面提供了相应的分页功能,如果要使用其分页功能,可以访问http://www.cnblogs.com/zero-zyq/p/5343287.html查看相关 ...

  4. knockoutjs+ jquery pagination+asp.net web Api 实现无刷新列表页

    Knockoutjs 是一个微软前雇员开发的前端MVVM JS框架, 具体信息参考官网 http://knockoutjs.com/ Web API数据准备: 偷个懒数据结构和数据copy自官网实例  ...

  5. ajax pagination 布局刷新

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xht ...

  6. jq pagination分页 全选、单选的思考

    $().pagination(总条数,配置项); 后端分页的跨页选择: 思路:把浏览过的页整体保存为,整体拥有 curPage(当前页码).allChoice(当前页是否全选).selected当前页 ...

  7. 分享一个Jquery 分页插件 Jquery Pagination

    分页插件来说,我觉得适用就行,尽量简单然后能够根据不同的应用场景能够换肤.展现形式等. 对于初学者想写分页插件的同学,也可以看下源码,代码也挺简单明了的,也助于自己写个小插件. 不过我比较懒,一般直接 ...

  8. jQuery Pagination分页插件的使用

    一.引用CSS和JS: <link href="/Content/Plugins/jQuery.Pagination_v2.2/pagination.css" rel=&qu ...

  9. web 前端常用组件【01】Pagination 分页

    分页组件几乎是一般网站都会涉及到的组件,网上有很多这样的插件,自己挑来跳去选择了这一款. 官方Demo网址:http://mricle.com/JqueryPagination 功能强大,可扩展性比较 ...

  10. ASP.NET MVC WebGrid – Performing true AJAX pagination and sorting 【转】

    ASP.NET MVC WebGrid – Performing true AJAX pagination and sorting FEBRUARY 27, 2012 14 COMMENTS WebG ...

随机推荐

  1. AdvStringGrid入门使用

    仅仅把数据从数据库中显示到AdvStringGrid中 procedure TForm1.btnQueryClick(Sender: TObject); var i, j: Integer; begi ...

  2. MySQL MHA搭建

    MHA算是业内比较成熟的MySQL高可用解决方案,在MySQL故障切换过程中,MHA能做到自动完成数据库的故障切换操作,并且在进行故障切换的过程中,MHA能在最大程度上保证数据的一致性,以达到真正意义 ...

  3. Excel使用SUMIF函数注意事项

    sumif函数的公式使用方法如下: =sumif(查询匹配的区域,条件,汇总求和的区域) 条件可以是“>10”或"=10"这种格式.其中“查询匹配区域”和“汇总求和区域”需要 ...

  4. [转] 你应该知道的应用UI动态设计规则

    转自 CocoaChina http://www.cocoachina.com/macdev/uiue/2014/0505/8315.html 你应该知道的应用UI动态设计规则 这篇文章中,我主要阐述 ...

  5. Python学习---远程执行命令

    原则:发送一个接受一个 原理:发送执行命令的大小给客户端,客户端根据接受的大小判断是否全部接收了服务器sendall()发送的全部 利用send发送的全部数据都是bytes类型的,需要进行字符编码的转 ...

  6. 查看dump oracle数据块查看

    alter system dump datafile 8 block 2523; Block dump from disk:buffer tsn: 87 rdba: 0x160dd924 (88/90 ...

  7. Sqlserver2008+搜索型注入技术

    简单的判断搜索型注入漏洞存在不存在的办法是先搜索',如果出错,说明90%存在这个漏洞.然后搜索%,如果正常返回,说明95%有洞了. 然后再搜索一个关键字,比如2006吧,正常返回所有2006相关的信息 ...

  8. php------中文出现乱码解决方法

    中文出现乱码解决方法:原因编码格式不一致 [1]  建立数据库的时候,字符集选择utf-8  数据库,点表名,点右键,数据库属性…. [2]  修改myspl的配置,在[myspld]模块下面添加ch ...

  9. BZOJ 2120 数颜色 【带修改莫队】

    任意门:https://www.lydsy.com/JudgeOnline/problem.php?id=2120 2120: 数颜色 Time Limit: 6 Sec  Memory Limit: ...

  10. MyBatis(8)延迟加载&缓存

    什么是延迟加载? resultMap可以实现高级映射,association,collection具有延迟加载的功能.   当我们需要查询某个信息的时候,再去查询,达到按需查询,就是延迟加载   可以 ...