private void openConfigurationFileToolStripMenuItem_Click(object sender, EventArgs e) { var theDialog = new OpenFileDialog { Title = @"Open Validation File", Filter = @"Text files|*.txt", InitialDirectory = @"" + GlobalParameters.ConfigurationPath + "" }; if (theDialog.ShowDialog() != DialogResult.OK) { return; } try { var myStream = theDialog.OpenFile(); using (myStream) { richTextBoxInformation.Clear(); var chosenFile = theDialog.FileName; // Load from disk into memory ClassEnvironmentConfiguration.LoadValidationFile(chosenFile); // Update values on form LocalInitialiseValidationSettings(); } } catch (Exception ex) { MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message, "An issues has been encountered", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public FormManageValidation(FormManageMetadata parent) { _myParent = parent; InitializeComponent(); // Make sure the validation information is available in this form try { var validationFile = GlobalParameters.ConfigurationPath + GlobalParameters.ValidationFileName + '_' + GlobalParameters.WorkingEnvironment + GlobalParameters.FileExtension; // If the config file does not exist yet, create it by calling the EnvironmentConfiguration Class if (!File.Exists(validationFile)) { var newEnvironmentConfiguration = new ClassEnvironmentConfiguration(); newEnvironmentConfiguration.CreateDummyValidationConfiguration(validationFile); } // Load the validation settings file using the paths retrieved from the application root contents (configuration path) ClassEnvironmentConfiguration.LoadValidationFile(validationFile); richTextBoxInformation.Text += "The validation file " + validationFile + " has been loaded."; // Apply the values to the form LocalInitialiseValidationSettings(); } catch (Exception) { } }
public FormMain() { // Set the version of the build for everything const string versionNumberForTeamApplication = "v1.5.5.2"; // Placeholder for the error handling var errorMessage = new StringBuilder(); errorMessage.AppendLine("Error were detected:"); errorMessage.AppendLine(); var errorDetails = new StringBuilder(); errorDetails.AppendLine(); var errorCounter = 0; InitializeComponent(); Text = "TEAM - Taxonomy for ETL Automation Metadata " + versionNumberForTeamApplication; // Make sure the application and custom location directories exist ClassEnvironmentConfiguration.InitialiseRootPath(); // Set the root path, to be able to locate the customisable configuration file ClassEnvironmentConfiguration.LoadRootPathFile(); // Make sure the configuration file is in memory ClassEnvironmentConfiguration.InitialiseConfigurationPath(); // Load the available configuration file ClassEnvironmentConfiguration.LoadConfigurationFile(GlobalParameters.ConfigurationPath + GlobalParameters.ConfigfileName + '_' + GlobalParameters.WorkingEnvironment + GlobalParameters.FileExtension); //Startup information richTextBoxInformation.Text = "Application initialised - the Taxonomy of ETL Automation Metadata (TEAM). \r\n"; richTextBoxInformation.AppendText("Version " + versionNumberForTeamApplication + "\r\n\r\n"); //richTextBoxInformation.AppendText("Source code on Github: https://github.com/RoelantVos/TEAM \r\n\r\n"); labelWorkingEnvironment.Text = "The working environment is: " + GlobalParameters.WorkingEnvironment; TestConnections(); if (errorCounter > 0) { richTextBoxInformation.AppendText(errorMessage.ToString()); } }
public FormManageConfiguration(FormMain parent) : base(parent) { this.parentFormMain = parent; InitializeComponent(); //Make sure the root directories exist, based on hard-coded (tool) parameters //Also create the initial file with the configuration if it doesn't exist already ClassEnvironmentConfiguration.InitialiseRootPath(); // Set the core TEAM (path) file using the information retrieved from memory. These values were loaded into memory from the path file in the main form. //Dev or prod environment (working environment) RadioButton radioButtonWorkingEnvironment; if (GlobalParameters.WorkingEnvironment == "Development") { radioButtonWorkingEnvironment = radioButtonDevelopment; radioButtonWorkingEnvironment.Checked = true; } else if (GlobalParameters.WorkingEnvironment == "Production") { radioButtonWorkingEnvironment = radioButtonProduction; radioButtonWorkingEnvironment.Checked = true; } //Paths textBoxOutputPath.Text = GlobalParameters.OutputPath; textBoxConfigurationPath.Text = GlobalParameters.ConfigurationPath; // Load the configuration file using the paths retrieved from the application root contents (configuration path) try { LocalInitialiseConnections(GlobalParameters.ConfigurationPath + GlobalParameters.ConfigfileName + '_' + GlobalParameters.WorkingEnvironment + GlobalParameters.FileExtension); } catch (Exception ex) { richTextBoxInformation.AppendText("Errors occured trying to load the configuration file, the message is " + ex + ". No default values were loaded. \r\n\r\n"); } _formLoading = false; }
/// <summary> /// Commit the changes to memory, save the configuration settings to disk and create a backup /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void saveConfigurationFileToolStripMenuItem_Click(object sender, EventArgs e) { string workingEnvironment = ""; if (radioButtonDevelopment.Checked) { workingEnvironment = "Development"; } else if (radioButtonProduction.Checked) { workingEnvironment = "Production"; } else { MessageBox.Show("An error occurred: neither the Development or Production radiobutton was selected.", "An issue has been encountered", MessageBoxButtons.OK, MessageBoxIcon.Error); } // Update the root path file, part of the core solution to be able to store the config and output path var rootPathConfigurationFile = new StringBuilder(); rootPathConfigurationFile.AppendLine("/* TEAM File Path Settings */"); rootPathConfigurationFile.AppendLine("/* Saved at " + DateTime.Now + " */"); rootPathConfigurationFile.AppendLine("ConfigurationPath|" + textBoxConfigurationPath.Text + ""); rootPathConfigurationFile.AppendLine("OutputPath|" + textBoxOutputPath.Text + ""); rootPathConfigurationFile.AppendLine("WorkingEnvironment|" + workingEnvironment + ""); rootPathConfigurationFile.AppendLine("/* End of file */"); using (var outfile = new StreamWriter(GlobalParameters.RootPath + GlobalParameters.PathfileName + GlobalParameters.FileExtension)) { outfile.Write(rootPathConfigurationFile.ToString()); outfile.Close(); } // Update the paths in memory GlobalParameters.OutputPath = textBoxOutputPath.Text; GlobalParameters.ConfigurationPath = textBoxConfigurationPath.Text; GlobalParameters.WorkingEnvironment = workingEnvironment; // Make sure the new paths as updated are available upon save for backup etc. ClassEnvironmentConfiguration.InitialiseConfigurationPath(); // Create a file backup for the configuration file try { ClassEnvironmentConfiguration.CreateEnvironmentConfigurationBackupFile(); richTextBoxInformation.Text = "A backup of the current configuration was made at " + DateTime.Now + " in " + textBoxConfigurationPath.Text + "."; } catch (Exception) { richTextBoxInformation.Text = "TEAM was unable to create a backup of the configuration file."; } // Update the in-memory variables for use throughout the application, to commit the saved changes for runtime use. // This is needed before saving to disk, as the EnvironmentConfiguration Class retrieves the values from memory. UpdateConfigurationInMemory(); // Save the information ClassEnvironmentConfiguration.SaveConfigurationFile(); parentFormMain.RevalidateFlag = true; }
/// <summary> /// This method will load an existing configuration file and display the values on the form, or create a new dummy one if not available /// </summary> /// <param name="chosenFile"></param> private void LocalInitialiseConnections(string chosenFile) { // If the config file does not exist yet, create it by calling the EnvironmentConfiguration Class if (!File.Exists(chosenFile)) { var newEnvironmentConfiguration = new ClassEnvironmentConfiguration(); newEnvironmentConfiguration.CreateDummyEnvironmentConfiguration(chosenFile); } // Open the configuration file var configList = new Dictionary <string, string>(); var fs = new FileStream(chosenFile, FileMode.Open, FileAccess.Read); var sr = new StreamReader(fs); try { string textline; while ((textline = sr.ReadLine()) != null) { if (textline.IndexOf(@"/*", StringComparison.Ordinal) == -1) { var line = textline.Split('|'); configList.Add(line[0], line[1]); } } sr.Close(); fs.Close(); ////Replace values for formatting and connection string layout //var connectionStringOmd = configList["connectionStringMetadata"]; //connectionStringOmd = connectionStringOmd.Replace("Provider=SQLNCLI10;", "").Replace("Provider=SQLNCLI11;", "").Replace("Provider=SQLNCLI12;", ""); //var connectionStringSource = configList["connectionStringSource"]; //connectionStringSource = connectionStringSource.Replace("Provider=SQLNCLI10;", "").Replace("Provider=SQLNCLI11;", "").Replace("Provider=SQLNCLI12;", ""); //var connectionStringStg = configList["connectionStringStaging"]; //connectionStringStg = connectionStringStg.Replace("Provider=SQLNCLI10;", "").Replace("Provider=SQLNCLI11;", "").Replace("Provider=SQLNCLI12;", ""); //var connectionStringHstg = configList["connectionStringPersistentStaging"]; //connectionStringHstg = connectionStringHstg.Replace("Provider=SQLNCLI10;", "").Replace("Provider=SQLNCLI11;", "").Replace("Provider=SQLNCLI12;", ""); //var connectionStringInt = configList["connectionStringIntegration"]; //connectionStringInt = connectionStringInt.Replace("Provider=SQLNCLI10;", "").Replace("Provider=SQLNCLI11;", "").Replace("Provider=SQLNCLI12;", ""); //var connectionStringPres = configList["connectionStringPresentation"]; //connectionStringPres = connectionStringPres.Replace("Provider=SQLNCLI10;", "").Replace("Provider=SQLNCLI11;", "").Replace("Provider=SQLNCLI12;", ""); ////Connections //textBoxIntegrationConnection.Text = connectionStringInt; //textBoxPSAConnection.Text = connectionStringHstg; //textBoxSourceConnection.Text = connectionStringSource; //textBoxStagingConnection.Text = connectionStringStg; //textBoxMetadataConnection.Text = connectionStringOmd; //textBoxPresentationConnection.Text = connectionStringPres; //DWH settings textBoxHubTablePrefix.Text = configList["HubTablePrefix"]; textBoxSatPrefix.Text = configList["SatTablePrefix"]; textBoxLinkTablePrefix.Text = configList["LinkTablePrefix"]; textBoxLinkSatPrefix.Text = configList["LinkSatTablePrefix"]; textBoxDWHKeyIdentifier.Text = configList["KeyIdentifier"]; textBoxSchemaName.Text = configList["SchemaName"]; textBoxEventDateTime.Text = configList["EventDateTimeStamp"]; textBoxLDST.Text = configList["LoadDateTimeStamp"]; textBoxExpiryDateTimeName.Text = configList["ExpiryDateTimeStamp"]; textBoxChangeDataCaptureIndicator.Text = configList["ChangeDataIndicator"]; textBoxRecordSource.Text = configList["RecordSourceAttribute"]; textBoxETLProcessID.Text = configList["ETLProcessID"]; textBoxETLUpdateProcessID.Text = configList["ETLUpdateProcessID"]; textBoxSourcePrefix.Text = configList["SourceSystemPrefix"]; textBoxStagingAreaPrefix.Text = configList["StagingAreaPrefix"]; textBoxPSAPrefix.Text = configList["PersistentStagingAreaPrefix"]; textBoxSourceRowId.Text = configList["RowID"]; // Databases textBoxSourceDatabase.Text = configList["SourceDatabase"]; textBoxStagingDatabase.Text = configList["StagingDatabase"]; textBoxPSADatabase.Text = configList["PersistentStagingDatabase"]; textBoxIntegrationDatabase.Text = configList["IntegrationDatabase"]; textBoxPresentationDatabase.Text = configList["PresentationDatabase"]; textBoxMetadataDatabaseName.Text = configList["MetadataDatabase"]; textBoxRecordChecksum.Text = configList["RecordChecksum"]; textBoxCurrentRecordAttributeName.Text = configList["CurrentRecordAttribute"]; textBoxAlternativeRecordSource.Text = configList["AlternativeRecordSource"]; textBoxHubAlternativeLDTSAttribute.Text = configList["AlternativeHubLDTS"]; textBoxSatelliteAlternativeLDTSAttribute.Text = configList["AlternativeSatelliteLDTS"]; textBoxLogicalDeleteAttributeName.Text = configList["LogicalDeleteAttribute"]; // Servers (instances) textBoxPhysicalModelServerName.Text = configList["PhysicalModelServerName"]; textBoxMetadataServerName.Text = configList["MetadataServerName"]; //Checkbox setting based on loaded configuration CheckBox myConfigurationCheckBox; if (configList["AlternativeRecordSourceFunction"] == "False") { myConfigurationCheckBox = checkBoxAlternativeRecordSource; myConfigurationCheckBox.Checked = false; textBoxAlternativeRecordSource.Enabled = false; } else { myConfigurationCheckBox = checkBoxAlternativeRecordSource; myConfigurationCheckBox.Checked = true; } if (configList["AlternativeHubLDTSFunction"] == "False") { myConfigurationCheckBox = checkBoxAlternativeHubLDTS; myConfigurationCheckBox.Checked = false; textBoxHubAlternativeLDTSAttribute.Enabled = false; } else { myConfigurationCheckBox = checkBoxAlternativeHubLDTS; myConfigurationCheckBox.Checked = true; } if (configList["AlternativeSatelliteLDTSFunction"] == "False") { myConfigurationCheckBox = checkBoxAlternativeSatLDTS; myConfigurationCheckBox.Checked = false; textBoxSatelliteAlternativeLDTSAttribute.Enabled = false; } else { myConfigurationCheckBox = checkBoxAlternativeSatLDTS; myConfigurationCheckBox.Checked = true; } //Radiobutton setting for prefix / suffix RadioButton myTableRadioButton; if (configList["TableNamingLocation"] == "Prefix") { myTableRadioButton = tablePrefixRadiobutton; myTableRadioButton.Checked = true; } else { myTableRadioButton = tableSuffixRadiobutton; myTableRadioButton.Checked = true; } //Radiobutton settings for on key location RadioButton myKeyRadioButton; if (configList["KeyNamingLocation"] == "Prefix") { myKeyRadioButton = keyPrefixRadiobutton; myKeyRadioButton.Checked = true; } else { myKeyRadioButton = keySuffixRadiobutton; myKeyRadioButton.Checked = true; } //Radiobutton settings for PSA Natural Key determination RadioButton myPsaBusinessKeyLocation; if (configList["PSAKeyLocation"] == "PrimaryKey") { myPsaBusinessKeyLocation = radioButtonPSABusinessKeyPK; myPsaBusinessKeyLocation.Checked = true; } else { myPsaBusinessKeyLocation = radioButtonPSABusinessKeyIndex; myPsaBusinessKeyLocation.Checked = true; } //Radiobutton settings for repository type RadioButton myMetadatarepositoryType; if (configList["metadataRepositoryType"] == "JSON") { myMetadatarepositoryType = radioButtonJSON; myMetadatarepositoryType.Checked = true; } else { myMetadatarepositoryType = radioButtonSQLServer; myMetadatarepositoryType.Checked = true; } // Authentication approach for metadata var myRadioButtonMetadataSSPI = radioButtonMetadataSSPI; var myRadioButtonMetadataNamed = radioButtonMetadataNamed; if (configList["MetadataSSPI"] == "True") { myRadioButtonMetadataSSPI.Checked = true; myRadioButtonMetadataNamed.Checked = false; groupBoxMetadataNamedUser.Visible = false; } else { myRadioButtonMetadataSSPI.Checked = false; } if (configList["MetadataNamed"] == "True") { myRadioButtonMetadataNamed.Checked = true; myRadioButtonMetadataSSPI.Checked = false; groupBoxMetadataNamedUser.Visible = true; } else { myRadioButtonMetadataNamed.Checked = false; groupBoxMetadataNamedUser.Visible = false; } // Authentication approach for the physical model var myRadioButtonPhysicalModelSSPI = radioButtonPhysicalModelSSPI; var myRadioButtonPhysicalModelNamed = radioButtonPhysicalModelNamed; if (configList["PhysicalModelSSPI"] == "True") { myRadioButtonPhysicalModelSSPI.Checked = true; myRadioButtonPhysicalModelNamed.Checked = false; groupBoxMetadataNamedUser.Visible = false; } else { myRadioButtonPhysicalModelSSPI.Checked = false; } if (configList["PhysicalModelNamed"] == "True") { myRadioButtonPhysicalModelNamed.Checked = true; myRadioButtonPhysicalModelSSPI.Checked = false; groupBoxPhysicalModelNamedUser.Visible = true; } else { myRadioButtonPhysicalModelNamed.Checked = false; groupBoxPhysicalModelNamedUser.Visible = false; } textBoxMetadataUserName.Text = configList["MetadataUserName"]; textBoxMetadataPassword.Text = configList["MetadataPassword"]; textBoxPhysicalModelUserName.Text = configList["PhysicalModelUserName"]; textBoxPhysicalModelPassword.Text = configList["PhysicalModelPassword"]; // Also commit the values to memory UpdateConfigurationInMemory(); richTextBoxInformation.AppendText(@"The file " + chosenFile + " was uploaded successfully. \r\n\r\n"); } catch (Exception ex) { richTextBoxInformation.AppendText("\r\n\r\nAn error occured while loading the configuration file. The original error is: '" + ex.Message + "'"); } }
private void toolStripMenuItem2_Click(object sender, EventArgs e) { try { // Save form values to memory // Source object existence check var stringSourceObjectExistence = ""; if (checkBoxSourceObjectExistence.Checked) { stringSourceObjectExistence = "True"; } else { stringSourceObjectExistence = "False"; } ValidationSettings.SourceObjectExistence = stringSourceObjectExistence; // Target object existence check var stringtargetObjectExistence = ""; if (checkBoxTargetObjectExistence.Checked) { stringtargetObjectExistence = "True"; } else { stringtargetObjectExistence = "False"; } ValidationSettings.TargetObjectExistence = stringtargetObjectExistence; // Source business key existence check var stringBusinessKeyExistence = ""; if (checkBoxSourceBusinessKeyExistence.Checked) { stringBusinessKeyExistence = "True"; } else { stringBusinessKeyExistence = "False"; } ValidationSettings.SourceBusinessKeyExistence = stringBusinessKeyExistence; // Logical Group Validation var stringLogicalGroup = ""; if (checkBoxLogicalGroup.Checked) { stringLogicalGroup = "True"; } else { stringLogicalGroup = "False"; } ValidationSettings.LogicalGroup = stringLogicalGroup; // Link Key Order Validation var stringLinkKeyOrder = ""; if (checkBoxLinkKeyOrder.Checked) { stringLinkKeyOrder = "True"; } else { stringLinkKeyOrder = "False"; } ValidationSettings.LinkKeyOrder = stringLinkKeyOrder; // Business key syntax check var businessKeySyntax = ""; if (checkBoxBusinessKeySyntaxValidation.Checked) { businessKeySyntax = "True"; } else { businessKeySyntax = "False"; } ValidationSettings.BusinessKeySyntax = businessKeySyntax; // Write to disk ClassEnvironmentConfiguration.SaveValidationFile(); richTextBoxInformation.Text = "The values have been successfully saved."; } catch (Exception ex) { MessageBox.Show("Error: Could not write values to memory and disk. Original error: " + ex.Message, "An issues has been encountered", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Check if the paths exists and create them if necessary /// </summary> internal static void InitialiseConfigurationPath() { // Create the configuration directory if it does not exist yet try { if (!Directory.Exists(FormBase.GlobalParameters.ConfigurationPath)) { Directory.CreateDirectory(FormBase.GlobalParameters.ConfigurationPath); } } catch (Exception ex) { MessageBox.Show( "Error creation default directory at " + FormBase.GlobalParameters.ConfigurationPath + " the message is " + ex, "An issue has been encountered", MessageBoxButtons.OK, MessageBoxIcon.Error); } // Create the output directory if it does not exist yet try { if (!Directory.Exists(FormBase.GlobalParameters.OutputPath)) { Directory.CreateDirectory(FormBase.GlobalParameters.OutputPath); } } catch (Exception ex) { MessageBox.Show( "Error creation default directory at " + FormBase.GlobalParameters.OutputPath + " the message is " + ex, "An issue has been encountered", MessageBoxButtons.OK, MessageBoxIcon.Error); } // Create a new dummy configuration file try { // Create a default configuration file if the file does not exist as expected if (File.Exists(FormBase.GlobalParameters.ConfigurationPath + FormBase.GlobalParameters.ConfigfileName + '_' + FormBase.GlobalParameters.WorkingEnvironment + FormBase.GlobalParameters.FileExtension)) { return; } var newEnvironmentConfiguration = new ClassEnvironmentConfiguration(); newEnvironmentConfiguration.CreateDummyEnvironmentConfiguration( FormBase.GlobalParameters.ConfigurationPath + FormBase.GlobalParameters.ConfigfileName + '_' + FormBase.GlobalParameters.WorkingEnvironment + FormBase.GlobalParameters.FileExtension); } catch (Exception ex) { MessageBox.Show( "An error occurred while creation the default Configuration File. The error message is " + ex, "An issue has been encountered", MessageBoxButtons.OK, MessageBoxIcon.Error); } // Create a new dummy validation file try { // Create a default configuration file if the file does not exist as expected if (File.Exists(FormBase.GlobalParameters.ConfigurationPath + FormBase.GlobalParameters.ValidationFileName + '_' + FormBase.GlobalParameters.WorkingEnvironment + FormBase.GlobalParameters.FileExtension)) { return; } var newEnvironmentConfiguration = new ClassEnvironmentConfiguration(); newEnvironmentConfiguration.CreateDummyEnvironmentConfiguration( FormBase.GlobalParameters.ConfigurationPath + FormBase.GlobalParameters.ValidationFileName + '_' + FormBase.GlobalParameters.WorkingEnvironment + FormBase.GlobalParameters.FileExtension); } catch (Exception ex) { MessageBox.Show( "An error occurred while creation the default Configuration File. The error message is " + ex, "An issue has been encountered", MessageBoxButtons.OK, MessageBoxIcon.Error); } }