public void AddPage(Type t, String condition, ObjectPage pager, IList list)
        {
            String key = CacheKey.getPageList(t, condition, pager.getSize(), pager.getCurrent());

            addList(key, list);
            addToApplication(CacheKey.getPagerInfoKey(key), pager);     // 添加分页统计数据
        }
示例#2
0
        /// <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);
                ObjectPage p    = state.Pager;
                ObjectPool.AddPage(typeof(T), condition, p, list);

                result             = new PageList();
                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 ObjectPage(result.RecordCount, result.Size, result.Current).PageBar;
            }

            return(new DataPage <T>(result));
        }
        public IPageList FindPage(Type t, String condition, ObjectPage pager)
        {
            String key = CacheKey.getPageList(t, condition, pager.getSize(), pager.getCurrent());

            logger.Debug("FindPage=>" + t.FullName);
            IList list = getListFromCache(key, t);

            if (list == null)
            {
                return(null);
            }

            IPageList result = new PageList();

            ObjectPage pageInfo = getPagerInfo(key);

            if (pageInfo == null)
            {
                return(null);
            }

            result.Results     = list;
            result.PageCount   = pageInfo.PageCount;
            result.RecordCount = pageInfo.RecordCount;
            result.Size        = pageInfo.getSize();
            result.PageBar     = pageInfo.PageBar;
            result.Current     = pageInfo.getCurrent();

            return(result);
        }
示例#4
0
 public void AddPage( Type t, String condition, ObjectPage pager, IList list )
 {
     String key = CacheKey.getPageList( t, condition, pager.getSize(), pager.getCurrent() );
     addList( key, list );
     addToApplication( CacheKey.getPagerInfoKey( key ), pager ); // 添加分页统计数据
 }
示例#5
0
        public IPageList FindPage( Type t, String condition, ObjectPage pager )
        {
            String key = CacheKey.getPageList( t, condition, pager.getSize(), pager.getCurrent() );
            logger.Debug( "FindPage=>" + t.FullName );
            IList list = getListFromCache( key, t );
            if (list == null) return null;

            IPageList result = new PageList();

            ObjectPage pageInfo = getPagerInfo( key );
            if (pageInfo == null) return null;

            result.Results = list;
            result.PageCount = pageInfo.PageCount;
            result.RecordCount = pageInfo.RecordCount;
            result.Size = pageInfo.getSize();
            result.PageBar = pageInfo.PageBar;
            result.Current = pageInfo.getCurrent();

            return result;
        }
示例#6
0
        public void AddPage(Type t, String condition, ObjectPage pager, IList list)
        {
            String key = CacheKey.getPageList(t, condition, pager.getSize(), pager.getCurrent());

            addList(key, list);
        }
示例#7
0
 public void AddPage( Type t, String condition, ObjectPage pager, IList list )
 {
     String key = CacheKey.getPageList( t, condition, pager.getSize(), pager.getCurrent() );
     addList( key, list );
 }