//评论
 protected void pinglun_Click(object sender, EventArgs e)
 {
     if (Session["username"] != null)
     {
         try
         {
             int             newsid = Convert.ToInt32(Request.QueryString["newsid"].ToString());
             News_Commentary nc     = new News_Commentary();
             nc.NC_News_ID1   = newsid;
             nc.NC_User_Name1 = Session["username"].ToString();
             nc.NC_Content1   = FCKeditor1.Text;
             nc.NC_Time1      = DateTime.Now;
             if (News_CommentaryBll.news_addnc(nc) == 1)
             {
                 FCKeditor1.Text = "";
                 ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('评论成功!');", true);
                 BingNC();
             }
             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);
     }
 }
Beispiel #2
0
        //添加新闻评论
        public static int news_addnc(News_Commentary nc)
        {
            string sql = "insert into News_Commentary values(@NC_Content,@NC_Time,@NC_Users_Name,@NC_News_ID)";

            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("@NC_Content", nc.NC_Content1),
                new SqlParameter("@NC_Time", nc.NC_Time1),
                new SqlParameter("@NC_Users_Name", nc.NC_User_Name1),
                new SqlParameter("@NC_News_ID", nc.NC_News_ID1)
            };
            return(DBHelper.GetExcuteNonQuery(sql, sp));
        }
 //添加新闻评论
 public static int news_addnc(News_Commentary nc)
 {
     return(News_CommentaryDal.news_addnc(nc));
 }