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


C# PaginatedList.GetCurrentPage方法代码示例

本文整理汇总了C#中PaginatedList.GetCurrentPage方法的典型用法代码示例。如果您正苦于以下问题:C# PaginatedList.GetCurrentPage方法的具体用法?C# PaginatedList.GetCurrentPage怎么用?C# PaginatedList.GetCurrentPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PaginatedList的用法示例。


在下文中一共展示了PaginatedList.GetCurrentPage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PaginatedListTest1

        public void PaginatedListTest1()
        {
            PaginatedList<int> pds = new PaginatedList<int>();
            pds.StartIndex = 1;
            pds.PageNo = 1;
            pds.PageSize = 5;

            pds.AddRange(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 });

            Assert.AreEqual(new int[] { 1, 2, 3, 4, 5 }, pds.GetCurrentPage().ToArray());

            pds.StartIndex = 2;
            pds.PageNo = 1;
            pds.PageSize = 5;
            Assert.AreEqual(new int[] { 2, 3, 4, 5, 6 }, pds.GetCurrentPage().ToArray());

            pds.StartIndex = 5;
            pds.PageNo = 3;
            pds.PageSize = 4;
            Assert.AreEqual(new int[] { 13, 14, 15, 16 }, pds.GetCurrentPage().ToArray());
        }
开发者ID:Terradue,项目名称:DotNetOpenSearch,代码行数:21,代码来源:ParametersTest.cs

示例2: SearchInAtom

        AtomFeed SearchInAtom(NameValueCollection parameters)
        {
            var alternate = (feed != null && feed.Links != null) ? feed.Links.FirstOrDefault(l => l.RelationshipType == "alternate") : null;
            if(alternate == null) alternate = feed.Links.FirstOrDefault(l => l.RelationshipType == "self");

            string[] queryString = Array.ConvertAll(parameters.AllKeys, key => String.Format("{0}={1}", key, parameters[key]));

            AtomFeed resultfeed = new AtomFeed("Discovery feed for " + this.Identifier,
                                         "This OpenSearch Service allows the discovery of the different items which are part of the " + this.Identifier + " collection" +
                                         "This search service is in accordance with the OGC 10-032r3 specification.",
                                               alternate != null ? alternate.Uri : new Uri(feed.Id) , feed.Id, DateTimeOffset.UtcNow);

            resultfeed.Generator = "Terradue Web Server";

            // Load all avaialable Datasets according to the context

            PaginatedList<AtomItem> pds = new PaginatedList<AtomItem>();

            int startIndex = 1;
            if (!string.IsNullOrEmpty(parameters["startIndex"]))
                startIndex = int.Parse(parameters["startIndex"]);

            pds.AddRange(SearchInItem((IEnumerable < AtomItem > )feed.Items, parameters));

            pds.PageNo = 1;
            if (!string.IsNullOrEmpty(parameters["startPage"]))
                pds.PageNo = int.Parse(parameters["startPage"]);

            pds.PageSize = 20;
            if (!string.IsNullOrEmpty(parameters["count"]))
                pds.PageSize = int.Parse(parameters["count"]);

            pds.StartIndex = startIndex - 1;

            if (this.Identifier != null)
                resultfeed.Identifier = this.Identifier;

            resultfeed.Items = pds.GetCurrentPage();
            resultfeed.TotalResults = pds.Count(); ;

            return resultfeed;
        }
开发者ID:Terradue,项目名称:DotNetOpenSearch,代码行数:42,代码来源:AtomFeedOpenSearchable.cs

示例3: GenerateSyndicationFeed

        private AtomFeed GenerateSyndicationFeed(NameValueCollection parameters)
        {
            UriBuilder myUrl = new UriBuilder("file:///test");
            string[] queryString = Array.ConvertAll(parameters.AllKeys, key => String.Format("{0}={1}", key, parameters[key]));
            myUrl.Query = string.Join("&", queryString);

            AtomFeed feed = new AtomFeed("Discovery feed for " + this.Identifier,
                                         "This OpenSearch Service allows the discovery of the different items which are part of the " + this.Identifier + " collection" +
                                         "This search service is in accordance with the OGC 10-032r3 specification.",
                                         myUrl.Uri, myUrl.ToString(), DateTimeOffset.UtcNow);

            feed.Generator = "Terradue Web Server";

            List<AtomItem> items = new List<AtomItem>();

            // Load all avaialable Datasets according to the context

            PaginatedList<TestItem> pds = new PaginatedList<TestItem>();

            int startIndex = 1;
            if (parameters["startIndex"] != null)
                startIndex = int.Parse(parameters["startIndex"]);

            pds.StartIndex = startIndex;
            pds.AddRange(Items);

            pds.PageNo = 1;
            if (parameters["startPage"] != null)
                pds.PageNo = int.Parse(parameters["startPage"]);

            pds.PageSize = 20;
            if (parameters["count"] != null)
                pds.PageSize = int.Parse(parameters["count"]);

            if (this.Identifier != null)
                feed.Identifier = this.Identifier;

            foreach (TestItem s in pds.GetCurrentPage()) {

                if (s is IAtomizable) {
                    AtomItem item = (s as IAtomizable).ToAtomItem(parameters);
                    if (item != null)
                        items.Add(item);
                } else {

                    string fIdentifier = s.Identifier;
                    string fName = s.Name;
                    string fText = (s.TextContent != null ? s.TextContent : "");

                    if (!string.IsNullOrEmpty(parameters["q"])) {
                        string q = parameters["q"];
                        if (!(fName.Contains(q) || fIdentifier.Contains(q) || fText.Contains(q)))
                            continue;
                    }

                    Uri alternate = new Uri("file:///test/search?count=0&id=" + fIdentifier);
                    Uri id = new Uri(s.Id);

                    AtomItem entry = new AtomItem(fIdentifier, fName, alternate, id.ToString(), s.Date);
                    entry.PublishDate = s.Date.DateTime;
                    entry.LastUpdatedTime = s.Date.DateTime;
                    entry.Categories.Add(new SyndicationCategory(this.Identifier));

                    entry.Summary = new TextSyndicationContent(fName);
                    entry.ElementExtensions.Add("identifier", "http://purl.org/dc/elements/1.1/", fIdentifier);

                    items.Add(entry);
                }
            }

            feed.Items = items;
            var tr = pds.Count();
            feed.TotalResults = tr;

            return feed;
        }
开发者ID:Terradue,项目名称:DotNetOpenSearch,代码行数:76,代码来源:TestUnlimitedOpenSearchable.cs

示例4: RequestCurrentPage

        /// <summary>
        /// Requests the current page.
        /// </summary>
        private void RequestCurrentPage()
        {
            PaginatedList<IOpenSearchable> pds = new PaginatedList<IOpenSearchable>();

            int startIndex = 1;
            if (parameters["startIndex"] != null)
                startIndex = int.Parse(parameters["startIndex"]);

            pds.PageNo = 1;
            if (parameters["startPage"] != null)
                pds.PageNo = int.Parse(parameters["startPage"]);

            pds.PageSize = ose.DefaultCount;
            if (parameters["count"] != null)
                pds.PageSize = int.Parse(parameters["count"]);

            pds.StartIndex = startIndex - 1;

            pds.AddRange(entities);

            ExecuteConcurrentRequest(pds.GetCurrentPage());

            MergeResults();
        }
开发者ID:Terradue,项目名称:DotNetOpenSearch,代码行数:27,代码来源:MultiAtomGroupedOpenSearchRequest.cs


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