Inheritance: AbstractSqlConfiguration
Beispiel #1
0
        protected void TestSqlSettingsClick(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textboxSqlDatabase.Text) || String.IsNullOrEmpty(textboxSqlServerPath.Text) ||
                String.IsNullOrEmpty(textboxSqlUsername.Text) || String.IsNullOrEmpty(textboxSqlPassword.Text))
            {
                labelMessage.Text = "You must complete all the SQL configuration fields to test your SQL connectivity";
                return;
            }

            AbstractSqlConfiguration sqlConfig = new MsSqlConfiguration();
            sqlConfig.Database = textboxSqlDatabase.Text;
            sqlConfig.Hostname = textboxSqlServerPath.Text;
            sqlConfig.Username = textboxSqlUsername.Text;
            sqlConfig.Password = textboxSqlPassword.Text;

            ConnectionTester dao = new ConnectionTester(sqlConfig.buildConnectionString());
            dto.BoolTO result = dao.canWrite();
            if (result.trueOrFalse)
            {
                labelMessage.Text = "You were able to write to your database with these SQL settings. Good job!";
            }
            else if (result.fault != null)
            {
                labelMessage.Text = "<p>MDWS failed to write to your database with those SQL settings. Maybe the " +
                    "following error will give you a clue why:</p>" + result.fault.message;
            }
            else
            {
                labelMessage.Text = "MDWS couldn't successfully connect to your database with those parameters " +
                    "but no error was reported. You got yourself a real pickle there.";
            }
        }
Beispiel #2
0
        public void readConfigFile(string configFilePath)
        {
            ConfigFileDao configDao = new ConfigFileDao(configFilePath);

            try
            {
                AllConfigs = configDao.getAllValues();
            }
            catch (System.IO.FileNotFoundException)
            {
                return;
            }

            if (!AllConfigs.ContainsKey(ConfigFileConstants.PRIMARY_CONFIG_SECTION))
            {
                throw new MdoException("Invalid configuration file! Unable to continue...");
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.SQL_CONFIG_SECTION))
            {
                AbstractSqlConfiguration primarySqlConfig = new MsSqlConfiguration(AllConfigs[ConfigFileConstants.SQL_CONFIG_SECTION]);
                SqlConnectionString = primarySqlConfig.buildConnectionString();
                SqlConfiguration    = primarySqlConfig;
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.BSE_CONFIG_SECTION))
            {
                AbstractSqlConfiguration bseSqlConfig = new MsSqlConfiguration(AllConfigs[ConfigFileConstants.BSE_CONFIG_SECTION]);
                BseValidatorConnectionString = bseSqlConfig.buildConnectionString();
            }
            else
            {
                BseValidatorConnectionString = SqlConnectionString; // use SQL connection string if separate BSE string isn't found
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.ADR_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.ADR_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new OracleConfiguration
                                                          (AllConfigs[ConfigFileConstants.ADR_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    AdrConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.MHV_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.MHV_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new OracleConfiguration
                                                          (AllConfigs[ConfigFileConstants.MHV_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    MhvConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.VADIR_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.VADIR_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new OracleConfiguration
                                                          (AllConfigs[ConfigFileConstants.VADIR_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    VadirConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.VBA_CORP_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.VBA_CORP_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new OracleConfiguration
                                                          (AllConfigs[ConfigFileConstants.VBA_CORP_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    VbaCorpConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.NPT_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.NPT_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new MsSqlConfiguration
                                                          (AllConfigs[ConfigFileConstants.NPT_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    NptConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.CDW_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.CDW_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new MsSqlConfiguration
                                                          (AllConfigs[ConfigFileConstants.CDW_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    CdwConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.MOS_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.MOS_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new OracleConfiguration
                                                          (AllConfigs[ConfigFileConstants.MOS_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    MosConnectionString = config.ConnectionString;
                }
            }
        }
Beispiel #3
0
        public void readConfigFile(string configFilePath)
        {
            ConfigFileDao configDao = new ConfigFileDao(configFilePath);
            try
            {
                AllConfigs = configDao.getAllValues();
            }
            catch (System.IO.FileNotFoundException)
            {
                return;
            }

            if (!AllConfigs.ContainsKey(ConfigFileConstants.PRIMARY_CONFIG_SECTION))
            {
                throw new MdoException("Invalid configuration file! Unable to continue...");
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.SQL_CONFIG_SECTION))
            {
                AbstractSqlConfiguration primarySqlConfig = new MsSqlConfiguration(AllConfigs[ConfigFileConstants.SQL_CONFIG_SECTION]);
                SqlConnectionString = primarySqlConfig.buildConnectionString();
                SqlConfiguration = primarySqlConfig;
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.BSE_CONFIG_SECTION))
            {
                AbstractSqlConfiguration bseSqlConfig = new MsSqlConfiguration(AllConfigs[ConfigFileConstants.BSE_CONFIG_SECTION]);
                BseValidatorConnectionString = bseSqlConfig.buildConnectionString();
            }
            else
            {
                BseValidatorConnectionString = SqlConnectionString; // use SQL connection string if separate BSE string isn't found
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.ADR_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.ADR_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new OracleConfiguration
                        (AllConfigs[ConfigFileConstants.ADR_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    AdrConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.MHV_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.MHV_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new OracleConfiguration
                        (AllConfigs[ConfigFileConstants.MHV_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    MhvConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.VADIR_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.VADIR_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new OracleConfiguration
                        (AllConfigs[ConfigFileConstants.VADIR_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    VadirConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.VBA_CORP_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.VBA_CORP_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new OracleConfiguration
                        (AllConfigs[ConfigFileConstants.VBA_CORP_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    VbaCorpConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.NPT_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.NPT_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new MsSqlConfiguration
                        (AllConfigs[ConfigFileConstants.NPT_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    NptConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.CDW_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.CDW_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new MsSqlConfiguration
                        (AllConfigs[ConfigFileConstants.CDW_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    CdwConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.MOS_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.MOS_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new OracleConfiguration
                        (AllConfigs[ConfigFileConstants.MOS_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    MosConnectionString = config.ConnectionString;
                }
            }
        }