コード例 #1
0
ファイル: PagerHelper.cs プロジェクト: zhq0131/CMS
 public static MvcHtmlString Pager <T>(this HtmlHelper helper, PagedList <T> pagedList, PagerOptions pagerOptions)
 {
     if (pagedList == null)
     {
         return(Pager(helper, pagerOptions, null));
     }
     return(Pager(helper, pagedList, null, null, pagerOptions, null, null, null));
 }
コード例 #2
0
ファイル: PagerHelper.cs プロジェクト: zhq0131/CMS
 public static MvcHtmlString Pager <T>(this HtmlHelper helper, PagedList <T> pagedList, PagerOptions pagerOptions, IDictionary <string, object> htmlAttributes)
 {
     if (pagedList == null)
     {
         return(Pager(helper, pagerOptions, htmlAttributes));
     }
     return(Pager(helper, pagedList, null, null, pagerOptions, null, null, htmlAttributes));
 }
コード例 #3
0
ファイル: PagerHelper.cs プロジェクト: zhq0131/CMS
 public static MvcHtmlString Pager <T>(this AjaxHelper ajax, PagedList <T> pagedList, string routeName, object routeValues, PagerOptions pagerOptions,
                                       AjaxOptions ajaxOptions, object htmlAttributes)
 {
     if (pagedList == null)
     {
         return(Pager(ajax, pagerOptions, new RouteValueDictionary(htmlAttributes)));
     }
     return(Pager(ajax, pagedList, null, null, routeName, pagerOptions, routeValues, ajaxOptions, htmlAttributes));
 }
コード例 #4
0
ファイル: PagerHelper.cs プロジェクト: zhq0131/CMS
 private static MvcHtmlString Pager(HtmlHelper helper, PagerOptions pagerOptions, IDictionary <string, object> htmlAttributes)
 {
     return(new PagerBuilder(helper, null, pagerOptions, htmlAttributes).RenderPager());
 }
コード例 #5
0
ファイル: PagerHelper.cs プロジェクト: zhq0131/CMS
 public static MvcHtmlString Pager <T>(this AjaxHelper ajax, PagedList <T> pagedList, PagerOptions pagerOptions, AjaxOptions ajaxOptions)
 {
     return(pagedList == null?Pager(ajax, pagerOptions, null) : Pager(ajax, pagedList,
                                                                      null, null, null, pagerOptions, null, ajaxOptions, null));
 }
コード例 #6
0
ファイル: PagerHelper.cs プロジェクト: zhq0131/CMS
 public static MvcHtmlString Pager <T>(this AjaxHelper ajax, PagedList <T> pagedList, PagerOptions pagerOptions, AjaxOptions ajaxOptions, IDictionary <string, object> htmlAttributes)
 {
     if (pagedList == null)
     {
         return(Pager(ajax, pagerOptions, htmlAttributes));
     }
     return(Pager(ajax, pagedList, null, null, null, pagerOptions, null, ajaxOptions, htmlAttributes));
 }
コード例 #7
0
ファイル: PagerHelper.cs プロジェクト: zhq0131/CMS
 public static MvcHtmlString AjaxPager <T>(this HtmlHelper html, PagedList <T> pagedList, string routeName, object routeValues, PagerOptions pagerOptions, AjaxOptions ajaxOptions)
 {
     if (pagedList == null)
     {
         return(AjaxPager(html, pagerOptions, null));
     }
     return(AjaxPager(html, pagedList, null, null, routeName, pagerOptions, routeValues, ajaxOptions,
                      null));
 }
コード例 #8
0
ファイル: PagerHelper.cs プロジェクト: zhq0131/CMS
 private static MvcHtmlString Pager(AjaxHelper ajax, PagerOptions pagerOptions, IDictionary <string, object> htmlAttributes)
 {
     return(new PagerBuilder(null, ajax, pagerOptions, htmlAttributes).RenderPager());
 }
コード例 #9
0
ファイル: PagerHelper.cs プロジェクト: zhq0131/CMS
 public static MvcHtmlString AjaxPager <T>(this HtmlHelper html, PagedList <T> pagedList, PagerOptions pagerOptions, AjaxOptions ajaxOptions, object htmlAttributes)
 {
     if (pagedList == null)
     {
         return(AjaxPager(html, pagerOptions, new RouteValueDictionary(htmlAttributes)));
     }
     return(AjaxPager(html, pagedList, null, null, null, pagerOptions, null,
                      ajaxOptions, htmlAttributes));
 }
コード例 #10
0
ファイル: PagerHelper.cs プロジェクト: zhq0131/CMS
 public static MvcHtmlString AjaxPager <T>(this HtmlHelper html, PagedList <T> pagedList, PagerOptions pagerOptions, AjaxOptions ajaxOptions)
 {
     if (pagedList == null)
     {
         return(AjaxPager(html, pagerOptions, null));
     }
     return(AjaxPager(html, pagedList, null, null, null, pagerOptions, null, ajaxOptions,
                      null));
 }
コード例 #11
0
ファイル: PagerHelper.cs プロジェクト: zhq0131/CMS
 public static MvcHtmlString Pager <T>(this HtmlHelper helper, PagedList <T> pagedList, PagerOptions pagerOptions, string routeName, object routeValues, object htmlAttributes)
 {
     if (pagedList == null)
     {
         return(Pager(helper, pagerOptions, new RouteValueDictionary(htmlAttributes)));
     }
     return(Pager(helper, pagedList, null, null, pagerOptions, routeName, routeValues, htmlAttributes));
 }
コード例 #12
0
ファイル: PagerHelper.cs プロジェクト: zhq0131/CMS
 public static MvcHtmlString Pager <T>(this HtmlHelper helper, PagedList <T> pagedList, PagerOptions pagerOptions, string routeName, RouteValueDictionary routeValues)
 {
     if (pagedList == null)
     {
         return(Pager(helper, pagerOptions, null));
     }
     return(Pager(helper, pagedList, null, null, pagerOptions, routeName, routeValues, null));
 }
コード例 #13
0
ファイル: PagerBuilder.cs プロジェクト: Epitomy/CMS
        public PagerBuilder(HtmlHelper html, AjaxHelper ajax, string actionName, string controllerName,
                            IPagedList pagedList, PagerOptions pagerOptions, string routeName, RouteValueDictionary routeValues,
                            AjaxOptions ajaxOptions, IDictionary <string, object> htmlAttributes)
        {
            _msAjaxPaging = (ajax != null);
            if (String.IsNullOrEmpty(actionName))
            {
                if (ajax != null)
                {
                    actionName = (string)ajax.ViewContext.RouteData.Values["action"];
                }
                else
                {
                    actionName = (string)html.ViewContext.RouteData.Values["action"];
                }
            }
            if (String.IsNullOrEmpty(controllerName))
            {
                if (ajax != null)
                {
                    controllerName = (string)ajax.ViewContext.RouteData.Values["controller"];
                }
                else
                {
                    controllerName = (string)html.ViewContext.RouteData.Values["controller"];
                }
            }
            if (pagerOptions == null)
            {
                pagerOptions = new PagerOptions();
            }

            _html           = html;
            _ajax           = ajax;
            _actionName     = actionName;
            _controllerName = controllerName;
            _pagedList      = pagedList;
            _pagerOptions   = pagerOptions;
            _routeName      = routeName;
            _routeValues    = routeValues;
            _ajaxOptions    = ajaxOptions;
            _htmlAttributes = htmlAttributes;

            // start page index
            _startPageIndex = pagedList.CurrentPageIndex - (pagerOptions.NumericPagerItemCount / 2);
            if (_startPageIndex + pagerOptions.NumericPagerItemCount > pagedList.TotalPageCount)
            {
                _startPageIndex = pagedList.TotalPageCount + 1 - pagerOptions.NumericPagerItemCount;
            }
            if (_startPageIndex < 1)
            {
                _startPageIndex = 1;
            }

            // end page index
            _endPageIndex = _startPageIndex + _pagerOptions.NumericPagerItemCount - 1;
            if (_endPageIndex > pagedList.TotalPageCount)
            {
                _endPageIndex = pagedList.TotalPageCount;
            }
        }