private int AddReply(ForumPost forumPost) { // Add reply int postID = ForumDB.AddPost(forumPost, ForumID); // Check to see whether author of parent post should be notified ForumPost parentForumPost = ForumDB.GetPost(forumPost.ParentPostID); // Send e-mail if (parentForumPost.Notify && parentForumPost.User.UserID != forumPost.User.UserID) { EmailReplyNotification(parentForumPost, forumPost); } // Return identifier of newly created post return(postID); }
private void PopulateUnits() { if (_action == "new" || _action == "reply" || _action == "quote") { ForumText aliasForumText = new ForumText(UserDB.GetUser(_userID).Alias); _nameLabel.Text = aliasForumText.ProcessSingleLine(GetImages()); } if (_action == "edit" || _action == "reply" || _action == "quote") { _forumPost = ForumDB.GetPost(_postID); if (_action == "edit") { if (LoggedOnUserID != _forumPost.User.UserID && !Page.User.IsInRole("ForumAdmin")) { RedirectUserHasNoAuthority(); } ForumText postAliasForumText = new ForumText(_forumPost.User.Alias); _nameLabel.Text = postAliasForumText.ProcessSingleLine(GetImages()); _subjectTextBox.Text = _forumPost.Subject; _bodyTextBox.Text = _forumPost.Body; _notifyCheckBox.Checked = _forumPost.Notify; } else { // If action is quote or reply, make sure subject begins "Re:" string subject = _forumPost.Subject; string replySubject = subject; if (replySubject.Length >= 3) { if (replySubject.Substring(0, 3) != "Re:") { replySubject = "Re: " + replySubject; } } else { replySubject = "Re: " + replySubject; } _subjectTextBox.Text = replySubject; // If action is quote, add message being replied to within QUOTE tags if (_action == "quote") { ForumText forumText = new ForumText(_forumPost.Body); _bodyTextBox.Text = forumText.ProcessQuoteBody(_forumPost.User.Alias); } } } if (_pinnedDropDownList != null && !Page.IsPostBack) { _pinnedDropDownList.Items.Add(new ListItem("Not Sticky", "0")); _pinnedDropDownList.Items.Add(new ListItem("1 Day", "1")); _pinnedDropDownList.Items.Add(new ListItem("3 Days", "3")); _pinnedDropDownList.Items.Add(new ListItem("1 Week", "7")); _pinnedDropDownList.Items.Add(new ListItem("2 Weeks", "14")); _pinnedDropDownList.Items.Add(new ListItem("1 Month", "30")); _pinnedDropDownList.Items.Add(new ListItem("3 Months", "90")); _pinnedDropDownList.Items.Add(new ListItem("6 Months", "180")); _pinnedDropDownList.Items.Add(new ListItem("1 Year", "365")); _pinnedDropDownList.Items.Add(new ListItem("3 Years", "1095")); } }