Ejemplo n.º 1
0
        // Methods
        protected void btnAddComment_Click(object sender, EventArgs e)
        {
            Page.Validate("PostComment");

            if (Page.IsValid && IsVerificationCodeMatch())
            {
                int i = ratTopic.CurrentRating;
                Comment comment = new Comment();
                comment.Content = this.txtComment.Text.Trim();
                comment.CustName = this.txtCustName.Text.Trim();
                comment.TopicID = this._topicID;

                if (!IsValidData(comment.Content))
                {
                    base.BuildPopup("Sorry, your comment contains invalid characters.");
                }
                else
                {
                    if (comment.AddOne())
                    {
                        this.txtCustName.Text = string.Empty;
                        this.txtComment.Text = string.Empty;
                        this.txtVerificationCode.Text = string.Empty;

                        base.BuildPopup("Thank you for your comment!");
                    }
                    else
                    {
                        base.BuildPopup("Cannot post your comment due to an error.");
                    }
                }

                ResetVerificationCode();
            }

            this.SetScreen();
        }
Ejemplo n.º 2
0
 private void SetScreen()
 {
     Comment comment = new Comment();
     comment.TopicID = this._topicID;
     this.dgComment.DataSource = comment.LoadAll();
     this.dgComment.DataBind();
 }