protected void SubmitReply_Click(object sender, EventArgs e) { CommentManagementBO bo = new CommentManagementBO(); UserManagementBO userBO = new UserManagementBO(); try { if (replyTextBox.Text == "") { throw new Exception("You must enter text to reply"); } bo.CreateNewComment(userBO.GetUser(Session["login"].ToString()).Username, replyTextBox.Text, Convert.ToInt32(Request.QueryString["subid"]), Convert.ToInt32(parentCommentID.Text)); Response.Redirect(Request.Url.ToString()); } catch (Exception exc) { errorLabel.Text = exc.Message; } }
protected void SubmitButton_Click(object sender, EventArgs e) { CommentManagementBO bo = new CommentManagementBO(); try { if (Session["login"] == null) { throw new Exception("You must be logged in to comment!"); } else if (commentContents.Text.Equals("")) { throw new Exception("A comment must be entered"); } string comText = commentContents.Text; comText = Server.HtmlEncode(comText); comText = comText.Replace(Environment.NewLine, "<br/>"); bo.CreateNewComment(Session["login"].ToString(), comText, submissionID, parentCommentID); Response.Redirect(WebConstants.SUBMISSION_COMMENT_PAGE + "?subid=" + submissionID); } catch (Exception exc) { errorLabel.Text = exc.Message; } }