public static int topic_comment(Topic_Comment tc) { //用户发表话题评论 string sql = "insert into Topic_Comment(Tc_user_id,Tc_top_id,Tc_mess,Tc_time) values(@tc_user_id,@tc_top_id,@tc_mess,@tc_time)"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("@tc_user_id", tc.Tc_user_id1), new SqlParameter("@tc_top_id", tc.Tc_top_id1), new SqlParameter("@tc_mess", tc.Tc_mess1), new SqlParameter("@tc_time", tc.Tc_time1), }; return(DBHelper.GetExcuteNonQuery(sql, sp)); }
protected void plfabu_Click(object sender, EventArgs e) { Button bt = (Button)sender; if (Session["user_name"] != null) { try { Topic_Comment tc = new Topic_Comment(); tc.Tc_user_id1 = int.Parse(Session["user_id"].ToString()); tc.Tc_top_id1 = Convert.ToInt32(Request.QueryString["Top_id"].ToString()); tc.Tc_mess1 = plshuru.Text; tc.Tc_time1 = DateTime.Now; if (Topic_CommentManager.topic_comment(tc) == 1) { Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('回复成功');</script>"); plshuru.Text = ""; BingTC(); } 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 topic_comment(Topic_Comment tc) { return(Topic_CommentService.topic_comment(tc)); }