/// <summary> /// 获得数据列表 /// </summary> private List <Sys.Model.SysConfig> DataTableToList(DataTable dt) { List <Sys.Model.SysConfig> modelList = new List <Sys.Model.SysConfig>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Sys.Model.SysConfig model; for (int n = 0; n < rowsCount; n++) { model = new Sys.Model.SysConfig(); model.Item = dt.Rows[n]["Item"].ToString(); model.Key = dt.Rows[n]["Key"].ToString(); model.Name = dt.Rows[n]["Name"].ToString(); model.Value = dt.Rows[n]["Value"].ToString(); if (dt.Rows[n]["OrderID"].ToString() != "") { model.OrderID = int.Parse(dt.Rows[n]["OrderID"].ToString()); } if (dt.Rows[n]["IsUsing"].ToString() != "") { model.IsUsing = int.Parse(dt.Rows[n]["IsUsing"].ToString()); } model.Note = dt.Rows[n]["Note"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 设置键值,并更新缓存 /// </summary> /// <param name="Key"></param> /// <param name="Value"></param> public static void SetString(string Key, string Value) { var bll = new Sys.BLL.SysConfig(); var model = new Sys.Model.SysConfig(); model = bll.GetModel("WebConfig", Key); model.Value = Value; bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-" + Key); }
/// <summary> /// 得到一个string数值 /// </summary> /// <param name="Item">项目类别</param> /// <param name="Key">键名</param> /// <returns></returns> public static string GetString(string Item, string Key) { Sys.BLL.SysConfig bll = new Sys.BLL.SysConfig(); Sys.Model.SysConfig model = bll.GetModel(Item, Key); if (model == null) { return(""); } else { return(model.Value); } }
private void ConfigSave() { ManageHelper.CheckAdminPower("system_configsystemupdate"); var bll = new Sys.BLL.SysConfig(); var model = new Sys.Model.SysConfig(); var json = Request["data"]; var rows = (ArrayList)PluSoft.Utils.JSON.Decode(json); foreach (Hashtable row in rows) { model = bll.GetModel("WebConfig", "WebsiteName"); model.Value = row["WebsiteName"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-WebsiteName"); model = bll.GetModel("WebConfig", "WebsiteUrl"); model.Value = row["WebsiteUrl"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-WebsiteUrl"); model = bll.GetModel("WebConfig", "PageHeadTitle"); model.Value = row["PageHeadTitle"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-PageHeadTitle"); model = bll.GetModel("WebConfig", "PageHeadMetaKeywords"); model.Value = row["PageHeadMetaKeywords"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-PageHeadMetaKeywords"); model = bll.GetModel("WebConfig", "PageHeadMetaDescription"); model.Value = row["PageHeadMetaDescription"].ToString(); bll.Update(model); ManageHelper.AddLog("system_configsystemupdate", "修改了系统配置"); DataCache.RemoveCache("SysConfigValue-WebConfig-PageHeadMetaDescription"); } Response.Write("yes"); Response.End(); }
private void ConfigSave() { ManageHelper.CheckAdminPower("system_configemailupdate"); var bll = new Sys.BLL.SysConfig(); var model = new Sys.Model.SysConfig(); var json = Request["data"]; var rows = (ArrayList)PluSoft.Utils.JSON.Decode(json); foreach (Hashtable row in rows) { model = bll.GetModel("WebConfig", "EmailServer"); model.Value = row["EmailServer"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-EmailServer"); model = bll.GetModel("WebConfig", "EmailPort"); model.Value = row["EmailPort"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-EmailPort"); model = bll.GetModel("WebConfig", "EmailAccount"); model.Value = row["EmailAccount"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-EmailAccount"); model = bll.GetModel("WebConfig", "EmailPassword"); model.Value = row["EmailPassword"].ToString(); bll.Update(model); DataCache.RemoveCache("SysConfigValue-WebConfig-EmailPassword"); model = bll.GetModel("WebConfig", "EmailSender"); model.Value = row["EmailSender"].ToString(); bll.Update(model); ManageHelper.AddLog("system_configemailupdate", "修改了邮件设置"); DataCache.RemoveCache("SysConfigValue-WebConfig-EmailSender"); } Response.Write("yes"); Response.End(); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Sys.Model.SysConfig model) { dal.Update(model); }