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

C# PagedList类代码示例

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

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



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

示例1: List

 public ActionResult List(int? id)
 {
     int PageNo = id ?? 1;
     Dictionary<string, string> sitemaster = GetSiteMaster();
     ViewData["SiteMaster"] = sitemaster;
     if (Int32.Parse(sitemaster["isadmin"]) == 2 || Int32.Parse(sitemaster["isadmin"]) == 5)
     {
         IList<IDictionary> bidAnounceList;
         Hashtable htparm = new Hashtable();
         htparm["start"] = PageSizeList * (PageNo - 1) + 1;   //记录开始数
         htparm["end"] = PageNo * PageSizeList;    //记录结束数
         bidAnounceList = EmedAppraiseMapper.Get().QueryForList<IDictionary>("QualityGroup.QueryAll", htparm);
         foreach (IDictionary b in bidAnounceList)
         {
             b["ProjectOid"] = EmedAppraiseMapper.Get().QueryForObject<string>("AuctionProject.getprojectname", Int32.Parse(b["ProjectOid"].ToString()));
         }
         IList<IDictionary> projects = EmedAppraiseMapper.Get().QueryForList<IDictionary>("AuctionProject.forgroup", "");
         int count = EmedAppraiseMapper.Get().QueryForObject<int>("QualityGroup.QueryAllCount", "");
         PagedList<IDictionary> list = new PagedList<IDictionary>(bidAnounceList, PageNo, PageSizeList, count);
         ViewData["ProvincebidAnounceListByUser"] = list;
         ViewData["Count"] = count;
         string selecthtml = string.Empty;
         foreach (IDictionary p in projects)
         {
             selecthtml += "<option value='" + p["OID"].ToString() + "'>" + p["NewProjectName"].ToString() + "</option>";
         }
         ViewData["projects"] = selecthtml;
         return View(list);
     }
     else
         return RedirectToAction("MemberLevelError", "Base");
     return View();
 }
开发者ID:kyoliumiao,项目名称:BidSystem,代码行数:33,代码来源:QualityGroupController.cs


示例2: GetProducts

        /// <summary>
        /// 获取未删除的所有products
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public PagedList<ProductModel> GetProducts(int pageIndex, int pageSize)
        {
            var data = new List<ProductModel>();
            var count = 0;
            using (var cmd = DataCommandManager.GetDataCommand("GetProducts"))
            {
                cmd.SetParameterValue("@PageIndex", pageIndex);
                cmd.SetParameterValue("@PageSize", pageSize);

                using (var ds = cmd.ExecuteDataSet())
                {
                   if(ds.Tables.Count>=2)
                   {
                       foreach (DataRow dr in ds.Tables[0].Rows)
                       {
                           data.Add(DataRowToProductModel(dr));
                       }
                       var drCount = ds.Tables[1].Rows[0][0];
                       count = !Convert.IsDBNull(drCount) ? Convert.ToInt32(drCount) : 0;
                   }

                }
            }

            var result = new PagedList<ProductModel>(data, pageIndex, pageSize, count);
            //总记录数量
            return result;
        }
开发者ID:jiangguang5201314,项目名称:DotNetStudio,代码行数:34,代码来源:ProductDataAccess.cs


示例3: Tour

 //从SelectCityView中得到CityPinYin     2012/3/29
 public ViewResult Tour(string id, int? pi)
 {
     ViewBag.pinyin = id;
     //定义了一个可变化的intPi =1
     var intPi = 1;
     //如果没有的话即表示在当前页
     if (pi == null)
     {
         pi = 1;
     }
     //将pi赋值给intPi
     intPi = (int)pi;
     if (id == "")
     {
         throw new ArgumentNullException("id is null");
     }
     var cityInfo = cityInfoService.GetCityByPinYin(id);
     if (cityInfo.city == "")
     {
         throw new ArgumentNullException("cityInfo is null");
     }
     else
     {
         id = cityInfo.city;
         IQueryable<Miaow.Application.dj.Dto.ListTypeMidTourPlanDto> data = null;
         int total = 0;    //总条数
         data = listService.GetTourListByCity(id, intPi, pageSize, ref total);
         PagedList<Miaow.Application.dj.Dto.ListTypeMidTourPlanDto> model = new PagedList<Miaow.Application.dj.Dto.ListTypeMidTourPlanDto>(data, intPi, pageSize, total);
         return View(model);
     }
 }
开发者ID:JPomichael,项目名称:Miaow,代码行数:32,代码来源:CityController.cs


示例4: FindEnties

 /// <summary>
 /// Find Enties 
 /// </summary>
 /// <param name="pageIndex">pageIndex</param>
 /// <param name="pageSize">pageSize</param>
 /// <returns>Enties</returns>
 public PagedList<EmployeePayHistoryDto> FindEnties(int? pageIndex, int pageSize)
 {
     var entities=entiesrepository.Repository.Find(p => p.EmployeeID!=null, p => p.EmployeeID, pageIndex, pageSize);
     var listDtos=new PagedList<EmployeePayHistoryDto>() { TotalCount = entities.TotalCount };
      entities.ForEach(entity => { listDtos.Add(typeAdapter.ConvertEntitiesToDto(entity)); });
      return listDtos;
 }
开发者ID:kouweizhong,项目名称:ironframework,代码行数:13,代码来源:EmployeePayHistoryBO.cs


示例5: GetBusinessLocations

        /// <summary>
        /// Gets sorted list of all Business Locations in the dataset by filter 
        /// </summary>
        /// <param name="SearchQuery">Query to filter on</param>
        /// <param name="PageNumber">Current page number</param>
        /// <param name="PageSize">Number of items per page</param>
        /// <param name="OrderBy">Column name to sequence the list by</param>
        /// <param name="OrderByAscDesc">Sort direction</param> 
        /// <returns>object PagedList</returns>
        public static PagedList<BusinessLocation> GetBusinessLocations(string SearchQuery, int PageNumber, int PageSize, string OrderBy, bool OrderByAscDesc)
        {
            //Create client to talk to OpenDat API Endpoint
            var client = new SodaClient(_APIEndPointHost, _AppToken);

            //get a reference to the resource itself the result (a Resouce object) is a generic type
            //the type parameter represents the underlying rows of the resource
            var dataset = client.GetResource <PagedList<BusinessLocation>>(_APIEndPoint4x4);

            //Build the select list of columns for the SoQL call
            string[] columns = new[] { "legal_name", "doing_business_as_name", "date_issued", "city", "state", "zip_code", "latitude", "longitude"  };
            
            //Column alias must not collide with input column name, i.e. don't alias 'city' as 'city'
            string[] aliases = new[] { "LegalName", "DBA", "IssuedOn" };

            //using SoQL and a fluent query building syntax
            var soql = new SoqlQuery().Select(columns)
                .As(aliases)
                .Order((OrderByAscDesc) ? SoqlOrderDirection.ASC: SoqlOrderDirection.DESC,  new[] { OrderBy });

            if(!string.IsNullOrEmpty(SearchQuery))
            {
                soql = new SoqlQuery().FullTextSearch(SearchQuery);
            }

            var results = dataset.Query<BusinessLocation>(soql);

            //page'em cause there might be quite a few
            PagedList<BusinessLocation> pagedResults = new PagedList<BusinessLocation>(results.ToList(), PageNumber, PageSize);

            return pagedResults;
        }
开发者ID:fr33k3r,项目名称:SocrataSodaNetSample,代码行数:41,代码来源:SODAHelper.cs


示例6: GetMessages

 public PagedList<MessageModel> GetMessages(int userId, int pageIndex, int pageSize)
 {
     var data = new List<MessageModel>();
     
     using (var cmd = DataCommandManager.GetDataCommand("GetMessages"))
     {
         cmd.SetParameterValue("@UserId", userId);
         cmd.SetParameterValue("@PageIndex", pageIndex);
         cmd.SetParameterValue("@PageSize", pageSize);
         var total = 0;
         using (var dr=cmd.ExecuteDataReader())
         {
             while (dr.Read())
             {
                 var messageModel = new MessageModel();
                 if (total == 0)
                 {
                     total = !Convert.IsDBNull(dr["Total"]) ? Convert.ToInt32(dr["Total"]) : 0;
                 }
                 messageModel.MessageId = !Convert.IsDBNull(dr["Id"]) ? Convert.ToInt32(dr["Id"]) : 0;
                 messageModel.UserId = !Convert.IsDBNull(dr["UserId"]) ? Convert.ToInt32(dr["UserId"]) : 0;
                 messageModel.Content = !Convert.IsDBNull(dr["MsgContent"]) ? dr["MsgContent"].ToString() : string.Empty;
                 messageModel.CreateTime = !Convert.IsDBNull(dr["CreateTime"]) ? Convert.ToDateTime(dr["CreateTime"]) : DateTime.MinValue;
                 messageModel.Status = !Convert.IsDBNull(dr["Status"]) ? Convert.ToInt32(dr["Status"]) : 0;
                 if (messageModel.MessageId > 0)
                 {
                     data.Add(messageModel);
                 }
             }
         }
         var result = new PagedList<MessageModel>(data, pageIndex, pageSize, total);
         return result;
     }
     
 }
开发者ID:jinhonglin,项目名称:DotNetStudio,代码行数:35,代码来源:MessageDataAccess.cs


示例7: Index

        // GET: Zapis
        public ActionResult Index(string SilowniaID, int page = 1, int pageSize = 10, AkcjaZapisEnum akcja = AkcjaZapisEnum.Brak)
        {
            if (Session["Auth"] != null)
            {
                if (Session["Auth"].ToString() == "Klient")
                {
                    ViewBag.SilowniaID = new SelectList(db.Silownie.DistinctBy(a => new { a.Nazwa }), "Nazwa", "Nazwa");

                    var zajeciaGrup = from ZajeciaGrupowe in db.ZajeciaGrup select ZajeciaGrupowe;

                    zajeciaGrup = zajeciaGrup.Search(SilowniaID, i => i.Sala.Silownia.Nazwa);

                    var final = zajeciaGrup.OrderBy(p => p.Instruktor.Nazwisko);
                    var ileWynikow = zajeciaGrup.Count();
                    if ((ileWynikow / page) <= 1)
                    {
                        page = 1;
                    }
                    var kk = ileWynikow / page;

                    PagedList<ZajeciaGrupowe> model = new PagedList<ZajeciaGrupowe>(final, page, pageSize);

                    if (akcja != AkcjaZapisEnum.Brak)
                    {
                        ViewBag.Akcja = akcja;
                    }

                    return View(model);
                }
            }
            return HttpNotFound();
        }
开发者ID:Damianekk,项目名称:Inzynierka,代码行数:33,代码来源:ZapisZajeciaGrupoweController.cs


示例8: GivenThatPageIsFirstOne_WhenCreatingPagedList_ThenPreviousPageNumberIsNull

        public void GivenThatPageIsFirstOne_WhenCreatingPagedList_ThenPreviousPageNumberIsNull()
        {
            var superset = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            var pagedList = new PagedList<int>(superset.AsQueryable(), 1, 1);

            Assert.IsNull(pagedList.PreviousPageNumber);
        }
开发者ID:joakimskoog,项目名称:Geymsla,代码行数:7,代码来源:PagedListTests.cs


示例9: GivenThatPageIsSecondOne_WhenCreatingPagedList_ThenPreviousPageNumberIsOne

        public void GivenThatPageIsSecondOne_WhenCreatingPagedList_ThenPreviousPageNumberIsOne()
        {
            var superset = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            var pagedList = new PagedList<int>(superset.AsQueryable(), 2, 1);

            Assert.AreEqual(1, pagedList.PreviousPageNumber.Value);
        }
开发者ID:joakimskoog,项目名称:Geymsla,代码行数:7,代码来源:PagedListTests.cs


示例10: SyncQueryLoad

 /// <summary>
 /// 同步一次性加载
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 private ActionResult SyncQueryLoad(QueryModel query)
 {
     List<MenuViewModel> treeNodes = MenuRepository.FindByQuery(Sql.Builder.OrderBy("SortId ASC")).Select(menu => menu.ToDto()).ToList();
     CommonHelper.SetState(treeNodes,MenuLoadMode);
     PagedList<MenuViewModel> result = new PagedList<MenuViewModel>(treeNodes, query.Page, query.Rows);
     return new TreeGridResult(result, true, result.TotalItemCount).GetResult();
 }
开发者ID:hero106wen,项目名称:BeiDreamEasyUi,代码行数:12,代码来源:MenuManageController.cs


示例11: RenderFlickrSetList

        public PartialViewResult RenderFlickrSetList(int? id)
        {
            IEnumerable<FlickrSets> flickrSets = _flickrImageService.GetList();
            PagedList<FlickrSets> fs = new PagedList<FlickrSets>(flickrSets, id ?? 1, 5, flickrSets.Count());

            return PartialView("_FlickrSets", fs);
        }
开发者ID:scarletgirl,项目名称:LisaKatherine,代码行数:7,代码来源:PhotosController.cs


示例12: Search

        public ActionResult  Search(string query, int page = 1)
        {
            var modelContent = RuntimeContext.Instance.ContentService.GetContent(System.Web.HttpContext.Current);
            var newModel = Mapper.Map<SearchResultsModel>(modelContent);
            
            var results = RuntimeContext.Instance.SearchService.Search(query);
            
            var searchResults = new List<SearchResultModel>();

            foreach (var result in results)
            {
                var content = RuntimeContext.Instance.ContentService.GetContent(result.Url);

                if (content == null || content.Type == "BlogComment") continue;

                result.Content = content;
                searchResults.Add(result);
            }

            var paged = new PagedList<SearchResultModel>(searchResults.AsQueryable(), page, 10);

            newModel.Query = query;
            newModel.SearchResults = paged;

            return View(newModel);
        }
开发者ID:iahdevelop,项目名称:moriyama-umbraco-runtime,代码行数:26,代码来源:SearchController.cs


示例13: Article

 public ActionResult Article(int? id, string keywords, int? page)
 {
     ((dynamic) base.ViewBag).Keywords = Globals.HtmlDecode(keywords);
     if (this.WebSiteSet != null)
     {
         ((dynamic) base.ViewBag).Title = Globals.HtmlDecode(this.WebSiteSet.WebTitle) + "-" + Globals.HtmlDecode(this.WebSiteSet.WebName);
         ((dynamic) base.ViewBag).Description = Globals.HtmlDecode(this.WebSiteSet.Description);
     }
     ((dynamic) base.ViewBag).Domain = this.WebSiteSet.BaseHost;
     ((dynamic) base.ViewBag).WebName = this.WebSiteSet.WebName;
     ((dynamic) base.ViewBag).HotWordss = keywords;
     if (keywords == null)
     {
         return base.View();
     }
     if (keywords.Length > 0x19)
     {
         return base.View();
     }
     Maticsoft.BLL.CMS.Content content = new Maticsoft.BLL.CMS.Content();
     int pageSize = 10;
     page = new int?((page.HasValue && (page.Value > 1)) ? page.Value : 1);
     int startIndex = (page.Value > 1) ? (((page.Value - 1) * pageSize) + 1) : 0;
     int endIndex = page.Value * pageSize;
     int recordCount = content.GetRecordCount(id, keywords);
     PagedList<Maticsoft.Model.CMS.Content> model = null;
     List<Maticsoft.Model.CMS.Content> list2 = content.GetList(id, startIndex, endIndex, keywords);
     string valueByCache = ConfigSystem.GetValueByCache("ArticleIsStatic");
     List<Maticsoft.Model.CMS.Content> items = new List<Maticsoft.Model.CMS.Content>();
     string str2 = ConfigSystem.GetValueByCache("MainArea");
     if ((list2 != null) && (list2.Count > 0))
     {
         foreach (Maticsoft.Model.CMS.Content content2 in list2)
         {
             if (valueByCache == "true")
             {
                 content2.SeoUrl = PageSetting.GetCMSUrl(content2.ContentID, "CMS", ApplicationKeyType.CMS);
             }
             else if (str2 == "CMS")
             {
                 content2.SeoUrl = "/Article/Details/" + content2.ContentID;
             }
             else
             {
                 content2.SeoUrl = "/CMS/Article/Details/" + content2.ContentID;
             }
             items.Add(content2);
         }
     }
     if ((items != null) && (items.Count > 0))
     {
         int? nullable = page;
         model = new PagedList<Maticsoft.Model.CMS.Content>(items, nullable.HasValue ? nullable.GetValueOrDefault() : 1, pageSize, recordCount);
     }
     if (base.Request.IsAjaxRequest())
     {
         return this.PartialView("~/Areas/CMS/Themes/Default/Views/Partial/UCjQuerySearchList.cshtml", model);
     }
     return base.View(model);
 }
开发者ID:huaminglee,项目名称:myyyyshop,代码行数:60,代码来源:SearchController.cs


示例14: IndexModel

 public IndexModel(PagedList<News> news)
     : this()
 {
     if (news == null)
         throw new ArgumentNullException("the news is null!!!");
     this.news = news;
 }
开发者ID:dalinhuang,项目名称:cy-pdcpms,代码行数:7,代码来源:IndexModel.cs


示例15: PagedList_BuildPagingLastPage_Valid

        public void PagedList_BuildPagingLastPage_Valid()
        {
            const int page = 3;
            const int pageSize = 1;
            const int shownEitherSide = 1;
            const string url = "url";

            List<string> source = new List<string> { "one", "two", "three" };

            var pagedList = new PagedList<string>(source.AsEnumerable(), page, pageSize);

            var actual = pagedList.BuildPagingLinks(shownEitherSide, url);

            const string expected = "<div class=\"pagination\">" +
                                        "<span class=\"page\"></span>" +
                                        "<ul>" +
                                            "<li><a href=\"url?page=1\">First</a></li>" +
                                            "<li><a href=\"url?page=2\">Prev</a></li>" +
                                            "<li><a href=\"url?page=1\">... </a></li>" +
                                            "<li><a href=\"url?page=2\">2</a></li>" +
                                            "<li class=\"current\"><a href=\"url?page=3\">3</a></li>" +
                                            "<li><a href=\"url?page=3\">Next</a></li>" +
                                            "<li><a href=\"url?page=3\">Last</a></li>" +
                                        "</ul>" +
                                    "</div>";

            Assert.AreEqual(expected, actual);
        }
开发者ID:leegould,项目名称:PagedList,代码行数:28,代码来源:PagedListTest.cs


示例16: TransactionsViewModel

 public TransactionsViewModel(IEnumerable<Transaction> transactions, int pageNumber, int pageSize)
 {
     PageNumber = pageNumber;
     PageSize = pageSize;
     Transactions = transactions;
     PagedTransactions = new PagedList<Transaction>(transactions, pageNumber,pageSize);
 }
开发者ID:GurvinderGarcha,项目名称:TestTransactions,代码行数:7,代码来源:TransactionsViewModel.cs


示例17: Get

         /// <summary>
        /// Get the List ofContactdto.
        /// </summary>
        /// <param name="_ContactDto">The Contact dto.</param>
        /// <example><code> HTTP GET: api/Contact/?pageindex=1&pagesize=10&....</code></example>
        /// <returns>DatagridData List of ContactDto</returns>
        public EasyuiDatagridData<ContactDto> Get([FromUri] ContactDto _ContactDtos, int pageIndex =1, int pageSize =10)
        {
		    var pagedlist = new PagedList<ContactDto>  {_ContactDtos };
            pagedlist.PageIndex = pageIndex;
            pagedlist.PageSize = pageSize;
            return _ContactBO.FindAll(pagedlist);
        }
开发者ID:kouweizhong,项目名称:ironframework,代码行数:13,代码来源:ContactController.Generated.cs


示例18: Get

        /// <summary>
        /// Returns a PagedList of items.
        /// </summary>
        /// <param name="pageIndex">Zero-based index for lookup.</param>
        /// <param name="pageSize">Number of items to return in a page.</param>
        /// <returns></returns>
        public PagedList<HtmlContent> Get(int pageIndex, int pageSize, out int totalCount)
        {
            var resultSet = new PagedList<HtmlContent>(Get(), pageIndex, pageSize);
            totalCount = resultSet.TotalCount;

            return resultSet;
        }
开发者ID:eiu165,项目名称:ContentManager,代码行数:13,代码来源:Db4oHtmlContentRepository.cs


示例19: Get

         /// <summary>
        /// Get the List ofAddressdto.
        /// </summary>
        /// <param name="_AddressDto">The Address dto.</param>
        /// <example><code> HTTP GET: api/Address/?pageindex=1&pagesize=10&....</code></example>
        /// <returns>DatagridData List of AddressDto</returns>
        public EasyuiDatagridData<AddressDto> Get([FromUri] AddressDto _AddressDtos, int pageIndex =1, int pageSize =10)
        {
		    var pagedlist = new PagedList<AddressDto>  {_AddressDtos };
            pagedlist.PageIndex = pageIndex;
            pagedlist.PageSize = pageSize;
            return _AddressBO.FindAll(pagedlist);
        }
开发者ID:kouweizhong,项目名称:ironframework,代码行数:13,代码来源:AddressController.Generated.cs


示例20: Search

        /// <summary>
        /// Searches for lessons based on input parameters. Lessons are paginated and a single paged is returned
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task<PagedList<Lesson>> Search(LessonViewModel model) 
        {
            PagedList<Lesson> page = new PagedList<Lesson>();

            IQueryable<Lesson> lessons = SearchedLesson(
                model.Keyword,
                model.InContent,
                model.Discipline,
                model.School,
                model.Classroom,
                model.Rate,
                model.Tags,
                model.PublishedOn,
                model.PublishedBy
            );

            page.Count = lessons.Count();
            page.StartRow = model.StartRow;
            page.PageSize = model.PageSize;

            lessons = lessons.OrderBy(model.OrderBy + " " + model.OrderDir).Skip(model.StartRow).Take(model.PageSize);
            page.Records = await lessons.ToListAsync<Lesson>();

            return page;
        }
开发者ID:jrgcubano,项目名称:disciturCQRSES,代码行数:30,代码来源:LessonQueryWorker.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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