#region 进行分页处理
///返回页面源数据
List<TbeampReportVMForMain> lstSource = db.Fetch<TbeampReportVMForMain>(sql); ;
///返回页面分页数据
List<TbeampReportVMForMain> lstPage = new List<TbeampReportVMForMain>();
//当前分页开始结束条数
int start = Convert.ToInt32((page - 1) * rows);
int end = Convert.ToInt32(start + rows) > lstSource.Count ? lstSource.Count : Convert.ToInt32(start + rows);
if (start > end)
{
start = start > end ? 0 : start;
end = Convert.ToInt32(rows);
page = 1;
}
for (int i = start; i < end; i++)
{
lstPage.Add(lstSource[i]);
}
//返回分页对象
Page<TbeampReportVMForMain> mainlist = new Page<TbeampReportVMForMain>()
{
Items = lstPage,
CurrentPage = page,
ItemsPerPage = rows,
TotalItems = lstSource.Count,
TotalPages = lstSource.Count / rows
};
#endregion