protected void plfabu_Click(object sender, EventArgs e) { Button bt = (Button)sender; if (Session["user_name"] != null) { try { Write_Comment wc = new Write_Comment(); wc.Wc_user_id1 = int.Parse(Session["user_id"].ToString()); wc.Wc_wri_id1 = Convert.ToInt32(Request.QueryString["Wri_id"].ToString()); wc.Wc_mess1 = plshuru.Text; wc.Wc_time1 = DateTime.Now; if (Write_CommentManager.write_comment(wc) == 1) { Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('回复成功');</script>"); plshuru.Text = ""; BingWC(); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('评论失败');</script>"); } } catch (Exception ex) { Response.Write("错误原因:" + ex.Message); } } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('请先登录!');</script>"); } }
//用户添加创作评论 public static int write_comment(Write_Comment wc) { string sql = "insert into Write_Comment(Wc_user_id,Wc_wri_id,Wc_mess,Wc_time) values(@wc_user_id,@wc_wri_id,@wc_mess,@wc_time)"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("@wc_user_id", wc.Wc_user_id1), new SqlParameter("@wc_wri_id", wc.Wc_wri_id1), new SqlParameter("@wc_mess", wc.Wc_mess1), new SqlParameter("@wc_time", wc.Wc_time1), }; return(DBHelper.GetExcuteNonQuery(sql, sp)); }
//用户添加创作评论 public static int write_comment(Write_Comment wc) { return(Write_CommentService.write_comment(wc)); }