#region 自定义list转datapage分页
DataPage<PolicyInfo> policyList = new DataPage<PolicyInfo>(); ObjectInfo state = new ObjectInfo(typeof(PolicyInfo)); state.includeAll(); state.Pager.setSize(5);//每页条数 int pc = plists.Count(); decimal pagec = Math.Ceiling((decimal)pc / 5); //state.Pager.PageBar =PageHelper.("",CurrentRequest.getCurrentPage(), (int)pagec); PageHelper p = state.Pager; p.PageCount = (int)pagec;//页数,用于后台自动生成页码条判断 IPageList result = new DataPageInfo(); int skip = CurrentRequest.getCurrentPage() <= 1 ? 0 : (CurrentRequest.getCurrentPage() - 1) * 5; result.Results = plists.Skip(skip).Take(5).ToList();//每页取5条 result.PageCount = (int)pagec; result.RecordCount = plists.Count(); result.Size = 5; result.PageBar = p.PageBar; result.Current = CurrentRequest.getCurrentPage(); policyList = new DataPage<PolicyInfo>(result); #endregion