Beispiel #1
0
 /// <summary>
 /// 获取分页数据集合
 /// </summary>
 /// <param name="pageSize">分页大小</param>
 /// <param name="currentPage">分页页号</param>
 /// <param name="count">数据总数</param>
 /// <returns>分页数据集合</returns>
 public valueType[] GetPage(int pageSize, int currentPage, out int count)
 {
     valueType[] values = null;
     count = 0;
     Monitor.Enter(cache.SqlTool.Lock);
     try
     {
         array.page page = new array.page(count = tree.Count, pageSize, currentPage);
         values = tree.GetRange(page.SkipCount, page.CurrentPageSize);
     }
     finally { Monitor.Exit(cache.SqlTool.Lock); }
     return(values);
 }
Beispiel #2
0
 /// <summary>
 /// 获取逆序分页数据集合
 /// </summary>
 /// <typeparam name="arrarType"></typeparam>
 /// <param name="index"></param>
 /// <param name="getValue"></param>
 /// <param name="pageSize">分页大小</param>
 /// <param name="currentPage">分页页号</param>
 /// <param name="count">数据总数</param>
 /// <returns>逆序分页数据集合</returns>
 public arrarType[] GetPageDesc <arrarType>(int index, Func <valueType, arrarType> getValue, int pageSize, int currentPage, out int count)
 {
     arrarType[] values = null;
     count = 0;
     fastCSharp.searchTree <sortType, valueType> tree = array[index].Value;
     if (tree != null)
     {
         Monitor.Enter(cache.SqlTool.Lock);
         try
         {
             array.page page = new array.page(count = tree.Count, pageSize, currentPage);
             values = tree.GetRange(count - page.SkipCount - page.CurrentPageSize, page.CurrentPageSize, getValue);
         }
         finally { Monitor.Exit(cache.SqlTool.Lock); }
     }
     return(values.reverse());
 }