//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("feedback", OSEnums.ActionEnum.Reply.ToString()); //检查权限 BLL.plugins.feedback bll = new BLL.plugins.feedback(); model = bll.GetModel(this.id); model.reply_content = Utils.ToHtml(txtReContent.Text); model.reply_time = DateTime.Now; bll.Update(model); AddAdminLog(OSEnums.ActionEnum.Reply.ToString(), "回复留言插件内容:" + model.title); //记录日志 PageSuccessMsg("留言回复成功!", "", "list.aspx"); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.plugins.feedback model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update " + databaseprefix + "feedback set "); strSql.Append("title=@title,"); strSql.Append("content=@content,"); strSql.Append("user_name=@user_name,"); strSql.Append("user_tel=@user_tel,"); strSql.Append("user_qq=@user_qq,"); strSql.Append("user_email=@user_email,"); strSql.Append("add_time=@add_time,"); strSql.Append("reply_content=@reply_content,"); strSql.Append("reply_time=@reply_time,"); strSql.Append("is_lock=@is_lock"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@title", SqlDbType.NVarChar, 100), new SqlParameter("@content", SqlDbType.NText), new SqlParameter("@user_name", SqlDbType.NVarChar, 50), new SqlParameter("@user_tel", SqlDbType.NVarChar, 30), new SqlParameter("@user_qq", SqlDbType.NVarChar, 30), new SqlParameter("@user_email", SqlDbType.NVarChar, 100), new SqlParameter("@add_time", SqlDbType.DateTime), new SqlParameter("@reply_content", SqlDbType.NText), new SqlParameter("@reply_time", SqlDbType.DateTime), new SqlParameter("@is_lock", SqlDbType.TinyInt, 1), new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = model.title; parameters[1].Value = model.content; parameters[2].Value = model.user_name; parameters[3].Value = model.user_tel; parameters[4].Value = model.user_qq; parameters[5].Value = model.user_email; parameters[6].Value = model.add_time; parameters[7].Value = model.reply_content; parameters[8].Value = model.reply_time; parameters[9].Value = model.is_lock; parameters[10].Value = model.id; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.plugins.feedback model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into " + databaseprefix + "feedback("); strSql.Append("title,content,user_name,user_tel,user_qq,user_email,add_time,is_lock)"); strSql.Append(" values ("); strSql.Append("@title,@content,@user_name,@user_tel,@user_qq,@user_email,@add_time,@is_lock)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@title", SqlDbType.NVarChar, 100), new SqlParameter("@content", SqlDbType.NText), new SqlParameter("@user_name", SqlDbType.NVarChar, 50), new SqlParameter("@user_tel", SqlDbType.NVarChar, 30), new SqlParameter("@user_qq", SqlDbType.NVarChar, 30), new SqlParameter("@user_email", SqlDbType.NVarChar, 100), new SqlParameter("@add_time", SqlDbType.DateTime), new SqlParameter("@is_lock", SqlDbType.TinyInt, 1) }; parameters[0].Value = model.title; parameters[1].Value = model.content; parameters[2].Value = model.user_name; parameters[3].Value = model.user_tel; parameters[4].Value = model.user_qq; parameters[5].Value = model.user_email; parameters[6].Value = model.add_time; parameters[7].Value = model.is_lock; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.plugins.feedback model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.plugins.feedback model) { return(dal.Add(model)); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.plugins.feedback GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,title,content,user_name,user_tel,user_qq,user_email,add_time,reply_content,reply_time,is_lock from " + databaseprefix + "feedback "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Model.plugins.feedback model = new Model.plugins.feedback(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } if (ds.Tables[0].Rows[0]["title"] != null && ds.Tables[0].Rows[0]["title"].ToString() != "") { model.title = ds.Tables[0].Rows[0]["title"].ToString(); } if (ds.Tables[0].Rows[0]["content"] != null && ds.Tables[0].Rows[0]["content"].ToString() != "") { model.content = ds.Tables[0].Rows[0]["content"].ToString(); } if (ds.Tables[0].Rows[0]["user_name"] != null && ds.Tables[0].Rows[0]["user_name"].ToString() != "") { model.user_name = ds.Tables[0].Rows[0]["user_name"].ToString(); } if (ds.Tables[0].Rows[0]["user_tel"] != null && ds.Tables[0].Rows[0]["user_tel"].ToString() != "") { model.user_tel = ds.Tables[0].Rows[0]["user_tel"].ToString(); } if (ds.Tables[0].Rows[0]["user_qq"] != null && ds.Tables[0].Rows[0]["user_qq"].ToString() != "") { model.user_qq = ds.Tables[0].Rows[0]["user_qq"].ToString(); } if (ds.Tables[0].Rows[0]["user_email"] != null && ds.Tables[0].Rows[0]["user_email"].ToString() != "") { model.user_email = ds.Tables[0].Rows[0]["user_email"].ToString(); } if (ds.Tables[0].Rows[0]["add_time"] != null && ds.Tables[0].Rows[0]["add_time"].ToString() != "") { model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString()); } if (ds.Tables[0].Rows[0]["reply_content"] != null && ds.Tables[0].Rows[0]["reply_content"].ToString() != "") { model.reply_content = ds.Tables[0].Rows[0]["reply_content"].ToString(); } if (ds.Tables[0].Rows[0]["reply_time"] != null && ds.Tables[0].Rows[0]["reply_time"].ToString() != "") { model.reply_time = DateTime.Parse(ds.Tables[0].Rows[0]["reply_time"].ToString()); } if (ds.Tables[0].Rows[0]["is_lock"] != null && ds.Tables[0].Rows[0]["is_lock"].ToString() != "") { model.is_lock = int.Parse(ds.Tables[0].Rows[0]["is_lock"].ToString()); } return(model); } else { return(null); } }
private void ShowInfo(int _id) { BLL.plugins.feedback bll = new BLL.plugins.feedback(); model = bll.GetModel(_id); txtReContent.Text = Utils.ToTxt(model.reply_content); }
/// <summary> /// �õ�һ������ʵ�� /// </summary> public Model.plugins.feedback GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,title,content,user_name,user_tel,user_qq,user_email,add_time,reply_content,reply_time,is_lock from " + databaseprefix + "feedback "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int,4)}; parameters[0].Value = id; Model.plugins.feedback model = new Model.plugins.feedback(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } if (ds.Tables[0].Rows[0]["title"] != null && ds.Tables[0].Rows[0]["title"].ToString() != "") { model.title = ds.Tables[0].Rows[0]["title"].ToString(); } if (ds.Tables[0].Rows[0]["content"] != null && ds.Tables[0].Rows[0]["content"].ToString() != "") { model.content = ds.Tables[0].Rows[0]["content"].ToString(); } if (ds.Tables[0].Rows[0]["user_name"] != null && ds.Tables[0].Rows[0]["user_name"].ToString() != "") { model.user_name = ds.Tables[0].Rows[0]["user_name"].ToString(); } if (ds.Tables[0].Rows[0]["user_tel"] != null && ds.Tables[0].Rows[0]["user_tel"].ToString() != "") { model.user_tel = ds.Tables[0].Rows[0]["user_tel"].ToString(); } if (ds.Tables[0].Rows[0]["user_qq"] != null && ds.Tables[0].Rows[0]["user_qq"].ToString() != "") { model.user_qq = ds.Tables[0].Rows[0]["user_qq"].ToString(); } if (ds.Tables[0].Rows[0]["user_email"] != null && ds.Tables[0].Rows[0]["user_email"].ToString() != "") { model.user_email = ds.Tables[0].Rows[0]["user_email"].ToString(); } if (ds.Tables[0].Rows[0]["add_time"] != null && ds.Tables[0].Rows[0]["add_time"].ToString() != "") { model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString()); } if (ds.Tables[0].Rows[0]["reply_content"] != null && ds.Tables[0].Rows[0]["reply_content"].ToString() != "") { model.reply_content = ds.Tables[0].Rows[0]["reply_content"].ToString(); } if (ds.Tables[0].Rows[0]["reply_time"] != null && ds.Tables[0].Rows[0]["reply_time"].ToString() != "") { model.reply_time = DateTime.Parse(ds.Tables[0].Rows[0]["reply_time"].ToString()); } if (ds.Tables[0].Rows[0]["is_lock"] != null && ds.Tables[0].Rows[0]["is_lock"].ToString() != "") { model.is_lock = int.Parse(ds.Tables[0].Rows[0]["is_lock"].ToString()); } return model; } else { return null; } }