/// <summary> /// 提交客户评论 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnsubmit_Click(object sender, EventArgs e) { tbLevelwords words = new tbLevelwords() { createdate = DateTime.Now, isDel = false, LevelWords = content.Value, UserName = txtusername.Text.ToString().Length == 0 ? "匿名用户" : txtusername.Text, proid = int.Parse(Request.QueryString["proid"].ToString()), type = "产品点评" }; ProBLL pbll = new ProBLL(); if (pbll.proLevelWords(words) != 0) { ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('评论添加成功,需审核后显示')", true); return; } }
/// <summary> /// 产品点评添加 /// </summary> /// <param name="model"></param> /// <returns></returns> public int proLevelWords(tbLevelwords model) { SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int,4), new SqlParameter("@proid", SqlDbType.Int,4), new SqlParameter("@UserName", SqlDbType.NVarChar,50), new SqlParameter("@LevelWords", SqlDbType.NVarChar,500), new SqlParameter("@type", SqlDbType.NVarChar,50), new SqlParameter("@createdate", SqlDbType.DateTime), new SqlParameter("@isDel", SqlDbType.Bit,1)}; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.proid; parameters[2].Value = model.UserName; parameters[3].Value = model.LevelWords; parameters[4].Value = model.type; parameters[5].Value = model.createdate; parameters[6].Value = model.isDel; int count= dbhelper.ExcuteCommandReturnInt("tbLevelwords_ADD", CommandType.StoredProcedure, parameters); return (int)parameters[0].Value; }