Exemplo n.º 1
0
        public static IList <T> Paging(string connectionString, out int recordCount, string tableName, string fields, string sortfield, int start, int end, string orderType, string whereSQL, ToEntityCallback callback)
        {
            IList <T> list = null;

            recordCount = DBH.Count(connectionString, tableName, whereSQL);
            using (IDataReader dr = DBH.Paging(connectionString, tableName, fields, sortfield, start, end, orderType, whereSQL))
            {
                if (dr != null)
                {
                    list = new List <T>();
                    while (dr.Read())
                    {
                        list.Add(callback(dr));
                    }
                    dr.Close();
                }
            }

            return(list);
        }