private void OnSaveCfg() { CtlDBAccess.BLL.SysCfgBll sysCfgBll = new CtlDBAccess.BLL.SysCfgBll(); if (!sysCfgBll.Exists(SysCfg.SysCfgModel.SysCfgFileName)) { CtlDBAccess.Model.SysCfgDBModel cfgModel = new CtlDBAccess.Model.SysCfgDBModel(); cfgModel.sysCfgName = SysCfg.SysCfgModel.SysCfgFileName; cfgModel.cfgFile = this.richTextBox1.Text; cfgModel.modifyTime = System.DateTime.Now; sysCfgBll.Add(cfgModel); } else { CtlDBAccess.Model.SysCfgDBModel cfgModel = sysCfgBll.GetModel(SysCfg.SysCfgModel.SysCfgFileName); cfgModel.cfgFile = this.richTextBox1.Text; cfgModel.modifyTime = System.DateTime.Now; sysCfgBll.Update(cfgModel); } string reStr = ""; XElement root = null; SysCfg.SysCfgModel.LoadCfg(ref root, ref reStr); MessageBox.Show("配置文件已保存!"); }
private void OnSaveCfg() { CtlDBAccess.BLL.SysCfgBll sysCfgBll = new CtlDBAccess.BLL.SysCfgBll(); if (!sysCfgBll.Exists(SysCfg.SysCfgModel.SysCfgFileName)) { CtlDBAccess.Model.SysCfgDBModel cfgModel = new CtlDBAccess.Model.SysCfgDBModel(); cfgModel.sysCfgName = SysCfg.SysCfgModel.SysCfgFileName; cfgModel.cfgFile = this.richTextBox1.Text; cfgModel.modifyTime = System.DateTime.Now; sysCfgBll.Add(cfgModel); } else { CtlDBAccess.Model.SysCfgDBModel cfgModel = sysCfgBll.GetModel(SysCfg.SysCfgModel.SysCfgFileName); cfgModel.cfgFile = this.richTextBox1.Text; cfgModel.modifyTime = System.DateTime.Now; sysCfgBll.Update(cfgModel); } string reStr = ""; string xmlCfgFile = System.AppDomain.CurrentDomain.BaseDirectory + @"data/AcCfg.xml"; SysCfg.SysCfgModel.LoadCfg(xmlCfgFile, ref reStr); MessageBox.Show("配置文件已保存!"); }
// public static bool HouseEnabledA { get; set; } // public static bool HouseEnabledB { get; set; } public static bool SaveCfg(ref string reStr) { try { CtlDBAccess.BLL.SysCfgBll sysCfgBll = new CtlDBAccess.BLL.SysCfgBll(); CtlDBAccess.Model.SysCfgDBModel cfgModel = sysCfgBll.GetModel(SysCfg.SysCfgModel.SysCfgFileName); XElement root = rootXE; // string xmlCfgFile = SysCfgModel.CfgFile;// System.AppDomain.CurrentDomain.BaseDirectory + @"data/NBssCfg.xml"; //if (cfgModel == null) //{ // reStr = "系统配置不存在!"; // return false; //} //root = XElement.Parse(cfgModel.cfgFile); //if (root == null) //{ // reStr = "系统配置不存在!"; // return false; //} // XElement runModeXE = root.Element("sysSet").Element("RunMode"); //if(runModeXE.Attribute("UnBindedMode") != null) //{ // runModeXE.Attribute("UnBindedMode").Value = SysCfg.SysCfgModel.UnbindMode.ToString(); //} //XElement root = XElement.Load(xmlCfgFile); XElement asrsStoreCfgXE = root.Element("sysSet").Element("AsrsStoreCfg"); asrsStoreCfgXE.Attribute("StoreTime").Value = AsrsStoreTime.ToString(); // XElement asrsBatchCfgXE = root.Element("sysSet").Element("AsrsBatchCfg"); //asrsBatchCfgXE.Attribute("HouseACheckin").Value = CheckinBatchDic["A1库房"]; //asrsBatchCfgXE.Attribute("HouseACheckout").Value = CheckoutBatchDic["A1库房"]; //asrsBatchCfgXE.Attribute("HouseBCheckin").Value = CheckinBatchDic["B1库房"]; //asrsBatchCfgXE.Attribute("HouseBCheckout").Value = CheckoutBatchDic["B1库房"]; //asrsBatchCfgXE.Attribute("HouseC1Checkout").Value = CheckoutBatchDic["C1库房"]; //asrsBatchCfgXE.Attribute("HouseC2Checkout").Value = CheckoutBatchDic["C2库房"]; // XElement asrsEnableXE = root.Element("sysSet").Element("AsrsEnableSet"); // asrsEnableXE.Attribute("HouseEnabledA").Value = HouseEnabledA.ToString(); // asrsEnableXE.Attribute("HouseEnabledB").Value = HouseEnabledB.ToString(); // root.Save(xmlCfgFile); if (cfgModel != null) { cfgModel.cfgFile = root.ToString(); sysCfgBll.Update(cfgModel); } return(true); } catch (Exception ex) { reStr = ex.ToString(); return(false); } }
public bool SetAreaColorCfg(string logicAreaName, Color color, ref string reStr) { StoreHouseLogicAreaModel logicArea = bllLogicArea.GetModelByName(logicAreaName); if (logicArea == null) { return(false); } if (this.areaColor.Keys.Contains(logicArea.StoreHouseLogicAreaID) == true) { foreach (Color col in this.areaColor.Values) { if (col == color) { reStr = "已经存在相同库区颜色!"; return(false); } } } this.areaColor[logicArea.StoreHouseLogicAreaID] = color; CtlDBAccess.BLL.SysCfgBll sysCfgBll = new CtlDBAccess.BLL.SysCfgBll(); CtlDBAccess.Model.SysCfgDBModel cfgModel = sysCfgBll.GetModel(SysCfg.SysCfgModel.SysCfgFileName); XElement root = null; if (cfgModel == null) { reStr = "系统配置不存在!"; return(false); } root = XElement.Parse(cfgModel.cfgFile); if (root == null) { reStr = "系统配置不存在!"; return(false); } XElement houseAreaColorSet = root.Element("sysSet").Element("HouseAreaColorSet"); if (houseAreaColorSet == null) { reStr = "系统逻辑库存颜色信息不存在!"; return(false); } houseAreaColorSet.Elements().Remove();//移除所有节点 foreach (KeyValuePair <long, Color> kv in this.areaColor) { long logicID = kv.Key; StoreHouseLogicAreaModel logicAreaModel = bllLogicArea.GetModel(logicID); if (logicAreaModel == null) { continue; } string rgb = kv.Value.R + "," + kv.Value.G + "," + kv.Value.B; XElement element = new XElement("HouseArea", new XAttribute("houseAreaID", logicID), new XAttribute("areaName", logicAreaModel.StoreHouseAreaName)); element.Value = rgb; houseAreaColorSet.Add(element); } if (cfgModel != null) { cfgModel.cfgFile = root.ToString(); sysCfgBll.Update(cfgModel); } ShowAreaColor(); RefreshPos(this.currHouseName, currRowth); return(true); }