/// <summary> /// 将List数据包装为PageObj /// </summary> /// <typeparam name="T"></typeparam> /// <param name="query"></param> /// <returns></returns> public static PageObj <T> ToPageObj <T>(this CRL.LambdaQuery.LambdaQuery <T> query) where T : CRL.IModel, new() { var result = query.ToList(); var pageObj = new PageObj <T>(result, query.SkipPage, query.RowCount, query.TakeNum); return(pageObj); }
/// <summary> /// 创建分页导航 /// </summary> public static MvcHtmlString CreatePageNavigation <T>(PageObj <T> pageObj, CoreHelper.PageNavigation.PageStyle style = CoreHelper.PageNavigation.PageStyle.Google, string navFormat = "") { var nav = new CoreHelper.PageNavigation(); nav.SetPageStyle(style); nav.PageNavigationFormat = navFormat; if (pageObj.Count == 0) { return(MvcHtmlString.Create("")); } string str = nav.GetPageNavigation(pageObj.PageIndex, pageObj.Total, pageObj.PageSize); return(MvcHtmlString.Create(str)); }
public static MvcHtmlString Pager <T>(this HtmlHelper html, PageObj <T> pageObj, CoreHelper.PageNavigation.PageStyle style = CoreHelper.PageNavigation.PageStyle.Google, string navFormat = "") { return(Core.Mvc.ControllHelper.CreatePageNavigation(pageObj, style, navFormat)); }