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


C# Pager.GetStartIndex方法代码示例

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


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

示例1: ShowFormResults

        public ActionResult ShowFormResults(int id, PagerParameters pagerParameters)
        {
            if (!_services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to view form results")))
                return new HttpUnauthorizedResult();

            var form = _services.ContentManager.Get<OFormPart>(id, VersionOptions.Latest);
            if (form == null)
                return HttpNotFound();

            CheckValidSerial();
            var pager = new Pager(_services.WorkContext.CurrentSite, pagerParameters);

            var formResults = _resultsRepo.Table.Where(x => x.OFormPartRecord == form.Record);

            var pagerShape = Shape.Pager(pager).TotalItemCount(formResults.Count());
            var results = formResults
                .OrderByDescending(x => x.CreatedDate)
                .Skip(pager.GetStartIndex()).Take(pager.PageSize);

            return View(new FormResultViewModel
            {
                FormId = form.Id,
                FormName = form.Name,
                Results = results.ToList(),
                Pager = pagerShape
            });
        }
开发者ID:dminik,项目名称:voda_code,代码行数:27,代码来源:ResultsAdminController.cs

示例2: Search

        public ActionResult Search(string tagName, PagerParameters pagerParameters)
        {
            Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);

            var tag = _tagService.GetTagByName(tagName);

            if (tag == null) {
                return RedirectToAction("Index");
            }

            var taggedItems = _tagService.GetTaggedContentItems(tag.Id, pager.GetStartIndex(), pager.PageSize)
                .Select(item => _contentManager.BuildDisplay(item, "Summary"));

            var list = _shapeFactory.List();
            list.AddRange(taggedItems);

            var totalItemCount = _tagService.GetTaggedContentItemCount(tag.Id);
            var viewModel = new TagsSearchViewModel {
                TagName = tag.TagName,
                List = list,
                Pager = _shapeFactory.Pager(pager).TotalItemCount(totalItemCount)
            };

            return View(viewModel);
        }
开发者ID:stack72,项目名称:GiveCamp-London,代码行数:25,代码来源:HomeController.cs

示例3: Item

        public ActionResult Item(int forumId, PagerParameters pagerParameters) {
            var forumPart = _forumService.Get(forumId, VersionOptions.Published);
            if (forumPart == null)
                return HttpNotFound();

            if (!_orchardServices.Authorizer.Authorize(Orchard.Core.Contents.Permissions.ViewContent, forumPart, T("Not allowed to view forum")))
                return new HttpUnauthorizedResult();

            Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
            
            var threads = _threadService
                .Get(forumPart, pager.GetStartIndex(), pager.PageSize, VersionOptions.Published)
                .Select(b => _orchardServices.ContentManager.BuildDisplay(b, "Summary"));

            dynamic forum = _orchardServices.ContentManager.BuildDisplay(forumPart);

            var list = Shape.List();
            list.AddRange(threads);
            forum.Content.Add(Shape.Parts_Forums_Thread_List(ContentPart: forumPart, ContentItems: list), "5");

            var totalItemCount = forumPart.ThreadCount;
            forum.Content.Add(Shape.Pager(pager).TotalItemCount(totalItemCount), "Content:after");

            return new ShapeResult(this, forum);
        }
开发者ID:six006,项目名称:NGM.Forum,代码行数:25,代码来源:ForumController.cs

示例4: Index

        public ActionResult Index(int? countryId, PagerParameters pagerParameters)
        {

            var viewModel = new DeliverySettingsViewModel
                {
                    CountryId = countryId,
                    CountryRepository = _countryRepository
                };

            var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters.Page, pagerParameters.PageSize);

            //var setting = _deliverySettingsRepository.Table.Where(s => s.DeliveryCulture == cultureUsed);
            //if (setting.FirstOrDefault() == null)
            //    {
            //        _deliverySettingService.AddSetting("Default", 0, 0, 1, cultureUsed);
            //    }


            var allCountrySettings = _deliverySettingsRepository.Table.Where(s => s.Country.Id == (countryId ?? 0));

            viewModel.DeliverySettings = allCountrySettings
                .OrderBy(a => a.State)
                .Skip(pager.GetStartIndex())
                .Take(pager.PageSize);

            var pagerShape = Shape.Pager(pager).TotalItemCount(allCountrySettings.Count());
            viewModel.Pager = pagerShape;

            return View(viewModel);
        }
开发者ID:omidam81,项目名称:Ver1.0,代码行数:30,代码来源:DeliverySettingsController.cs

示例5: Item

        public ActionResult Item(string TimetableSlug, PagerParameters pagerParameters) {
            Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);

            var correctedSlug = _TimetableSlugConstraint.FindSlug(TimetableSlug);
            if (correctedSlug == null)
                return HttpNotFound();

            var TimetablePart = _TimetableService.Get(correctedSlug);
            if (TimetablePart == null)
                return HttpNotFound();

            if (!RouteData.DataTokens.ContainsKey("ParentActionViewContext")
                && TimetablePart.Id == _routableHomePageProvider.GetHomePageId(_workContextAccessor.GetContext().CurrentSite.HomePage)) {
                return HttpNotFound();
            }
            _feedManager.Register(TimetablePart);
            var TimetableAppointments = _TimetableAppointmentService.Get(TimetablePart, pager.GetStartIndex(), pager.PageSize)
                //.Select(b => _services.ContentManager.BuildDisplay(b, "Summary"));
                .Select(b => b);

            dynamic Timetable = _services.ContentManager.BuildDisplay(TimetablePart);

            var list = Shape.List();
            list.AddRange(TimetableAppointments);
            Timetable.Content.Add(Shape.Parts_Timetables_TimetableAppointment_List(ContentItems: list), "5");

            var totalItemCount = _TimetableAppointmentService.AppointmentCount(TimetablePart);
            Timetable.Content.Add(Shape.Pager(pager).TotalItemCount(totalItemCount), "Content:after");

            return View((object)Timetable);
        }
开发者ID:dminik,项目名称:voda_code,代码行数:31,代码来源:TimetableController.cs

示例6: Item

        public ActionResult Item(int blogId, PagerParameters pagerParameters) {
            Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);

            var blogPart = _blogService.Get(blogId, VersionOptions.Published).As<BlogPart>();
            if (blogPart == null)
                return HttpNotFound();

            if (!_services.Authorizer.Authorize(Orchard.Core.Contents.Permissions.ViewContent, blogPart, T("Cannot view content"))) {
                return new HttpUnauthorizedResult();
            }


            _feedManager.Register(blogPart, _services.ContentManager.GetItemMetadata(blogPart).DisplayText);
            var blogPosts = _blogPostService.Get(blogPart, pager.GetStartIndex(), pager.PageSize)
                .Select(b => _services.ContentManager.BuildDisplay(b, "Summary"));
            dynamic blog = _services.ContentManager.BuildDisplay(blogPart);

            var list = Shape.List();
            list.AddRange(blogPosts);
            blog.Content.Add(Shape.Parts_Blogs_BlogPost_List(ContentItems: list), "5");

            var totalItemCount = _blogPostService.PostCount(blogPart);
            blog.Content.Add(Shape.Pager(pager).TotalItemCount(totalItemCount), "Content:after");

            return new ShapeResult(this, blog);
        }
开发者ID:jdages,项目名称:AndrewsHouse,代码行数:26,代码来源:BlogController.cs

示例7: Post

        public object Post(string id, ListQueryModel model) {
            if (string.IsNullOrEmpty(id)) {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
            var part = GetProjectionPartRecord(model.ViewId);
            if (part == null) {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
            var pluralService = PluralizationService.CreateService(new CultureInfo("en-US"));
            id = pluralService.Singularize(id);
            string filterDescription = null;
            
            return GetFilteredRecords(id, part, out filterDescription, model, p => {
                _gridService.GenerateSortCriteria(id, model.Sidx, model.Sord, p.Record.QueryPartRecord.Id);
                var totalRecords = _projectionManager.GetCount(p.Record.QueryPartRecord.Id);
                var pageSize = model.Rows;
                var totalPages = (int) Math.Ceiling((float) totalRecords/(float) pageSize);
                var pager = new Pager(Services.WorkContext.CurrentSite, model.Page, pageSize);
                var records = GetLayoutComponents(p, pager.GetStartIndex(), pager.PageSize);

                return new {
                    totalPages = totalPages,
                    page = model.Page,
                    totalRecords = totalRecords,
                    rows = records,
                    filterDescription = filterDescription
                };
            });
        }
开发者ID:wezmag,项目名称:Coevery,代码行数:29,代码来源:EntityController.cs

示例8: List

        public ActionResult List(ListContentsViewModel model, PagerParameters pagerParameters) {
            var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
            var query = _contentManager.Query<ProductPart, ProductPartRecord>(VersionOptions.Latest);

            switch (model.Options.OrderBy) {
                case ContentsOrder.Modified:
                    query.OrderByDescending<CommonPartRecord>(cr => cr.ModifiedUtc);
                    break;
                case ContentsOrder.Published:
                    query.OrderByDescending<CommonPartRecord>(cr => cr.PublishedUtc);
                    break;
                case ContentsOrder.Created:
                    query.OrderByDescending<CommonPartRecord>(cr => cr.CreatedUtc);
                    break;
            }

            var pagerShape = Shape.Pager(pager).TotalItemCount(query.Count());
            var pageOfContentItems = query.Slice(pager.GetStartIndex(), pager.PageSize).ToList();

            var list = Shape.List();
            list.AddRange(pageOfContentItems.Select(ci => _contentManager.BuildDisplay(ci, "SummaryAdmin")));

            dynamic viewModel = Shape.ViewModel()
                .ContentItems(list)
                .Pager(pagerShape)
                .Options(model.Options);

            // Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
            return View((object)viewModel);
        }
开发者ID:richinoz,项目名称:Orchard1.6,代码行数:30,代码来源:ProductAdminController.cs

示例9: Item

        public ActionResult Item(string blogPath, PagerParameters pagerParameters) {
            Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
            var correctedPath = _blogPathConstraint.FindPath(blogPath);
            if (correctedPath == null)
                return HttpNotFound();

            var blogPart = _blogService.Get(correctedPath);
            if (blogPart == null)
                return HttpNotFound();

            // primary action run for a home paged item shall not pass
            if (!RouteData.DataTokens.ContainsKey("ParentActionViewContext")
                && blogPart.Id == _routableHomePageProvider.GetHomePageId(_workContextAccessor.GetContext().CurrentSite.HomePage)) {
                return HttpNotFound();
            }

            _feedManager.Register(blogPart);
            var blogPosts = _blogPostService.Get(blogPart, pager.GetStartIndex(), pager.PageSize)
                .Select(b => _services.ContentManager.BuildDisplay(b, "Summary"));
            dynamic blog = _services.ContentManager.BuildDisplay(blogPart);

            var list = Shape.List();
            list.AddRange(blogPosts);
            blog.Content.Add(Shape.Parts_Blogs_BlogPost_List(ContentItems: list), "5");

            var totalItemCount = _blogPostService.PostCount(blogPart);
            blog.Content.Add(Shape.Pager(pager).TotalItemCount(totalItemCount), "Content:after");

            return new ShapeResult(this, blog);
        }
开发者ID:rupertwhitlock,项目名称:IncreasinglyAbsorbing,代码行数:30,代码来源:BlogController.cs

示例10: List

        public ActionResult List(ListContentsViewModel model, PagerParameters pagerParameters) {
            var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
            var container = model.ContainerId.HasValue ? _contentManager.GetLatest((int)model.ContainerId) : null;
            if (container == null || !container.Has<ContainerPart>()) {
                return HttpNotFound();
            }

            var restrictedContentType = container.As<ContainerPart>().Record.ItemContentType;
            var hasRestriction = !string.IsNullOrEmpty(restrictedContentType);
            if (hasRestriction) {
                model.FilterByContentType = restrictedContentType;
            }
            model.Options.SelectedFilter = model.FilterByContentType;

            model.ContainerDisplayName = container.ContentManager.GetItemMetadata(container).DisplayText;
            if (string.IsNullOrEmpty(model.ContainerDisplayName)) {
                model.ContainerDisplayName = container.ContentType;
            }

            var query = GetListContentItemQuery(model.ContainerId.Value, model.FilterByContentType, model.Options.OrderBy);
            if (query == null) {
                return HttpNotFound();
            }

            model.Options.FilterOptions = GetContainableTypes()
                .Select(ctd => new KeyValuePair<string, string>(ctd.Name, ctd.DisplayName))
                .ToList().OrderBy(kvp => kvp.Key);

            var pagerShape = Shape.Pager(pager).TotalItemCount(query.Count());
            var pageOfContentItems = query.Slice(pager.GetStartIndex(), pager.PageSize).ToList();

            var list = Shape.List();
            list.AddRange(pageOfContentItems.Select(ci => _contentManager.BuildDisplay(ci, "SummaryAdmin")));

            var containerItemContentDisplayName = String.Empty;
            if (hasRestriction)
                containerItemContentDisplayName = _contentDefinitionManager.GetTypeDefinition(restrictedContentType).DisplayName;
            else if (!string.IsNullOrEmpty(model.FilterByContentType))
                containerItemContentDisplayName = _contentDefinitionManager.GetTypeDefinition(model.FilterByContentType).DisplayName;

            dynamic viewModel = Shape.ViewModel()
                .ContentItems(list)
                .Pager(pagerShape)
                .ContainerId(model.ContainerId)
                .Options(model.Options)
                .ContainerDisplayName(model.ContainerDisplayName)
                .HasRestriction(hasRestriction)
                .ContainerContentType(container.ContentType)
                .ContainerItemContentDisplayName(containerItemContentDisplayName)
                .ContainerItemContentType(hasRestriction ? restrictedContentType : (model.FilterByContentType ?? ""))
                .OtherLists(_contentManager.Query<ContainerPart>(VersionOptions.Latest).List()
                    .Select(part => part.ContentItem)
                    .Where(item => item != container)
                    .OrderBy(item => item.As<CommonPart>().VersionPublishedUtc));

            // Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
            return View((object)viewModel);
        }
开发者ID:wezmag,项目名称:Coevery,代码行数:58,代码来源:AdminController.cs

示例11: Index

 public ActionResult Index(PagerParameters pagerParameters)
 {
     var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters.Page, pagerParameters.PageSize);
     var ordersQuery = _orderService.GetOrders().List().OrderByDescending(o => o.CreatedAt);
     var orders = ordersQuery.Skip(pager.GetStartIndex()).Take(pager.PageSize);
     var pagerShape = Shape.Pager(pager).TotalItemCount(ordersQuery.Count());
     var model = Shape.Orders(Orders: orders.ToArray(), Pager: pagerShape);
     return View((object)model);
 }
开发者ID:davegardner,项目名称:Cascade.WebShop,代码行数:9,代码来源:OrderAdminController.cs

示例12: Index

        public ActionResult Index(SpamIndexOptions options, PagerParameters pagerParameters) {
            if (!Services.Authorizer.Authorize(Permissions.ManageAntiSpam, T("Not authorized to manage spam")))
                return new HttpUnauthorizedResult();

            var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);

            // default options
            if (options == null)
                options = new SpamIndexOptions();

            var query = Services.ContentManager.Query().ForPart<SpamFilterPart>();
            
            switch(options.Filter) {
                case SpamFilter.Spam:
                    query = query.Where<SpamFilterPartRecord>(x => x.Status == SpamStatus.Spam);
                    break;
                case SpamFilter.Ham:
                    query = query.Where<SpamFilterPartRecord>(x => x.Status == SpamStatus.Ham);
                    break;
                case SpamFilter.All:
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            var pagerShape = Shape.Pager(pager).TotalItemCount(query.Count());

            switch (options.Order) {
                case SpamOrder.Creation:
                    query = query.Join<CommonPartRecord>().OrderByDescending(u => u.CreatedUtc);
                    break;
            }

            var results = query
                .Slice(pager.GetStartIndex(), pager.PageSize);

            var model = new SpamIndexViewModel {
                Spams = results.Select(x => new SpamEntry {
                    Spam = x.As<SpamFilterPart>(),
                    Shape = Services.ContentManager.BuildDisplay(x, "SummaryAdmin")
                }).ToList(),
                
                Options = options,
                Pager = pagerShape
            };

            // maintain previous route data when generating page links
            var routeData = new RouteData();
            routeData.Values.Add("Options.Filter", options.Filter);
            routeData.Values.Add("Options.Search", options.Search);
            routeData.Values.Add("Options.Order", options.Order);

            pagerShape.RouteData(routeData);

            return View(model);
        }
开发者ID:richinoz,项目名称:Orchard1.6,代码行数:56,代码来源:AdminController.cs

示例13: Index

        public ActionResult Index(ListContentsViewModel model, PagerParameters pagerParameters) {
            var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);

            var query = Services.ContentManager.Query(VersionOptions.Latest, GetCreatableTypes(false).Select(ctd => ctd.Name).ToArray());

            if (!string.IsNullOrEmpty(model.Options.SelectedFilter)) {
                var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(model.Options.SelectedFilter);
                if (contentTypeDefinition == null)
                    return HttpNotFound();

                model.TypeDisplayName = !string.IsNullOrWhiteSpace(contentTypeDefinition.DisplayName)
                                            ? contentTypeDefinition.DisplayName
                                            : contentTypeDefinition.Name;
                query = query.ForType(model.Options.SelectedFilter);

            }
            
            switch (model.Options.OrderBy) {
                case ContentsOrder.Modified:
                    query = query.OrderByDescending<CommonPartRecord>(cr => cr.ModifiedUtc);
                    break;
                case ContentsOrder.Published:
                    query = query.OrderByDescending<CommonPartRecord>(cr => cr.PublishedUtc);
                    break;
                case ContentsOrder.Created:
                    query = query.OrderByDescending<CommonPartRecord>(cr => cr.CreatedUtc);
                    break;
            }

            model.Options.FilterOptions = GetCreatableTypes(false)
                .Select(ctd => new KeyValuePair<string, string>(ctd.Name, ctd.DisplayName))
                .ToList().OrderBy(kvp => kvp.Value);

            var pagerShape = Services.New.Pager(pager).TotalItemCount(query.Count());
            var pageOfContentItems = query.Slice(pager.GetStartIndex(), pager.PageSize).ToList();

            var list = Services.New.List();
            list.AddRange(pageOfContentItems.Select(ci => Services.ContentManager.BuildDisplay(ci, "SummaryAdmin")));

            foreach(IShape item in list.Items) {
                item.Metadata.Type = "ContentPicker";
            }

            dynamic tab = Services.New.RecentContentTab()
                .ContentItems(list)
                .Pager(pagerShape)
                .Options(model.Options)
                .TypeDisplayName(model.TypeDisplayName ?? "");

            // retain the parameter in the pager links
            RouteData.Values["Options.SelectedFilter"] = model.Options.SelectedFilter;
            RouteData.Values["Options.OrderBy"] = model.Options.OrderBy.ToString();

            return new ShapeResult(this, Services.New.ContentPicker().Tab(tab));
        }
开发者ID:richinoz,项目名称:Orchard1.6,代码行数:55,代码来源:AdminController.cs

示例14: Index

 public ActionResult Index(string id, PagerParameters pagerParameters) {
     var pager = new Pager(_services.WorkContext.CurrentSite, pagerParameters);
     var submissions = _formService.GetSubmissions(id, pager.GetStartIndex(), pager.PageSize);
     var pagerShape = _services.New.Pager(pager).TotalItemCount(submissions.TotalItemCount);
     var viewModel = new SubmissionsIndexViewModel {
         FormName = id,
         Submissions = _formService.GenerateDataTable(submissions),
         Pager = pagerShape
     };
     return View(viewModel);
 }
开发者ID:RasterImage,项目名称:Orchard,代码行数:11,代码来源:SubmissionAdminController.cs

示例15: Index

        public ActionResult Index(BindingIndexOptions options, PagerParameters pagerParameters) {
            if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to list bindings")))
                return new HttpUnauthorizedResult();

            var pager = new Pager(Services.WorkContext.CurrentSite, pagerParameters);

            // default options
            if (options == null)
                options = new BindingIndexOptions();

            var bindings = _repository.Table;

            switch (options.Filter) {
                case BindingsFilter.All:
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            if (!String.IsNullOrWhiteSpace(options.Search)) {
                bindings = bindings.Where(r => r.DisplayName.Contains(options.Search));
            }

            var pagerShape = Shape.Pager(pager).TotalItemCount(bindings.Count());

            switch (options.Order) {
                case BindingsOrder.Name:
                    bindings = bindings.OrderBy(u => u.DisplayName);
                    break;
            }

            var results = bindings
                .Skip(pager.GetStartIndex())
                .Take(pager.PageSize)
                .ToList();

            var model = new BindingIndexViewModel {
                Bindings = results.Select(x => new BindingEntry { Binding = x }).ToList(),
                Options = options,
                Pager = pagerShape
            };

            // maintain previous route data when generating page links
            var routeData = new RouteData();
            routeData.Values.Add("Options.Filter", options.Filter);
            routeData.Values.Add("Options.Search", options.Search);
            routeData.Values.Add("Options.Order", options.Order);

            pagerShape.RouteData(routeData);

            return View(model);
        }
开发者ID:anycall,项目名称:Orchard,代码行数:52,代码来源:BindingController.cs


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