Ejemplo n.º 1
0
 //发表评论
 protected void pinglun_Click(object sender, EventArgs e)
 {
     if (Session["username"] != null)
     {
         try
         {
             int         id = Convert.ToInt32(Request.QueryString["bbsid"].ToString());
             BBS_Comment bc = new BBS_Comment();
             bc.BC_BBS_ID1     = id;
             bc.BC_Users_Name1 = Session["username"].ToString();
             bc.BC_Content1    = txtContent.Text;
             bc.BC_Time1       = DateTime.Now;
             if (BBS_CommentBll.addbc(bc) == 1)
             {
                 txtContent.Text = "";
                 ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('评论成功!');", true);
                 BingBC();
             }
             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);
     }
 }
Ejemplo n.º 2
0
        //增加评论
        public static int addbc(BBS_Comment bc)
        {
            string sql = "insert into BBS_Comment values(@BC_Content,@BC_Time,@BC_Users_Name,@BC_BBS_ID)";

            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("@BC_Content", bc.BC_Content1),
                new SqlParameter("@BC_Time", bc.BC_Time1),
                new SqlParameter("@BC_Users_Name", bc.BC_Users_Name1),
                new SqlParameter("@BC_BBS_ID", bc.BC_BBS_ID1)
            };
            return(DBHelper.GetExcuteNonQuery(sql, sp));
        }
Ejemplo n.º 3
0
 //增加评论
 public static int addbc(BBS_Comment bc)
 {
     return(BBS_CommentDal.addbc(bc));
 }