• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Pagination类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Pagination的典型用法代码示例。如果您正苦于以下问题:C# Pagination类的具体用法?C# Pagination怎么用?C# Pagination使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Pagination类属于命名空间,在下文中一共展示了Pagination类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetRestUrl

        /// <summary>Gets REST url.</summary>
        /// <param name="urlKey">Url key.</param>
        /// <param name="addClientId">Denotes whether client identifier should be composed into final url.</param>
        /// <param name="pagination">Pagination object.</param>
        /// <param name="additionalUrlParams">Additional parameters.</param>
        /// <returns>Final REST url.</returns>
        public String GetRestUrl(String urlKey, Boolean addClientId, Pagination pagination, Dictionary<String, String> additionalUrlParams)
        {
            String url;

            if (!addClientId)
            {
                url = "/v2.01" + urlKey;
            }
            else
            {
                url = "/v2.01/" + _root.Config.ClientId + urlKey;
            }

            bool paramsAdded = false;
            if (pagination != null)
            {
                url += "?page=" + pagination.Page + "&per_page=" + pagination.ItemsPerPage;
                paramsAdded = true;
            }

            if (additionalUrlParams != null)
            {
                foreach (string key in additionalUrlParams.Keys)
                {

                    url += paramsAdded ? Constants.URI_QUERY_PARAMS_SEPARATOR : Constants.URI_QUERY_SEPARATOR;
                    url += key + "=" + Uri.EscapeDataString(additionalUrlParams[key]);
                    paramsAdded = true;
                }
            }

            return url;
        }
开发者ID:ioliver85,项目名称:mangopay2-net-sdk,代码行数:39,代码来源:UrlTool.cs


示例2: showData

    private void showData()
    {
        string ID = Request.QueryString["Id"];
        int total = 0;
        _Page = Request.QueryString["Page"] == null ? "1" : this.IsPostBack ? "1" : Request.QueryString["Page"];
        _Limit = "10";
        projects = DataAccess.getProjects("-1", _Page, _Limit, ref total);

        _Total = total.ToString();
        int from, to;
        from = _Total == "0" ? 0 : (1 + (Convert.ToInt32(_Page) - 1) * 10);
        to = 10 * Convert.ToInt32(_Page) <= Convert.ToInt32(_Total) ? 10 * Convert.ToInt32(_Page) : Convert.ToInt32(_Total);
        //_Status = "<span class='actived_true'>Hiển thị từ " + from.ToString() + " đến " + to.ToString() + " trong tổng số " + _Total + " bản ghi</span>";
        Pagination pg = new Pagination();

        pg.Limit = Convert.ToInt32(_Limit);
        pg.PageNumber = Convert.ToInt32(_Page);
        pg.Total = Convert.ToInt64(_Total);
        pg.Page = "";
        pg.First = "|<";
        pg.Next = ">";
        pg.Previous = "<";
        pg.Last = ">|";
        pg.ItemShowNumber = 10;
        pg.URL = "";//Session["PageOriginal"].ToString();
        _Pagination = pg.getStringPagination();
        //loadColFilter();
    }
开发者ID:nmduy3984,项目名称:SanNhua,代码行数:28,代码来源:Projects.ascx.cs


示例3: Test_Events_GetAll_SortByCreationDate

        public void Test_Events_GetAll_SortByCreationDate()
        {
            try
            {
                PayInCardWebDTO payIn1 = GetJohnsNewPayInCardWeb();
                PayInCardWebDTO payIn2 = GetJohnsNewPayInCardWeb();

                FilterEvents eventsFilter = new FilterEvents();
                eventsFilter.BeforeDate = payIn2.CreationDate;
                eventsFilter.AfterDate = payIn1.CreationDate;
                eventsFilter.Type = EventType.PAYIN_NORMAL_CREATED;

                Sort sort = new Sort();
                sort.AddField("Date", SortDirection.desc);

                Pagination pagination = new Pagination();

                ListPaginated<EventDTO> result = this.Api.Events.GetAll(pagination, eventsFilter, sort);

                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 1);
                Assert.IsTrue(result[0].Date > result[1].Date);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
开发者ID:ioliver85,项目名称:mangopay2-net-sdk,代码行数:28,代码来源:ApiEventsTest.cs


示例4: Index

 //
 // GET: /Badminton/Model/
 public ActionResult Index(Pagination page)
 {
     IList<Model> list = _daoFactory.ModelDao().GetAll();
     page.TotalRows = list.Count;
     ViewData["nav"] = page;
     return View(list);
 }
开发者ID:luqizheng,项目名称:OrnamentFramework,代码行数:9,代码来源:ModelController.cs


示例5: Get

        public IPagination<Person> Get([FromUri] PagingCriteria pagingCriteria, [FromUri] Person personFilter, [FromUri] bool OrderBy, [FromUri] string OrderOn)
        {
            int totalRecords = 0;
            Entities.OrderBy order = OrderBy ? Entities.OrderBy.Ascending : Entities.OrderBy.Descending;

            var orderBy = new PersonOrderBy
            {
                Id = OrderOn == "Id" ? order : Entities.OrderBy.None,
                FirstName = OrderOn == "FirstName" ? order : Entities.OrderBy.None,
                LastName = OrderOn == "LastName" ? order : Entities.OrderBy.None,
                Age = OrderOn == "Age" ? order : Entities.OrderBy.None,
            };

            var dataResult = _personRepository.GetByPaging(pagingCriteria, personFilter, orderBy, out totalRecords);

            IPagination<Person> result = new Pagination<Person>
            {
                Records = dataResult.ToList(),
                TotalItems = totalRecords,
                PageSize = pagingCriteria.PageSize,
                Page = pagingCriteria.Page
            };

            return result;
        }
开发者ID:jorisbrauns,项目名称:MoonShot,代码行数:25,代码来源:PersonsController.cs


示例6: ProductsPartial

        public ActionResult ProductsPartial(string categoryId = null, bool? fromIndexPage = null, int pageNumber = 1)
        {
            using (var client = new HttpClient())
            {
                var numberOfProductsPerPage = int.Parse(ConfigurationManager.AppSettings["productsPerPage"]);
                var pagination = new Pagination { PageSize = numberOfProductsPerPage, PageNumber = pageNumber };
                ProductDtoWithPagination productsDtoWithPagination = null;

                //productsDtoWithPagination = string.IsNullOrEmpty((categoryId)) ?
                //    client.GetAsync("").Result:
                //    client.GetAsync("").Result;

                if (string.IsNullOrEmpty(categoryId))
                    ViewBag.CategoryName = "所有商品";
                else
                {
                    var category = client.GetAsync("").Result;
                    //ViewBag.CategoryName = category.Name;
                }

                ViewBag.CategoryId = categoryId;
                ViewBag.FromIndexPage = fromIndexPage;
                if (fromIndexPage == null || fromIndexPage.Value)
                    ViewBag.Action = "Index";
                else
                    ViewBag.Action = "Category";
                ViewBag.IsFirstPage = productsDtoWithPagination.Pagination.PageNumber == 1;
                ViewBag.IsLastPage = productsDtoWithPagination.Pagination.PageNumber == productsDtoWithPagination.Pagination.TotalPages;
                return PartialView(productsDtoWithPagination);
            }
        }
开发者ID:lizhi5753186,项目名称:BDF,代码行数:31,代码来源:LayoutController.cs


示例7: BindPromoteSales

 void BindPromoteSales()
 {
     int num2;
     int promotiontype = 0;
     if (int.TryParse(this.Page.Request.QueryString["promoteType"], out num2))
     {
         promotiontype = num2;
     }
     Pagination pagination = new Pagination();
     pagination.PageIndex = this.pager.PageIndex;
     pagination.PageSize = this.pager.PageSize;
     int totalPromotes = 0;
     DataTable table = CommentBrowser.GetPromotes(pagination, promotiontype, out totalPromotes);
     table.Columns.Add("PromoteTypeName");
     if ((table != null) && (table.Rows.Count > 0))
     {
         foreach (DataRow row in table.Rows)
         {
             row["PromoteTypeName"] = this.ConvertPromoteType((PromoteType) ((int) row["PromoteType"]));
         }
         this.rptPromoteSales.DataSource = table;
         this.rptPromoteSales.DataBind();
     }
     this.pager.TotalRecords = totalPromotes;
 }
开发者ID:davinx,项目名称:himedi,代码行数:25,代码来源:Promotes.cs


示例8: ProductsPartial

        public ActionResult ProductsPartial(string categoryID = null, bool? fromIndexPage = null, int pageNumber = 1)
        {
            using (var proxy = new ServiceProxy<IProductService>())
            {
                var numberOfProductsPerPage = ByteartRetailConfigurationReader.Instance.ProductsPerPage;
                var pagination = new Pagination { PageSize = numberOfProductsPerPage, PageNumber = pageNumber };
                ProductDataObjectListWithPagination productsWithPagination = 
                    string.IsNullOrEmpty(categoryID) ? 
                    proxy.Channel.GetProductsWithPagination(pagination) : 
                    proxy.Channel.GetProductsForCategoryWithPagination(new Guid(categoryID), pagination);

                if (fromIndexPage != null &&
                    !fromIndexPage.Value)
                {
                    if (string.IsNullOrEmpty(categoryID))
                        ViewBag.CategoryName = "所有商品";
                    else
                    {
                        var category = proxy.Channel.GetCategoryByID(new Guid(categoryID), QuerySpec.Empty);
                        ViewBag.CategoryName = category.Name;
                    }
                }
                else
                    ViewBag.CategoryName = null;
                ViewBag.CategoryID = categoryID;
                ViewBag.FromIndexPage = fromIndexPage;
                if (fromIndexPage == null || fromIndexPage.Value)
                    ViewBag.Action = "Index";
                else
                    ViewBag.Action = "Category";
                ViewBag.IsFirstPage = productsWithPagination.Pagination.PageNumber == 1;
                ViewBag.IsLastPage = productsWithPagination.Pagination.PageNumber == productsWithPagination.Pagination.TotalPages;
                return PartialView(productsWithPagination);
            }
        }
开发者ID:szlfwolf,项目名称:ByteartRetail_Apworks,代码行数:35,代码来源:LayoutController.cs


示例9: ProductList

 public int page { get; set; }       // used to keep track of what page the list has loaded up to
 
 public ProductList()
 {
     results = new ObservableCollection<Listing>();
     @params = new Page_Parameters();
     pagination = new Pagination();
     page = 1;
 }
开发者ID:CarltonSemple,项目名称:WindowsApps,代码行数:9,代码来源:List.cs


示例10: CreatePaginator

        private Paginator CreatePaginator(int page, int perPage, int pages, string baseUrl, string urlFormat, IEnumerable<DocumentFile> documents)
        {
            // It is important that this query is not executed here (aka: do not add ToList() or ToArray()). This
            // query should be executed by the rendering engine so the returned documents are rendered first.
            var pagedDocuments = documents.Skip((page - 1) * perPage).Take(perPage);

            var pagination = new Pagination();

            if (pages > 1 && !String.IsNullOrEmpty(urlFormat))
            {
                pagination.Page = page;
                pagination.PerPage = perPage;
                pagination.TotalPage = pages;
                pagination.NextPageUrl = page < pages ? this.UrlForPage(page + 1, baseUrl, urlFormat) : null;
                pagination.PreviousPageUrl = page > 1 ? this.UrlForPage(page - 1, baseUrl, urlFormat) : null;

                var start = Math.Max(1, page - 3);
                var end = Math.Min(pages, start + 6);
                start = Math.Max(start, end - 6);

                pagination.Pages = this.CreatePages(page, start, end, baseUrl, urlFormat).ToList();
            }

            return new Paginator(pagedDocuments, pagination);
        }
开发者ID:fearthecowboy,项目名称:tinysite,代码行数:25,代码来源:PaginateCommand.cs


示例11: GridPaging

    protected void GridPaging()
    {
        try
        {
            int startRecordNumber = (CurPageNum - 1) * pageSize + 1;
            int endRecordNumber = startRecordNumber + gvApplicationNotApproved.Rows.Count - 1;

            if (gvApplicationNotApproved.Rows.Count == 0)
                startRecordNumber = 0;

            int totalPages = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(totalRows) / Convert.ToDecimal(pageSize)));
            lblPagingLeft.Text = "Showing " + startRecordNumber + " to " + endRecordNumber + " of " + totalRows;
            StringBuilder sb = new StringBuilder();
            sb.Append(@"<div class='Pages'><div class='Paginator'>");
            Pagination pagingstring = new Pagination();
            pagingstring.CurPage = CurPageNum;
            pagingstring.BaseUrl = Request.Url.GetLeftPart(UriPartial.Path).ToString();
            pagingstring.TotalRows = totalRows;
            pagingstring.PerPage = pageSize;
            pagingstring.PrevLink = "&lt; Prev";
            pagingstring.NextLink = "Next &gt;";
            pagingstring.LastLink = "Last &gt;";
            pagingstring.FirstLink = "&lt; First";
            sb.Append(pagingstring.GetPageLinks());
            sb.Append(@"</div></div><br clear='all' />");
            ltrlPaging.Text = sb.ToString();
        }
        catch (Exception ex)
        {
            new SqlLog().InsertSqlLog(0, "adminApplications.GridPaging", ex);
        }
    }
开发者ID:AsmaBabarISL,项目名称:Epr_General,代码行数:32,代码来源:ViewApplication.aspx.cs


示例12: ExpectedValueForLowerboundWithEvenVariance

        public void ExpectedValueForLowerboundWithEvenVariance()
        {
            Pagination p = new Pagination(100, 5, 10, 10);

            //5 - 4
            Assert.AreEqual(1, p.Lowerbound);
        }
开发者ID:justin-arvay,项目名称:Trakker,代码行数:7,代码来源:PaginationTests.cs


示例13: ExpectedValueForLowerboundWithOddVariance

        public void ExpectedValueForLowerboundWithOddVariance()
        {
            Pagination p = new Pagination(100, 5, 10, 7);

            //5 - 3
            Assert.AreEqual(2, p.Lowerbound);
        }
开发者ID:justin-arvay,项目名称:Trakker,代码行数:7,代码来源:PaginationTests.cs


示例14: showData

    private void showData()
    {
        string ID = Request.QueryString["ID"];
        int total = 0;
        _Page = Request.QueryString["Page"] == null ? "1" : this.IsPostBack ? "1" : Request.QueryString["Page"];
        _Limit = ddlPageSize.SelectedValue;
        dt = DataAccess.getProjectLogo("-1", _Page, _Limit, ref total);

        _Total = total.ToString();
        int from, to;
        from = _Total == "0" ? 0 : (1 + (Convert.ToInt32(_Page) - 1) * Convert.ToInt32(ddlPageSize.SelectedValue));
        to = Convert.ToInt32(ddlPageSize.SelectedValue) * Convert.ToInt32(_Page) <= Convert.ToInt32(_Total) ? Convert.ToInt32(ddlPageSize.SelectedValue) * Convert.ToInt32(_Page) : Convert.ToInt32(_Total);
        _Status = "<span class='actived_true'>Viewing " + from.ToString() + " to " + to.ToString() + " of " + _Total + "</span>";
        Pagination pg = new Pagination();

        pg.Limit = Convert.ToInt32(_Limit);
        pg.PageNumber = Convert.ToInt32(_Page);
        pg.Total = Convert.ToInt64(_Total);
        pg.Page = "Pages";
        pg.First = "|<";
        pg.Next = ">";
        pg.Previous = "<";
        pg.Last = ">|";
        pg.ItemShowNumber = 10;
        pg.URL = "";//Session["PageOriginal"].ToString();
        _Pagination = pg.getStringPagination();
        //loadColFilter();
    }
开发者ID:nmduy3984,项目名称:SanNhua,代码行数:28,代码来源:QLProjectLogo.aspx.cs


示例15: Test_Client_GetKycDocuments

        public void Test_Client_GetKycDocuments()
        {
            ListPaginated<KycDocumentDTO> result = null;
            ListPaginated<KycDocumentDTO> result2 = null;

            try
            {
                result = this.Api.Clients.GetKycDocuments(null, null);
                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 0);

                Pagination pagination = new Pagination(1, 2);
                Sort sort = new Sort();
                sort.AddField("CreationDate", SortDirection.asc);
                result = this.Api.Clients.GetKycDocuments(pagination, null, sort);
                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 0);

                sort = new Sort();
                sort.AddField("CreationDate", SortDirection.desc);
                result2 = this.Api.Clients.GetKycDocuments(pagination, null, sort);
                Assert.IsNotNull(result2);
                Assert.IsTrue(result2.Count > 0);

                Assert.IsTrue(result[0].Id != result2[0].Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
开发者ID:ioliver85,项目名称:mangopay2-net-sdk,代码行数:31,代码来源:ApiClientsTest.cs


示例16: GridPaging

 protected void GridPaging()
 {
     try
     {
         int totalPages = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(totalRows) / Convert.ToDecimal(pageSize)));
         //lblPagingLeft.Text = "Showing " + CurPageNum + " to " + totalPages + " of " + totalRows + " entries";
         StringBuilder sb = new StringBuilder();
         sb.Append(@"<div class='Pages'><div class='Paginator'>");
         Pagination pagingstring = new Pagination();
         pagingstring.CurPage = CurPageNum;
         pagingstring.BaseUrl = Request.Url.GetLeftPart(UriPartial.Path).ToString();
         pagingstring.TotalRows = totalRows;
         pagingstring.PerPage = pageSize;
         pagingstring.PrevLink = "&lt; Prev";
         pagingstring.NextLink = "Next &gt;";
         pagingstring.LastLink = "Last &gt;";
         pagingstring.FirstLink = "&lt; First";
         sb.Append(pagingstring.GetPageLinks());
         sb.Append(@"</div></div><br clear='all' />");
         //ltrlPaging.Text = sb.ToString();
     }
     catch (Exception ex)
     {
         new SqlLog().InsertSqlLog(0, "adminStakeholders.GridPaging", ex);
     }
 }
开发者ID:AsmaBabarISL,项目名称:Epr_General,代码行数:26,代码来源:admindashboard.aspx.cs


示例17: ExpectedValueForHasPreviousPage

        public void ExpectedValueForHasPreviousPage()
        {
            Pagination p = new Pagination(2, 2, 1);
            Assert.IsTrue(p.HasPreviousPage);

            p = new Pagination(2, 1, 1);
            Assert.IsTrue(!p.HasPreviousPage);
        }
开发者ID:justin-arvay,项目名称:Trakker,代码行数:8,代码来源:PaginationTests.cs


示例18: Index

        public ActionResult Index(int page=1)
        {
            if (!this._nhanvien_permission.Contains("donhang_view"))
            {
                return _fail_permission("donhang_view");
            }

            DonHangController ctr=new DonHangController();
            //
            Boolean timkiem_ngay_from;
            Boolean timkiem_ngay_to;
            DateTime ngay_from = TextLibrary.ToDateTime(timkiem_donhang["ngay_from"], out timkiem_ngay_from);
            DateTime ngay_to = TextLibrary.ToDateTime(timkiem_donhang["ngay_to"], out timkiem_ngay_to);
            Boolean timkiem_ngay = timkiem_ngay_from && timkiem_ngay_to;
            //Pagination
                Pagination pg = new Pagination();
                int max_item_per_page = TextLibrary.ToInt(this.timkiem_donhang["max_item_per_page"]);//get from setting
                pg.set_current_page(page);
                pg.set_max_item_per_page(max_item_per_page);
                pg.set_total_item(
                    ctr.timkiem_count(
                        timkiem_donhang["id"],
                        timkiem_donhang["khachhang_ten"],
                        TextLibrary.ToInt(timkiem_donhang["tongtien_from"]),
                        TextLibrary.ToInt(timkiem_donhang["tongtien_to"]),
                        timkiem_ngay,
                        ngay_from,
                        ngay_to,
                        timkiem_donhang["thanhtoan_tructuyen"],
                        timkiem_donhang["trangthai"],
                        timkiem_donhang["active"]
                        )
                    );
                pg.update();

            ViewBag.pagination = pg;
            ViewBag.DonHang_List = ctr.timkiem(
                timkiem_donhang["id"],
                timkiem_donhang["khachhang_ten"],
                TextLibrary.ToInt(timkiem_donhang["tongtien_from"]),
                TextLibrary.ToInt(timkiem_donhang["tongtien_to"]),
                timkiem_ngay,
                ngay_from,
                ngay_to,
                timkiem_donhang["thanhtoan_tructuyen"],
                timkiem_donhang["trangthai"],
                timkiem_donhang["active"],
                timkiem_donhang["order_by"],
                TextLibrary.ToBoolean(timkiem_donhang["order_desc"])
                ,pg.start_point,pg.max_item_per_page
                );
            ViewBag.timkiem_donhang = timkiem_donhang;
            //pagination

            this._set_activetab(new String[] { "QuanLyDonHang","DonHang_"+timkiem_donhang["trangthai"] });
            return View();
        }
开发者ID:quocdunginfo,项目名称:tmdtud_local,代码行数:57,代码来源:AdminDonHangsController.cs


示例19: Index

 public ActionResult Index()
 {
     var model = new DashboardViewModel();
     int records;
     var pagination = new Pagination();
     model.LatestArticles = adminService.GetArticlesByPage(pagination, totalRecords: out records).Take(5);
     model.LatestUsers = adminService.GetUsersByPage(pagination, totalRecords: out records).Take(5);
     return View("Dashboard", model);
 }
开发者ID:alebustillo,项目名称:SciReview,代码行数:9,代码来源:AdminController.cs


示例20: InitBlogPostWrapper

 /// <summary>
 /// 
 /// </summary>
 /// <param name="posts"></param>
 /// <param name="pagination"></param>
 /// <returns></returns>
 public BlogPostWrapper InitBlogPostWrapper(IEnumerable<BlogPostDTO> posts, Pagination pagination)
 {
     var result = new BlogPostWrapper
     {
         BlogPosts = posts,
         Pagination = pagination
     };
     return result;
 }
开发者ID:pspfolio,项目名称:BlogApi,代码行数:15,代码来源:BlogPostConverters.cs



注:本文中的Pagination类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Paging类代码示例发布时间:2022-05-24
下一篇:
C# PaginatedList类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap