protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["Page"] == null) { (Master as Dreadnought_Master).Message("No page specified. Please use the querystring Page to specify the full relative path to a page."); DisableAll(); return; } pageInfo = new PageInfo(Request.QueryString["Page"]); try { pageInfo.Load(); } catch (PageDoesNotExistException) { (Master as Dreadnought_Master).Message("The specified page does not exist (<a href=\"CreatePage.aspx?Page=" + pageInfo.RelativePath + "\">Create it</a>)."); DisableAll(); return; } catch (InvalidDirectoryException) { (Master as Dreadnought_Master).Message("You are not allowed to load a page from the directory '" + pageInfo.RelativeDirectory + "'."); DisableAll(); return; } catch { (Master as Dreadnought_Master).Message("An unexpected error occurred. Please make sure you have sufficient user rights."); DisableAll(); return; } if (!IsPostBack) { LoadContentPlaceholders(); LoadText(); } }
/// <summary> /// 加载列表 /// </summary> private void InitList() { Id = Utils.GetQueryStringValue("Id"); int CurrencyPage = Utils.GetInt(Utils.GetQueryStringValue("Page")); if (CurrencyPage == 0) CurrencyPage = 1; PageInfo pi = new PageInfo(); pi.PageIndex = CurrencyPage; pi.PageSize = 4; pi.AddCondition<HotspotHotelDTO>(o => o.publishtarget, Target, QueryMethod.Equal); pi.AddCondition<HotspotHotelDTO>(o => o.is_valid, 1, QueryMethod.Equal); //Response.Write(pi.ToSqlCondition()); pi.OrderBy.Add("order_id", OrderByType.Asc); var list = BHotspot.GetHotelsList(pi); if (list != null) { this.rptList.DataSource = list; this.rptList.DataBind(); if (!String.IsNullOrEmpty(Id)) { InitRoomInfo(Id); } else { Id = list[0].hotspot_id; InitRoomInfo(Id); } } }
public void Constructor_SetsNavigationMode() { PageInfo navigationEntry = new PageInfo("SamplePage", null); PageNavigationEventArgs eventArgs = new PageNavigationEventArgs(navigationEntry, PageNavigationMode.Forward); Assert.Equal(PageNavigationMode.Forward, eventArgs.NavigationMode); }
protected void btnCreate_Click(object sender, EventArgs e) { if (!IsValid) { (Master as Dreadnought_Master).Message("Please make sure the form is valid."); return; } PageInfo pageInfo = new PageInfo(txtPage.Text); if (pageInfo.Exists) { (Master as Dreadnought_Master).Message("This page already exists (<a href=\"EditPage.aspx?Page=" + pageInfo.RelativePath + "\">Edit it</a>)."); return; } try { pageInfo.Save(); } catch (Dreadnought.InvalidDirectoryException) { (Master as Dreadnought_Master).Message("You cannot create a page in the directory '" + pageInfo.RelativeDirectory + "'."); return; } catch { (Master as Dreadnought_Master).Message("An unexpected error occurred. Please make sure you have sufficent user rights."); return; } if (chkRedirect.Checked) Response.Redirect("EditPage.aspx?Page=" + pageInfo.RelativePath); }
/// <summary> /// Adds a new Redirection. /// </summary> /// <param name="source">The source Page.</param> /// <param name="destination">The destination Page.</param> /// <returns>True if the Redirection is added, false otherwise.</returns> /// <remarks>The method prevents circular and multi-level redirection.</remarks> public static void AddRedirection(PageInfo source, PageInfo destination) { if(source == null) throw new ArgumentNullException("source"); if(destination == null) throw new ArgumentNullException("destination"); Cache.Provider.AddRedirection(source.FullName, destination.FullName); }
/// <summary> /// 加载评论数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void InitTalkCount(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Repeater rptTalkList = (Repeater)e.Item.FindControl("rptTalkList"); var Id = ((TywphotoalbumDTO)e.Item.DataItem).id; Literal ltrCollectCount = (Literal)e.Item.FindControl("ltrCollectCount"); ltrCollectCount.Text = BMycollect.Count(Id); Literal ltrTalkCount = (Literal)e.Item.FindControl("ltrTalkCount"); ltrTalkCount.Text = BComment.Count(Id,评论类型.光影); #region 评论列表 PageInfo pi = new PageInfo(); pi.PageIndex = 1; pi.PageSize = 10; pi.AddCondition<TywcommentDTO>(o => o.datasource, BasePage.Target, QueryMethod.Equal); pi.AddCondition<TywcommentDTO>(o => o.objecttype, (int)Adpost.YCH.BLL.评论类型.光影, QueryMethod.Equal); pi.AddCondition<TywcommentDTO>(o => o.objectid, Id, QueryMethod.Equal); pi.AddCondition<TywcommentDTO>(o => o.replyid, "0", QueryMethod.Equal); pi.OrderBy.Add("commenttime", OrderByType.Desc); var list = BComment.GetList(pi); if (list != null) { rptTalkList.DataSource = list; rptTalkList.DataBind(); } #endregion } }
private PageInfo GetAFreePage(uint size) { uint neededBlocks = BlocksForSize(size); if (InfoTable.Any(page => PageIsUnusedAndBigEnough(page, neededBlocks))) { return InfoTable.First(page => PageIsUnusedAndBigEnough(page, neededBlocks)); } else { PageInfo lastPage = InfoTable.Last(); uint nextAvailableAddress = lastPage.RealAddress + lastPage.Size; PageInfo newPage = new PageInfo() { RealAddress = nextAvailableAddress, Size = neededBlocks * BLOCKSIZE, Used = true }; InfoTable.Add(newPage); return newPage; } }
/// <summary> /// 取得一个文章的评论 /// </summary> /// <param name="articleId"></param> /// <param name="pageIndex"></param> /// <returns></returns> public PageInfo<Comment> GetCommentsByArticleId(int articleId, int pageIndex) { //缓存加载 PageInfo<Comment> page = null; page = new PageInfo<Comment>(); int userId = _sessionManager.User == null ? 0 : _sessionManager.User.UserId; int pageSize = int.Parse(_settiongService.GetSetting("CommentPageSize")); page.PageSize = pageSize; page.TotalItem = (int)_commentRepository.Single(query => query.Where( c => c.Article.ArticleId == articleId && (c.Parent.CommentId == 0 || c.Parent == null) && ((c.Status == CommentStatus.Open) || (c.User.UserId == userId && c.Status != CommentStatus.Delete)) ).Count() ); pageIndex = pageIndex > page.TotalPage ? page.TotalPage : pageIndex; pageIndex = pageIndex <= 0 ? 1 : pageIndex; page.PageItems = _commentRepository.Find(query => query.Where( c => c.Article.ArticleId == articleId && (c.Parent.CommentId == 0 || c.Parent == null) && ((c.Status == CommentStatus.Open) || (c.User.UserId == userId && c.Status != CommentStatus.Delete)) ).OrderBy(c => c.CreateDate).Skip((pageIndex - 1) * pageSize).Take(pageSize) ); page.PageIndex = pageIndex; return page; }
/// <summary> /// 加载列表 /// </summary> private void InitList() { CurrencyPage = Utils.GetInt(Utils.GetQueryStringValue("Page")); if (CurrencyPage == 0) CurrencyPage = 1; string Keyword = Utils.GetQueryStringValue("KeyWord"); PageInfo pi = new PageInfo(); pi.PageIndex = CurrencyPage; pi.PageSize = PageSize; pi.AddCondition<CptoutactivitiesDTO>(o => o.publishtarget, Target, QueryMethod.Equal); pi.AddCondition<CptoutactivitiesDTO>(o => o.is_valid, 1, QueryMethod.Equal); //有效活动 DateTime cDate = DateTime.Now; pi.AddCondition<CptoutactivitiesDTO>(o => o.act_startdate, cDate, QueryMethod.LessThanOrEqual); pi.AddCondition<CptoutactivitiesDTO>(o => o.act_enddate, cDate, QueryMethod.GreaterThan); if (!String.IsNullOrWhiteSpace(Keyword)) { pi.AddCondition<CptoutactivitiesDTO>(o => o.act_name, Keyword, QueryMethod.Like); } pi.OrderBy.Add("create_date", OrderByType.Desc); var list = BActivities.GetList(pi, ref TotalRows); if (list != null) { this.rptList.DataSource = list; this.rptList.DataBind(); } }
/// <summary> /// 加载列表 /// </summary> private void InitScenicList() { PageInfo pi = new PageInfo(); pi.PageIndex = 1; pi.PageSize = int.MaxValue; pi.AddCondition<HotspotScenicsDTO>(o => o.publishtarget, Target, QueryMethod.Equal); pi.AddCondition<HotspotScenicsDTO>(o => o.is_valid, 1, QueryMethod.Equal); //Response.Write(pi.ToSqlCondition()); var list = BHotspot.GetScenicsList(pi); if (list != null) { System.Text.StringBuilder tmpStr = new System.Text.StringBuilder(); tmpStr.Append("<li>"); for (int i = 0; i < list.Count(); i++) { if ((i + 1) % 2 == 0) { tmpStr.Append("<div class=\"list_div right\"><img class=\"list_img\" src=\"" + Common.NoPhotoDefault(list[i].coverphoto) + "\"><h1>" + list[i].hotspot_name + "</h1><p>" + list[i].tourtime + "</p><a href=\"javascript:void(0)\" ID=\"" + list[i].id + "\" EID=\"" + list[i].hotspot_id + "\" class=\"jingdianAdd\"> </a></div>"); } else { tmpStr.Append("<div class=\"list_div left\"><img class=\"list_img\" src=\"" + Common.NoPhotoDefault(list[i].coverphoto) + "\"><h1>" + list[i].hotspot_name + "</h1><p>" + list[i].tourtime + "</p><a href=\"javascript:void(0)\" ID=\"" + list[i].id + "\" EID=\"" + list[i].hotspot_id + "\" class=\"jingdianAdd\"> </a></div>"); } if ((i+1) % 2 == 0) { tmpStr.Append("</li><li>"); } } tmpStr.Append("</li>"); this.ltrJD.Text = tmpStr.ToString(); } }
private PageInfo ExtractFromResponse(HttpWebResponse response) { var info = new PageInfo(); using (var responseStream = response.GetResponseStream()) { var htmlDocument = new HtmlDocument(); htmlDocument.Load(responseStream); htmlDocument.OptionFixNestedTags = true; var quote = htmlDocument.DocumentNode .SelectSingleNode("//body") .SelectNodes("//p").Where(a => a.Attributes.Any(x => x.Name == "class" && x.Value == "qt")) .SingleOrDefault(); var title = htmlDocument.DocumentNode .SelectSingleNode("//title"); //Quote might not be found, bash.org doesn't have a 404 page if (quote == null || title == null) { return null; } //Strip out any HTML that isn't defined in the WhiteList SanitizeHtml(quote); info.Quote = quote.InnerHtml; info.PageURL = response.ResponseUri.AbsoluteUri; info.QuoteNumber = title.InnerHtml; } return info; }
public ActionResult BadReportList() { int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0); int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0); int pageSize = WebUtil.GetFormValue<int>("pageSize", 0); string storageNum = this.DefaultStore; BadProvider provider = new BadProvider(); BadReportEntity entity = new BadReportEntity(); PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; if (queryTime > 0) { entity.Where("CreateTime", ECondition.Between, DateTime.Now.AddDays(-queryTime), DateTime.Now); } if (storageNum.IsNotNull()) { entity.Where("StorageNum", ECondition.Eth, storageNum); } entity.And(a => a.StorageNum == this.DefaultStore); List<BadReportEntity> listResult = provider.GetList(entity, ref pageInfo, storageNum); listResult = listResult == null ? new List<BadReportEntity>() : listResult; string json = ConvertJson.ListToJson<BadReportEntity>(listResult, "List"); this.ReturnJson.AddProperty("Data", new JsonObject(json)); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); return Content(this.ReturnJson.ToString()); }
public ActionResult ShowQuestion(string categoryName, int page = 1) { var pageSize = Constants.ItemsPerPage; var questions = _questionService .GetQuestionsByCategory(categoryName) .Select(q => q.ToQuestionViewModel()); ViewBag.Category = categoryName.ToUpper(); var questionPerPages = questions.Skip((page - 1) * pageSize).Take(pageSize); var pageInfo = new PageInfo { PageNumber = page, PageSize = pageSize, TotalItems = questions.Count() }; var ivm = new IndexViewModel<QuestionViewModel> { PageInfo = pageInfo, Entities = questionPerPages }; if (Request.IsAjaxRequest()) { return PartialView("PartialShowQuestion", ivm); } return View(ivm); }
/// <summary> /// 加载列表 /// </summary> private void InitList() { CurrencyPage = Utils.GetInt(Utils.GetQueryStringValue("Page")); if (CurrencyPage == 0) CurrencyPage = 1; string Keyword = Utils.GetQueryStringValue("KeyWord"); PageInfo pi = new PageInfo(); pi.PageIndex = CurrencyPage; pi.PageSize = PageSize; int infoType = (int)资讯类别.新闻资讯; pi.AddCondition<TywinformationDTO>(o => o.publishtarget, Target, QueryMethod.Equal); pi.AddCondition<TywinformationDTO>(o => o.info_type, infoType, QueryMethod.Equal); pi.AddCondition<TywinformationDTO>(o => o.is_valid, 1, QueryMethod.Equal); if (!String.IsNullOrWhiteSpace(Keyword)) { pi.AddCondition<TywinformationDTO>(o => o.title, Keyword, QueryMethod.Like); } //Response.Write(pi.ToSqlCondition()); pi.OrderBy.Add("create_date", OrderByType.Desc); var list = BInfomation.GetList(pi, ref TotalRows); if (list != null) { this.rptList.DataSource = list; this.rptList.DataBind(); } }
/// <summary> /// Initializes a new instance of the <see cref="T:PageActivityEventArgs" /> class. /// </summary> /// <param name="page">The page the activity refers to.</param> /// <param name="pageOldName">The old name of the renamed page, or <c>null</c>.</param> /// <param name="author">The author of the activity, if available, <c>null</c> otherwise.</param> /// <param name="activity">The activity.</param> public PageActivityEventArgs(PageInfo page, string pageOldName, string author, PageActivity activity) { this.page = page; this.pageOldName = pageOldName; this.author = author; this.activity = activity; }
protected void Page_Load(object sender, EventArgs e) { page = Pages.FindPage(Request["Page"]); if(page == null) UrlTools.RedirectHome(); // Check permissions bool canView = false; if(Request["Discuss"] == null) { canView = AuthChecker.CheckActionForPage(page, Actions.ForPages.ReadPage, SessionFacade.GetCurrentUsername(), SessionFacade.GetCurrentGroupNames()); } else { canView = AuthChecker.CheckActionForPage(page, Actions.ForPages.ReadDiscussion, SessionFacade.GetCurrentUsername(), SessionFacade.GetCurrentGroupNames()); } if(!canView) UrlTools.Redirect("AccessDenied.aspx"); content = Content.GetPageContent(page, true); Literal canonical = new Literal(); canonical.Text = Tools.GetCanonicalUrlTag(Request.Url.ToString(), page, Pages.FindNamespace(NameTools.GetNamespace(page.FullName))); Page.Header.Controls.Add(canonical); Page.Title = FormattingPipeline.PrepareTitle(content.Title, false, FormattingContext.PageContent, page) + " - " + Settings.WikiTitle; PrintContent(); }
/// <summary> /// 加载列表 /// </summary> private void InitList() { int typeId = Utils.GetInt(Utils.GetQueryStringValue("Type")); CurrencyPage = Utils.GetInt(Utils.GetQueryStringValue("Page")); if (CurrencyPage == 0) CurrencyPage = 1; string Keyword = Utils.GetQueryStringValue("KeyWord"); PageInfo pi = new PageInfo(); pi.PageIndex = CurrencyPage; pi.PageSize = PageSize; //pi.AddCondition<ViewOrderDTO>(o => o.publishtarget, Target, QueryMethod.Equal); pi.AddCondition<ViewOrderDTO>(o => o.is_valid, 1, QueryMethod.Equal); if (typeId != 0) { pi.AddCondition<ViewOrderDTO>(o => o.ordertype, typeId, QueryMethod.Equal); } else { pi.AddCondition<ViewOrderDTO>(o => o.ordertype, (int)订单类型.酒店订单, QueryMethod.Equal); } var model = LoginCheck(); pi.AddCondition<ViewOrderDTO>(o => o.member_id, model.id, QueryMethod.Equal); if (!String.IsNullOrWhiteSpace(Keyword)) { pi.AddCondition<ViewOrderDTO>(o => o.productname, Keyword, QueryMethod.Like); } pi.OrderBy.Add("create_date", OrderByType.Desc); var list = BOrder.GetViewList(pi, ref TotalRows); if (list != null) { this.rptList.DataSource = list; this.rptList.DataBind(); } }
/// <summary> /// 加载列表 /// </summary> private void InitList() { CurrencyPage = Utils.GetInt(Utils.GetQueryStringValue("Page")); if (CurrencyPage == 0) CurrencyPage = 1; string Keyword = Utils.GetQueryStringValue("KeyWord"); PageInfo pi = new PageInfo(); pi.PageIndex = CurrencyPage; pi.PageSize = PageSize; //pi.AddCondition<TywmytravellineDTO>(o => o.publishtarget, Target, QueryMethod.Equal); //pi.AddCondition<TywmytravellineDTO>(o => o.is_valid, 1, QueryMethod.Equal); var model = LoginCheck(); pi.AddCondition<TywmytravellineDTO>(o => o.member_id, model.id, QueryMethod.Equal); pi.AddCondition<TywmytravellineDTO>(o => o.ordernum, 0, QueryMethod.Equal); if (!String.IsNullOrWhiteSpace(Keyword)) { pi.AddCondition<TywmytravellineDTO>(o => o.title, Keyword, QueryMethod.Like); } pi.OrderBy.Add("create_date", OrderByType.Desc); var list = BMyTravelline.GetList(pi, ref TotalRows); if (list != null) { this.rptList.DataSource = list; this.rptList.DataBind(); } }
public void LoadLayout(PageInfo pageInfo, bool isSiteLayout) { PageInfo = pageInfo; List<FWebPartZone> webPartZones = PortalHelper.GetWebPartZones(this); if (webPartZones != null && webPartZones.Count > 0) { for (int i = 0; i < webPartZones.Count; i++) { if (isSiteLayout) { webPartZones[i].LoadWebPartZone(pageInfo, pageInfo.SiteBlocks); } else { webPartZones[i].LoadWebPartZone(pageInfo, pageInfo.PageLayoutBlocks); webPartZones[i].LoadWebPartZone(pageInfo, pageInfo.PageBlocks); } } } List<FPlaceHolder> placeHolders = PortalHelper.GetPlaceHolders(this); if (placeHolders != null && placeHolders.Count > 0) { for (int i = 0; i < placeHolders.Count; i++) { placeHolders[i].LoadPlaceHolder(pageInfo, false); } } }
public static MvcHtmlString PageLinks(this HtmlHelper html, PageInfo pageInfo, Func<int, string, string> pageLink) { var result = new StringBuilder(); int paginationButtonOnPage = Constants.PageRange; //Make button 'first' if (pageInfo.PageNumber > paginationButtonOnPage / 2 + 1) { var first = new TagBuilder("div"); first.InnerHtml = pageLink(1, "first"); first.AddCssClass("btn-page"); result.Append(first); } #region Generate button of pagination if (pageInfo.TotalPages <= paginationButtonOnPage) { for (int i = 1; i <= pageInfo.TotalPages; i++) { GeneratePages(ref result, i, pageInfo, pageLink); } } else if (pageInfo.PageNumber <= (int)Math.Round((double)paginationButtonOnPage / 2, MidpointRounding.ToEven)) { for (int i = 1; i <= paginationButtonOnPage; i++) { GeneratePages(ref result, i, pageInfo, pageLink); } } else if (pageInfo.TotalPages - pageInfo.PageNumber < (int)Math.Round((double)paginationButtonOnPage / 2, MidpointRounding.ToEven)) { for (int i = pageInfo.TotalPages - paginationButtonOnPage + 1; i <= pageInfo.TotalPages; ++i) { GeneratePages(ref result, i, pageInfo, pageLink); } } else { for (int i = pageInfo.PageNumber - paginationButtonOnPage / 2; i <= pageInfo.PageNumber + paginationButtonOnPage / 2; i++) { GeneratePages(ref result, i, pageInfo, pageLink); } } #endregion //Make button 'last' if (pageInfo.PageNumber < pageInfo.TotalPages - paginationButtonOnPage / 2) { var last = new TagBuilder("div"); last.InnerHtml = pageLink(pageInfo.TotalPages, "last"); last.AddCssClass("btn-page"); result.Append(last); } return MvcHtmlString.Create(result.ToString()); }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="pageInfo">Information on the arguments and state passed to the page.</param> public async void Activate(PageInfo pageInfo) { // TODO: Create an appropriate data model for your problem domain to replace the sample data string itemId = pageInfo.GetArguments<string>(); var item = await SampleDataSource.GetItemAsync(itemId); this.Item = item; }
/// <summary> /// Контрол пейджер /// </summary> /// <param name="htmlHelper"><see cref="HtmlHelper"/></param> /// <param name="pageInfo"></param> /// <param name="values">Дополнительные параметры для роутинга</param> /// <returns>HTML текст с пейджером</returns> public static string Pager(this HtmlHelper htmlHelper, PageInfo pageInfo, object values) { ViewContext controllerContext = htmlHelper.ViewContext; var routeValueDictionary = new RouteValueDictionary(values); return new Pager(controllerContext.RequestContext, routeValueDictionary, pageInfo) .RenderHtml(); }
/// <summary> /// Creates a lookup box. /// </summary> /// <param name="pixelWidth"></param> /// <param name="defaultText">Text displayed when the LookupBox does not have focus.</param> /// <param name="postBackId"></param> /// <param name="handler">Supplies the string entered into the LookupBox from the user. Returns the resource the user will be redirected to.</param> /// <param name="autoCompleteService"></param> public LookupBoxSetup( int pixelWidth, string defaultText, string postBackId, Func<string, ResourceInfo> handler, PageInfo autoCompleteService = null ) { this.pixelWidth = pixelWidth; this.defaultText = defaultText; this.autoCompleteService = autoCompleteService; this.postBackId = postBackId; this.handler = handler; }
/// <summary> /// Gets the destination Page. /// </summary> /// <param name="page">The source Page.</param> /// <returns>The destination Page, or null.</returns> public static PageInfo GetDestination(PageInfo page) { if(page == null) throw new ArgumentNullException("page"); string destination = Cache.Provider.GetRedirectionDestination(page.FullName); if(string.IsNullOrEmpty(destination)) return null; else return Pages.FindPage(destination); }
public void Constructor_SetsArguments_Struct() { PageInfo navigationEntry = new PageInfo("Page Name", new StructState() { Text = "Text Value", Number = 42 }); var args = navigationEntry.GetArguments<StructState>(); Assert.Equal("Text Value", args.Text); Assert.Equal(42, args.Number); }
/// <summary> /// 显示列表信息 /// </summary> /// <param name="gvList">GridView对象</param> /// <param name="pageInfo">分页信息</param> public void ShowList(PagedGridView gvList, PageInfo pageInfo) { //IPageOfList<TransControl> result = transControlService.FindAll(GetFilterParameters(), pageInfo); DataTable result = transControlService.FindTansControl(GetFilterParameters(),pageInfo); gvList.ItemCount = pageInfo.ItemCount; gvList.DataSource = result; gvList.DataBind(); }
/// <summary> /// Контрол пейджер /// </summary> /// <param name="htmlHelper"><see cref="HtmlHelper"/></param> /// <param name="pageInfo"></param> /// <returns>HTML текст с пейджером</returns> public static string Pager(this HtmlHelper htmlHelper, PageInfo pageInfo) { ViewContext controllerContext = htmlHelper.ViewContext; RouteValueDictionary routeValueDictionary = controllerContext.RouteData.Values; return new Pager(controllerContext.RequestContext, routeValueDictionary, pageInfo) .RenderHtml(); }
/// <summary> /// Writes a page to the output XML writer. /// </summary> /// <param name="mainUrl">The main wiki URL.</param> /// <param name="page">The page.</param> /// <param name="isDefault">A value indicating whether the page is the default of its namespace.</param> /// <param name="writer">The writer.</param> private void WritePage(string mainUrl, PageInfo page, bool isDefault, XmlWriter writer) { writer.WriteStartElement("url"); writer.WriteElementString("loc", mainUrl + Tools.UrlEncode(page.FullName) + Settings.PageExtension); writer.WriteElementString("priority", isDefault ? "0.75" : "0.5"); writer.WriteElementString("changefreq", "daily"); writer.WriteEndElement(); }
/// <summary> /// 显示列表信息 /// </summary> /// <param name="gvList">GridView对象</param> /// <param name="pageInfo">分页信息</param> public void ShowList(PagedGridView gvList, PageInfo pageInfo) { DataTable result = transitionService.FindTransition(GetFilterParameters(), pageInfo); //IPageOfList<DataTable> result = transitionService.FindTransition(GetFilterParameters(),pageInfo).Cast<AgileEAP.Core.IPageOfList<DataTable>>;//FindAll(GetFilterParameters(), pageInfo); gvList.ItemCount = pageInfo.ItemCount; gvList.DataSource = result; gvList.DataBind(); }
public ReturnValue<PageInfo<QA_AnswerShow>> GetAnswerByQuest(int pagesize, int pageindex, int sysno) { int total = 0; DataTable m_dt = QA_AnswerBll.GetInstance().GetListByQuest(pagesize, pageindex, sysno, ref total); List<QA_AnswerShow> ret = new List<QA_AnswerShow>(); PageInfo<QA_AnswerShow> rett = new PageInfo<QA_AnswerShow>(); if (m_dt == null || m_dt.Rows.Count == 0) { rett.List = ret; rett.Total = total; rett.HasNextPage = false; return ReturnValue<PageInfo<QA_AnswerShow>>.Get200OK(rett); } for (int i = 0; i < m_dt.Rows.Count; i++) { QA_AnswerShow tmp_answer = MapQA_AnswerShow(m_dt.Rows[i]); USR_CustomerShow tmpu = new USR_CustomerShow(); USR_CustomerBll.GetInstance().GetModel(tmp_answer.CustomerSysNo).MemberwiseCopy(tmpu); tmp_answer.Customer = tmpu; DataTable tmp_dt = QA_CommentBll.GetInstance().GetListByAnswer(tmp_answer.SysNo); if (tmp_dt != null && tmp_dt.Rows.Count > 0) { List<QA_CommentShow> commentlist = new List<QA_CommentShow>(); for (int j = 0; j < tmp_dt.Rows.Count && j <= 3; j++) { QA_CommentShow tmp_comment = MapQA_CommentShow(tmp_dt.Rows[j]); USR_CustomerMaintain tmpuu = new USR_CustomerMaintain(); USR_CustomerBll.GetInstance().GetModel(tmp_comment.CustomerSysNo).MemberwiseCopy(tmpuu); tmp_comment.Customer = tmpuu; commentlist.Add(tmp_comment); } tmp_answer.TopComments = commentlist; tmp_answer.ToalComment = tmp_dt.Rows.Count; if (tmp_dt.Rows.Count > 3) { tmp_answer.HasMoreComment = true; } else { tmp_answer.HasMoreComment = false; } } ret.Add(tmp_answer); } rett.List = ret; rett.Total = total; if (pagesize * pageindex >= total) { rett.HasNextPage = false; } else { rett.HasNextPage = true; } return ReturnValue<PageInfo<QA_AnswerShow>>.Get200OK(rett); }