Ejemplo n.º 1
0
        private void CreateDataSources()
        {
            _dataSources.Clear();

            if (checkBoxSqlServer.Checked)
            {
                var sqlSource = new SqlSource(textBoxSqlServer.Text);
                if (!sqlSource.TestConnection())
                {
                    MessageBox.Show("Could not connect to database. Please check the connection string.", "Error");
                }
                else
                {
                    _dataSources.Add(sqlSource);
                }
            }

            if (checkBoxCsvFile.Checked)
            {
                var csvSource = new CsvSource(textBoxCsvFile.Text);
                if (!csvSource.TestConnection())
                {
                    MessageBox.Show("Could not find the CSV file. Please check the path to the file.", "Error");
                }
                else
                {
                    _dataSources.Add(csvSource);
                }
            }

            if (checkBoxXmlFile.Checked)
            {
                var xmlSource = new XmlSource(textBoxXmlFile.Text);
                if (!xmlSource.TestConnection())
                {
                    MessageBox.Show("Could not find the XML file. Please check the path to the file.", "Error");
                }
                else
                {
                    _dataSources.Add(xmlSource);
                }
            }
        }