Example #1
0
        /// <summary>
        /// This event launches the ConnectionStringForm
        /// </summary>
        private void BuildSourceConnectionStringButton_Click(object sender, EventArgs e)
        {
            // If the CompareInfo object exists
            if ((HasCompareInfo) && (this.HasSettings))
            {
                // if the CompareType is CompareTwoSQLDatabases or CreateXmlFile
                if ((CompareInfo.CompareType == CompareTypeEnum.CompareTwoSQLDatabases) || (CompareInfo.CompareType == CompareTypeEnum.CreateXmlFile))
                {
                    // Create an instance of the ConnectionStringBuilderForm
                    ConnectionStringBuilderForm connectionForm = new ConnectionStringBuilderForm();

                    // Show the form
                    connectionForm.ShowDialog();

                    // if the user did not cancel
                    if (!connectionForm.UserCancelled)
                    {
                        // Set the SourceConnectionStringControl
                        this.SourceConnectionStringControl.Text = connectionForm.ConnectionString;
                    }
                }
                else if (CompareInfo.CompareType == CompareTypeEnum.CompareXmlFileAndSQLDatabase)
                {
                    // Choose the file
                    DialogHelper.ChooseFile(this.SourceConnectionStringControl.GetTextBox(), XmlFilter, this.Settings.SourceXmlFilePath);
                }
            }
        }
Example #2
0
        /// <summary>
        /// This event builds the target connection.
        /// </summary>
        private void BuildTargetConnectionStringButton_Click(object sender, EventArgs e)
        {
            // If the CompareInfo object exists and the Settings exist
            if ((HasCompareInfo) && (HasSettings))
            {
                // if the CompareType is CompareTwoSQLDatabases or CreateXmlFile
                if ((CompareInfo.CompareType == CompareTypeEnum.CompareTwoSQLDatabases) || (CompareInfo.CompareType == CompareTypeEnum.CompareXmlFileAndSQLDatabase))
                {
                    // Create an instance of the ConnectionStringBuilderForm
                    ConnectionStringBuilderForm connectionForm = new ConnectionStringBuilderForm();

                    // Show the form
                    connectionForm.ShowDialog();

                    // if the user did not cancel
                    if (!connectionForm.UserCancelled)
                    {
                        // Set the TargetConnectionStringControl
                        this.TargetConnectionStringControl.Text = connectionForm.ConnectionString;
                    }
                }
                else if (CompareInfo.CompareType == CompareTypeEnum.CompareXmlFileAndSQLDatabase)
                {
                    // local
                    string folderName = "";

                    // if the OutputXmlFilePath exists
                    if ((TextHelper.Exists(Settings.OutputXmlFilePath)) && (File.Exists(Settings.OutputXmlFilePath)))
                    {
                        // Crete the directory
                        FileInfo file = new FileInfo(Settings.OutputXmlFilePath);

                        // if the file exists
                        if (file.Exists)
                        {
                            // get the folderName
                            folderName = file.Directory.FullName;
                        }
                    }

                    // Choose the folder
                    DialogHelper.ChooseFolder(this.TargetConnectionStringControl.GetTextBox(), folderName);

                    // if a folder was selected
                    if (TargetConnectionStringControl.HasText)
                    {
                        // Add [Enter The File Name] to the choosen folder
                        this.TargetConnectionStringControl.Text += "[Enter The File Name].xml";
                    }
                }
            }
        }