/// <summary> /// Returns a TypedList which contains the last (amount) posted messages in /// the forum given. For RSS production. /// </summary> /// <param name="amount">limit of amount of messages to return</param> /// <param name="forumID">ID of forum to pull the messages for</param> /// <returns>typed list with data requested</returns> public static ForumMessagesTypedList GetLastPostedMessagesInForum(int amount, int forumID) { ForumMessagesTypedList forumMessages = new ForumMessagesTypedList(); forumMessages.Fill(amount, new SortExpression(MessageFields.PostingDate.Ascending()), false, (ForumFields.ForumID == forumID).And(ForumFields.HasRSSFeed == true)); return(forumMessages); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, System.EventArgs e) { _siteName = HttpUtility.HtmlEncode(ApplicationAdapter.GetSiteName()); int forumID = HnDGeneralUtils.TryConvertToInt(Request.QueryString["ForumID"]); _forum = CacheManager.GetForum(forumID); if ((_forum != null) && _forum.HasRSSFeed) { _forumURL = "http://" + Request.Url.Host + ApplicationAdapter.GetVirtualRoot() + String.Format(@"Threads.aspx?ForumID={0}", forumID); // get the messages ForumMessagesTypedList messages = ForumGuiHelper.GetLastPostedMessagesInForum(10, forumID); rptRSS.DataSource = messages; rptRSS.DataBind(); Response.Cache.SetExpires(DateTime.Now.AddDays(7)); Response.Cache.SetCacheability(HttpCacheability.Public); Response.Cache.SetValidUntilExpires(true); Response.Cache.VaryByParams["ForumID"] = true; Response.Cache.AddValidationCallback(new HttpCacheValidateHandler(Validate), null); } }
/// <summary> /// Returns a TypedList which contains the last (amount) posted messages in /// the forum given. For RSS production. /// </summary> /// <param name="amount">limit of amount of messages to return</param> /// <param name="forumID">ID of forum to pull the messages for</param> /// <returns>typed list with data requested</returns> public static ForumMessagesTypedList GetLastPostedMessagesInForum(int amount, int forumID) { ForumMessagesTypedList forumMessages = new ForumMessagesTypedList(); forumMessages.Fill(amount, new SortExpression(MessageFields.PostingDate.Ascending()), false, (ForumFields.ForumID == forumID).And(ForumFields.HasRSSFeed == true)); return forumMessages; }