本文整理汇总了C#中Pager类的典型用法代码示例。如果您正苦于以下问题:C# Pager类的具体用法?C# Pager怎么用?C# Pager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pager类属于命名空间,在下文中一共展示了Pager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
var Data = V_Base.Data;
int catid = ParentLoad.CatID;
var products = from nw in Data.CV_Products
join cat_ in Data.CV_CatProducts on nw.CatID equals cat_.CatID
where (nw.CatID==catid||catid==-1) && (cat_.PortalID==ParentLoad.PortalId)
orderby nw.ProductID descending
select nw;
//1 . chuyen truy van thanh list
PagedList<IB.Common.Entities.CV_Product> pl = new PagedList<IB.Common.Entities.CV_Product>(products, ParentLoad.PageCurr - 1, ParentLoad.PageSize);
if (pl.Count > 0)
{
//2 . gan vao repeater
rptproducts.DataSource = pl;
rptproducts.DataBind();
//3 . chuyen thanh thanh phan trang
Pager pg = new Pager(ParentLoad.PageSize, ParentLoad.PageCurr, pl.TotalItemCount, ParentLoad.TabId);
//4. tao thanh phan trang
pnPaging.Text = pg.RenderHtml();
}
}
开发者ID:shahinhemati,项目名称:project-example-a,代码行数:31,代码来源:ProductListFull.ascx.cs
示例3: Index
//
// GET: /News/
public ActionResult Index(int page=1)
{
ViewBag.NaviCss.Current = TextileCity.Models.Navigation.News;
int count = 0;
if (page > 0)
{
NewsOperation nop = new NewsOperation();
List<News> news = new List<News>();
news = nop.GetMinList(page, out count);
Pager pager =new Pager(page,count,NewsOperation.NewsListSize);
ViewData["News"] = news;
if (count > NewsOperation.NewsListSize)
{
if (page > 1)
{
ViewData["Prev"] = page - 1;
}
if (page < pager.Count)
{
ViewData["Next"] = page + 1;
}
}
}
return View();
}
开发者ID:luckywiky,项目名称:TextileCity,代码行数:27,代码来源:NewsController.cs
示例4: Index
//
// GET: /Xueya/
public ActionResult Index(int? p)
{
Pager pager = new Pager();
pager.table = "CMSXueya";
pager.strwhere = "1=1";
pager.PageSize = 30;
pager.PageNo = p ?? 1;
pager.FieldKey = "XueyaId";
pager.FiledOrder = "XueyaId Desc";
pager = CMSService.SelectAll("Xueya", pager);
List<XueyaDto> list = new List<XueyaDto>();
foreach (DataRow dr in pager.EntityDataTable.Rows)
{
XueyaDto dto = XueyaMapping.getDTO(dr);
list.Add(dto);
}
pager.Entity = list.AsQueryable();
ViewBag.PageNo = p ?? 1;
ViewBag.PageCount = pager.PageCount;
ViewBag.RecordCount = pager.Amount;
ViewBag.Message = pager.Amount;
// ViewBag.CustomerId = id;
//ViewBag.CustomerName = MyService.CustomerIdToName("CustomerId=" + id);
return View(pager.Entity);
}
开发者ID:jorzen2010,项目名称:SkyWebCMS,代码行数:31,代码来源:XueyaJianceController.cs
示例5: Home
public ActionResult Home(Models.Employee Emp,Pager pager)
{
var result = new List<Models.Employee>();
string sql = string.Empty;
using (conn)
{
conn.Open();
if (Emp.id > 0)
{
sql = string.Format(@"Update Employee set EmpName= '{0}',Email='{1}',Password='{2}',Role='{3}' where id={4}", Emp.EmpName, Emp.Email, Emp.Password, Emp.Role, Emp.id);
conn.Execute(sql);
}
else
{
sql = "INSERT INTO Employee(EmpName,Email,Password,Role) VALUES (@EmpName,@Email,@Password,@Role)";
conn.Execute(sql, new { Emp.EmpName, Emp.Email, Emp.Password, Emp.Role });
}
string sql1 = string.Format("Select * from Employee ");
string qrycount = string.Format(@"select count(e.id)'count' from Employee e");
ViewBag.PagerReceived= pager;
result = conn.Query<Models.Employee>(sql1).ToList();
conn.Close();
}
return View(result);
}
开发者ID:shivankt,项目名称:test,代码行数:27,代码来源:AccountController.cs
示例6: Can_Build_Correct_Model_For_33_Items_With_2_Item_Per_Page_And_Max_5_Pages
public void Can_Build_Correct_Model_For_33_Items_With_2_Item_Per_Page_And_Max_5_Pages()
{
// Assemble
var pager = new Pager(null, 2, 1, 33).Options(o => o.MaxNrOfPages(5));
var expectedPagination = new List<PaginationLink>()
{
new PaginationLink { Active = false, DisplayText = "«", Url = null },
new PaginationLink { Active = true, DisplayText = "1", PageIndex = 1, IsCurrent = true, Url = null },
new PaginationLink { Active = true, DisplayText = "2", PageIndex = 2, Url = "/test/2"},
new PaginationLink { Active = true, DisplayText = "3", PageIndex = 3, Url = "/test/3" },
new PaginationLink { Active = true, DisplayText = "4", PageIndex = 4, Url = "/test/4" },
new PaginationLink { Active = true, DisplayText = "5", PageIndex = 5, Url = "/test/5" },
new PaginationLink { Active = true, DisplayText = "...", Url = null },
new PaginationLink { Active = true, DisplayText = "16", PageIndex = 16, Url = "/test/16" },
new PaginationLink { Active = true, DisplayText = "17", PageIndex = 17, Url = "/test/17" },
new PaginationLink { Active = true, DisplayText = "»", PageIndex = 2, Url = "/test/2" }
};
// Act
var result = pager.BuildPaginationModel(BuildUrl);
// Assert
Assert.AreEqual(expectedPagination.Count, result.PaginationLinks.Count());
CollectionAssert.AreEqual(expectedPagination, result.PaginationLinks, new PaginationComparer());
}
开发者ID:rafgithub,项目名称:MvcPaging,代码行数:25,代码来源:PagerTests.cs
示例7: ListMsgs
public async Task<IEnumerable<TxtMessage>> ListMsgs(Pager pager = null, bool onlyUnread = true) {
var uid = this.GetUserID();
if (uid.HasValue)
return await this.Biz.GetTxtMsg(uid.Value, pager, onlyUnread);
else
return Enumerable.Empty<TxtMessage>();
}
开发者ID:gruan01,项目名称:MessageCenter,代码行数:7,代码来源:MsgHub.cs
示例8: 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
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
RadTreeNode parentNode = ((administrator_administrator)this.Master).Menu.FindNodeByValue(beans.JobEnum.NumericSettings.ToString());
parentNode.Expanded = true;
RadTreeNode childNode = parentNode.Nodes.FindNodeByValue("list");
if (childNode != null)
childNode.ImageUrl = "images/map_e.png";
ISession session = (ISession)Context.Items[Constant.NHibernateSessionSign];
this.CurrentPlayer = session.Load<Player>(Session[Constant.StaffUserSessionSign]);
int page = 0;
if (Request["key"] != null)
{
double value = 0;
if (double.TryParse(Request["value"], out value))
ServicesList.ConfigurationService.ChangeNumericSetting(this.CurrentPlayer, Request["key"], value, session);
}
if (IsPostBack)
return;
if (Request["p"] != null)
int.TryParse(Request["p"], out page);
int count = 0;
IList<NumericConfiguration> numericConfigurations = ServicesList.ConfigurationService.GetNumericSettings(this.CurrentPlayer, page, out count, session);
this.numericConfigurationRepeater.DataSource = numericConfigurations;
this.numericConfigurationRepeater.DataBind();
Pager pager = new Pager(count, page);
this.lblPaging.Text = pager.GetInfo(Request.Url.AbsolutePath).ToString();
}
开发者ID:DF-thangld,项目名称:web_game,代码行数:32,代码来源:numeric_settings.aspx.cs
示例10: ClassesList
/// <summary>
/// 查看班级列表
/// </summary>
public void ClassesList(int id)
{
CQGJClassesListViewData viewData = new CQGJClassesListViewData();
passport.CQGJPassport cqgj = new CQGJ.passport.CQGJPassport();
string OrgType = HttpContext.Session["OrgType"].ToString();
List<Classes> TempList=null;
if (OrgType.Equals("1"))
{
TempList = (from c in CQGJ.Classes
select c).ToList();
}
if (OrgType.Equals("3"))
{
int OrgID = int.Parse(HttpContext.Session["OrgID"].ToString());
TempList = (from c in CQGJ.Classes
where c.Org.OrgID == OrgID select c).ToList();
}
//取出了所有的列表
//下步是取出实际的列表
viewData.ClassesList = TempList.Skip((id - 1) * 20).Take(20).ToList();
UrlManager urlManager = new DefaultUrlManager(TempList.Count(), 20);
Pager pager = new Pager(urlManager);
viewData.PagerString = pager.PagerString;
RenderView("ClassesList", viewData);
}
开发者ID:dalinhuang,项目名称:cqgj,代码行数:34,代码来源:NotifyController.cs
示例11: PostView
public static string PostView(this UrlHelper urlHelper, PostPart postPart, Pager pager)
{
if (pager.Page >= 2)
return string.Format("{0}#{1}", ThreadView(urlHelper, postPart.ThreadPart, pager), postPart.Id);
else
return PostView(urlHelper, postPart);
}
开发者ID:Trifectgaming,项目名称:Trifect-CMS,代码行数:7,代码来源:UrlHelperExtensions.cs
示例12: 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
示例13: ClassesList
/// <summary>
/// 查看班级列表
/// </summary>
public ActionResult ClassesList(int id)
{
NotifyViewData viewData = new NotifyViewData();
List<Classes> TempList = null;
if (GetOrg().OrgType.ToString().Equals("1"))
{
TempList = (from c in CQGJ.Classes
select c).ToList();
}
if (GetOrg().OrgType.ToString().Equals("3"))
{
int OrgID = GetOrg().OrgID;
TempList = (from c in CQGJ.Classes
where c.Org.OrgID == OrgID
select c).ToList();
}
//取出了所有的列表
//下步是取出实际的列表
viewData.ClassesList = TempList.Skip((id - 1) * 20).Take(20).ToList();
UrlManager urlManager = new DefaultUrlManager(TempList.Count(), 20);
Pager pager = new Pager(urlManager);
viewData.PagerString = pager.PagerString;
return View("ClassesList", viewData);
}
开发者ID:dalinhuang,项目名称:newcqgj,代码行数:32,代码来源:NotifyController.cs
示例14: Initialize
public void Initialize()
{
int page;
int rowsPerPage;
int.TryParse(Query("page"), out page);
int.TryParse(Query("count"), out rowsPerPage);
if (page == 0)
{
page = 1;
}
if (rowsPerPage == 0)
{
rowsPerPage = 10;
}
this.RowsPerPage = rowsPerPage;
this.Page = page;
using (var connection = this.Storage.GetConnection())
{
this.RowCount = connection.Count();
int skip = (Page - 1) * RowsPerPage;
int top = RowsPerPage;
if (skip >= this.RowCount || Page < 1)
{
throw new ArgumentOutOfRangeException("page");
}
this.Rows = connection.Get(skip, top);
}
this.Pager = new Pager(this.Page, this.RowsPerPage, this.RowCount);
}
开发者ID:remunda,项目名称:PugTrace,代码行数:29,代码来源:HomePage.cs
示例15: 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
示例16: 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
示例17: GetJiwangshiPager
public static Pager GetJiwangshiPager(Pager pager,string strwhere,string table)
{
//return JiwangshiDal.GetJiwangshiPage(pager, strwhere,table);
return JiwangshiDal.GetJiwangshiPage(pager, strwhere, table);
}
开发者ID:jorzen2010,项目名称:HealthCrm,代码行数:7,代码来源:JiwangshiBll.cs
示例18: AttachChildControls
protected override void AttachChildControls()
{
this.rptProduct = (ThemedTemplatedRepeater) this.FindControl("rptProduct");
this.pager = (Pager) this.FindControl("pager");
this.litBrandProductResult = (Literal) this.FindControl("litBrandProductResult");
this.cutdownSearch = (Common_CutdownSearch) this.FindControl("search_Common_CutdownSearch");
this.btnSortPrice = (Common_Search_SortPrice) this.FindControl("btn_Common_Search_SortPrice");
this.btnSortTime = (Common_Search_SortTime) this.FindControl("btn_Common_Search_SortTime");
this.btnSortPopularity = (Common_Search_SortPopularity) this.FindControl("btn_Common_Search_SortPopularity");
this.btnSortSaleCounts = (Common_Search_SortSaleCounts) this.FindControl("btn_Common_Search_SortSaleCounts");
this.cutdownSearch.ReSearch += new Common_CutdownSearch.ReSearchEventHandler(this.cutdownSearch_ReSearch);
this.btnSortPrice.Sorting += new Common_Search_SortTime.SortingHandler(this.btnSortPrice_Sorting);
this.btnSortTime.Sorting += new Common_Search_SortTime.SortingHandler(this.btnSortTime_Sorting);
if (this.btnSortPopularity != null)
{
this.btnSortPopularity.Sorting += new Common_Search_SortPopularity.SortingHandler(this.btnSortPopularity_Sorting);
}
if (this.btnSortSaleCounts != null)
{
this.btnSortSaleCounts.Sorting += new Common_Search_SortSaleCounts.SortingHandler(this.btnSortSaleCounts_Sorting);
}
if (!this.Page.IsPostBack)
{
this.BindBrandProduct();
}
}
开发者ID:davinx,项目名称:himedi,代码行数:26,代码来源:Brand.cs
示例19: Daizhen
public ActionResult Daizhen(int? p)
{
Pager pager = new Pager();
pager.table = "CMSCustomer";
pager.strwhere = "1=1";
pager.PageSize = 10;
pager.PageNo = p ?? 1;
pager.FieldKey = "CustomerId";
pager.FiledOrder = "CustomerId Desc";
pager.strwhere = pager.strwhere + " and CustomerTizhi='0'";
pager = CMSService.SelectAll("Customer", pager);
List<CustomerDto> list = new List<CustomerDto>();
foreach (DataRow dr in pager.EntityDataTable.Rows)
{
CustomerDto dto = CustomerMapping.getDTO(dr);
list.Add(dto);
}
pager.Entity = list.AsQueryable();
ViewBag.PageNo = p ?? 1;
ViewBag.PageCount = pager.PageCount;
ViewBag.RecordCount = pager.Amount;
ViewBag.Message = pager.Amount;
return View(pager.Entity);
}
开发者ID:jorzen2010,项目名称:SkyWebCMS,代码行数:28,代码来源:CustomerController.cs
示例20: Can_Build_Correct_Model_For_33_Items_With_2_Item_Per_Page
public void Can_Build_Correct_Model_For_33_Items_With_2_Item_Per_Page()
{
// Assemble
var pager = new Pager(null, 2, 13, 33);
var expectedPagination = new List<PaginationLink>()
{
new PaginationLink { Active = true, DisplayText = "«", PageIndex = 12, Url = "/test/12" },
new PaginationLink { Active = true, DisplayText = "1", PageIndex = 1, Url = "/test/1" },
new PaginationLink { Active = true, DisplayText = "2", PageIndex = 2, Url = "/test/2" },
new PaginationLink { Active = true, DisplayText = "...", Url = null },
new PaginationLink { Active = true, DisplayText = "8", PageIndex = 8, Url = "/test/8" },
new PaginationLink { Active = true, DisplayText = "9", PageIndex = 9, Url = "/test/9" },
new PaginationLink { Active = true, DisplayText = "10", PageIndex = 10, Url = "/test/10" },
new PaginationLink { Active = true, DisplayText = "11", PageIndex = 11, Url = "/test/11" },
new PaginationLink { Active = true, DisplayText = "12", PageIndex = 12, Url = "/test/12" },
new PaginationLink { Active = true, DisplayText = "13", PageIndex = 13, IsCurrent = true, Url = null },
new PaginationLink { Active = true, DisplayText = "14", PageIndex = 14, Url = "/test/14" },
new PaginationLink { Active = true, DisplayText = "15", PageIndex = 15, Url = "/test/15" },
new PaginationLink { Active = true, DisplayText = "16", PageIndex = 16, Url = "/test/16" },
new PaginationLink { Active = true, DisplayText = "17", PageIndex = 17, Url = "/test/17" },
new PaginationLink { Active = true, DisplayText = "»", PageIndex = 14, Url = "/test/14" }
};
// Act
var result = pager.BuildPaginationModel(BuildUrl);
// Assert
Assert.AreEqual(expectedPagination.Count, result.PaginationLinks.Count());
CollectionAssert.AreEqual(expectedPagination, result.PaginationLinks, new PaginationComparer());
}
开发者ID:rafgithub,项目名称:MvcPaging,代码行数:30,代码来源:PagerTests.cs
注:本文中的Pager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论