using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace Utils.Datas
|
|
{
|
|
public class PageNumUtil
|
|
{
|
|
/// <summary>
|
|
/// 根据总数量和每页允许的最大数量,得到总页数
|
|
/// </summary>
|
|
/// <param name="count">总数量</param>
|
|
/// <param name="maxCountPerPage">每页允许的最大数量</param>
|
|
/// <returns>总页数</returns>
|
|
public static int GetTotalPageCount(long count, long maxCountPerPage)
|
|
{
|
|
#if DEBUG
|
|
if (maxCountPerPage == 0)
|
|
throw new ApplicationException("maxCountPerPage参数不允许为0");
|
|
#endif
|
|
int pageCount = (int)(count / maxCountPerPage);
|
|
if (count % maxCountPerPage > 0)
|
|
pageCount++;
|
|
return pageCount;
|
|
}
|
|
}
|
|
}
|