예제 #1
0
        protected void btnCommentSubmit_Click(object sender, EventArgs e)
        {
            VsrDataContext db = new VsrDataContext();
            Guid postid = Guid.Empty;

            if (Request.QueryString["post"] == null)
            {
                Response.Redirect("Default.aspx");
            }
            else
            {
                postid = new Guid(Request.QueryString["post"].ToString());
                if(!DoesPostIdExist(postid))
                    Response.Redirect("Default.aspx");
            }


            if (txtComment.Text.ToString().Length > 3 && txtUsername.Text.ToString().Length > 3)
            {
                PostComment p = new PostComment();
                p.comment_id = Guid.NewGuid();
                p.posts_id = postid;
                p.post_date = DateTime.Now;
                p.praise_count = 0;
                p.criticism_count = 0;
                p.source_ip = Request.ServerVariables["REMOTE_ADDR"];
                p.username = txtUsername.Text.ToString();
                p.posttext = txtComment.Text.ToString();

                db.PostComments.InsertOnSubmit(p);
                db.SubmitChanges();

                txtComment.Text = "";
                txtUsername.Text = "";

                PopulateComments(postid);

            }
        }
예제 #2
0
 partial void UpdatePostComment(PostComment instance);
예제 #3
0
 partial void DeletePostComment(PostComment instance);
예제 #4
0
 partial void InsertPostComment(PostComment instance);