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(); }
/// <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); }
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); }
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); }
/// <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); }
public static Pager GetCloudHealthPager(Pager pager,string strwhere,string table) { //return CloudHealthDal.GetCloudHealthPage(pager, strwhere,table); return CloudHealthDal.GetCloudHealthPage(pager, strwhere, table); }
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()); }
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); }
public ActionResult List(int? page) { var pager = new Pager(page, 24, 6); PagedList<RegisteredUser> RegisteredUserList = InMemoryDataService.GetAll(pager); ViewData["list"] = RegisteredUserList; return View(RegisteredUserList); }
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(); } }
public ActionResult MyPackages(PagerParameters pagerParameters) { Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters); IUser authenticatedUser = _authenticationService.GetAuthenticatedUser(); var key = _userkeyService.GetAccessKeyForUser(authenticatedUser.Id); dynamic list = _services.New.List(); int startingPackageIndex = pager.GetStartIndex(); IEnumerable<PackagePart> packages = GetPublishedPackagesUserCanManage(authenticatedUser, key, startingPackageIndex, pager.PageSize); int totalPackageCount = GetCountOfPublishedPackagesUserCanManage(authenticatedUser, key); IEnumerable<PackagePart> unpublishedPackages = GetUnpublishedPackagesUserCanManage(authenticatedUser, key); list.AddRange(packages.Select(p => { dynamic packageShape = _services.ContentManager.BuildDisplay(p, "SummaryOwner"); packageShape.HasTags = p.As<TagsPart>().CurrentTags.Count() > 0; return packageShape; } )); var viewModel = new MyPackagesViewModel { Packages = list, TotalNumberOfPackages = totalPackageCount, StartingNumber = startingPackageIndex + 1, EndingNumber = totalPackageCount < startingPackageIndex + pager.PageSize ? totalPackageCount : startingPackageIndex + pager.PageSize, Pager = Shape.Pager(pager).TotalItemCount(totalPackageCount), UnpublishedPackages = unpublishedPackages }; return View(viewModel); }
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); }
// // 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); }
protected override void AttachChildControls() { this.favorites = (Common_Favorite_ProductList) this.FindControl("list_Common_Favorite_ProList"); this.btnSearch = ButtonManager.Create(this.FindControl("btnSearch")); this.txtKeyWord = (TextBox) this.FindControl("txtKeyWord"); this.pager = (Pager) this.FindControl("pager"); this.btnDeleteSelect = (LinkButton) this.FindControl("btnDeleteSelect"); this.btnSearch.Click += new EventHandler(this.btnSearch_Click); this.favorites.ItemCommand += new Common_Favorite_ProductList.CommandEventHandler(this.favorites_ItemCommand); this.btnDeleteSelect.Click += new EventHandler(this.btnDeleteSelect_Click); PageTitle.AddSiteNameTitle("商品收藏夹", HiContext.Current.Context); if (!this.Page.IsPostBack) { if (!string.IsNullOrEmpty(this.Page.Request.QueryString["ProductId"])) { int result = 0; int.TryParse(this.Page.Request.QueryString["ProductId"], out result); if (!CommentsHelper.ExistsProduct(result) && !CommentsHelper.AddProductToFavorite(result)) { this.ShowMessage("添加商品到收藏夹失败", false); } } this.BindList(); } }
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(); } }
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); }
// // 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(); }
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); }
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 }); }
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); }
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='******',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); }
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>(); }
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()); }
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); }
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); }
public static Pager GetJiwangshiPager(Pager pager,string strwhere,string table) { //return JiwangshiDal.GetJiwangshiPage(pager, strwhere,table); return JiwangshiDal.GetJiwangshiPage(pager, strwhere, table); }
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); }
public ActionResult Index(PagerParameters pagerParameters, string type = "Module", string q = "", string s = "") { var pager = new Pager(_orchardService.WorkContext.CurrentSite, pagerParameters); var searchBuilder = GetSearchBuilder(); if (!String.IsNullOrWhiteSpace(q)) { foreach (var field in new[] { "body", "title", "tags", "package-id" }) { searchBuilder.Parse( defaultField: field, query: q, escape: true ).AsFilter(); } } searchBuilder.WithField("package-extension-type", type.ToLowerInvariant()).NotAnalyzed().ExactMatch(); // Only apply custom order if there is no search filter. Otherwise some oddly related packages // might appear at the top. if (String.IsNullOrWhiteSpace(q) && !String.IsNullOrWhiteSpace(s)) { switch (s) { case "download": searchBuilder.SortByInteger("package-download-count"); break; default: // Order by relevance by default. break; } } else if(String.IsNullOrWhiteSpace(q) && String.IsNullOrWhiteSpace(s)) { searchBuilder.SortByInteger("package-download-count"); } var count = searchBuilder.Count(); var pageOfResults = searchBuilder.Slice((pager.Page - 1) * pager.PageSize, pager.PageSize).Search(); var list = _orchardService.New.List(); var foundIds = pageOfResults.Select(searchHit => searchHit.ContentItemId).ToList(); var foundItems = _orchardService.ContentManager.GetMany<IContent>(foundIds, VersionOptions.Published, new QueryHints()).ToList(); foreach (var contentItem in foundItems) { list.Add(_orchardService.ContentManager.BuildDisplay(contentItem, "Summary")); } var pagerShape = _orchardService.New.Pager(pager).TotalItemCount(count); var searchViewModel = _orchardService.New.ViewModel( Query: q, TotalItemCount: count, StartPosition: (pager.Page - 1) * pager.PageSize + 1, EndPosition: pager.Page * pager.PageSize > count ? count : pager.Page * pager.PageSize, ContentItems: list, Pager: pagerShape, Type: type ); return View(searchViewModel); }
protected override void AttachChildControls() { this.refriendscircle = (VshopTemplatedRepeater) this.FindControl("refriendscircle"); this.pager = (Pager) this.FindControl("pager"); this.refriendscircle.ItemDataBound += new RepeaterItemEventHandler(this.refriendscircle_ItemDataBound); this.BindData(); PageTitle.AddSiteNameTitle("朋友圈分享"); }
public ActionResult DeviceFault(int userId, int dId, string pageNo) { //int totalRecord = 0; //int yyyy = DateTime.Now.Year; int intValue = 0; int.TryParse(pageNo, out intValue); Pager page = new Pager() { PageSize = ComConst.PageSize, PageIndex = intValue }; Hashtable table = new Hashtable(); table.Add("page", page); Fault fault = new Fault() { confirmed = "0", device = new Device() { id = dId }, sendTime = DateTime.Now }; table.Add("fault", fault); ViewData["page"] = page; IList<Fault> faultsList = faultService.GetDeviceLogsPage(table); /* totalRecord += (table["page"] as Pager).RecordCount; int startIndex = (intValue - 1) * page.PageSize;//当前页码的开始索引 IList<Fault> faults = new List<Fault>(); if (totalRecord > startIndex) { foreach (Fault item in faultsList) { if (faults.Count < page.PageSize) faults.Add(item); else break; } } while (yyyy-- > DateTime.Now.Year - 5) { //改成开始时间 page.PageIndex = Math.Abs(startIndex + page.PageSize - totalRecord) / page.PageSize; fault.sendTime = fault.sendTime.AddYears(-1); faultsList = faultService.GetDeviceLogsPage(table); int skip = 0; if (Math.Abs(totalRecord - startIndex) < page.PageSize) skip = totalRecord - startIndex; totalRecord += (table["page"] as Pager).RecordCount; if (totalRecord > startIndex) { foreach (Fault item in faultsList) { if (faults.Count < page.PageSize && skip++ >= 0) faults.Add(item); } } } page.RecordCount = totalRecord;//返回查询的所有年数的所有记录 page.PageIndex = intValue; */ ViewData["user"] = UserService.GetInstance().Get(userId); return View("devicefault", faultsList); }
public override void Execute() { WriteLiteral("\r\n"); #line 8 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Layout = new LayoutPage { Title = "Failed Jobs" }; int from, perPage; int.TryParse(Request.Query["from"], out from); int.TryParse(Request.Query["count"], out perPage); var monitor = Storage.GetMonitoringApi(); Pager pager = new Pager(from, perPage, monitor.FailedCount()) { BasePageUrl = Request.LinkTo("/failed") }; JobList <FailedJobDto> failedJobs = monitor .FailedJobs(pager.FromRecord, pager.RecordsPerPage); #line default #line hidden WriteLiteral("\r\n"); #line 26 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" if (pager.TotalPageCount == 0) { #line default #line hidden WriteLiteral(" <div class=\"alert alert-success\">\r\n You have no failed jobs at the mom" + "ent.\r\n </div>\r\n"); #line 31 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" } else { #line default #line hidden WriteLiteral(" <div class=\"js-jobs-list\">\r\n <div class=\"btn-toolbar btn-toolbar-top\">" + "\r\n <button class=\"js-jobs-list-command btn btn-sm btn-primary\"\r\n " + " data-url=\""); #line 37 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(Request.LinkTo("/failed/requeue")); #line default #line hidden WriteLiteral(@""" data-loading-text=""Enqueueing...""> <span class=""glyphicon glyphicon-repeat""></span> Requeue jobs </button> <button class=""js-jobs-list-command btn btn-sm btn-default"" data-url="""); #line 44 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(Request.LinkTo("/failed/delete")); #line default #line hidden WriteLiteral(@""" data-loading-text=""Deleting..."" data-confirm=""Do you really want to DELETE ALL selected jobs?""> <span class=""glyphicon glyphicon-remove""></span> Delete selected </button> "); #line 51 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(RenderPartial(new PerPageSelector(pager))); #line default #line hidden WriteLiteral(@" </div> <table class=""table failed-table""> <thead> <tr> <th class=""min-width""> <input type=""checkbox"" class=""js-jobs-list-select-all"" /> </th> <th class=""min-width"">Id</th> <th>Failed</th> <th>Job</th> </tr> </thead> <tbody> "); #line 66 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" var index = 0; #line default #line hidden #line 67 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" foreach (var job in failedJobs) { #line default #line hidden WriteLiteral(" <tr class=\"js-jobs-list-row "); #line 69 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(!job.Value.InFailedState ? "obsolete-data" : null); #line default #line hidden WriteLiteral(" "); #line 69 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(job.Value.InFailedState ? "hover" : null); #line default #line hidden WriteLiteral("\">\r\n <td rowspan=\""); #line 70 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(job.Value.InFailedState ? "2" : "1"); #line default #line hidden WriteLiteral("\">\r\n"); #line 71 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" if (job.Value.InFailedState) { #line default #line hidden WriteLiteral(" <input type=\"checkbox\" class=\"js-jobs-list-checkb" + "ox\" name=\"jobs[]\" value=\""); #line 73 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(job.Key); #line default #line hidden WriteLiteral("\" />\r\n"); #line 74 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n <td class=\"min-width\" rows" + "pan=\""); #line 76 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(job.Value.InFailedState ? "2" : "1"); #line default #line hidden WriteLiteral("\">\r\n <a href=\""); #line 77 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(Request.LinkTo("/job/" + job.Key)); #line default #line hidden WriteLiteral("\">\r\n "); #line 78 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(HtmlHelper.JobId(job.Key)); #line default #line hidden WriteLiteral("\r\n </a>\r\n"); #line 80 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" if (!job.Value.InFailedState) { #line default #line hidden WriteLiteral(" <span title=\"Job\'s state has been changed while f" + "etching data.\" class=\"glyphicon glyphicon-question-sign\"></span>\r\n"); #line 83 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n <td class=\"min-width\">\r\n"); #line 86 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" if (job.Value.FailedAt.HasValue) { #line default #line hidden WriteLiteral(" <span data-moment=\""); #line 88 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(JobHelper.ToTimestamp(job.Value.FailedAt.Value)); #line default #line hidden WriteLiteral("\">\r\n "); #line 89 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(job.Value.FailedAt); #line default #line hidden WriteLiteral("\r\n </span>\r\n"); #line 91 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n <td>\r\n " + " <div>\r\n <a class=\"job-method\" href=\""); #line 95 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(Request.LinkTo("/job/" + job.Key)); #line default #line hidden WriteLiteral("\">\r\n "); #line 96 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(HtmlHelper.DisplayJob(job.Value.Job)); #line default #line hidden WriteLiteral("\r\n </a>\r\n </div>\r\n"); #line 99 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" if (!String.IsNullOrEmpty(job.Value.ExceptionMessage)) { #line default #line hidden WriteLiteral(" <div style=\"color: #888;\">\r\n " + " "); #line 102 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(job.Value.Reason); #line default #line hidden WriteLiteral(" <a class=\"expander\" href=\"#\">More details...</a>\r\n " + " </div>\r\n"); #line 104 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n </tr>\r\n"); #line 107 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" if (job.Value.InFailedState) { #line default #line hidden WriteLiteral(" <tr>\r\n <td colspan=\"2\" class=\"" + "failed-job-details\">\r\n <div class=\"expandable\" st" + "yle=\""); #line 111 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(index++ == 0 ? "display: block;" : null); #line default #line hidden WriteLiteral("\">\r\n <h4>"); #line 112 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(job.Value.ExceptionType); #line default #line hidden WriteLiteral("</h4>\r\n <p>\r\n " + " "); #line 114 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(job.Value.ExceptionMessage); #line default #line hidden WriteLiteral("\r\n </p>\r\n\r\n"); #line 117 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" if (!String.IsNullOrEmpty(job.Value.ExceptionDetails)) { #line default #line hidden WriteLiteral(" <pre class=\"stack-trace\">"); #line 119 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(HtmlHelper.MarkupStackTrace(job.Value.ExceptionDetails)); #line default #line hidden WriteLiteral("</pre>\r\n"); #line 120 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </div>\r\n </td>\r\n " + " </tr>\r\n"); #line 124 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" } } #line default #line hidden WriteLiteral(" </tbody>\r\n </table>\r\n </div>\r\n"); #line 129 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" #line default #line hidden #line 130 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" Write(RenderPartial(new Paginator(pager))); #line default #line hidden #line 130 "..\..\Dashboard\Pages\FailedJobsPage.cshtml" } #line default #line hidden }
protected override IEnumerable <SampleData> Search(Pager p) { var dataId = p["dataId"].ToLong(-1); var appId = p["appId"].ToInt(-1); var name = p["name"] + ""; var traceId = p["traceId"]; var spanId = p["spanId"]; var parentId = p["parentId"]; var success = p["success"]?.ToBoolean(); //var start = p["dtStart"].ToDateTime(); //var end = p["dtEnd"].ToDateTime(); var start = p["start"].ToLong(-1); var end = p["end"].ToLong(-1); // 指定跟踪标识后,分页500 if (!traceId.IsNullOrEmpty()) { if (p.PageSize == 20) { p.PageSize = 500; } } if (p.Sort.IsNullOrEmpty()) { p.OrderBy = SampleData._.Id.Desc(); } var list = SampleData.Search(dataId, appId, name, traceId, spanId, parentId, success, start, end, p["Q"], p); if (list.Count == 0) { return(list); } // 如果有traceId,则按照要求排序,深度搜索算法 if (!traceId.IsNullOrEmpty() && list.Count > 0) { var rs = new List <SampleData>(); var stack = new Stack <SampleData>(); // 有些数据有pid,但是pid对应的span实际不存在 var pids = list.Where(e => !e.ParentId.IsNullOrEmpty()).OrderByDescending(e => e.StartTime).Select(e => e.ParentId).Distinct().ToArray(); foreach (var item in pids.Where(e => !list.Any(y => y.SpanId == e))) { foreach (var elm in list.Where(e => e.ParentId == item)) { stack.Push(elm); } } foreach (var item in stack) { list.Remove(item); } var pid = ""; while (true) { // 降序入栈 var ps = list.Where(e => e.ParentId + "" == pid).OrderByDescending(e => e.StartTime).ToList(); foreach (var item in ps) { stack.Push(item); list.Remove(item); } // 没有数据,跳出 if (stack.Count == 0) { break; } // 出栈,加入结果,处理它的下级 if (stack.TryPop(out var sd)) { rs.Add(sd); pid = sd.SpanId; } } // 残留的异常数据 rs.AddRange(list); //return rs; list = rs; } if (appId <= 0 && list.Count > 0) { appId = list[0].AppId; } var ar = AppTracer.FindByID(appId); if (ar != null) { ViewBag.Title = $"{ar}采样"; } return(list); }
public ActionResult Index(string sortOrder, string searchString, int?page) { string keyword = string.IsNullOrEmpty(searchString) ? null : searchString.ToUpper(); InstructorIndexData viewModel = new InstructorIndexData(); if (searchString != null) { page = 1; } var instructors = repository.GetInstructors() .Include(i => i.OfficeAssignment) .Include(i => i.Courses.Select(x => x.Department)); if (!string.IsNullOrEmpty(keyword)) { instructors = instructors.Where(x => x.LastName.ToUpper().Contains(keyword) || x.FirstMidName.ToUpper().Contains(keyword)); } switch (sortOrder) { case "Name_desc": instructors = instructors.OrderByDescending(x => x.LastName); break; case "FirstName": instructors = instructors.OrderBy(x => x.FirstMidName); break; case "FirstName_desc": instructors = instructors.OrderByDescending(x => x.FirstMidName); break; case "Date": instructors = instructors.OrderBy(x => x.HireDate); break; case "Date_desc": instructors = instructors.OrderByDescending(x => x.HireDate); break; case "Loc": instructors = instructors.OrderBy(x => x.OfficeAssignment.Location); break; case "Loc_desc": instructors = instructors.OrderByDescending(x => x.OfficeAssignment.Location); break; default: instructors = instructors.OrderBy(x => x.LastName); break; } int pageSize = Constants.PAGE_SIZE; int pageNumber = (page ?? 1); var l = instructors.ToPagedList(pageNumber, pageSize); var lx = l.Select(x => new { PersonID = x.PersonID, LastName = x.LastName, FirstMidName = x.FirstMidName, HireDate = x.HireDate, OfficeAssignment = new { Location = x.OfficeAssignment == null ? null : x.OfficeAssignment.Location }, Courses = x.Courses == null ? null : x.Courses.Select(c => new { CourseID = c.CourseID, Title = c.Title }) }); Pager pager = new Pager(l.TotalItemCount, l.PageNumber, l.PageSize); Dictionary <string, object> res = new Dictionary <string, object> { { "pager", pager }, { "model", lx } }; return(Json(res, JsonRequestBehavior.AllowGet)); }
public override void Execute() { WriteLiteral("\r\n"); #line 9 "..\..\Pages\PublishedPage.cshtml" Layout = new LayoutPage(Strings.PublishedMessagesPage_Title); int from, perPage; int.TryParse(Query("from"), out from); int.TryParse(Query("count"), out perPage); var name = Query("name"); var content = Query("content"); var monitor = Storage.GetMonitoringApi(); var pager = new Pager(from, perPage, GetTotal(monitor)); var queryDto = new MessageQueryDto { MessageType = MessageType.Publish, Name = name, Content = content, StatusName = Name, CurrentPage = pager.CurrentPage - 1, PageSize = pager.RecordsPerPage }; var succeededMessages = monitor.Messages(queryDto); #line default #line hidden WriteLiteral("\r\n<div class=\"row\">\r\n <div class=\"col-md-3\">\r\n "); #line 35 "..\..\Pages\PublishedPage.cshtml" Write(Html.MessagesSidebar(MessageType.Publish)); #line default #line hidden WriteLiteral("\r\n </div>\r\n <div class=\"col-md-9\">\r\n <h1 class=\"page-header\">"); #line 38 "..\..\Pages\PublishedPage.cshtml" Write(Strings.PublishedPage_Title); #line default #line hidden WriteLiteral("</h1>\r\n\r\n"); #line 40 "..\..\Pages\PublishedPage.cshtml" if (succeededMessages.Count == 0) { #line default #line hidden WriteLiteral(" <div class=\"alert alert-info\">\r\n "); #line 43 "..\..\Pages\PublishedPage.cshtml" Write(Strings.MessagesPage_NoMessages); #line default #line hidden WriteLiteral("\r\n </div>\r\n"); #line 45 "..\..\Pages\PublishedPage.cshtml" } else { #line default #line hidden WriteLiteral(@" <div class=""js-jobs-list""> <div class=""btn-toolbar btn-toolbar-top""> <form class=""row""> <div class=""col-md-3""> <input type=""text"" class=""form-control"" name=""name"" value="""); #line 52 "..\..\Pages\PublishedPage.cshtml" Write(Query("name")); #line default #line hidden WriteLiteral("\" placeholder=\""); #line 52 "..\..\Pages\PublishedPage.cshtml" Write(Strings.MessagesPage_Query_MessageName); #line default #line hidden WriteLiteral("\"/>\r\n </div>\r\n <div class=\"col-md-5" + "\">\r\n <div class=\"input-group\">\r\n " + " <input type=\"text\" class=\"form-control\" name=\"content\" value=\""); #line 56 "..\..\Pages\PublishedPage.cshtml" Write(Query("content")); #line default #line hidden WriteLiteral("\" placeholder=\""); #line 56 "..\..\Pages\PublishedPage.cshtml" Write(Strings.MessagesPage_Query_MessageBody); #line default #line hidden WriteLiteral("\"/>\r\n <span class=\"input-group-btn\">\r\n " + " <button class=\"btn btn-info\">"); #line 58 "..\..\Pages\PublishedPage.cshtml" Write(Strings.MessagesPage_Query_Button); #line default #line hidden WriteLiteral(@"</button> </span> </div> </div> </form> </div> <div class=""btn-toolbar btn-toolbar-top""> <button class=""js-jobs-list-command btn btn-sm btn-primary"" data-url="""); #line 66 "..\..\Pages\PublishedPage.cshtml" Write(Url.To("/published/requeue")); #line default #line hidden WriteLiteral("\"\r\n data-loading-text=\""); #line 67 "..\..\Pages\PublishedPage.cshtml" Write(Strings.Common_Enqueueing); #line default #line hidden WriteLiteral("\"\r\n disabled=\"disabled\">\r\n <spa" + "n class=\"glyphicon glyphicon-repeat\"></span>\r\n "); #line 70 "..\..\Pages\PublishedPage.cshtml" Write(Strings.Common_RequeueMessages); #line default #line hidden WriteLiteral("\r\n </button>\r\n\r\n "); #line 73 "..\..\Pages\PublishedPage.cshtml" Write(Html.PerPageSelector(pager)); #line default #line hidden WriteLiteral(@" </div> <div class=""table-responsive""> <table class=""table""> <thead> <tr> <th style=""width: 30px;""> <input type=""checkbox"" class=""js-jobs-list-select-all""/> </th> <th style=""width: 175px"">"); #line 83 "..\..\Pages\PublishedPage.cshtml" Write(Strings.Common_Id); #line default #line hidden WriteLiteral("</th>\r\n <th>"); #line 84 "..\..\Pages\PublishedPage.cshtml" Write(Strings.Common_Version); #line default #line hidden WriteLiteral("</th>\r\n <th>"); #line 85 "..\..\Pages\PublishedPage.cshtml" Write(Strings.MessagesPage_Table_Name); #line default #line hidden WriteLiteral("</th>\r\n <th class=\"min-width\">"); #line 86 "..\..\Pages\PublishedPage.cshtml" Write(Strings.MessagesPage_Table_Retries); #line default #line hidden WriteLiteral("</th>\r\n"); #line 87 "..\..\Pages\PublishedPage.cshtml" if (string.Equals(Name, "Processing", StringComparison.CurrentCultureIgnoreCase)) { #line default #line hidden WriteLiteral(" <th>"); #line 89 "..\..\Pages\PublishedPage.cshtml" Write(Strings.MessagesPage_Table_State); #line default #line hidden WriteLiteral("</th>\r\n"); #line 90 "..\..\Pages\PublishedPage.cshtml" } #line default #line hidden WriteLiteral(" <th class=\"align-right\">"); #line 91 "..\..\Pages\PublishedPage.cshtml" Write(Strings.MessagesPage_Table_ExpiresAt); #line default #line hidden WriteLiteral("</th>\r\n </tr>\r\n </thead>\r\n " + " <tbody>\r\n"); #line 95 "..\..\Pages\PublishedPage.cshtml" foreach (var message in succeededMessages) { #line default #line hidden WriteLiteral(" <tr class=\"js-jobs-list-row hover\">\r\n " + " <td>\r\n <input type=\"checkbox\"" + " class=\"js-jobs-list-checkbox\" name=\"messages[]\" value=\""); #line 99 "..\..\Pages\PublishedPage.cshtml" Write(message.Id); #line default #line hidden WriteLiteral("\" />\r\n </td>\r\n <td " + "class=\"word-break\">\r\n <a href=\"javascript:;\" " + "data-url=\'"); #line 102 "..\..\Pages\PublishedPage.cshtml" Write(Url.To("/published/message/") + message.Id); #line default #line hidden WriteLiteral("\' class=\"openModal\">#"); #line 102 "..\..\Pages\PublishedPage.cshtml" Write(message.Id); #line default #line hidden WriteLiteral("</a>\r\n </td>\r\n <td>" + "\r\n "); #line 105 "..\..\Pages\PublishedPage.cshtml" Write(message.Version); #line default #line hidden WriteLiteral("\r\n </td>\r\n <td>\r\n " + " "); #line 108 "..\..\Pages\PublishedPage.cshtml" Write(message.Name); #line default #line hidden WriteLiteral("\r\n </td>\r\n <td>\r\n " + " "); #line 111 "..\..\Pages\PublishedPage.cshtml" Write(message.Retries); #line default #line hidden WriteLiteral("\r\n </td>\r\n"); #line 113 "..\..\Pages\PublishedPage.cshtml" if (string.Equals(Name, "Processing", StringComparison.CurrentCultureIgnoreCase)) { #line default #line hidden WriteLiteral(" <td>\r\n " + " "); #line 116 "..\..\Pages\PublishedPage.cshtml" Write(message.StatusName); #line default #line hidden WriteLiteral("\r\n </td>\r\n"); #line 118 "..\..\Pages\PublishedPage.cshtml" } #line default #line hidden WriteLiteral(" <td class=\"align-right\">\r\n"); #line 120 "..\..\Pages\PublishedPage.cshtml" if (message.ExpiresAt.HasValue) { #line default #line hidden #line 122 "..\..\Pages\PublishedPage.cshtml" Write(Html.RelativeTime(message.ExpiresAt.Value)); #line default #line hidden #line 122 "..\..\Pages\PublishedPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n\r\n </tr>\r\n"); #line 127 "..\..\Pages\PublishedPage.cshtml" } #line default #line hidden WriteLiteral(" </tbody>\r\n </table>\r\n <" + "/div>\r\n "); #line 131 "..\..\Pages\PublishedPage.cshtml" Write(Html.Paginator(pager)); #line default #line hidden WriteLiteral("\r\n </div>\r\n"); #line 133 "..\..\Pages\PublishedPage.cshtml" #line default #line hidden WriteLiteral(@" <div> <div class=""modal fade"" tabindex=""-1"" role=""dialog""> <div class=""modal-dialog"" role=""document""> <div class=""modal-content""> <div class=""modal-header""> <button type=""button"" class=""close"" data-dismiss=""modal"" aria-label=""Close""> <span aria-hidden=""true"">×</span> </button> <h4 class=""modal-title"">Message Content</h4> </div> <div id=""jsonContent"" style=""max-height: 500px; overflow-y: auto;"" class=""modal-body""> </div> <div class=""modal-footer""> <button type=""button"" class=""btn btn-sm btn-primary"" id=""formatBtn"" onclick="""">"); #line 147 "..\..\Pages\PublishedPage.cshtml" Write(Strings.MessagesPage_Modal_Format); #line default #line hidden WriteLiteral("</button>\r\n <button type=\"button\" class=\"btn btn-s" + "m btn-primary\" id=\"rawBtn\" onclick=\"\">"); #line 148 "..\..\Pages\PublishedPage.cshtml" Write(Strings.MessagesPage_Modal_Raw); #line default #line hidden WriteLiteral("</button>\r\n <button type=\"button\" class=\"btn btn-s" + "m btn-primary\" id=\"expandBtn\" onclick=\"\">"); #line 149 "..\..\Pages\PublishedPage.cshtml" Write(Strings.MessagesPage_Modal_Expand); #line default #line hidden WriteLiteral("</button>\r\n <button type=\"button\" class=\"btn btn-s" + "m btn-primary\" id=\"collapseBtn\" onclick=\"\">"); #line 150 "..\..\Pages\PublishedPage.cshtml" Write(Strings.MessagesPage_Model_Collaspse); #line default #line hidden WriteLiteral("</button>\r\n </div>\r\n </div><!--" + " /.modal-content -->\r\n </div><!-- /.modal-dialog -->\r\n " + " </div><!-- /.modal -->\r\n </div>\r\n"); #line 156 "..\..\Pages\PublishedPage.cshtml" } #line default #line hidden WriteLiteral(" </div>\r\n</div>"); }
public async Task <IEnumerable <PostItem> > GetList(Expression <Func <BlogPost, bool> > predicate, Pager pager) { var skip = pager.CurrentPage * pager.ItemsPerPage - pager.ItemsPerPage; var drafts = _db.BlogPosts .Where(p => p.Published == DateTime.MinValue).Where(predicate) .OrderByDescending(p => p.Published).ToList(); var pubs = _db.BlogPosts .Where(p => p.Published > DateTime.MinValue).Where(predicate) .OrderByDescending(p => p.IsFeatured) .ThenByDescending(p => p.Published).ToList(); var items = drafts.Concat(pubs).ToList(); pager.Configure(items.Count); var postPage = items.Skip(skip).Take(pager.ItemsPerPage).ToList(); return(await Task.FromResult(PostListToItems(postPage))); }
private async Task <IEnumerable <Post> > GetPagedListAsync(IEnumerable <Expression <Func <Post, bool> > > predicates, Pager pager, string pagingUrlPartFormat, CancellationToken cancellationToken) { var skip = (pager.CurrentPage - 1) * pager.ItemsPerPage; var count = await _uow.Posts.CountAsync(predicates, cancellationToken); pager.Configure(count, pagingUrlPartFormat); return(await _uow.Posts.GetAsync(predicates, skip, pager.ItemsPerPage, cancellationToken)); }
/// <summary> /// 获取分页数据 /// </summary> /// <param name="pager"></param> /// <param name="strCardNo">身份证号码</param> /// <param name="strStatus">0为未分配,1为已分配</param> /// <returns></returns> public DataTable GetPagerData(ref Pager pager, string strCardNo, string strStatus) { return(_mTB_AssignRoomDAL.GetTable(ref pager, strCardNo, strStatus)); }
/// <summary> /// 定义在获取分页数据之后的操作 /// </summary> /// <param name="pager"></param> protected virtual void AfterGetPageData(Pager <T> pager) { }
/// <summary> /// 获取所有的宣传图片 /// </summary> /// <returns></returns> public IList <Adpic> GetAdpicPage(Pager page) { return(_adpic.GetAdpicPage(page)); }
public IActionResult ListApplicants(string search, string val, int?page, int PerPage) { Console.WriteLine(search); Console.WriteLine(val); if (!String.IsNullOrEmpty(val) || !String.IsNullOrWhiteSpace(val)) { ViewBag.Message = val; ViewBag.search = search; } var token = HttpContext.Session.GetString("JWTToken"); var jwtSec = new JwtSecurityTokenHandler(); var securityToken = jwtSec.ReadToken(token) as JwtSecurityToken; var sub = securityToken?.Claims.First(Claim => Claim.Type == "sub").Value; ViewBag.admin = sub; var countLeave = from i in _AppDbContext.leaveRequests where i.Status == "Pending" select i; var countLeave1 = countLeave.Count(); ViewBag.countLeaveReq = countLeave1; PerPage = 5; ViewBag.PerPage = PerPage; if (!String.IsNullOrEmpty(search) || !String.IsNullOrWhiteSpace(search)) { System.Console.WriteLine("search"); if (val == "Home") { System.Console.WriteLine("home"); var applicants = from x in _AppDbContext.applicants where (x.Name.Contains(search) || x.Email.Contains(search) || x.Phone.Contains(search) || x.Position.Contains(search) || x.Departement.Contains(search)) select x; ViewBag.applicants = applicants; var applicantsUnprocessed = from x in _AppDbContext.applicants where x.Status == "Unprocessed" select x; ViewBag.applicantsUnprocessed = applicantsUnprocessed; var applicantsScheduledPsychoTest = from x in _AppDbContext.applicants where x.Status == "Scheduled to Psycho Test" select x; ViewBag.applicantsScheduledPsychoTest = applicantsScheduledPsychoTest; var applicantsScheduledInterview = from x in _AppDbContext.applicants where x.Status == "Scheduled to Interview" select x; ViewBag.applicantsScheduledInterview = applicantsScheduledInterview; var pager = new Pager(applicants.Count(), page, PerPage); var viewModel = new IndexViewModel { Applicant = applicants.Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize), Pager = pager }; return(View(viewModel)); } else if (val == "News") { System.Console.WriteLine("news"); var applicants = from x in _AppDbContext.applicants select x; ViewBag.applicants = applicants; var applicantsUnprocessed = from x in _AppDbContext.applicants where x.Status == "Unprocessed" && (x.Name.Contains(search) || x.Email.Contains(search) || x.Phone.Contains(search) || x.Position.Contains(search) || x.Departement.Contains(search)) select x; ViewBag.applicantsUnprocessed = applicantsUnprocessed; var applicantsScheduledPsychoTest = from x in _AppDbContext.applicants where x.Status == "Scheduled to Psycho Test" select x; ViewBag.applicantsScheduledPsychoTest = applicantsScheduledPsychoTest; var applicantsScheduledInterview = from x in _AppDbContext.applicants where x.Status == "Scheduled to Interview" select x; ViewBag.applicantsScheduledInterview = applicantsScheduledInterview; var pager = new Pager(applicantsUnprocessed.Count(), page, PerPage); var viewModel = new IndexViewModel { Applicant = applicantsUnprocessed.Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize), Pager = pager }; return(View(viewModel)); } else if (val == "Contact") { System.Console.WriteLine("contact"); var applicants = from x in _AppDbContext.applicants select x; ViewBag.applicants = applicants; var applicantsUnprocessed = from x in _AppDbContext.applicants where x.Status == "Unprocessed" select x; ViewBag.applicantsUnprocessed = applicantsUnprocessed; var applicantsScheduledPsychoTest = from x in _AppDbContext.applicants where x.Status == "Scheduled to Psycho Test" && (x.Name.Contains(search) || x.Email.Contains(search) || x.Phone.Contains(search) || x.Position.Contains(search) || x.Departement.Contains(search)) select x; ViewBag.applicantsScheduledPsychoTest = applicantsScheduledPsychoTest; var applicantsScheduledInterview = from x in _AppDbContext.applicants where x.Status == "Scheduled to Interview" select x; ViewBag.applicantsScheduledInterview = applicantsScheduledInterview; var pager = new Pager(applicantsScheduledPsychoTest.Count(), page, PerPage); var viewModel = new IndexViewModel { Applicant = applicantsScheduledPsychoTest.Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize), Pager = pager }; return(View(viewModel)); } else if (val == "About") { System.Console.WriteLine("about"); var applicants = from x in _AppDbContext.applicants select x; ViewBag.applicants = applicants; var applicantsUnprocessed = from x in _AppDbContext.applicants where x.Status == "Unprocessed" select x; ViewBag.applicantsUnprocessed = applicantsUnprocessed; var applicantsScheduledPsychoTest = from x in _AppDbContext.applicants where x.Status == "Scheduled to Psycho Test" select x; ViewBag.applicantsScheduledPsychoTest = applicantsScheduledPsychoTest; var applicantsScheduledInterview = from x in _AppDbContext.applicants where x.Status == "Scheduled to Interview" && (x.Name.Contains(search) || x.Email.Contains(search) || x.Phone.Contains(search) || x.Position.Contains(search) || x.Departement.Contains(search)) select x; ViewBag.applicantsScheduledInterview = applicantsScheduledInterview; var pager = new Pager(applicantsScheduledInterview.Count(), page, PerPage); var viewModel = new IndexViewModel { Applicant = applicantsScheduledInterview.Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize), Pager = pager }; return(View(viewModel)); } } else { var applicants = from i in _AppDbContext.applicants select i; ViewBag.applicants = applicants; var applicantsUnprocessed = from i in _AppDbContext.applicants where i.Status == "Unprocessed" select i; ViewBag.applicantsUnprocessed = applicantsUnprocessed; var applicantsScheduledPsychoTest = from i in _AppDbContext.applicants where i.Status == "Scheduled to Psycho Test" select i; ViewBag.applicantsScheduledPsychoTest = applicantsScheduledPsychoTest; var applicantsScheduledInterview = from i in _AppDbContext.applicants where i.Status == "Scheduled to Interview" select i; ViewBag.applicantsScheduledInterview = applicantsScheduledInterview; var pager = new Pager(applicants.Count(), page, PerPage); var viewModel = new IndexViewModel { Applicant = applicants.Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize), Pager = pager }; return(View(viewModel)); } return(View()); }
/* ** Query status information for a single database connection */ static int sqlite3_db_status( sqlite3 db, /* The database connection whose status is desired */ int op, /* Status verb */ ref int pCurrent, /* Write current value here */ ref int pHighwater, /* Write high-water mark here */ int resetFlag /* Reset high-water mark if true */ ) { int rc = SQLITE_OK; /* Return code */ sqlite3_mutex_enter(db.mutex); switch (op) { case SQLITE_DBSTATUS_LOOKASIDE_USED: { pCurrent = db.lookaside.nOut; pHighwater = db.lookaside.mxOut; if (resetFlag != 0) { db.lookaside.mxOut = db.lookaside.nOut; } break; } case SQLITE_DBSTATUS_LOOKASIDE_HIT: case SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE: case SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL: { testcase(op == SQLITE_DBSTATUS_LOOKASIDE_HIT); testcase(op == SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE); testcase(op == SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL); Debug.Assert((op - SQLITE_DBSTATUS_LOOKASIDE_HIT) >= 0); Debug.Assert((op - SQLITE_DBSTATUS_LOOKASIDE_HIT) < 3); pCurrent = 0; pHighwater = db.lookaside.anStat[op - SQLITE_DBSTATUS_LOOKASIDE_HIT]; if (resetFlag != 0) { db.lookaside.anStat[op - SQLITE_DBSTATUS_LOOKASIDE_HIT] = 0; } break; } /* ** Return an approximation for the amount of memory currently used ** by all pagers associated with the given database connection. The ** highwater mark is meaningless and is returned as zero. */ case SQLITE_DBSTATUS_CACHE_USED: { int totalUsed = 0; int i; sqlite3BtreeEnterAll(db); for (i = 0; i < db.nDb; i++) { Btree pBt = db.aDb[i].pBt; if (pBt != null) { Pager pPager = sqlite3BtreePager(pBt); totalUsed += sqlite3PagerMemUsed(pPager); } } sqlite3BtreeLeaveAll(db); pCurrent = totalUsed; pHighwater = 0; break; } /* ** *pCurrent gets an accurate estimate of the amount of memory used ** to store the schema for all databases (main, temp, and any ATTACHed ** databases. *pHighwater is set to zero. */ case SQLITE_DBSTATUS_SCHEMA_USED: { int i; /* Used to iterate through schemas */ int nByte = 0; /* Used to accumulate return value */ sqlite3BtreeEnterAll(db); //db.pnBytesFreed = nByte; for (i = 0; i < db.nDb; i++) { Schema pSchema = db.aDb[i].pSchema; if (ALWAYS(pSchema != null)) { HashElem p; //nByte += (int)(sqlite3GlobalConfig.m.xRoundup(sizeof(HashElem)) * ( // pSchema.tblHash.count // + pSchema.trigHash.count // + pSchema.idxHash.count // + pSchema.fkeyHash.count //)); //nByte += (int)sqlite3MallocSize( pSchema.tblHash.ht ); //nByte += (int)sqlite3MallocSize( pSchema.trigHash.ht ); //nByte += (int)sqlite3MallocSize( pSchema.idxHash.ht ); //nByte += (int)sqlite3MallocSize( pSchema.fkeyHash.ht ); for (p = sqliteHashFirst(pSchema.trigHash); p != null; p = sqliteHashNext(p)) { Trigger t = (Trigger)sqliteHashData(p); sqlite3DeleteTrigger(db, ref t); } for (p = sqliteHashFirst(pSchema.tblHash); p != null; p = sqliteHashNext(p)) { Table t = (Table)sqliteHashData(p); sqlite3DeleteTable(db, ref t); } } } db.pnBytesFreed = 0; sqlite3BtreeLeaveAll(db); pHighwater = 0; pCurrent = nByte; break; } /* ** *pCurrent gets an accurate estimate of the amount of memory used ** to store all prepared statements. ** *pHighwater is set to zero. */ case SQLITE_DBSTATUS_STMT_USED: { Vdbe pVdbe; /* Used to iterate through VMs */ int nByte = 0; /* Used to accumulate return value */ //db.pnBytesFreed = nByte; for (pVdbe = db.pVdbe; pVdbe != null; pVdbe = pVdbe.pNext) { sqlite3VdbeDeleteObject(db, ref pVdbe); } db.pnBytesFreed = 0; pHighwater = 0; pCurrent = nByte; break; } default: { rc = SQLITE_ERROR; break; } } sqlite3_mutex_leave(db.mutex); return(rc); }
protected virtual List <TEntity> GetPagerData(Pager pager) { return(this.Service.SelectAll(pager)); }
public static Pager <XuatNhapChiTiet> pagerTuNgayDenNgayKhoIdDmId(string url, bool rewrite, string sort, string q, int size, string TuNgay, string DenNgay, string KHO_ID, string DM_ID, string KH_ID) { var obj = new SqlParameter[7]; if (!string.IsNullOrEmpty(sort)) { obj[0] = new SqlParameter("Sort", sort); } else { obj[0] = new SqlParameter("Sort", DBNull.Value); } if (!string.IsNullOrEmpty(q)) { obj[1] = new SqlParameter("q", q); } else { obj[1] = new SqlParameter("q", DBNull.Value); } if (!string.IsNullOrEmpty(TuNgay)) { obj[2] = new SqlParameter("TuNgay", TuNgay); } else { obj[2] = new SqlParameter("TuNgay", DBNull.Value); } if (!string.IsNullOrEmpty(DenNgay)) { obj[3] = new SqlParameter("DenNgay", DenNgay); } else { obj[3] = new SqlParameter("DenNgay", DBNull.Value); } if (!string.IsNullOrEmpty(KHO_ID)) { obj[4] = new SqlParameter("KHO_ID", KHO_ID); } else { obj[4] = new SqlParameter("KHO_ID", DBNull.Value); } if (!string.IsNullOrEmpty(DM_ID)) { obj[5] = new SqlParameter("DM_ID", DM_ID); } else { obj[5] = new SqlParameter("DM_ID", DBNull.Value); } if (!string.IsNullOrEmpty(KH_ID)) { obj[6] = new SqlParameter("KH_ID", KH_ID); } else { obj[6] = new SqlParameter("KH_ID", DBNull.Value); } var pg = new Pager <XuatNhapChiTiet>("sp_tblXuatNhapChiTiet_Select_TuNgayDenNgayKhoIdDmId_linhnx", "page", size, 10, rewrite, url, obj); return(pg); }
private void List() { string strKeyword = Microsoft.JScript.GlobalObject.unescape(RequestClass.GetString("keyword")).Trim().Replace("'", ""); string strDTstartDate = RequestClass.GetString("dtstartDate").Trim().Replace("'", ""); string strDTendDate = RequestClass.GetString("dtendDate").Trim().Replace("'", ""); string strSortRule = RequestClass.GetString("sortrule").Trim().Replace("'", ""); string strSortField = RequestClass.GetString("sortfield").Trim().Replace("'", ""); string orderClass = String.Empty; if (string.IsNullOrEmpty(strSortField)) { strSortField = "AP_Time"; strSortRule = "desc"; orderClass = "taxisDown"; } else { if (strSortRule.Equals("asc")) { orderClass = "taxisUp"; } else { orderClass = "taxisDown"; } } StringBuilder sbWhere = new StringBuilder(" where AP_AU_Code="); sbWhere.Append(UserSession.User.AU_Code); StringBuilder sbList = new StringBuilder(); //if (0 < strKeyword.Length) //{ // sbWhere.Append(" and (CG_Title like '%"); // sbWhere.Append(strKeyword); // sbWhere.Append("%' or CG_Desc like '%"); // sbWhere.Append(strKeyword); // sbWhere.Append("%')"); //} sbList.Append("<table class=\"t-bd\"><tr>"); sbList.Append("<th class=\"w40\">Sequence </th>"); sbList.Append("<th style=\"cursor:pointer;\" "); if (strSortField.Equals("AP_Code")) { sbList.Append("class=\"w40 taxisCurrent\" onclick=\"changeOrder(this,'AP_Code')\">ID<span class=\""); sbList.Append(orderClass); sbList.Append("\" title=\"Sort by the column \"></span></th>"); } else { sbList.Append("class=\"w40\" onclick=\"changeOrder(this,'AP_Code')\">ID<span class=\"taxis\" title=\"Sort by the column \"></span></th>"); } sbList.Append("<th>CI_Code</th>"); sbList.Append("<th>CS_Style_EN</th>"); sbList.Append("<th>AD_Name_EN</th>"); sbList.Append("<th>DE_ID</th>"); sbList.Append("<th style=\"cursor:pointer;\" "); if (strSortField.Equals("AP_Time")) { sbList.Append("class=\"taxisCurrent\" onclick=\"changeOrder(this,'AP_Time')\">AP_Time<span class=\""); sbList.Append(orderClass); sbList.Append("\" title=\"Sort by the column \"></span></th>"); } else { sbList.Append(" onclick=\"changeOrder(this,'AP_Time')\">AP_Time<span class=\"taxis\" title=\"Sort by the column \"></span></th>"); } sbList.Append("<th class=\"w100\">Operate</th>"); //初始化变量 int intRowsCount = 0; //总行数 int intPageCount = 0; //总页数 int intCurrentPage = RequestClass.GetInt("page", 1); //当前页 int intPageSize = RequestClass.GetInt("pagesize", 15);; //每页条数 //得到数据表 //var dt = DbHelperSQL.ProcedurePagerByProc("[App_getList]", "AP_Code", "*", strSortField, strSortRule, sbWhere.ToString(), intCurrentPage, intPageSize, out intPageCount, out intRowsCount).Tables[0]; var dt = new DataTable(); if (null != dt && dt.Rows.Count > 0) { //生成分页html var strPager = new StringBuilder(); if (1 < intPageCount) { strPager = Pager.JavascriptPagination(true, intCurrentPage, intPageCount, intRowsCount); } for (int i = 0; i < dt.Rows.Count; i++) { var intID = dt.Rows[i][0]; var intRows = i + 1; sbList.Append("<tr><td>"); sbList.Append(((i + 1) + (intCurrentPage - 1) * intPageSize)); sbList.Append("</td><td>"); sbList.Append(intID); sbList.Append("</td><td>"); sbList.Append(dt.Rows[i][1]); sbList.Append("</td><td>"); sbList.Append(dt.Rows[i][2]); sbList.Append("</td><td>"); sbList.Append(dt.Rows[i][3]); sbList.Append("</td><td>"); sbList.Append(dt.Rows[i][4]); sbList.Append("</td><td>"); sbList.Append(Convert.ToDateTime(dt.Rows[i][5].ToString()).ToString("MM/dd/yyyy HH:mm")); sbList.Append("</td><td>"); sbList.Append("<a href=\"/manage/Appointment/Appointment.aspx?id="); sbList.Append(intID); sbList.Append("\"><i class=\"btnModify\" title=\"edit\"></i></a>"); sbList.Append("<a href=\"javascript:;\"><i class=\"btnDelete\" title=\"Delete\" onclick=\"Delete("); sbList.Append(intID); sbList.Append(")\"></i></a>"); sbList.Append("</td></tr>"); } sbList.Append("</table>"); sbList.Append(strPager); } else { sbList.Append("<tr ><td colspan=\"10\"><div class=\"noData\">No matching data!</div></td></tr>"); sbList.Append("</tbody>"); sbList.Append("</table>"); } Response.Write(sbList); }
public override ActionResult Index(Pager p = null) { return(base.Index(p)); }
public async Task <IEnumerable <AssetItem> > Find(Func <AssetItem, bool> predicate, Pager pager, string path = "") { var skip = pager.CurrentPage * pager.ItemsPerPage - pager.ItemsPerPage; var files = GetAssets(path); var items = MapFilesToAssets(files); if (predicate != null) { items = items.Where(predicate).ToList(); } pager.Configure(items.Count); var page = items.Skip(skip).Take(pager.ItemsPerPage).ToList(); return(await Task.FromResult(page)); }
public async Task <IActionResult> Index(TenantIndexOptions options, PagerParameters pagerParameters) { var allSettings = _shellHost.GetAllSettings().OrderBy(s => s.Name); var dataProtector = _dataProtectorProvider.CreateProtector("Tokens").ToTimeLimitedDataProtector(); var siteSettings = await _siteService.GetSiteSettingsAsync(); var pager = new Pager(pagerParameters, siteSettings.PageSize); // default options if (options == null) { options = new TenantIndexOptions(); } var entries = allSettings.Select(x => { var entry = new ShellSettingsEntry { Name = x.Name, ShellSettings = x, IsDefaultTenant = string.Equals(x.Name, ShellHelper.DefaultShellName, StringComparison.OrdinalIgnoreCase) }; if (x.State == TenantState.Uninitialized && !string.IsNullOrEmpty(x["Secret"])) { entry.Token = dataProtector.Protect(x["Secret"], _clock.UtcNow.Add(new TimeSpan(24, 0, 0))); } return(entry); }).ToList(); if (!string.IsNullOrWhiteSpace(options.Search)) { entries = entries.Where(t => t.Name.IndexOf(options.Search, StringComparison.OrdinalIgnoreCase) > -1 || (t.ShellSettings != null && ((t.ShellSettings.RequestUrlHost != null && t.ShellSettings.RequestUrlHost.IndexOf(options.Search, StringComparison.OrdinalIgnoreCase) > -1) || (t.ShellSettings.RequestUrlPrefix != null && t.ShellSettings.RequestUrlPrefix.IndexOf(options.Search, StringComparison.OrdinalIgnoreCase) > -1)))).ToList(); } switch (options.Filter) { case TenantsFilter.Disabled: entries = entries.Where(t => t.ShellSettings.State == TenantState.Disabled).ToList(); break; case TenantsFilter.Running: entries = entries.Where(t => t.ShellSettings.State == TenantState.Running).ToList(); break; case TenantsFilter.Uninitialized: entries = entries.Where(t => t.ShellSettings.State == TenantState.Uninitialized).ToList(); break; } switch (options.OrderBy) { case TenantsOrder.Name: entries = entries.OrderBy(t => t.Name).ToList(); break; case TenantsOrder.State: entries = entries.OrderBy(t => t.ShellSettings?.State).ToList(); break; default: entries = entries.OrderByDescending(t => t.Name).ToList(); break; } var count = entries.Count(); var results = entries .Skip(pager.GetStartIndex()) .Take(pager.PageSize).ToList(); // 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.OrderBy", options.OrderBy); var pagerShape = (await New.Pager(pager)).TotalItemCount(count).RouteData(routeData); var model = new AdminIndexViewModel { ShellSettingsEntries = results, Options = options, Pager = pagerShape }; // We populate the SelectLists model.Options.TenantsStates = new List <SelectListItem>() { new SelectListItem() { Text = S["All states"], Value = nameof(TenantsFilter.All) }, new SelectListItem() { Text = S["Running"], Value = nameof(TenantsFilter.Running) }, new SelectListItem() { Text = S["Disabled"], Value = nameof(TenantsFilter.Disabled) }, new SelectListItem() { Text = S["Uninitialized"], Value = nameof(TenantsFilter.Uninitialized) } }; model.Options.TenantsSorts = new List <SelectListItem>() { new SelectListItem() { Text = S["Name"], Value = nameof(TenantsOrder.Name) }, new SelectListItem() { Text = S["State"], Value = nameof(TenantsOrder.State) } }; model.Options.TenantsBulkAction = new List <SelectListItem>() { new SelectListItem() { Text = S["Disable"], Value = nameof(TenantsBulkAction.Disable) }, new SelectListItem() { Text = S["Enable"], Value = nameof(TenantsBulkAction.Enable) } }; return(View(model)); }
public IEnumerable <ProfileListItem> ProfileList(Expression <Func <Profile, bool> > predicate, Pager pager) { var skip = pager.CurrentPage * pager.ItemsPerPage - pager.ItemsPerPage; var all = this.db.Profiles.Include(p => p.Assets).Include(p => p.BlogPosts).Where(predicate); pager.Configure(all.Count()); var posts = all.OrderBy(p => p.Id).Skip(skip).Take(pager.ItemsPerPage).ToList(); return(posts.Select(p => new ProfileListItem { ProfileId = p.Id, Title = p.Title, Email = p.AuthorEmail, Url = ApplicationSettings.BlogRoute + "/" + p.Slug, IdentityName = p.IdentityName, AuthorName = p.AuthorName, IsAdmin = p.IsAdmin, PostCount = p.BlogPosts.Count, PostViews = this.db.BlogPosts.Where(bp => bp.Profile.Id == p.Id).Sum(bp => bp.PostViews), DbUsage = this.db.BlogPosts.Where(bp => bp.Profile.Id == p.Id).Sum(bp => Convert.ToInt32(bp.Content.Length)), AssetCount = p.Assets.Count, DownloadCount = this.db.Assets.Where(a => a.ProfileId == p.Id).Sum(a => a.DownloadCount), DiskUsage = this.db.Assets.Where(a => a.ProfileId == p.Id).Sum(a => a.Length), LastUpdated = p.LastUpdated })); }
public override void Execute() { WriteLiteral("\r\n"); #line 8 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" Layout = new LayoutPage { Title = "Deleted Jobs" }; int from, perPage; int.TryParse(Request.Query["from"], out from); int.TryParse(Request.Query["count"], out perPage); var monitor = Storage.GetMonitoringApi(); Pager pager = new Pager(from, perPage, monitor.DeletedListCount()) { BasePageUrl = Request.LinkTo("/deleted") }; JobList <DeletedJobDto> jobs = monitor.DeletedJobs(pager.FromRecord, pager.RecordsPerPage); #line default #line hidden WriteLiteral("\r\n"); #line 25 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" if (pager.TotalPageCount == 0) { #line default #line hidden WriteLiteral(" <div class=\"alert alert-info\">\r\n No deleted jobs found.\r\n </div>\r\n"); #line 30 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" } else { #line default #line hidden WriteLiteral(" <div class=\"js-jobs-list\">\r\n <div class=\"btn-toolbar btn-toolbar-top\">" + "\r\n <button class=\"js-jobs-list-command btn btn-sm btn-primary\"\r\n " + " data-url=\""); #line 36 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" Write(Request.LinkTo("/deleted/requeue")); #line default #line hidden WriteLiteral("\"\r\n data-loading-text=\"Enqueueing...\">\r\n <span " + "class=\"glyphicon glyphicon-repeat\"></span>\r\n Requeue jobs\r\n " + " </button>\r\n "); #line 41 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" Write(RenderPartial(new PerPageSelector(pager))); #line default #line hidden WriteLiteral(@" </div> <table class=""table""> <thead> <tr> <th class=""min-width""> <input type=""checkbox"" class=""js-jobs-list-select-all"" /> </th> <th class=""min-width"">Id</th> <th>Job</th> <th class=""align-right"">Deleted</th> </tr> </thead> <tbody> "); #line 55 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" foreach (var job in jobs) { #line default #line hidden WriteLiteral(" <tr class=\"js-jobs-list-row "); #line 57 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" Write(job.Value != null && !job.Value.InDeletedState ? "obsolete-data" : null); #line default #line hidden WriteLiteral(" "); #line 57 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" Write(job.Value != null && job.Value.InDeletedState && job.Value != null ? "hover" : null); #line default #line hidden WriteLiteral("\">\r\n <td>\r\n"); #line 59 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" if (job.Value != null && job.Value.InDeletedState) { #line default #line hidden WriteLiteral(" <input type=\"checkbox\" class=\"js-jobs-list-checkb" + "ox\" name=\"jobs[]\" value=\""); #line 61 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" Write(job.Key); #line default #line hidden WriteLiteral("\" />\r\n"); #line 62 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n <td class=\"min-width\">\r\n " + " <a href=\""); #line 65 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" Write(Request.LinkTo("/job/" + job.Key)); #line default #line hidden WriteLiteral("\">\r\n "); #line 66 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" Write(HtmlHelper.JobId(job.Key)); #line default #line hidden WriteLiteral("\r\n </a>\r\n"); #line 68 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" if (job.Value != null && !job.Value.InDeletedState) { #line default #line hidden WriteLiteral(" <span title=\"Job\'s state has been changed while f" + "etching data.\" class=\"glyphicon glyphicon-question-sign\"></span>\r\n"); #line 71 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n\r\n"); #line 74 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" if (job.Value == null) { #line default #line hidden WriteLiteral(" <td colspan=\"2\">\r\n <em" + ">Job has expired.</em>\r\n </td>\r\n"); #line 79 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" } else { #line default #line hidden WriteLiteral(" <td>\r\n <a class=\"job-m" + "ethod\" href=\""); #line 83 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" Write(Request.LinkTo("/job/" + job.Key)); #line default #line hidden WriteLiteral("\">\r\n "); #line 84 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" Write(HtmlHelper.DisplayMethod(job.Value.Job)); #line default #line hidden WriteLiteral("\r\n </a>\r\n </td>\r\n"); WriteLiteral(" <td class=\"align-right\">\r\n"); #line 88 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" if (job.Value.DeletedAt.HasValue) { #line default #line hidden WriteLiteral(" <span data-moment=\""); #line 90 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" Write(JobHelper.ToTimestamp(job.Value.DeletedAt.Value)); #line default #line hidden WriteLiteral("\">\r\n "); #line 91 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" Write(job.Value.DeletedAt); #line default #line hidden WriteLiteral("\r\n </span>\r\n"); #line 93 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n"); #line 95 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </tr>\r\n"); #line 97 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </tbody>\r\n </table>\r\n </div>\r\n"); #line 101 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" #line default #line hidden #line 101 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" Write(RenderPartial(new Paginator(pager))); #line default #line hidden #line 101 "..\..\Dashboard\Pages\DeletedJobsPage.cshtml" } #line default #line hidden }
public static OperateResult GetByPager(QueryParam param = null) { try { using (DbContextRoot db = new DbContextRoot()) { var elements = from e in db.rightList.Include("module") orderby e.module.showIndex select new { e.id, moduleName = e.module.name, e.name, e.url, e.icon, e.show, e.authorize }; #region 查询过滤 if (param != null && param.filters != null) { // 过滤显示 #region 过滤显示 if (param.filters.Keys.Contains("show")) { var p = param.filters["show"]; bool v = Convert.ToBoolean(p.value); elements = elements.Where(t => t.show == v); } #endregion } #endregion int total = elements.Count(); int pages = 0; Pager pager = param.pager; if (pager == null || pager.rows == 0) { pages = total > 0 ? 1 : 0; } else { pages = total / (pager.rows == 0 ? 20 : pager.rows); pages = total % pager.rows == 0 ? pages : pages + 1; if (pager.page <= 1) { elements = elements.Take(pager.rows); } else { elements = elements.Skip((pager.page - 1) * pager.rows).Take(pager.rows); } } var data = new { pages, total, rows = elements.ToList() }; return(new OperateResult { status = OperateStatus.Success, data = data, }); } } catch (Exception ex) { return(new OperateResult { content = Model.Utility.Utility.GetExceptionMsg(ex), }); } }
public override void Execute() { WriteLiteral("\r\n"); #line 10 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Layout = new LayoutPage(Strings.RecurringJobsPage_Title); List <RecurringJobDto> recurringJobs; int from, perPage; int.TryParse(Query("from"), out from); int.TryParse(Query("count"), out perPage); Pager pager = null; using (var connection = Storage.GetConnection()) { var storageConnection = connection as JobStorageConnection; if (storageConnection != null) { pager = new Pager(from, perPage, storageConnection.GetRecurringJobCount()); recurringJobs = storageConnection.GetRecurringJobs(pager.FromRecord, pager.FromRecord + pager.RecordsPerPage); } else { recurringJobs = connection.GetRecurringJobs(); } } #line default #line hidden WriteLiteral("\r\n<div class=\"row\">\r\n <div class=\"col-md-12\">\r\n <h1 class=\"page-header\"" + ">"); #line 38 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.RecurringJobsPage_Title); #line default #line hidden WriteLiteral("</h1>\r\n"); #line 39 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" if (recurringJobs.Count == 0) { #line default #line hidden WriteLiteral(" <div class=\"alert alert-info\">\r\n "); #line 42 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.RecurringJobsPage_NoJobs); #line default #line hidden WriteLiteral("\r\n </div>\r\n"); #line 44 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } else { #line default #line hidden WriteLiteral(" <div class=\"js-jobs-list\">\r\n <div class=\"btn-toolbar b" + "tn-toolbar-top\">\r\n"); #line 49 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" if (!IsReadOnly) { #line default #line hidden WriteLiteral(" <button class=\"js-jobs-list-command btn btn-sm btn-primar" + "y\"\r\n data-url=\""); #line 52 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Url.To("/recurring/trigger")); #line default #line hidden WriteLiteral("\"\r\n data-loading-text=\""); #line 53 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.RecurringJobsPage_Triggering); #line default #line hidden WriteLiteral("\"\r\n disabled=\"disabled\">\r\n " + " <span class=\"glyphicon glyphicon-play-circle\"></span>\r\n " + " "); #line 56 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.RecurringJobsPage_TriggerNow); #line default #line hidden WriteLiteral("\r\n </button>\r\n"); #line 58 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } #line default #line hidden #line 59 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" if (!IsReadOnly) { #line default #line hidden WriteLiteral(" <button class=\"js-jobs-list-command btn btn-sm btn-defaul" + "t\"\r\n data-url=\""); #line 62 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Url.To("/recurring/remove")); #line default #line hidden WriteLiteral("\"\r\n data-loading-text=\""); #line 63 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.Common_Deleting); #line default #line hidden WriteLiteral("\"\r\n data-confirm=\""); #line 64 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.Common_DeleteConfirm); #line default #line hidden WriteLiteral("\"\r\n disabled=\"disabled\">\r\n " + " <span class=\"glyphicon glyphicon-remove\"></span>\r\n " + " "); #line 67 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.Common_Delete); #line default #line hidden WriteLiteral("\r\n </button>\r\n"); #line 69 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } #line default #line hidden #line 70 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" if (pager != null) { #line default #line hidden WriteLiteral(" "); WriteLiteral(" "); #line 72 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Html.PerPageSelector(pager)); #line default #line hidden WriteLiteral("\r\n"); #line 73 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </div>\r\n\r\n <div class=\"table-responsive\">\r\n " + " <table class=\"table\">\r\n <thead>\r\n " + " <tr>\r\n"); #line 80 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" if (!IsReadOnly) { #line default #line hidden WriteLiteral(" <th class=\"min-width\">\r\n " + " <input type=\"checkbox\" class=\"js-jobs-list-select-all\"/>\r\n " + " </th>\r\n"); #line 85 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } #line default #line hidden WriteLiteral(" <th class=\"min-width\">"); #line 86 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.Common_Id); #line default #line hidden WriteLiteral("</th>\r\n <th class=\"min-width\">"); #line 87 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.RecurringJobsPage_Table_Cron); #line default #line hidden WriteLiteral("</th>\r\n <th class=\"min-width\">"); #line 88 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.RecurringJobsPage_Table_TimeZone); #line default #line hidden WriteLiteral("</th>\r\n <th>"); #line 89 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.Common_Job); #line default #line hidden WriteLiteral("</th>\r\n <th class=\"align-right min-width\">"); #line 90 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.RecurringJobsPage_Table_NextExecution); #line default #line hidden WriteLiteral("</th>\r\n <th class=\"align-right min-width\">"); #line 91 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.RecurringJobsPage_Table_LastExecution); #line default #line hidden WriteLiteral("</th>\r\n <th class=\"align-right min-width\">"); #line 92 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.Common_Created); #line default #line hidden WriteLiteral("</th>\r\n </tr>\r\n </thead>\r\n " + " <tbody>\r\n"); #line 96 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" foreach (var job in recurringJobs) { #line default #line hidden WriteLiteral(" <tr class=\"js-jobs-list-row hover\">\r\n"); #line 99 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" if (!IsReadOnly) { #line default #line hidden WriteLiteral(" <td>\r\n " + " <input type=\"checkbox\" class=\"js-jobs-list-checkbox\" name=\"jobs[]\" valu" + "e=\""); #line 102 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(job.Id); #line default #line hidden WriteLiteral("\"/>\r\n </td>\r\n"); #line 104 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } #line default #line hidden WriteLiteral(" <td class=\"min-width\">"); #line 105 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(job.Id); #line default #line hidden WriteLiteral("</td>\r\n <td class=\"min-width\">\r\n " + " "); WriteLiteral("\r\n"); #line 108 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" string cronDescription = null; #if NETFULL try { cronDescription = string.IsNullOrEmpty(job.Cron) ? null : CronExpressionDescriptor.ExpressionDescriptor.GetDescription(job.Cron); } catch (FormatException) { } #endif #line default #line hidden WriteLiteral("\r\n"); #line 121 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" if (cronDescription != null) { #line default #line hidden WriteLiteral(" <code title=\""); #line 123 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(cronDescription); #line default #line hidden WriteLiteral("\">"); #line 123 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(job.Cron); #line default #line hidden WriteLiteral("</code>\r\n"); #line 124 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } else { #line default #line hidden WriteLiteral(" <code>"); #line 127 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(job.Cron); #line default #line hidden WriteLiteral("</code>\r\n"); #line 128 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n <t" + "d class=\"min-width\">\r\n"); #line 131 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" if (!String.IsNullOrWhiteSpace(job.TimeZoneId)) { #line default #line hidden WriteLiteral(" <span title=\""); #line 133 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(TimeZoneInfo.FindSystemTimeZoneById(job.TimeZoneId).DisplayName); #line default #line hidden WriteLiteral("\" data-container=\"body\">"); #line 133 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(job.TimeZoneId); #line default #line hidden WriteLiteral("</span>\r\n"); #line 134 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } else { #line default #line hidden WriteLiteral(" "); WriteLiteral(" UTC\r\n"); #line 138 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n <t" + "d class=\"word-break\">\r\n"); #line 141 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" if (job.Job != null) { #line default #line hidden WriteLiteral(" "); WriteLiteral(" "); #line 143 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Html.JobName(job.Job)); #line default #line hidden WriteLiteral("\r\n"); #line 144 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } else { #line default #line hidden WriteLiteral(" <em>"); #line 147 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(job.LoadException.InnerException.Message); #line default #line hidden WriteLiteral("</em>\r\n"); #line 148 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n <t" + "d class=\"align-right min-width\">\r\n"); #line 151 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" if (job.NextExecution != null) { #line default #line hidden #line 153 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Html.RelativeTime(job.NextExecution.Value)); #line default #line hidden #line 153 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } else { #line default #line hidden WriteLiteral(" <em>"); #line 157 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.Common_NotAvailable); #line default #line hidden WriteLiteral("</em>\r\n"); #line 158 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n <t" + "d class=\"align-right min-width\">\r\n"); #line 161 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" if (job.LastExecution != null) { if (!String.IsNullOrEmpty(job.LastJobId)) { #line default #line hidden WriteLiteral(" <a href=\""); #line 165 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Url.JobDetails(job.LastJobId)); #line default #line hidden WriteLiteral("\">\r\n <span class=\"label label-" + "default label-hover\" style=\""); #line 166 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write($"background-color: {JobHistoryRenderer.GetForegroundStateColor(job.LastJobState)};"); #line default #line hidden WriteLiteral("\">\r\n "); #line 167 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Html.RelativeTime(job.LastExecution.Value)); #line default #line hidden WriteLiteral("\r\n </span>\r\n " + " </a>\r\n"); #line 170 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } else { #line default #line hidden WriteLiteral(" <em>\r\n " + " "); #line 174 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.RecurringJobsPage_Canceled); #line default #line hidden WriteLiteral(" "); #line 174 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Html.RelativeTime(job.LastExecution.Value)); #line default #line hidden WriteLiteral("\r\n </em>\r\n"); #line 176 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } } else { #line default #line hidden WriteLiteral(" <em>"); #line 180 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Strings.Common_NotAvailable); #line default #line hidden WriteLiteral("</em>\r\n"); #line 181 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n <t" + "d class=\"align-right min-width\">\r\n"); #line 184 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" if (job.CreatedAt != null) { #line default #line hidden #line 186 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Html.RelativeTime(job.CreatedAt.Value)); #line default #line hidden #line 186 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } else { #line default #line hidden WriteLiteral(" <em>N/A</em>\r\n"); #line 191 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n </tr>\r" + "\n"); #line 194 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </tbody>\r\n </table>\r\n <" + "/div>\r\n\r\n"); #line 199 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" if (pager != null) { #line default #line hidden WriteLiteral(" "); WriteLiteral(" "); #line 201 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" Write(Html.Paginator(pager)); #line default #line hidden WriteLiteral("\r\n"); #line 202 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </div>\r\n"); #line 204 "..\..\Dashboard\Pages\RecurringJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </div>\r\n</div> "); }
public List <OrganizationUnit> SelectOrganizationUnitByOrganizations(Pager pager, int[] organizationIds, bool isAggregatedChildren = false) { List <OrganizationUnit> items = this.SelectByColumnIds(pager, "OrganizationId", organizationIds, isAggregatedChildren); return(items); }
public JsonResult LoadData(Pager page, SearchVipProduct condition) { var rows = _vipProductQuery.GetPageList(page, condition); return(Json(new { success = true, data = rows, total = page.Total })); }
public override void Execute() { WriteLiteral("\r\n"); #line 9 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Layout = new LayoutPage(Queue.ToUpperInvariant()); int from, perPage; int.TryParse(Query("from"), out from); int.TryParse(Query("count"), out perPage); var monitor = Storage.GetMonitoringApi(); var pager = new Pager(from, perPage, monitor.FetchedCount(Queue)); var fetchedJobs = monitor.FetchedJobs(Queue, pager.FromRecord, pager.RecordsPerPage); #line default #line hidden WriteLiteral("\r\n<div class=\"row\">\r\n <div class=\"col-md-3\">\r\n "); #line 24 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Html.JobsSidebar()); #line default #line hidden WriteLiteral("\r\n </div>\r\n <div class=\"col-md-9\">\r\n "); #line 27 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Html.Breadcrumbs(Strings.FetchedJobsPage_Title, new Dictionary <string, string> { { "Queues", Url.LinkToQueues() }, { Queue.ToUpperInvariant(), Url.Queue(Queue) } })); #line default #line hidden WriteLiteral("\r\n\r\n <h1 class=\"page-header\">\r\n "); #line 34 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Queue.ToUpperInvariant()); #line default #line hidden WriteLiteral(" <small>"); #line 34 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Strings.FetchedJobsPage_Title); #line default #line hidden WriteLiteral("</small>\r\n </h1>\r\n\r\n"); #line 37 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" if (pager.TotalPageCount == 0) { #line default #line hidden WriteLiteral(" <div class=\"alert alert-info\">\r\n "); #line 40 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Strings.FetchedJobsPage_NoJobs); #line default #line hidden WriteLiteral("\r\n </div>\r\n"); #line 42 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" } else { #line default #line hidden WriteLiteral(" <div class=\"js-jobs-list\">\r\n <div class=\"btn-toolbar btn-toolb" + "ar-top\">\r\n"); #line 47 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" if (!IsReadOnly) { #line default #line hidden WriteLiteral(" <button class=\"js-jobs-list-command btn btn-sm btn-primary\"\r\n" + " data-url=\""); #line 50 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Url.To("/jobs/enqueued/requeue")); #line default #line hidden WriteLiteral("\"\r\n data-loading-text=\""); #line 51 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Strings.Common_Enqueueing); #line default #line hidden WriteLiteral("\"\r\n disabled=\"disabled\">\r\n <spa" + "n class=\"glyphicon glyphicon-repeat\"></span>\r\n "); #line 54 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Strings.Common_RequeueJobs); #line default #line hidden WriteLiteral("\r\n </button>\r\n"); #line 56 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" } #line default #line hidden #line 57 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" if (!IsReadOnly) { #line default #line hidden WriteLiteral(" <button class=\"js-jobs-list-command btn btn-sm btn-default\"\r\n" + " data-url=\""); #line 60 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Url.To("/jobs/enqueued/delete")); #line default #line hidden WriteLiteral("\"\r\n data-loading-text=\""); #line 61 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Strings.Common_Deleting); #line default #line hidden WriteLiteral("\"\r\n data-confirm=\""); #line 62 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Strings.Common_DeleteConfirm); #line default #line hidden WriteLiteral("\"\r\n disabled=\"disabled\">\r\n <spa" + "n class=\"glyphicon glyphicon-remove\"></span>\r\n "); #line 65 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Strings.Common_DeleteSelected); #line default #line hidden WriteLiteral("\r\n </button>\r\n"); #line 67 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" "); #line 68 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Html.PerPageSelector(pager)); #line default #line hidden WriteLiteral("\r\n </div>\r\n\r\n <div class=\"table-responsive\">\r\n " + " <table class=\"table\">\r\n <thead>\r\n <" + "tr>\r\n"); #line 75 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" if (!IsReadOnly) { #line default #line hidden WriteLiteral(" <th class=\"min-width\">\r\n " + " <input type=\"checkbox\" class=\"js-jobs-list-select-all\"/>\r\n " + " </th>\r\n"); #line 80 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" <th class=\"min-width\">"); #line 81 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Strings.Common_Id); #line default #line hidden WriteLiteral("</th>\r\n <th class=\"min-width\">"); #line 82 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Strings.Common_State); #line default #line hidden WriteLiteral("</th>\r\n <th>"); #line 83 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Strings.Common_Job); #line default #line hidden WriteLiteral("</th>\r\n <th class=\"align-right\">"); #line 84 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Strings.Common_Fetched); #line default #line hidden WriteLiteral("</th>\r\n </tr>\r\n </thead>\r\n " + " <tbody>\r\n"); #line 88 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" foreach (var job in fetchedJobs) { #line default #line hidden WriteLiteral(" <tr class=\"js-jobs-list-row hover "); #line 90 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(job.Value == null ? "obsolete-data" : null); #line default #line hidden WriteLiteral("\">\r\n"); #line 91 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" if (!IsReadOnly) { #line default #line hidden WriteLiteral(" <td>\r\n"); #line 94 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" if (job.Value != null) { #line default #line hidden WriteLiteral(" <input type=\"checkbox\" class=\"js-jobs" + "-list-checkbox\" name=\"jobs[]\" value=\""); #line 96 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(job.Key); #line default #line hidden WriteLiteral("\"/>\r\n"); #line 97 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n"); #line 99 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" <td class=\"min-width\">\r\n " + " "); #line 101 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Html.JobIdLink(job.Key)); #line default #line hidden WriteLiteral("\r\n </td>\r\n"); #line 103 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" if (job.Value == null) { #line default #line hidden WriteLiteral(" <td colspan=\"3\"><em>"); #line 105 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Strings.Common_JobExpired); #line default #line hidden WriteLiteral("</em></td>\r\n"); #line 106 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" } else { #line default #line hidden WriteLiteral(" <td class=\"min-width\">\r\n " + " "); #line 110 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Html.StateLabel(job.Value.State)); #line default #line hidden WriteLiteral("\r\n </td>\r\n"); WriteLiteral(" <td class=\"word-break\">\r\n " + " "); #line 113 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Html.JobNameLink(job.Key, job.Value.Job)); #line default #line hidden WriteLiteral("\r\n </td>\r\n"); WriteLiteral(" <td class=\"align-right\">\r\n"); #line 116 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" if (job.Value.FetchedAt.HasValue) { #line default #line hidden #line 118 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Html.RelativeTime(job.Value.FetchedAt.Value)); #line default #line hidden #line 118 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </td>\r\n"); #line 121 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </tr>\r\n"); #line 123 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </tbody>\r\n </table>\r\n </div>\r\n\r\n " + " "); #line 128 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" Write(Html.Paginator(pager)); #line default #line hidden WriteLiteral("\r\n </div>\r\n"); #line 130 "..\..\Dashboard\Pages\FetchedJobsPage.cshtml" } #line default #line hidden WriteLiteral(" </div>\r\n</div>"); }
public async Task <IActionResult> Register(UsersViewModel model, string returnUrl = null) { ViewData["ReturnUrl"] = returnUrl; ViewData["AdminPage"] = true; if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.RegisterModel.Email, Email = model.RegisterModel.Email }; var result = await _userManager.CreateAsync(user, model.RegisterModel.Password); if (result.Succeeded) { _logger.LogInformation(string.Format("Created a new account for {0}", user.UserName)); // create new profile var profile = new Profile(); if (_db.Profiles.All().ToList().Count == 0 || model.RegisterModel.IsAdmin) { profile.IsAdmin = true; } profile.AuthorName = model.RegisterModel.AuthorName; profile.AuthorEmail = model.RegisterModel.Email; profile.Title = "New blog"; profile.Description = "New blog description"; profile.IdentityName = user.UserName; profile.Slug = SlugFromTitle(profile.AuthorName); profile.Avatar = ApplicationSettings.ProfileAvatar; profile.BlogTheme = BlogSettings.Theme; profile.LastUpdated = SystemClock.Now(); _db.Profiles.Add(profile); _db.Complete(); _logger.LogInformation(string.Format("Created a new profile at /{0}", profile.Slug)); if (model.RegisterModel.SendEmailNotification) { var userUrl = string.Format("{0}://{1}/{2}", Request.Scheme, Request.Host, profile.Slug); await _emailSender.SendEmailWelcomeAsync(model.RegisterModel.Email, model.RegisterModel.AuthorName, userUrl); } return(RedirectToLocal(returnUrl)); } AddErrors(result); } // If we got this far, something failed, redisplay form var pager = new Pager(1); var blogs = _db.Profiles.ProfileList(p => p.Id > 0, pager); var regModel = GetUsersModel(); regModel.Blogs = blogs; regModel.Pager = pager; return(View(_theme + "Settings/Users.cshtml", regModel)); }
/// <summary>搜索数据集</summary> /// <param name="p"></param> /// <returns></returns> protected override IEnumerable <User> Search(Pager p) { var id = p["id"].ToInt(-1); if (id > 0) { var list = new List <User>(); var entity = FindByID(id); entity.Password = null; if (entity != null) { list.Add(entity); } return(list); } var roleId = p["roleId"].ToInt(-1); var roleIds = p["roleIds"]?.Split(","); var departmentId = p["departmentId"].ToInt(-1); var departmentIds = p["departmentIds"]?.Split(","); var enable = p["enable"]?.ToBoolean(); var start = p["dtStart"].ToDateTime(); var end = p["dtEnd"].ToDateTime(); var key = p["q"]; //p.RetrieveState = true; //return XCode.Membership.User.Search(roleId, departmentId, enable, start, end, key, p); var exp = new WhereExpression(); if (roleId >= 0) { exp &= _.RoleID == roleId | _.RoleIds.Contains("," + roleId + ","); } if (roleIds != null && roleIds.Length > 0) { exp &= _.RoleID.In(roleIds) | _.RoleIds.Contains("," + roleIds.Join(",") + ","); } if (departmentId >= 0) { exp &= _.DepartmentID == departmentId; } if (departmentIds != null && departmentIds.Length > 0) { exp &= _.DepartmentID.In(departmentIds); } if (enable != null) { exp &= _.Enable == enable.Value; } exp &= _.LastLogin.Between(start, end); if (!key.IsNullOrEmpty()) { exp &= _.Code.StartsWith(key) | _.Name.StartsWith(key) | _.DisplayName.StartsWith(key) | _.Mobile.StartsWith(key) | _.Mail.StartsWith(key); } var list2 = XCode.Membership.User.FindAll(exp, p); foreach (var user in list2) { user.Password = null; } return(list2); }
//public string wid; protected override void AttachChildControls() { this.rptCategories = (VshopTemplatedRepeater)this.FindControl("rptCategories"); this.rptProducts = (VshopTemplatedRepeater)this.FindControl("rptProducts"); this.rptProducts.ItemDataBound += new RepeaterItemEventHandler(this.rptProducts_ItemDataBound); this.rptCategories.ItemDataBound += new RepeaterItemEventHandler(this.rptCategories_ItemDataBound); this.img = (HtmlImage)this.FindControl("imgDefaultBg"); this.pager = (Pager)this.FindControl("pager"); this.litstorename = (Literal)this.FindControl("litstorename"); this.litdescription = (Literal)this.FindControl("litdescription"); this.litattention = (Literal)this.FindControl("litattention"); this.imglogo = (HiImage)this.FindControl("imglogo"); this.litImgae = (Literal)this.FindControl("litImgae"); this.litItemParams = (Literal)this.FindControl("litItemParams"); if (string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralId"])) { HttpCookie cookie = HttpContext.Current.Request.Cookies["Vshop-ReferralId"]; if ((cookie != null) && !string.IsNullOrEmpty(cookie.Value)) { this.Page.Response.Redirect("Default.aspx?ReferralId=" + cookie.Value); } } if (this.rptCategories.Visible) { DataTable brandCategories = CategoryBrowser.GetBrandCategories(wid); this.itemcount = brandCategories.Rows.Count; if (brandCategories.Rows.Count > 0) { this.rptCategories.DataSource = brandCategories; this.rptCategories.DataBind(); } } this.Page.Session["stylestatus"] = "3"; SiteSettings masterSettings = SettingsManager.GetMasterSettings(false, wid); PageTitle.AddSiteNameTitle(masterSettings.SiteName); this.litstorename.Text = masterSettings.SiteName; this.litdescription.Text = masterSettings.ShopIntroduction; if (!string.IsNullOrEmpty(masterSettings.DistributorLogoPic)) { this.imglogo.ImageUrl = masterSettings.DistributorLogoPic.Split(new char[] { '|' })[0]; } if (base.referralId <= 0) { HttpCookie cookie2 = HttpContext.Current.Request.Cookies["Vshop-ReferralId"]; if ((cookie2 != null) && !string.IsNullOrEmpty(cookie2.Value)) { base.referralId = int.Parse(cookie2.Value); this.Page.Response.Redirect("Default.aspx?ReferralId=" + this.referralId.ToString(), true); } } else { HttpCookie cookie3 = HttpContext.Current.Request.Cookies["Vshop-ReferralId"]; if (((cookie3 != null) && !string.IsNullOrEmpty(cookie3.Value)) && (this.referralId.ToString() != cookie3.Value)) { this.Page.Response.Redirect("Default.aspx?ReferralId=" + this.referralId.ToString(), true); } } IList <BannerInfo> allBanners = new List <BannerInfo>(); allBanners = VshopBrowser.GetAllBanners(); foreach (BannerInfo info in allBanners) { TplCfgInfo info2 = new NavigateInfo { LocationType = info.LocationType, Url = info.Url }; string loctionUrl = "javascript:"; if (!string.IsNullOrEmpty(info.Url)) { loctionUrl = info2.LoctionUrl; } string text = this.litImgae.Text; this.litImgae.Text = text + "<a id=\"ahref\" href='" + loctionUrl + "'><img src=\"" + info.ImageUrl + "\" title=\"" + info.ShortDesc + "\" alt=\"" + info.ShortDesc + "\" /></a>"; } if (allBanners.Count == 0) { this.litImgae.Text = "<a id=\"ahref\" href='javascript:'><img src=\"/Utility/pics/default.jpg\" title=\"\" /></a>"; } DistributorsInfo userIdDistributors = new DistributorsInfo(); userIdDistributors = DistributorsBrower.GetUserIdDistributors(base.referralId); if ((userIdDistributors != null) && (userIdDistributors.UserId > 0)) { PageTitle.AddSiteNameTitle(userIdDistributors.StoreName); this.litdescription.Text = userIdDistributors.StoreDescription; this.litstorename.Text = userIdDistributors.StoreName; if (!string.IsNullOrEmpty(userIdDistributors.Logo)) { this.imglogo.ImageUrl = userIdDistributors.Logo; } else if (!string.IsNullOrEmpty(masterSettings.DistributorLogoPic)) { this.imglogo.ImageUrl = masterSettings.DistributorLogoPic.Split(new char[] { '|' })[0]; } if (!string.IsNullOrEmpty(userIdDistributors.BackImage)) { this.litImgae.Text = ""; foreach (string str2 in userIdDistributors.BackImage.Split(new char[] { '|' })) { if (!string.IsNullOrEmpty(str2)) { this.litImgae.Text = this.litImgae.Text + "<a ><img src=\"" + str2 + "\" title=\"\" /></a>"; } } } } this.dtpromotion = ProductBrowser.GetAllFull(); if (this.rptProducts != null) { ProductQuery query = new ProductQuery { PageSize = this.pager.PageSize, PageIndex = this.pager.PageIndex, SortBy = "DisplaySequence", SortOrder = SortAction.Desc }; DbQueryResult homeProduct = ProductBrowser.GetHomeProduct(MemberProcessor.GetCurrentMember(), query); this.rptProducts.DataSource = homeProduct.Data; this.rptProducts.DataBind(); this.pager.TotalRecords = homeProduct.TotalRecords; if (this.pager.TotalRecords <= this.pager.PageSize) { this.pager.Visible = false; } } if (this.img != null) { this.img.Src = new VTemplateHelper().GetDefaultBg(); } if (!string.IsNullOrEmpty(masterSettings.GuidePageSet)) { this.litattention.Text = masterSettings.GuidePageSet; } string str3 = ""; if (!string.IsNullOrEmpty(masterSettings.ShopHomePic)) { str3 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.ShopHomePic; } string str4 = ""; string str5 = (userIdDistributors == null) ? masterSettings.SiteName : userIdDistributors.StoreName; if (!string.IsNullOrEmpty(masterSettings.DistributorBackgroundPic)) { str4 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.DistributorBackgroundPic.Split(new char[] { '|' })[0]; } this.litItemParams.Text = str3 + "|" + masterSettings.ShopHomeName + "|" + masterSettings.ShopHomeDescription + "$"; this.litItemParams.Text = string.Concat(new object[] { this.litItemParams.Text, str4, "|好店推荐之", str5, "商城|一个购物赚钱的好去处|", HttpContext.Current.Request.Url }); }
public IEnumerable <Employee> GetEmployeesByPage(int pager) { Pager p = new Pager(pager); return(_employeeRepository.GetEmployeesByPage(p)); }
protected ActionResult ListExtensions(PackagingExtensionsOptions options, string packageType, Pager pager) { var selectedSource = _packagingSourceManager.GetSources().Where(s => s.Id == options.SourceId).FirstOrDefault(); var sources = selectedSource != null ? new[] { selectedSource } : _packagingSourceManager.GetSources() ; IEnumerable <PackagingEntry> extensions = null; int totalCount = 0; foreach (var source in sources) { try { Expression <Func <PublishedPackage, bool> > packagesCriteria = p => p.PackageType == packageType && p.IsLatestVersion && (string.IsNullOrEmpty(options.SearchText) || p.Title.Contains(options.SearchText) || p.Description.Contains(options.SearchText) || p.Tags.Contains(options.SearchText)); var sourceExtensions = _packagingSourceManager.GetExtensionList(true, source, packages => { packages = packages.Where(packagesCriteria); switch (options.Order) { case PackagingExtensionsOrder.Downloads: packages = packages.OrderByDescending(p => p.DownloadCount).ThenBy(p => p.Title); break; case PackagingExtensionsOrder.Ratings: packages = packages.OrderByDescending(p => p.Rating).ThenBy(p => p.Title); break; case PackagingExtensionsOrder.Alphanumeric: packages = packages.OrderBy(p => p.Title); break; } if (pager.PageSize != 0) { packages = packages.Skip((pager.Page - 1) * pager.PageSize).Take(pager.PageSize); } return(packages); }).ToArray(); // count packages separately to prevent loading everything just to count totalCount += _packagingSourceManager.GetExtensionCount( source, packages => packages.Where(packagesCriteria)); extensions = extensions == null ? sourceExtensions : extensions.Concat(sourceExtensions); // apply another paging rule in case there were multiple sources if (sources.Count() > 1) { switch (options.Order) { case PackagingExtensionsOrder.Downloads: extensions = extensions.OrderByDescending(p => p.DownloadCount).ThenBy(p => p.Title); break; case PackagingExtensionsOrder.Ratings: extensions = extensions.OrderByDescending(p => p.Rating).ThenBy(p => p.Title); break; case PackagingExtensionsOrder.Alphanumeric: extensions = extensions.OrderBy(p => p.Title); break; } if (pager.PageSize != 0) { extensions = extensions.Take(pager.PageSize); } } } catch (Exception exception) { Services.Notifier.Error(T("Error loading extensions from gallery source '{0}'. {1}.", source.FeedTitle, exception.Message)); } } extensions = extensions ?? new PackagingEntry[0]; var pagerShape = Services.New.Pager(pager).TotalItemCount(totalCount); // maintain previous route data when generating page links var routeData = new RouteData(); routeData.Values.Add("Options.Order", options.Order); routeData.Values.Add("Options.SearchText", options.SearchText); routeData.Values.Add("Options.SourceId", options.SourceId); pagerShape.RouteData(routeData); extensions = extensions.ToList(); // Populate the notifications IEnumerable <Tuple <ExtensionDescriptor, PackagingEntry> > extensionDescriptors = _extensionManager.AvailableExtensions() .Join(extensions, extensionDescriptor => extensionDescriptor.Id, packaginEntry => packaginEntry.ExtensionId(), (extensionDescriptor, packagingEntry) => new Tuple <ExtensionDescriptor, PackagingEntry>(extensionDescriptor, packagingEntry)); foreach (Tuple <ExtensionDescriptor, PackagingEntry> packagings in extensionDescriptors) { packagings.Item2.Installed = true; if (_extensionDisplayEventHandler != null) { foreach (string notification in _extensionDisplayEventHandler.Displaying(packagings.Item1, ControllerContext.RequestContext)) { packagings.Item2.Notifications.Add(notification); } } } return(View(packageType == DefaultExtensionTypes.Theme ? "Themes" : "Modules", new PackagingExtensionsViewModel { Extensions = extensions, Sources = _packagingSourceManager.GetSources().OrderBy(s => s.FeedTitle), Pager = pagerShape, Options = options })); }
protected override void AttachChildControls() { this.lblminDraws = (Literal)this.FindControl("lblminDraws"); this.lblBanlance = (Literal)this.FindControl("lblBanlance"); this.txtAmount = (TextBox)this.FindControl("txtAmount"); this.txtTradePassword = (TextBox)this.FindControl("txtTradePassword"); this.btnDraw = ButtonManager.Create(this.FindControl("btnDraw")); this.txtBankName = (TextBox)this.FindControl("txtBankName"); this.txtAccountName = (TextBox)this.FindControl("txtAccountName"); this.txtMerchantCode = (TextBox)this.FindControl("txtMerchantCode"); this.txtAlipayRealName = (TextBox)this.FindControl("txtAlipayRealName"); this.txtAlipayCode = (TextBox)this.FindControl("txtAlipayCode"); this.txtRemark = (TextBox)this.FindControl("txtRemark"); this.IsWithdrawToAccount = (RadioButton)this.FindControl("IsWithdrawToAccount"); this.IsDefault = (RadioButton)this.FindControl("IsDefault"); this.IsWeixin = (RadioButton)this.FindControl("IsWeixin"); this.IsAlipay = (RadioButton)this.FindControl("IsAlipay"); this.rptSplittinDraw = (Common_Referral_SplittinDraw)this.FindControl("Common_Referral_Splitin"); this.pager = (Pager)this.FindControl("pager"); this.btnDraw.Click += this.btnDraw_Click; PageTitle.AddSiteNameTitle("申请提现"); if (!this.Page.IsPostBack) { MemberInfo user = HiContext.Current.User; if (!user.IsOpenBalance || string.IsNullOrEmpty(user.TradePassword)) { this.Page.Response.Redirect($"/user/OpenBalance?ReturnUrl={HttpContext.Current.Request.Url}"); } BalanceDrawRequestQuery balanceDrawRequestQuery = new BalanceDrawRequestQuery(); balanceDrawRequestQuery.PageIndex = 1; balanceDrawRequestQuery.PageSize = this.pager.PageSize; balanceDrawRequestQuery.UserId = HiContext.Current.UserId; DbQueryResult mySplittinDraws = MemberProcessor.GetMySplittinDraws(balanceDrawRequestQuery, 1); if (mySplittinDraws.TotalRecords > 0) { this.ShowMessage("提现申请成功,等待管理员审核", true, "", 1); this.btnDraw.Visible = false; this.BindSplittinDraw(); } else { this.lblBanlance.Text = MemberProcessor.GetUserUseSplittin(HiContext.Current.UserId).F2ToString("f2"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); this.lblminDraws.Text = masterSettings.MinimumSingleShot.F2ToString("f2"); if (!masterSettings.EnableBulkPaymentAliPay || !masterSettings.SplittinDraws_CashToALiPay) { this.IsAlipay.Visible = false; } if (!masterSettings.EnableBulkPaymentWeixin || !masterSettings.SplittinDraws_CashToWeiXin) { this.IsWeixin.Visible = false; } if (!masterSettings.SplittinDraws_CashToDeposit) { this.IsWithdrawToAccount.Visible = false; } if (!masterSettings.SplittinDraws_CashToBankCard) { this.IsDefault.Visible = false; } else if (user.MemberOpenIds == null) { this.IsWeixin.Visible = false; } else { MemberOpenIdInfo memberOpenIdInfo = user.MemberOpenIds.FirstOrDefault((MemberOpenIdInfo item) => item.OpenIdType.ToLower() == "hishop.plugins.openid.weixin"); if (memberOpenIdInfo == null) { this.IsWeixin.Visible = false; } } this.IsWithdrawToAccount.Checked = true; this.BindSplittinDraw(); } } }