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

C# PagingInfo类代码示例

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

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



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

示例1: Can_Generate_Page_Links

        public void Can_Generate_Page_Links()
        {
            // przygotowanie - definiowanie metody pomocniczej HTML — potrzebujemy tego,
            // aby użyć metody rozszerzającej
            HtmlHelper myHelper = null;

            // przygotowanie - tworzenie danych PagingInfo
            PagingInfo pagingInfo = new PagingInfo
            {
                CurrentPage = 2,
                TotalItems = 28,
                ItemsPerPage = 10
            };

            // przygotowanie - konfigurowanie delegatu z użyciem wyrażenia lambda
            Func<int, string> pageUrlDelegate = i => "Strona" + i;

            // działanie
            MvcHtmlString result = myHelper.PageLinks(pagingInfo, pageUrlDelegate);

            // asercje
            Assert.AreEqual(@"<a class=""btn btn-default"" href=""Strona1"">1</a>"
                + @"<a class=""btn btn-default btn-primary selected"" href=""Strona2"">2</a>"
                + @"<a class=""btn btn-default"" href=""Strona3"">3</a>",
                result.ToString());
        }
开发者ID:PawelHaracz,项目名称:SportsStore,代码行数:26,代码来源:UnitTest1.cs


示例2: PagerModel

 public PagerModel(PagingInfo info, string action, string controller, object parameters)
 {
     PageInfo = info;
     Action = action;
     Controller = controller;
     Parameters = parameters;
 }
开发者ID:bunny1985,项目名称:BooksLib,代码行数:7,代码来源:PagerModel.cs


示例3: Can_Generate_Links_To_Other_Pages

        public void Can_Generate_Links_To_Other_Pages()
        {
            //  Arrange: Create a reference to the HtmlHelper class instance
            //  We can use a null reference here because we're going to extend
            //  the HtmlHelper class with an extension method
            HtmlHelper html = null;

            //  Arrange: The helper should take a paging info instance
            //  and a lambda to specify the URLs
            //  Create an anonymous instance of the paging info class
            PagingInfo pagingInfo = new PagingInfo
            {
                CurrentPage = 2,
                TotalItems = 28,
                ItemsPerPage = 10
            };

            //  Create a lambda expression that takes an
            //  integer and spits out a string
            Func<int, string> pageUrl = i => "Page" + i;

            //  Act: Create the html string to supply to the view
            MvcHtmlString result = html.PageLinks(pagingInfo, pageUrl);

            //  Assert: Here's how it should format the links
            result.ToString().ShouldEqual(@"<a href=""Page1"">1</a>
            <a class=""selected"" href=""Page2"">2</a>
            <a href=""Page3"">3</a>
            ");
        }
开发者ID:Lindi,项目名称:SportsStore,代码行数:30,代码来源:DisplayingPageLinks.cs


示例4: StatsResultVM

 public StatsResultVM()
 {
     StatItems = new List<StatItem>();
     StatRoomItems = new List<StatRoomItem>();
     StatMessageItems = new List<StatMessageItem>();
     PaginationInfo = new PagingInfo() { CurrentPage = 1 };
 }
开发者ID:jascenci,项目名称:Chat,代码行数:7,代码来源:StatsResultVM.cs


示例5: CanBrowseWithSharding

	    public async Task CanBrowseWithSharding()
	    {
            var ms = new MemoryStream();
            var streamWriter = new StreamWriter(ms);
            var expected = new string('a', 1024);
            streamWriter.Write(expected);
            streamWriter.Flush();
            ms.Position = 0;

            await shardedClient.UploadAsync("a.txt", ms);
            await shardedClient.UploadAsync("b.txt", ms);
            await shardedClient.UploadAsync("c.txt", ms);
            await shardedClient.UploadAsync("d.txt", ms);
            await shardedClient.UploadAsync("e.txt", ms);

	        var pagingInfo = new PagingInfo(shardedClient.NumberOfShards);
	        var result = await shardedClient.BrowseAsync(2, pagingInfo);
            Assert.Equal(2, result.Length);

	        pagingInfo.CurrentPage++;
            result = await shardedClient.BrowseAsync(2, pagingInfo);
            Assert.Equal(2, result.Length);

            pagingInfo.CurrentPage++;
            result = await shardedClient.BrowseAsync(2, pagingInfo);
            Assert.Equal(1, result.Length);

            pagingInfo.CurrentPage++;
            result = await shardedClient.BrowseAsync(2, pagingInfo);
            Assert.Equal(0, result.Length);
	    }
开发者ID:hibernating-rhinos,项目名称:RavenFS,代码行数:31,代码来源:SimpleSharding.cs


示例6: CreateRssFeed

    private SyndicationLibrary.RSS.RssFeed CreateRssFeed()
    {
        DateTime fromDate = DateTime.Now.AddDays(-MESSAGE_AGE);

        SyndicationLibrary.RSS.RssFeed rss;
        using (System.IO.FileStream stream = new System.IO.FileStream(Eucalypto.PathHelper.LocateServerPath(TEMPLATE_FILE), System.IO.FileMode.Open, System.IO.FileAccess.Read))
          rss = SyndicationLibrary.RSS.RssFeed.GetFeed(stream);

        if (rss == null)
          throw new ApplicationException("Failed to load rss from " + TEMPLATE_FILE);

        PagingInfo paging = new PagingInfo(MAX_MESSAGES, 0);
        IList<Eucalypto.Forum.Message> messages = Eucalypto.Forum.ForumManager.FindMessages(
                                                Eucalypto.Common.Filter.MatchOne(GetSelectedForums()),
                                                null,
                                                null,
                                                null,
                                                fromDate,
                                                null,
                                                paging);

        DateTime lastPubDate = DateTime.MinValue;
        foreach (Eucalypto.Forum.Message msg in messages)
        {
          rss.Channel.Items.Add(CreateRssItem(msg));

          if (msg.UpdateDate > lastPubDate)
        lastPubDate = msg.UpdateDate;
        }

        rss.Channel.PublicationDate = lastPubDate;
        rss.Channel.LastBuildDate = lastPubDate;

        return rss;
    }
开发者ID:Learion,项目名称:BruceToolSet,代码行数:35,代码来源:ForumRss.aspx.cs


示例7: List

        public ViewResult List(string category, int page = 1)
        {
            IEnumerable<Product> productList = _productRepository.Products.Where(p => category == null || p.Category == category);

            var products = productList
                .OrderBy(p => p.ProductId)
                .Skip((page - 1) * PageSize)
                .Take(PageSize);

            var pagingInfo = new PagingInfo
            {
                CurrentPage = page,
                ItemsPerPage = PageSize,
                TotalItems = productList.Count(p => category == null || p.Category == category)
            };

            var productsListViewModel = new ProductsListViewModel
            {
                Products = products,
                PagingInfo = pagingInfo,
                CurrentCategory = category
            };

            return View(productsListViewModel);
        }
开发者ID:twinzer,项目名称:SportsStore,代码行数:25,代码来源:ProductController.cs


示例8: List

        // GET: Product
        public ViewResult List(string category = "", int page = 1)
        {
            Func<Product, bool> filter;
            if (string.IsNullOrEmpty(category))
            {
                filter = p => p.Category != null;
            }
            else
            {
                filter = p => p.Category == category;
            }

            var model = _repository.Products
                .Where(filter)
                .Skip((page - 1)*PageSize)
                .Take(PageSize).ToList();

            var pageInfo = new PagingInfo
            {
                CurrentPage = page,
                ItemsPerPage = PageSize,
                TotalItems = _repository.Products.Count()
            };

            return View(new ProductListViewModel
            {
                Products = model,
                PagingInfo = pageInfo,
                CurrentCategory = category

            });
        }
开发者ID:naingyelin,项目名称:SportsStore,代码行数:33,代码来源:ProductController.cs


示例9: Can_Generate_Page_Links

        public void Can_Generate_Page_Links()
        {
            //arrange
            //define an helper, we need to do this in order to apply the extensionmethod
            HtmlHelper myHelper = null;

            //arrange paginginfo
            PagingInfo pagingInfo = new PagingInfo
            {
                CurrentPage = 2,
                TotalItems = 28,
                ItemsPerPage = 10
            };
            // arrange- set lambda
            Func<int, string> pageUrlDelegate = i => "Page" + i;

            //act
            MvcHtmlString result = myHelper.PageLinks(pagingInfo, pageUrlDelegate);

            //assert
            Assert.AreEqual(@"<a class=""btn btn-default"" href=""Page1"">1</a>" +
                @"<a class=""btn btn-default btn-primary selected"" href=""Page2"">2</a>" +
                @"<a class=""btn btn-default"" href=""Page3"">3</a>"
            ,result.ToString());
        }
开发者ID:Gluba,项目名称:SportsStore,代码行数:25,代码来源:UnitTest1.cs


示例10: Can_Generate_Page_Links

        public void Can_Generate_Page_Links()
        {
            // Arrange - define an HTML helper - we need to do this
            // in order to apply the extension method
            HtmlHelper myHelper = null;

            // Arrange - create PagingInfo data
            PagingInfo pagingInfo = new PagingInfo
            {
                CurrentPage = 2,
                TotalItems = 28,
                ItemsPerPage = 10
            };

            // Arrange - set up the delegate using a lambda expression
            Func<int, string> pageUrlDelegate = i => "Page" + i;

            // Act
            MvcHtmlString result = myHelper.PageLinks(pagingInfo, pageUrlDelegate);

            // Assert
            Assert.AreEqual(result.ToString(), @"<a href=""Page1"">1</a>"
                + @"<a class=""selected"" href=""Page2"">2</a>"
                + @"<a href=""Page3"">3</a>");
        }
开发者ID:t-sql,项目名称:SportsStore,代码行数:25,代码来源:UnitTest1.cs


示例11: Can_Generate_Page_Links

        public void Can_Generate_Page_Links()
        {
            // Arrange

            // define an HtmlHelper in order to apply the extension method
            HtmlHelper myHelper = null;

            PagingInfo pagingInfo = new PagingInfo
            {
                CurrentPage = 2,
                TotalItems = 28,
                ItemsPerPage = 10
            };

            // set up delegate using lambda expression
            Func<int, string> pageUrlDelegate = i => "Page" + i;

            // Act
            MvcHtmlString result = myHelper.PageLinks(pagingInfo, pageUrlDelegate);

            // Assert
            string expected = @"<a class=""btn btn-default"" href=""Page1"">Page 1</a>";
            expected += @"<a class=""btn btn-default btn-primary selected"" href=""Page2"">Page 2</a>";
            expected += @"<a class=""btn btn-default"" href=""Page3"">Page 3</a>";
            Assert.AreEqual(expected, result.ToString());
        }
开发者ID:nhebb,项目名称:ProMVC5,代码行数:26,代码来源:UnitTest1.cs


示例12: Can_Generate_Links_To_Other_Pages

        public void Can_Generate_Links_To_Other_Pages()
        {
            // Arrange: We're going to extend the HtmlHelper class.
            // It doesn't matter if the variable we use is null.
            HtmlHelper html = null;

            // Arrange: The helper should take a PagingInfo instance (that's a class we haven't yet defined)
            // and a lambda to specify the URLs
            PagingInfo pagingInfo = new PagingInfo
            {
                CurrentPage = 2,
                TotalItems = 28,
                ItemsPerPage = 10
            };

            Func<int, string> pageUrl = (i => "Page" + i);

            // Act
            MvcHtmlString result = html.PageLinks(pagingInfo, pageUrl);

            // Assert: Here's how it should format the links
            // Выравнивание не трогать - это такое многострочное значение с переводами строк, т.е. \r\n
            result.ToString().ShouldEqual(@"<a href=""Page1"">1</a>
            <a class=""selected"" href=""Page2"">2</a>
            <a href=""Page3"">3</a>
            ");
        }
开发者ID:astrateg,项目名称:SportsStore,代码行数:27,代码来源:DisplayingPageLinks.cs


示例13: Serializes_Unbounded_Value

			public void Serializes_Unbounded_Value()
			{
				PagingInfo pagingInfo = new PagingInfo(PageNumberAndSize.Unbounded, 1701);
				string serializedPagingInfo = JsonConvert.SerializeObject(pagingInfo, DefaultFormatting, this.settings);

				Assert.AreEqual(Unbounded_Total1701, serializedPagingInfo);
			}
开发者ID:jimkropa,项目名称:misc.corlib,代码行数:7,代码来源:PagingInfoTests-Serialization.cs


示例14: ListOfBooksModel

 public ListOfBooksModel(List<Book> books, List<Author> authors,
                         List<Category> categories, PagingInfo pagingModel)
 {
     Books = books;
     Authors = authors;
     Categories = categories;
     PageInfo = pagingModel;
 }
开发者ID:bunny1985,项目名称:BooksLib,代码行数:8,代码来源:ListOfBooksModel.cs


示例15: Execute

 public ListSitesQueryResult Execute(PagingInfo pagingInfo)
 {
     return new ListSitesQueryResult(
         this.Context.Sites
         .Skip((pagingInfo.PageNumber - 1) * pagingInfo.PageSize)
         .Take(pagingInfo.PageSize)
         .ToList());
 }
开发者ID:MrClyfar,项目名称:Simple-.NET-CQRS-Sample,代码行数:8,代码来源:ListSitesQuery.cs


示例16: Serializes_With_All_Pages_When_Specified

			public void Serializes_With_All_Pages_When_Specified()
			{
				PagingInfo pagingInfo = new PagingInfo(2, 10, 27, true);
				string serializedPagingInfo = JsonConvert.SerializeObject(
					pagingInfo, DefaultFormatting, this.settings);

				Assert.AreEqual(Page2_Size10_Total27_WithAllPages, serializedPagingInfo);
			}
开发者ID:jimkropa,项目名称:misc.corlib,代码行数:8,代码来源:PagingInfoTests-Serialization.cs


示例17: Serializes_All_Properties

			public void Serializes_All_Properties()
			{
				PagingInfo pagingInfo = new PagingInfo(7, 20, 1138);
				string serializedPagingInfo = JsonConvert.SerializeObject(
					pagingInfo, DefaultFormatting, this.settings);

				Assert.AreEqual(Page7_Size20_Total1138, serializedPagingInfo);
			}
开发者ID:jimkropa,项目名称:misc.corlib,代码行数:8,代码来源:PagingInfoTests-Serialization.cs


示例18: Can_Generate_Page_Links

 public void Can_Generate_Page_Links()
 {
     HtmlHelper helper = null;
     var pagingInfo = new PagingInfo { CurrentPage = 2, TotalItems = 28, ItemsPerPage = 10 };
     Func<int, string> pageUrlDelegate = i => "Page" + i;
     MvcHtmlString result = helper.PageLinks(pagingInfo, pageUrlDelegate);
     var expect = @"<a href=""Page1"">1</a>" + @"<a class=""selected"" href=""Page2"">2</a>" + @"<a href=""Page3"">3</a>";
     Assert.AreEqual(expect, result.ToString());
 }
开发者ID:sunston,项目名称:SportStore,代码行数:9,代码来源:UnitTestPagination.cs


示例19: Display_View

    public void Display_View()
    {
        PagingInfo pInfo = new PagingInfo(m_PageSize > 0 ? m_PageSize : 0);
        pInfo.CurrentPage = m_intCurrentPage;
        m_aGroups = m_refCommunityGroupApi.GetInvitedCommunityGroups(this.m_refContentApi.UserId, pInfo);
        m_intTotalPages = pInfo.TotalPages;

        Populate_ViewCommunityGroupsGrid(m_aGroups);
    }
开发者ID:jaytem,项目名称:minGit,代码行数:9,代码来源:MyInvitedGroups.aspx.cs


示例20: ModifyToPagingTree

        /// <summary>
        /// 使用 ROWNUM 来进行分页。
        /// </summary>
        /// <param name="raw">The raw.</param>
        /// <param name="pagingInfo">The paging information.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">pagingInfo</exception>
        /// <exception cref="System.InvalidProgramException">必须排序后才能使用分页功能。</exception>
        protected override ISqlSelect ModifyToPagingTree(SqlSelect raw, PagingInfo pagingInfo)
        {
            if (PagingInfo.IsNullOrEmpty(pagingInfo)) { throw new ArgumentNullException("pagingInfo"); }
            if (!raw.HasOrdered()) { throw new InvalidProgramException("必须排序后才能使用分页功能。"); }

            var startRow = pagingInfo.PageSize * (pagingInfo.PageNumber - 1) + 1;
            var endRow = startRow + pagingInfo.PageSize - 1;

            var res = MakePagingTree(raw, startRow, endRow);

            return res;
        }
开发者ID:hardCTE,项目名称:Rafy,代码行数:20,代码来源:OracleSqlGenerator.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Paint类代码示例发布时间:2022-05-24
下一篇:
C# Paging类代码示例发布时间: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