Esempio n. 1
0
        public static List <PageLink> GenerateNumericNavigation(int?navigatorSize, int pageCount, int pageNumber, string url)
        {
            if (navigatorSize == null || navigatorSize == 0)
            {
                return(null);
            }

            if (pageCount == 0)
            {
                return(null);
            }

            int[] limits = UrlNavigatorBuilder.GetComplexLimits(navigatorSize, pageCount, pageNumber);

            int start = limits[0];
            int end   = limits[1];

            var numerics = new List <PageLink>();

            for (int i = start; i <= end; i++)
            {
                numerics.Add(PageLinkBuilder.Build(url, i));
            }

            return(numerics);
        }
Esempio n. 2
0
        public static UrlNavigator Build(string url, int pageNumber, int pageCount, int?navigatorSize)
        {
            if (navigatorSize != null && navigatorSize < 1)
            {
                navigatorSize = null;
            }

            var urlNavigator = new UrlNavigator()
            {
                Numerics      = UrlNavigatorBuilder.GenerateNumericNavigation(navigatorSize, pageCount, pageNumber, url),
                NavigatorSize = navigatorSize
            };

            UrlNavigatorBuilder.GenerateBasicNavigation(urlNavigator, pageCount, pageNumber, url);

            return(urlNavigator);
        }