//赋值操作 private void ShowInfo() { BLL.feedbackconfig bll = new BLL.feedbackconfig(); Model.feedbackconfig model = bll.loadConfig(); rblBookMsg.SelectedValue = model.bookmsg.ToString(); txtBookTemplet.Text = model.booktemplet; txtReceive.Text = model.receive; }
/// <summary> /// 写入站点配置文件 /// </summary> public Model.feedbackconfig saveConifg(Model.feedbackconfig model, string configFilePath) { lock (lockHelper) { SerializationHelper.Save(model, configFilePath); } return(model); }
/// <summary> /// 读取配置文件 /// </summary> public Model.feedbackconfig loadConfig(string config_path) { string cacheName = "gs_cache_feedback_config"; Model.feedbackconfig model = CacheHelper.Get <Model.feedbackconfig>(cacheName); if (model == null) { CacheHelper.Insert(cacheName, dal.loadConfig(Utils.GetMapPath(config_path)), Utils.GetMapPath(config_path)); model = CacheHelper.Get <Model.feedbackconfig>(cacheName); } return(model); }
//保存操作 /// <summary> /// 保存配置信息 /// </summary> protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_feedback", DTEnums.ActionEnum.Instal.ToString()); BLL.feedbackconfig bll = new BLL.feedbackconfig(); Model.feedbackconfig model = bll.loadConfig(); try { model.bookmsg = Utils.StrToInt(rblBookMsg.SelectedValue, 0); model.booktemplet = txtBookTemplet.Text.Trim(); model.receive = txtReceive.Text.Trim(); bll.saveConifg(model); AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改留言插件配置信息"); JscriptMsg("修改留言插件配置信息成功!", "index.aspx"); } catch { JscriptMsg("文件写入失败,请检查文件夹权限!", ""); } }
/// <summary> /// 保存配置文件 /// </summary> public Model.feedbackconfig saveConifg(Model.feedbackconfig model, string config_path) { return(dal.saveConifg(model, Utils.GetMapPath(config_path))); }