Пример #1
0
        private void OpenCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            SaveFieldsToSettings();

            DbConnectionStringBuilder connectionStringBuilder = new DbConnectionStringBuilder();

            connectionStringBuilder.ConnectionString = ConnectionStringTextBox.Text;
            SqlConnection sqlConnection = new SqlConnection(connectionStringBuilder.ConnectionString);

            AuditUpdateParameters parameters = new AuditUpdateParameters
            {
                AlwaysRecreateFramework    = AlwaysRecreateCheckBox.IsChecked ?? false,
                AuditingDatabaseConnection = sqlConnection,
                AuditingFileGroup          = AuditingFileGroupTextBox.Text,
                AuditingSchema             = AuditingSchemaTextBox.Text,
                AuditTableFormat           = AuditTableFormatTextBox.Text,
                AutoDeployToDatabase       = AutomaticallyDeployCheckBox.IsChecked ?? false,
                DatabaseName       = sqlConnection.Database,
                OutputPath         = new DirectoryInfo(OutputPathTextBox.Text),
                RemoveAll          = RemoveAllCheckBox.IsChecked ?? false,
                TrackByPrimaryKeys = MatchByPrimaryKeysCheckBox.IsChecked ?? false,
                GenerateBaseline   = GenerateBaselineCheckBox.IsChecked ?? false
            };

            parameters.ColumnsNotAudited.AddRange(new[] { "", "" });
            parameters.ExecuteGrantees.AddRange(ExecuteGranteesTextBox.Text.Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));
            parameters.SchemasToAudit.AddRange(SchemasToAuditTextBox.Text.Trim().Split('\n', ' '));
            parameters.TablesNotAudited.AddRange(TablesNotAuditedTextBox.Text.Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));
            parameters.ColumnsNotAudited.AddRange(ColumnsNotAuditedTextBox.Text.Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));

            Generator generator = new Generator();
            string    sql       = generator.GenerateAuditingFrameworkUpdateSql(parameters);

            SqlWindow sqlWindow = new SqlWindow();

            sqlWindow.SqlText = sql;
            sqlWindow.ShowDialog();
        }
Пример #2
0
        private void OpenCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            SaveFieldsToSettings();

            DbConnectionStringBuilder connectionStringBuilder = new DbConnectionStringBuilder();
            connectionStringBuilder.ConnectionString = ConnectionStringTextBox.Text;
            SqlConnection sqlConnection = new SqlConnection(connectionStringBuilder.ConnectionString);

            AuditUpdateParameters parameters = new AuditUpdateParameters
            {
                AlwaysRecreateFramework = AlwaysRecreateCheckBox.IsChecked ?? false,
                AuditingDatabaseConnection = sqlConnection,
                AuditingFileGroup = AuditingFileGroupTextBox.Text,
                AuditingSchema = AuditingSchemaTextBox.Text,
                AuditTableFormat = AuditTableFormatTextBox.Text,
                AutoDeployToDatabase = AutomaticallyDeployCheckBox.IsChecked ?? false,
                DatabaseName = sqlConnection.Database,
                OutputPath = new DirectoryInfo(OutputPathTextBox.Text),
                RemoveAll = RemoveAllCheckBox.IsChecked ?? false,
                TrackByPrimaryKeys = MatchByPrimaryKeysCheckBox.IsChecked ?? false,
                GenerateBaseline = GenerateBaselineCheckBox.IsChecked ?? false
            };
            parameters.ColumnsNotAudited.AddRange(new[] { "", "" });
            parameters.ExecuteGrantees.AddRange(ExecuteGranteesTextBox.Text.Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));
            parameters.SchemasToAudit.AddRange(SchemasToAuditTextBox.Text.Trim().Split('\n', ' '));
            parameters.TablesNotAudited.AddRange(TablesNotAuditedTextBox.Text.Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));
            parameters.ColumnsNotAudited.AddRange(ColumnsNotAuditedTextBox.Text.Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));

            Generator generator = new Generator();
            string sql = generator.GenerateAuditingFrameworkUpdateSql(parameters);

            SqlWindow sqlWindow = new SqlWindow();
            sqlWindow.SqlText = sql;
            sqlWindow.ShowDialog();
        }