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. C/C++读写excel文件 的几种方式

    因为有些朋友问代码的问题,将OLE读写的代码分享在这个地方,大家请自己看. http://blog.csdn.net/fullsail/article/details/8449448 C++读取Exc ...

  2. 在Ubuntu14.10中部署Hadoop2.6.0单节点伪分布集群

    1. 环境信息如下: ubuntu:14.10 jdk:openjdk-1.7.0 hadoop:2.6.0 2. 下载hadoop2.6.0, http://apache.fayea.com/had ...

  3. 【Leetcode】【Easy】Merge Two Sorted Lists .

    Merge two sorted linked lists and return it as a new list. The new list should be made by splicing t ...

  4. Python学习---重点模块之pickle

    仅仅支持Python里面的函数等相关功能的实现,而且pickle写入的内容是看不出来的,读取的时候要求有原内容 pickled的写入: import pickle def fun(): print(' ...

  5. DFS BFS代码

    #define maxnum 30 #include<bits_stdc++.h> int visited[maxnum]={0}; using namespace std; typede ...

  6. Dom4j的一个小例子,用于解析xml文件的元素获取方式

    import java.io.File; import java.io.IOException; import javax.xml.parsers.ParserConfigurationExcepti ...

  7. c++内存区域结构及堆栈的一些知识

    一.c++在内存区域的分配图 可以看出,对于Linux系统下的,存储空间的分配有着较为层次清晰的分层.单片机大概也遵循这个分区架构. 二进制代码以及常量(CONST修饰)以及全局变量在最底层,存储空间 ...

  8. 转 C++11之std::function和std::bind

    std::function是可调用对象的包装器,它最重要的功能是实现延时调用: #include "stdafx.h" #include<iostream>// std ...

  9. hdu-2841 Visible Trees---容斥定理

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2841 题目大意: N*M的格点上有树,从0,0点可以看到多少棵树. 解题思路: 发现如果A1/B1= ...

  10. thuwc2018 爆炸记

    从没考过这么差,必须好好总结一下.. $day1$: 上午到了雅礼洋湖,下午就开始考试.. 食堂饭菜还是很不错的,听说都是雅礼自己垫的? 下午的$day1$爆炸了.. 开考以后看了一下三个题,感觉一开 ...