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. Ubuntu 18.04 的网络配置

    netplan简介 目前,ubuntu18.04上使用了netplan 作为网络配置工具:在终端上配置网络参数跟之前的版本有比较大的差别 Netplan工作流程如下图所示:通过读取  /etc/net ...

  2. mysql 修改数据库密码

    MYSQL5.7以下版本的数据库密码使用的是 mysql这个数据库里的user表的password这个字段, 修改密码只需: 1.update MySQL.user set password=pass ...

  3. shell编程报错:“syntax error near unexpected token `”

    今天写了个shell脚本,在自己机器上运行正常,给同事,运行报错syntax error near unexpected token `,左看右看shell脚本没有问题,没有办法google搜索,发现 ...

  4. 【Oracle】Oracle11g安装和基本的使用-转载

    一.测试操作系统和硬件环境是否符合,我使用的是win2008企业版.下面的都是step by step看图就ok了,不再详细解释. 请留意下面的总的设置步骤:--------------------- ...

  5. Studying TCP's Throughput and Goodput using NS

    Studying TCP's Throughput and Goodput using NS What is Throughput Throughput is the amount of data r ...

  6. Python学习---重点模块之re

    正则表达式是用来操作字符串,但是字符串提供的正则是完全匹配,有时候我们需要进行模糊匹配,这个时候就需要正则表达式了.通过re模块来实现,由C语言来执行底层的匹配 字符匹配(普通字符,元字符): 1 普 ...

  7. Jsonp实现Ajax跨域Demo

    JSONP 1.一个众所周知的问题,Ajax直接请求普通文件存在跨域无权限访问的问题,甭管你是静态页面.动态网页.web服务.WCF,只要是跨域请求,一律不准: 2.不过我们又发现,Web页面上调用j ...

  8. July 14th 2017 Week 28th Friday

    A life without a dress rehearsal, every day is broadcast live. 人生没有彩排,每天都是现场直播. Every day when I pre ...

  9. January 25 2017 Week 4 Wednesday

    In every triumph, there's a lot of try. 每个胜利背后都有许多尝试. There's a lot of try behind every success, and ...

  10. C#学习——入门简介

    # C#简介 #原版出处点击这里 C#是一个现代的.通用的.面向对象的编程语言,它是由微软(Microsoft)开发的,由Ecma和ISO核准认可的. C#是由Anders Heilsberg和他的团 ...