public int InsertMallComments(MallComments MallComments) //向商品评论表插入评论 { string sql = "insert into MallComments values(@GoodsID,@UserID,@MallComTime,@MallComContent)"; SqlParameter[] para = { new SqlParameter("@GoodsID", MallComments.GoodsID), new SqlParameter("@UserID", MallComments.UserID), new SqlParameter("@MallComTime", MallComments.Comments_time), new SqlParameter("@MallComContent", MallComments.Comments_contents) }; return(DBHelper.GetExcuteNonQuery(sql, para)); }
public int InsertMallComments(MallComments mallcomments) { string sql = "insert into MallComments(MallCommentsID,GoodsID,UserID,Comments_time,Comments_contents) values(@MallCommentsID,@GoodsID,@UserID,@Comments_time,@Comments_contents)"; SqlParameter[] para = { new SqlParameter("@MallCommentsID", mallcomments.MallCommentsID), new SqlParameter("@GoodsID", mallcomments.GoodsID), new SqlParameter("@UserID", mallcomments.UserID), new SqlParameter("@Comments_time", mallcomments.Comments_time), new SqlParameter("@Comments_contents", mallcomments.Comments_contents) }; return(DBHelper.GetExcuteNonQuery(sql, para)); }
protected void btnComments_Click(object sender, EventArgs e) //发表评论 { if (Session["UserName"] != null) { if (Page.IsValid) { try { MallComments mallcomments = new MallComments(); mallcomments.GoodsID = Convert.ToInt32(ViewState["GoodsID"]); mallcomments.UserID = Convert.ToInt32(Session["UserID"]); mallcomments.Comments_time = DateTime.Now; mallcomments.Comments_contents = txtComments.Text; int result = GoodsManager.InsertMallComments(mallcomments); if (result >= 1) { ScriptManager.RegisterClientScriptBlock(UpP002, this.GetType(), "click", "alert('评论成功!')", true); BindMallComments(); txtComments.Text = ""; } else { ScriptManager.RegisterClientScriptBlock(UpP002, this.GetType(), "click", "alert('未知原因 评论失败')", true); } } catch { ScriptManager.RegisterClientScriptBlock(UpP002, this.GetType(), "click", "alert('未知原因 评论失败')", true); } } } else { ScriptManager.RegisterClientScriptBlock(UpP002, this.GetType(), "click", "alert('请先登录')", true); } }
public static int InsertMallComments(MallComments MallComments) //向商品评论表插入评论 { return(igoods.InsertMallComments(MallComments)); }
public static int InsertMallComments(MallComments mallcomments) { return(imallcomments.InsertMallComments(mallcomments)); }