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. unity中Animation与Animator的区别

    Animation:单一动画,一般使用在单一动画播放.占用资源小. Animator:多个动画,可用控制器切换多个动画播放.占用资源大.

  2. win7 64 位安装 python,提示: 0x80240017-未指定的错误

    首先确保从python官网下载正确的python版本: https://www.python.org/downloads/windows/ 然后,应该是 VC 相关的问题. 去微软网站下载下列补丁包即 ...

  3. 自学git心得-2

    趁着最近还没忙起来,抓紧更新一下学习心得. 现在的情景是,我们已经在本地创建了一个Git仓库,又想在GitHub创建一个Git仓库,并且让这两个仓库进行远程同步,这样,GitHub上的仓库既可以作为备 ...

  4. 微信小程序支付返回信息为空

    1.昨天公司说要实现微信小程序的支付,于是看了下微信小程序的开发api文档,和之前的app  端以及pc端基本相似:于是让他们把参数改了下,把之前的trade_type 由 app 改成 小程序要求的 ...

  5. 仿照jQuery进行一些简单的框架封装(欢迎指教~)

    (function(window,undefined){ var arr = [], push = arr.push, slice = arr.slice; //首先要做的就是封装一个parseHtm ...

  6. Python unittest模块心得(二)

    基础概念介绍请参看: http://www.cnblogs.com/frost-hit/p/8295818.html 组织测试用例 unittest.TestSuite(tests=()): 除了使用 ...

  7. html 表单button

    做一下标记: 请务必为form里面button设置type 因为: Internet Explorer 的默认类型是 "button",而其他浏览器中(包括 W3C 规范)的默认值 ...

  8. .Net程序员应该掌握的正则表达式

    Regular Expression Net程序员必然要掌握正则的核心内容:匹配.提取.替换.常用元字符. 正则表达式是用来进行文本处理的技术,是语言无关的,在几乎所有语言中都有实现. 常用元字符 . ...

  9. ajax 请求 服务器 响应内容过长 返回500错误的解决方法

    在web.config试试加上 <system.web.extensions> <scripting> <webServices> <jsonSerializ ...

  10. hexo安装-nodejs

    npm- 安装淘宝源 http://npm.taobao.org/$ npm install -g cnpm --registry=https://registry.npm.taobao.org- 查 ...