/// <summary> /// 分页获取数据 /// </summary> /// <param name="where">条件</param> /// <param name="order">排序</param> /// <param name="page">当前页数</param> /// <param name="pagesize">分页大小</param> /// <returns></returns> public virtual TabledList <Model.Model> GetModelList(string where, string order, int page, int pagesize) { string sql = SqlProviders.Current.BuildSelectSQL(ModelType); if (!string.IsNullOrWhiteSpace(where)) { sql += " where " + where; } if (string.IsNullOrWhiteSpace(order)) { order = "ID"; } var countSql = SqlProviders.Current.CreateCountingSql(sql); var rcount = DataAccessProvider.Current.ExecuteSingle(countSql); int recordCount = rcount == null ? 0 : (int)rcount; sql = SqlProviders.Current.CreatePagingSql(recordCount, pagesize, page, sql, order); var dt = DataAccessProvider.Current.Query(sql); var ls = SqlProviders.Current.TableToModelList(ModelType, dt); TabledList <Model.Model> tabledList = new TabledList <Model.Model>(ls, ModelType, page, pagesize, recordCount); return(tabledList); }
public static MvcHtmlString Gird(this HtmlHelper helper, TabledList<Model> tabledList) { Gird gird = new Gird(tabledList); PagedList<Model> pagedlist = new PagedList<Model>(tabledList, tabledList.Page, tabledList.PageSize, tabledList.RecordCount); gird.Pagers = helper.Pager(pagedlist, new PagerOptions() { AutoHide = false, ContainerTagName = "span", CssClass = "pull-right" }).ToHtmlString(); return new MvcHtmlString(gird.Reader()); }
public static MvcHtmlString Gird(this HtmlHelper helper, TabledList <Model> tabledList) { Gird gird = new Gird(tabledList); PagedList <Model> pagedlist = new PagedList <Model>(tabledList, tabledList.Page, tabledList.PageSize, tabledList.RecordCount); gird.Pagers = helper.Pager(pagedlist, new PagerOptions() { AutoHide = false, ContainerTagName = "span", CssClass = "pull-right" }).ToHtmlString(); return(new MvcHtmlString(gird.Reader())); }
public Gird(TabledList<Model.Model> Source) { Source.TableID = Guid.NewGuid().ToString(); this.Source = Source; }
public Gird(TabledList <Model.Model> Source) { Source.TableID = Guid.NewGuid().ToString(); this.Source = Source; }
/// <summary> /// 分页获取数据 /// </summary> /// <param name="where">条件</param> /// <param name="order">排序</param> /// <param name="page">当前页数</param> /// <param name="pagesize">分页大小</param> /// <returns></returns> public virtual TabledList<Model.Model> GetModelList(string where, string order, int page, int pagesize) { string sql = SqlProviders.Current.BuildSelectSQL(ModelType); if (!string.IsNullOrWhiteSpace(where)) { sql += " where " + where; } if (string.IsNullOrWhiteSpace(order)) { order = "ID"; } var countSql = SqlProviders.Current.CreateCountingSql(sql); var rcount = DataAccessProvider.Current.ExecuteSingle(countSql); int recordCount = rcount == null ? 0 : (int)rcount; sql = SqlProviders.Current.CreatePagingSql(recordCount, pagesize, page, sql, order); var dt = DataAccessProvider.Current.Query(sql); var ls = SqlProviders.Current.TableToModelList(ModelType, dt); TabledList<Model.Model> tabledList = new TabledList<Model.Model>(ls, ModelType, page, pagesize, recordCount); return tabledList; }