Example #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            VsrDataContext db = new VsrDataContext();
            ContactMessage m = new ContactMessage();

            m.message_id = Guid.NewGuid();
            m.sender_ip = Request.UserHostAddress;
            m.name = txtName.Text.ToString();
            m.email = txtEmail.Text.ToString();
            m.sent = DateTime.Now;
            m.message = txtMessage.Text.ToString();
            db.ContactMessages.InsertOnSubmit(m);
            db.SubmitChanges();

            txtEmail.Text = "";
            txtMessage.Text = "";
            txtName.Text = "";

            mv1.ActiveViewIndex = 1;
 
        }
Example #2
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);

            }
        }