Esempio n. 1
0
        /// <summary>
        /// Get Data Source.
        /// </summary>
        /// <returns></returns>
        private PagedDataSource GetOrderList()
        {
            PagedDataSource pds = new PagedDataSource();

            pds.DataSource = _presenter.GetOrdersByCondition(Name, StartDate, EndDate);

            pds.AllowPaging      = true;
            pds.PageSize         = 8;
            TotalPageCount       = pds.PageCount;
            pds.CurrentPageIndex = CurrentPageIndex;
            int currentPage = CurrentPageIndex + 1;

            if (pds.Count != 0)
            {
                this.lb_current.Text = (currentPage).ToString();
                this.lb_total.Text   = TotalPageCount.ToString();
            }
            else
            {
                this.lb_current.Text = InitialPageIndex.ToString();
                this.lb_total.Text   = InitialPageIndex.ToString();
            }

            if (TotalPageCount != 0 && TotalPageCount != 1)
            {
                lb_first.Enabled = true;
                lb_last.Enabled  = true;
            }
            else
            {
                lb_first.Enabled = false;
                lb_last.Enabled  = false;
            }

            if (currentPage < TotalPageCount)
            {
                lb_next.Enabled = true;
                lb_last.Enabled = true;
            }
            else
            {
                lb_next.Enabled = false;
                lb_last.Enabled = false;
            }
            if (currentPage > 1)
            {
                lb_prv.Enabled   = true;
                lb_first.Enabled = true;
            }
            else
            {
                lb_prv.Enabled   = false;
                lb_first.Enabled = false;
            }

            return(pds);
        }
Esempio n. 2
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.Append("<div class='i-pager'>");

            if (IsShow)
            {
                if (IsShowPageNum)
                {
                    sb.Append("<span>每页显示条数:<input type='text' value='" + PageSize + "'  name='pagesize'></span>");
                }
                if (HasPreviousPage)
                {
                    sb.Append("<a class='i-pager-first' name='gopage' href=" + PageUrl.Replace(ReplaceNum, "1") + "  page='1' title='" + FirstPageText + "'><span>" + FirstPageText + "</span></a>");
                    sb.Append("<a class='i-pager-prev' name='gopage' href=" + PageUrl.Replace(ReplaceNum, (CurrentPageIndex - 1).ToString()) + "  page='" + (CurrentPageIndex - 1) + "' title='" + PreviousPageText + "'><span>" + PreviousPageText + "</span></a>");
                }

                for (int i = StartPageNum; i <= EndPageNum; i++)
                {
                    if (i == CurrentPageIndex)
                    {
                        sb.Append("<a href='javascript:void(0)' name='gopage'   page='" + i +
                                  "' class='i-pager-item i-pager-item-active'><span>" + i + "</span></a>");
                    }
                    else
                    {
                        sb.Append("<a href=" + PageUrl.Replace(ReplaceNum, i.ToString()) + " name='gopage'   page='" + i +
                                  "' class='i-pager-item'><span>" + i + "</span></a>");
                    }
                }

                if (HasNextPage)
                {
                    sb.Append("<a class='i-pager-next' name='gopage' href=" + PageUrl.Replace(ReplaceNum, (CurrentPageIndex + 1).ToString()) + " page='" + (CurrentPageIndex + 1) +
                              "' title='" + NextPageText + "'><span>" + NextPageText + "</span></a>");
                    sb.Append("<a class='i-pager-last' name='gopage' href=" + PageUrl.Replace(ReplaceNum, TotalPageCount.ToString()) + "  page='" + TotalPageCount +
                              "' title='" + LastPageText + "'><span>" + LastPageText + "</span></a>");
                }

                sb.Append("<span class='i-pager-info'>");

                sb.Append("<span class='i-pager-current'>" + CurrentPageText + "</span><span class='i-pager-info-c'>" + CurrentPageIndex + "</span>");
                sb.Append("<span class='i-pager-info-p'>/" + TotalPageCount + "</span><span class='i-pager-info-t'>" + CountPageText +
                          TotalItemCount + "</span>");
                sb.Append("</span>");
            }

            sb.Append("</div>");

            return(sb.ToString());
        }