当前位置: 首页>>代码示例>>C#>>正文


C# PagingInfo类代码示例

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


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


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