示例#1
0
        /// <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());
        }
示例#2
0
        /// <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);
        }
示例#3
0
        /// <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))
            {
            }
        }
示例#4
0
        /// <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);
        }
示例#5
0
        /// <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);
        }
示例#6
0
        /// <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);
        }
示例#7
0
        /// <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);
        }
示例#8
0
        /// <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);
        }
示例#9
0
        /// <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);
        }
示例#10
0
        /// <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);
        }
示例#11
0
        /// <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);
            }
        }