Exemplo n.º 1
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.º 2
0
        //回复
        protected void huifu_Click(object sender, EventArgs e)
        {
            Button bt = (Button)sender;

            if (Session["User_ID"] != null)
            {
                try
                {
                    ReplyLeavewords reply = new ReplyLeavewords();
                    reply.ReplyLeavewords_Comment = (bt.Parent.FindControl("txtContent") as TextBox).Text;
                    reply.ReplyLeavewords_Time    = DateTime.Now;
                    reply.User_ID       = int.Parse(Session["User_ID"].ToString());
                    reply.Leavewords_ID = Int32.Parse((bt.Parent.FindControl("HiddenField1") as HiddenField).Value);
                    if (ReplyLeavewordsService.InsertReplyLeavewords(reply) == 1)
                    {
                        txtContent.Text = "";
                        ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('回复评论成功!');", true);
                        flag = true;
                        BindBC();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('回复评论失败!');", true);
                    }
                }
                catch (Exception ex)
                {
                    Response.Write("错误原因:" + ex.Message);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('对不起,请先登录!');", true);
            }
        }
Exemplo n.º 3
0
        //回复留言
        public int InsertReplyLeavewords(ReplyLeavewords Replywords)
        {
            string sql = "insert into ReplyLeavewords(Leavewords_ID,User_ID,ReplyLeavewords_Comment,ReplyLeavewords_Time) values(@LeaveID,@UserID,@ReplyContent,@ReplyTime)";

            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("@LeaveID", Replywords.Leavewords_ID),
                new SqlParameter("@UserID", Replywords.User_ID),
                new SqlParameter("@ReplyContent", Replywords.ReplyLeavewords_Comment),
                new SqlParameter("@ReplyTime", Replywords.ReplyLeavewords_Time)
            };
            return(DBHelper.GetExcuteNonQuery(sql, sp));
        }
Exemplo n.º 4
0
 //回复留言
 public static int InsertReplyLeavewords(ReplyLeavewords Replywords)
 {
     return(ireplyleavewords.InsertReplyLeavewords(Replywords));
 }