Ejemplo n.º 1
0
 /// <summary>
 /// 缓存分页数据对象
 /// </summary>
 /// <param name="index"></param>
 /// <param name="pagerSet"></param>
 private void CacheObject(int index, PagerSet pagerSet)
 {
     if (this.m_fixedCacher != null)
     {
         this.m_fixedCacher.Add(index, pagerSet);
     }
     else if (this.m_prams.CacherSize > 0)
     {
         this.m_fixedCacher = new Dictionary <int, PagerSet>(this.m_prams.CacherSize);
         this.m_fixedCacher.Add(index, pagerSet);
     }
 }
Ejemplo n.º 2
0
        public PagerSet RunProc(string proc, int pageIndex, int pageSize, Dictionary <string, object> conditions)
        {
            var prams = new List <DbParameter>();

            prams.Add(this.m_dbHelper.MakeInParam("pageIndex", pageIndex));
            prams.Add(this.m_dbHelper.MakeInParam("pageSize", pageSize));
            foreach (var item in conditions)
            {
                prams.Add(this.m_dbHelper.MakeInParam(item.Key, item.Value));
            }
            DataSet ds;

            this.m_dbHelper.RunProc(proc, prams, out ds);
            int totalCount = 0;

            if (ds.Tables[0].Rows.Count > 0)
            {
                totalCount = Convert.ToInt32(ds.Tables[0].Rows[0]["totalCount"]);
            }
            int      totalPage = (int)Math.Ceiling((double)totalCount / pageSize);
            PagerSet pageSet   = new PagerSet(pageIndex, pageSize, totalPage, totalCount, ds);

            return(pageSet);
        }