日期:2014-05-17 浏览次数:20478 次
public DBBasedPageHelper(List<T> list,int curPage, int pageSize, int TotalCount)
{
CurrentPage = curPage;
PageSize = pageSize;
if (PageSize > 0)
{
if (PageSize > 200)//每页显示数据量,自动不大于200
{
PageSize = 200;
}
PageCount = (int)Math.Ceiling(TotalCount / (double)PageSize);
if (CurrentPage < 1) //当前页码,自动不小于1
{
CurrentPage = 1;
}
if (CurrentPage > PageCount) //当前页码,自动不大于总页数
{
CurrentPage = PageCount;
}
AddRange(list);
}
else
{
PageSize = 0;
PageCount = 0;
CurrentPage = 0;
&n