/// <summary> /// 配置値设定 /// </summary> private Boolean SetDatabaseConfig() { NdnXmlConfig xmlConfig; xmlConfig = new NdnXmlConfig(NCConst.CONFIG_FILE_DIR + NCUtility.GetAppConfig()); string strConnectionString = string.Format( "Data Source={0};Initial Catalog={1};User ID={2};Password={3}", txtDataSource.Text, txtDatabase.Text, txtUser.Text, NCCryp.Encrypto(txtPwd.Text)); string str = "ConnectionString"; if (!xmlConfig.WriteValue("database", str, strConnectionString)) { string msg = string.Format(NCMessage.GetInstance(db.Language).GetMessageById("CM0450E", db.Language), str); NCLogger.GetInstance().WriteErrorLog(msg); return(false); } strConnectionString = string.Format( "Data Source={0};Initial Catalog={1};User ID={2};Password={3}", txtDataSource.Text, "master", txtUser.Text, NCCryp.Encrypto(txtPwd.Text)); str = "MConnectionString"; if (!xmlConfig.WriteValue("database", str, strConnectionString)) { string msg = string.Format(NCMessage.GetInstance(db.Language).GetMessageById("CM0450E", db.Language), str); NCLogger.GetInstance().WriteErrorLog(msg); return(false); } return(SetDatabaseConfig2()); }
/// <summary> /// 配置 /// </summary> /// <returns></returns> private bool GetConfigValue() { bool ret = true; ///取得配置信息 NCLogger.GetInstance().WriteInfoLog("GetConfigValue Start"); NdnXmlConfig xmlConfig; xmlConfig = new NdnXmlConfig(NCConst.CONFIG_FILE_DIR + NCUtility.GetAppConfig()); if (!xmlConfig.ReadXmlData("config", "ftpserver", ref ftpserver)) { ret = false; } if (!xmlConfig.ReadXmlData("config", "ftpuser", ref userName)) { ret = false; } if (!xmlConfig.ReadXmlData("config", "ftppassword", ref password)) { ret = false; } password = NCCryp.Decrypto(password); NCLogger.GetInstance().WriteInfoLog("GetConfigValue end"); return(ret); }
/// <summary> /// 配置値设定 /// </summary> private void SetSkinValue(string Skin) { NdnXmlConfig xmlConfig; string path = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), "Config"); xmlConfig = new NdnXmlConfig(Path.Combine(path, "HPSTest.Config")); if (!xmlConfig.WriteValue("config", "Skin", Skin)) { } }
/// <summary> /// 配置値取得 /// </summary> private bool GetProductValue() { bool ret = true; NdnXmlConfig xmlConfig; xmlConfig = new NdnXmlConfig(NCConst.CONFIG_FILE_DIR + NCUtility.GetAppConfig()); if (!xmlConfig.ReadXmlData("config", "Product", ref product)) { ret = false; } return(ret); }
/// <summary> /// 配置値取得 /// </summary> private bool GetConfigValue() { bool ret = true; NdnXmlConfig xmlConfig; string appName = Path.GetFileNameWithoutExtension(System.Windows.Forms.Application.ExecutablePath); xmlConfig = new NdnXmlConfig(string.Format(NCConst.CONFIG_FILE_DIR, appName) + NCUtility.GetAppConfig()); if (!xmlConfig.ReadXmlData("config", "home2", ref home2)) { ret = false; } return(ret); }
/// <summary> /// 配置値设定 /// </summary> private void SetProductValue(string product) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0460I", db.Language); NCLogger.GetInstance().WriteInfoLog(msg); NdnXmlConfig xmlConfig; xmlConfig = new NdnXmlConfig(NCConst.CONFIG_FILE_DIR + NCUtility.GetAppConfig()); if (!xmlConfig.WriteValue("config", "Product", product)) { msg = string.Format(NCMessage.GetInstance(db.Language).GetMessageById("CM0450E", db.Language), product); NCLogger.GetInstance().WriteErrorLog(msg); } msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0470I", db.Language); NCLogger.GetInstance().WriteInfoLog(msg); }
/// <summary> /// 取得数据库连接 /// </summary> /// <returns></returns> protected bool GetConnectionString() { NdnXmlConfig xmlConfig; xmlConfig = new NdnXmlConfig(NCConst.CONFIG_FILE_DIR + NCUtility.GetAppConfig()); string strConnectionString = null; string str = "ConnectionString"; if (xmlConfig.ReadXmlData("database", str, ref strConnectionString)) { string[] temp = strConnectionString.Split(';'); if (temp.Length > 0) { for (int idx = 0; idx < temp.Length; idx++) { if (temp[idx].IndexOf("Password="******"Password="******""); strPassword = NCCryp.Decrypto(temp[idx]); } else if (temp[idx].IndexOf("Data Source=") > -1) { temp[idx] = temp[idx].Replace("Data Source=", ""); strDataSource = temp[idx]; } else if (temp[idx].IndexOf("Initial Catalog=") > -1) { temp[idx] = temp[idx].Replace("Initial Catalog=", ""); strDbName = temp[idx]; } else if (temp[idx].IndexOf("User ID=") > -1) { temp[idx] = temp[idx].Replace("User ID=", ""); strUserName = temp[idx]; } } return(true); } } return(false); }
/// <summary> /// 配置値设定 /// </summary> private bool SetConfigValue() { bool ret = true; NdnXmlConfig xmlConfig; string path = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), "Config"); xmlConfig = new NdnXmlConfig(Path.Combine(path, "HPSTest.Config")); if (!xmlConfig.WriteValue("config", "company", company)) { ret = false; } if (!xmlConfig.WriteValue("config", "home", home)) { ret = false; } if (!xmlConfig.WriteValue("config", "home2", home2)) { ret = false; } return(ret); }
/// <summary> /// 配置値设定 /// </summary> private bool SetConfigValue() { bool ret = true; NC.HPS.Lib.NdnXmlConfig xmlConfig; string appName = Path.GetFileNameWithoutExtension(System.Windows.Forms.Application.ExecutablePath); xmlConfig = new NdnXmlConfig(string.Format(NCConst.CONFIG_FILE_DIR, appName) + NCUtility.GetAppConfig()); if (!xmlConfig.WriteValue("config", "ServerUrl", ServerUrl)) { ret = false; } if (!xmlConfig.WriteValue("config", "UserName", UserName)) { ret = false; } if (!xmlConfig.WriteValue("config", "Password", Password)) { ret = false; } return(ret); }
/// <summary> /// 配置値取得 /// </summary> private bool GetConfigValue() { bool ret = true; NdnXmlConfig xmlConfig; string path = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), "Config"); xmlConfig = new NdnXmlConfig(Path.Combine(path, "HPSTest.Config")); if (!xmlConfig.ReadXmlData("config", "Skin", ref Skin)) { ret = false; } if (!xmlConfig.ReadXmlData("config", "company", ref company)) { ret = false; } if (!xmlConfig.ReadXmlData("config", "home", ref home)) { ret = false; } if (!xmlConfig.ReadXmlData("config", "home2", ref home2)) { ret = false; } if (!xmlConfig.ReadXmlData("config", "ServerUrl", ref ServerUrl)) { ret = false; } if (!xmlConfig.ReadXmlData("config", "UserName", ref UserName)) { ret = false; } if (!xmlConfig.ReadXmlData("config", "Password", ref Password)) { ret = false; } return(ret); }
/// <summary> /// 初期化 /// </summary> public CmWinServiceAPI() { try { string constr = null; NdnXmlConfig xmlConfig; string path = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), "Config"); string dbpath = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), "DB"); xmlConfig = new NdnXmlConfig(Path.Combine(path, "HPSTest.Config")); if (!xmlConfig.ReadXmlData("database", "ConnectionString", ref constr)) { string msg = string.Format(NCMessage.GetInstance("").GetMessageById("CM0440E", ""), "サンプル間隙(秒)"); NCLogger.GetInstance().WriteErrorLog(msg); } Connection = new OleDbConnection(string.Format(constr, dbpath)); Connection.Open(); } catch (Exception e) { NCLogger.GetInstance().WriteExceptionLog(e); } }