本文整理汇总了C#中Pager类的典型用法代码示例。如果您正苦于以下问题:C# Pager类的具体用法?C# Pager怎么用?C# Pager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pager类属于命名空间,在下文中一共展示了Pager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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();
}
}
示例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();
}
示例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);
}
示例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);
}
示例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());
}
示例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>();
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}