/// <summary> /// 根据查询条件、每页数量,返回分页数据集合 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="condition">查询条件</param> /// <param name="pageSize">每页需要显示的数据量</param> /// <returns>分页数据列表,包括当前页、总记录数、分页条等</returns> public static DataPage <T> findPage <T>(String condition, int pageSize) where T : IEntity { if (pageSize <= 0) { pageSize = 20; } ObjectInfo state = new ObjectInfo(typeof(T)); state.includeAll(); state.Pager.setSize(pageSize); IPageList result = ObjectPool.FindPage(typeof(T), condition, state.Pager); if (result == null) { IList list = ObjectDB.FindPage(state, condition); PageHelper p = state.Pager; ObjectPool.AddPage(typeof(T), condition, p, list); result = new DataPageInfo(); result.Results = list; result.PageCount = p.PageCount; result.RecordCount = p.RecordCount; result.Size = p.getSize(); result.PageBar = p.PageBar; result.Current = p.getCurrent(); } else { result.PageBar = new PageHelper(result.RecordCount, result.Size, result.Current).PageBar; } return(new DataPage <T>(result)); }
/// <summary> /// 返回一个空的分页结果集 /// </summary> /// <returns></returns> public static DataPageInfo GetEmpty() { DataPageInfo p = new DataPageInfo(); p.Results = new ArrayList(); p.Current = 1; p.RecordCount = 0; return(p); }
/// <summary> /// 根据查询条件、当前页码和每页数量,返回分页数据集合 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="condition">查询条件</param> /// <param name="current">当前页码</param> /// <param name="pageSize">每页需要显示的数据量</param> /// <returns>分页数据列表,包括当前页、总记录数、分页条等</returns> public static DataPage <T> findPage <T>(String condition, int current, int pageSize) where T : IEntity { ObjectInfo state = new ObjectInfo(typeof(T)); state.includeAll(); state.Pager.setSize(pageSize); state.Pager.setCurrent(current); IList list = ObjectDB.FindPage(state, condition); IPageList result = new DataPageInfo(); result.Results = list; result.PageCount = state.Pager.PageCount; result.RecordCount = state.Pager.RecordCount; result.Size = state.Pager.getSize(); result.PageBar = state.Pager.PageBar; result.Current = state.Pager.getCurrent(); return(new DataPage <T>(result)); }
/// <summary> /// 根据查询条件,返回分页数据集合 /// </summary> /// <param name="t"></param> /// <param name="condition">查询条件</param> /// <param name="pageSize">每页数量</param> /// <returns>分页数据列表,包括当前页、总记录数、分页条等</returns> public static IPageList findPage(Type t, String condition, int pageSize) { ObjectInfo state = new ObjectInfo(t); state.includeAll(); if (pageSize > 0) { state.Pager.setSize(pageSize); } IList list = ObjectDB.FindPage(state, condition); IPageList result = new DataPageInfo(); result.Results = list; result.PageCount = state.Pager.PageCount; result.RecordCount = state.Pager.RecordCount; result.Size = pageSize > 0 ? pageSize: state.Pager.getSize(); result.PageBar = state.Pager.PageBar; result.Current = state.Pager.getCurrent(); return(result); }
/// <summary> /// 返回一个空的分页结果集 /// </summary> /// <returns></returns> public static DataPageInfo GetEmpty() { DataPageInfo p = new DataPageInfo(); p.Results = new ArrayList(); p.Current = 1; p.RecordCount = 0; return p; }
/// <summary> /// 根据查询条件,返回分页数据集合 /// </summary> /// <param name="t"></param> /// <param name="condition">查询条件</param> /// <param name="pageSize">每页数量</param> /// <returns>分页数据列表,包括当前页、总记录数、分页条等</returns> public static IPageList findPage( Type t, String condition, int pageSize ) { ObjectInfo state = new ObjectInfo( t ); state.includeAll(); if (pageSize > 0) state.Pager.setSize( pageSize ); IList list = ObjectDB.FindPage( state, condition ); IPageList result = new DataPageInfo(); result.Results = list; result.PageCount = state.Pager.PageCount; result.RecordCount = state.Pager.RecordCount; result.Size = pageSize>0 ? pageSize: state.Pager.getSize(); result.PageBar = state.Pager.PageBar; result.Current = state.Pager.getCurrent(); return result; }