/// <summary>
        /// /
        /// </summary>
        /// <param name="Start"></param>
        /// <param name="End"></param>
        /// <param name="Index"></param>
        /// <param name="Url"></param>
        /// <returns></returns>
        //public static Page getPage(int Start, int End, int Index, string Url)
        //{
        //    var p = new PageSet(Start, End, Index, Url);
        //    var page = new Page();
        //    page.CloneIn<Page>(p);
        //    return page;
        //}

        public static Page getPage(int Index, int PageSize, int Total, string Url)
        {
            var start = Index;
            var end = (PageSize * Index) > Total ? Total : (PageSize * Index);
            var p = new PageSet(start, end, Index, Url);
            var page = new Page();
            page.CloneIn<Page>(p);
            return page;
        }
示例#2
0
        /// <summary>
        /// /
        /// </summary>
        /// <param name="Start"></param>
        /// <param name="End"></param>
        /// <param name="Index"></param>
        /// <param name="Url"></param>
        /// <returns></returns>
        //public static Page getPage(int Start, int End, int Index, string Url)
        //{
        //    var p = new PageSet(Start, End, Index, Url);
        //    var page = new Page();
        //    page.CloneIn<Page>(p);
        //    return page;
        //}

        public static Page getPage(int Index, int PageSize, int Total, string Url)
        {
            var start = Index;
            var end   = (PageSize * Index) > Total ? Total : (PageSize * Index);
            var p     = new PageSet(start, end, Index, Url);
            var page  = new Page();

            page.CloneIn <Page>(p);
            return(page);
        }
 /// <summary>
 /// 生成分页列表
 /// </summary>
 protected void SetPages()
 {
     this.List = new List <Page>();
     for (int i = ViewStartIndex; i <= ViewEndIndex; i++)
     {
         //   var start = i * PageSize - PageSize;
         //  var end = (PageSize * i) > Total ? Total : (PageSize * i);
         //   var pageset = PageSet.getPage(start, end, i, BaseUrl);
         var pageset = PageSet.getPage(i, PageSize, Total, BaseUrl);
         List.Add(pageset);
         if (i == CurrentIndex)
         {
             this.Current = pageset;
         }
     }
     this.First = PageSet.getPage(FirstIndex, PageSize, Total, BaseUrl); // String.Format(Style.First, First);
     this.Last  = PageSet.getPage(LastIndex, PageSize, Total, BaseUrl);  // String.Format(Style.Last, Last);
     this.Next  = PageSet.getPage(NextIndex, PageSize, Total, BaseUrl);  // String.Format(Style.Next, Next);
     this.Prv   = PageSet.getPage(PrvIndex, PageSize, Total, BaseUrl);   //String.Format(Style.Prv, Prv);
 }