Esempio n. 1
0
        public IEnumerable <T> PagerList <T>(string sql, int pageindex, out int count, string defaultsort = "", IDbDataParameter[] paramters = null)
        {
            StringBuilder sqlcountbuilder  = new StringBuilder(sql);
            StringBuilder sqlrownumbuilder = new StringBuilder(sql);

            SqlHelper.Driver = this;
            SqlHelper.AddCounter(sqlcountbuilder);
            SqlHelper.AddPager(pageindex, pagesize, sqlrownumbuilder, defaultsort);

            if (OrderByName != null)
            {
                SqlHelper.AddOrderBy(OrderByName, OrderByOrder == OrderBy.Asc ? true : false, defaultsort, sqlrownumbuilder);
            }

            count = Int32.Parse(ExecuteScalar(sqlcountbuilder.ToString(), paramters).ToString());

            return(FindAll <T>(sqlrownumbuilder.ToString(), paramters));
        }