Exemplo n.º 1
0
        protected void btnMessage_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(ViewState["VideoID"]);

            if (Session["UserName"] != null)
            {
                if (Page.IsValid)
                {
                    int        userid     = Convert.ToInt32(Session["UserID"]);
                    int        videoid    = Convert.ToInt32(Request.QueryString["VideoID"]);
                    Leavewords leavewords = new Leavewords();
                    leavewords.UserID       = userid;
                    leavewords.VideoID      = videoid;
                    leavewords.LeaveContent = txtMessage.Text.Trim();
                    leavewords.LeaveTime    = DateTime.Now;
                    int result = LeavewordsService.InsertLeavewords(leavewords);
                    if (result >= 1)
                    {
                        ScriptManager.RegisterClientScriptBlock(MessageUpdatePanel, this.GetType(), "click", "alert('留言成功')", true);
                        BindMessage();
                        txtMessage.Text = "";
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(MessageUpdatePanel, this.GetType(), "click", "alert('留言失败')", true);
                    }
                }
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(MessageUpdatePanel, this.GetType(), "click", "alert('您必须先登录才能发表评论');", true);
                ScriptManager.RegisterStartupScript(MessageUpdatePanel, MessageUpdatePanel.GetType(), "updateScript", "window.location.href='Login.aspx'", true);
            }
        }
Exemplo n.º 2
0
        //回复留言
        protected void btnRply_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(ViewState["VideoID"]);

            if (Session["UserName"] != null)
            {
                if (Page.IsValid)
                {
                    LinkButton      btn        = (LinkButton)sender;
                    int             userid     = Convert.ToInt32(Session["UserID"]);
                    ReplyLeavewords Replywords = new ReplyLeavewords();
                    Replywords.LeaveID         = Int32.Parse((btn.Parent.FindControl("HiddenFieldComID") as HiddenField).Value);
                    Replywords.UserID          = userid;
                    Replywords.ReplyLeaContent = ((TextBox)btn.Parent.FindControl("txtReplyContent")).Text;
                    Replywords.ReplyLeaTime    = DateTime.Now;
                    int result = ReplyLeavewordsService.InsertReplyLeavewords(Replywords);
                    if (result >= 1)
                    {
                        ScriptManager.RegisterClientScriptBlock(ReplyUpdatePanel, this.GetType(), "click", "alert('回复成功')", true);
                        visibleflag = true;
                        BindMessage();
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(ReplyUpdatePanel, this.GetType(), "click", "alert('回复失败')", true);
                    }
                }
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(ReplyUpdatePanel, this.GetType(), "click", "alert('您必须先登录才能发表评论');", true);
                ScriptManager.RegisterStartupScript(ReplyUpdatePanel, MessageUpdatePanel.GetType(), "updateScript", "window.location.href='Login.aspx'", true);
            }
        }
Exemplo n.º 3
0
 //发布评论
 protected void btnMessage_Click(object sender, EventArgs e)
 {
     //Session["UserID"] = 1;
     if (Session["UserName"] != null)
     {
         if (Page.IsValid)
         {
             int      UserID   = Convert.ToInt32(Session["UserID"]);
             int      ActID    = Convert.ToInt32(Request.QueryString["id"]);
             Comments Comments = new Comments();
             Comments.UserID     = UserID;
             Comments.ActID      = ActID;
             Comments.ComContent = txtMessage.Text.Trim();
             Comments.ComTime    = DateTime.Now;
             int result = CommentsService.InsertComments(Comments);
             if (result >= 1)
             {
                 ScriptManager.RegisterClientScriptBlock(MessageUpdatePanel, this.GetType(), "click", "alert('留言成功')", true);
                 BindMessage();
                 txtMessage.Text = "";
             }
             else
             {
                 ScriptManager.RegisterClientScriptBlock(MessageUpdatePanel, this.GetType(), "click", "alert('留言失败')", true);
             }
         }
     }
     else
     {
         ScriptManager.RegisterClientScriptBlock(MessageUpdatePanel, this.GetType(), "click", "alert('您必须先登录才能发表评论');", true);
         ScriptManager.RegisterStartupScript(MessageUpdatePanel, MessageUpdatePanel.GetType(), "updateScript", "window.location.href='Login.aspx'", true);
     }
 }