Example #1
0
        /// <summary>
        /// 分页获取泛型数据列表
        /// </summary>
        public PageList <ZSystem.Model.t_Client> GetPageList(PageInfo pi)
        {
            pi.RecordCount = GetCount();
            pi.Compute();

            PageList <ZSystem.Model.t_Client> pl = new PageList <ZSystem.Model.t_Client>(pi);

            using (DbDataReader dr = dbHelper.ExecuteReader(CommandType.Text, "SELECT * FROM t_Client", null))
            {
                pl.List = GetPageList(dr, pi.FirstIndex, pi.PageSize);
            }
            return(pl);
        }
Example #2
0
        /// <summary>
        /// 获取分页的实体列表
        /// </summary>
        /// <param name="pi"></param>
        /// <param name="where"></param>
        /// <param name="order"></param>
        /// <returns></returns>
        public virtual PageList <TModel> GetPageList(PageInfo pi, string where, string order)
        {
            pi.RecordCount = this.GetCount();
            pi.Compute();

            PageList <TModel> pl = new PageList <TModel>(pi);

            DbCommand cmd = db.GetSqlStringCommand(this.GetQuerySql(where, order));

            using (SafeDataReader dr = new SafeDataReader(db.ExecuteReader(cmd)))
            {
                pl.List = this.GetList(dr);
            }
            return(pl);
        }