Example #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);
        }
Example #2
0
        private static void GenerateBasicNavigation(UrlNavigator urlNavigator, int pageCount, int pageNumber, string url)
        {
            if (pageNumber > 1)
            {
                urlNavigator.First = PageLinkBuilder.Build(url, 1);

                int previousNumber = pageNumber - 1;
                urlNavigator.Previous = PageLinkBuilder.Build(url, previousNumber);
            }

            if (pageNumber != pageCount && pageCount != 0)
            {
                int nextNumber = pageNumber + 1;
                urlNavigator.Next = PageLinkBuilder.Build(url, nextNumber);

                urlNavigator.Last = PageLinkBuilder.Build(url, pageCount);
            }
        }