From 4da1292698b93a4d81657e8589542e04dd481f9c Mon Sep 17 00:00:00 2001 From: "Valeriano A.R" Date: Wed, 24 Oct 2018 21:28:27 +0200 Subject: [PATCH] Code clean up --- .gitignore | 1 + .../Code/BusinessLogic/DatabaseBL.cs | 9 +++-- .../Code/BusinessLogic/ProcedureBL.cs | 3 +- .../Code/BusinessLogic/TableBL.cs | 5 ++- .../Code/DataAccess/ColumnDA.cs | 4 +-- .../Code/DataAccess/DatabaseDA.cs | 13 ++++--- .../Code/DataAccess/ProcedureDA.cs | 4 +-- .../Code/DataAccess/ServerDA.cs | 4 +-- .../Code/DataAccess/TableDA.cs | 7 ++-- VAR.DatabaseExplorer/Code/DataTableHelper.cs | 10 +++--- .../Code/DataTransfer/Column.cs | 5 ++- .../Code/DataTransfer/Database.cs | 5 ++- .../Code/DataTransfer/Procedure.cs | 2 +- .../Code/DataTransfer/Server.cs | 2 +- .../Code/DataTransfer/Table.cs | 5 ++- .../Code/DataTransfer/User.cs | 2 +- .../Controls/CustomListView.cs | 24 ++++++------- .../Controls/CustomTextBox.cs | 7 ++-- VAR.DatabaseExplorer/Controls/WindowButton.cs | 12 ++++--- VAR.DatabaseExplorer/Program.cs | 6 ++-- .../Properties/AssemblyInfo.cs | 2 +- VAR.DatabaseExplorer/UI/FrmBaseDatos.cs | 35 ++++++++----------- VAR.DatabaseExplorer/UI/FrmDatos.cs | 27 +++++++------- VAR.DatabaseExplorer/UI/FrmExec.cs | 11 +++--- VAR.DatabaseExplorer/UI/FrmPrincipal.cs | 14 ++++---- VAR.DatabaseExplorer/UI/FrmProcedimientos.cs | 11 +++--- VAR.DatabaseExplorer/UI/FrmServidores.cs | 3 +- 27 files changed, 110 insertions(+), 123 deletions(-) diff --git a/.gitignore b/.gitignore index c9b511f..058a695 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ *.user */bin/* */obj/* +/.vs/* diff --git a/VAR.DatabaseExplorer/Code/BusinessLogic/DatabaseBL.cs b/VAR.DatabaseExplorer/Code/BusinessLogic/DatabaseBL.cs index 0b69074..9a1e333 100644 --- a/VAR.DatabaseExplorer/Code/BusinessLogic/DatabaseBL.cs +++ b/VAR.DatabaseExplorer/Code/BusinessLogic/DatabaseBL.cs @@ -1,5 +1,4 @@ -using System; -using System.IO; +using System.IO; using VAR.DatabaseExplorer.Code.DataAccess; using VAR.DatabaseExplorer.Code.DataTransfer; @@ -69,7 +68,7 @@ namespace VAR.DatabaseExplorer.Code.BusinessLogic // Preparar cabecera del script txtWriter.WriteLine("SET NOCOUNT ON;"); txtWriter.WriteLine(string.Empty); - + // Desactivar todas las FKs txtWriter.WriteLine("-- Disable all constraints"); txtWriter.WriteLine("EXEC sp_MSforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT all'"); @@ -83,7 +82,7 @@ namespace VAR.DatabaseExplorer.Code.BusinessLogic txtWriter.WriteLine(string.Format("PRINT '*** Importing data of {0}....';", tableName)); TableBL.Table_ExportData(txtWriter, connectionString, tableName); } - + // Activar todas las FKs txtWriter.WriteLine("-- Enable all constraints"); txtWriter.WriteLine("EXEC sp_MSforeachtable @command1='print ''?''', @command2='ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all'"); @@ -91,4 +90,4 @@ namespace VAR.DatabaseExplorer.Code.BusinessLogic txtWriter.WriteLine(string.Empty); } } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Code/BusinessLogic/ProcedureBL.cs b/VAR.DatabaseExplorer/Code/BusinessLogic/ProcedureBL.cs index 5d46352..73e9a07 100644 --- a/VAR.DatabaseExplorer/Code/BusinessLogic/ProcedureBL.cs +++ b/VAR.DatabaseExplorer/Code/BusinessLogic/ProcedureBL.cs @@ -18,6 +18,5 @@ namespace VAR.DatabaseExplorer.Code.BusinessLogic } return procedures; } - } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Code/BusinessLogic/TableBL.cs b/VAR.DatabaseExplorer/Code/BusinessLogic/TableBL.cs index 3bba707..f77a98b 100644 --- a/VAR.DatabaseExplorer/Code/BusinessLogic/TableBL.cs +++ b/VAR.DatabaseExplorer/Code/BusinessLogic/TableBL.cs @@ -13,7 +13,7 @@ namespace VAR.DatabaseExplorer.Code.BusinessLogic List tables = TableDA.GetAllTables(connectionString); if (fillColumns) { - foreach(Table table in tables) + foreach (Table table in tables) { table.Columns = ColumnDA.GetColumns(connectionString, table.Schema, table.Name); } @@ -34,6 +34,5 @@ namespace VAR.DatabaseExplorer.Code.BusinessLogic txtWriter.WriteLine("GO"); txtWriter.WriteLine(string.Empty); } - } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Code/DataAccess/ColumnDA.cs b/VAR.DatabaseExplorer/Code/DataAccess/ColumnDA.cs index e4c8a19..4313ba1 100644 --- a/VAR.DatabaseExplorer/Code/DataAccess/ColumnDA.cs +++ b/VAR.DatabaseExplorer/Code/DataAccess/ColumnDA.cs @@ -48,7 +48,7 @@ namespace VAR.DatabaseExplorer.Code.DataAccess { string columnName = Convert.ToString(dr["ColumnName"]); Column col = columns.FirstOrDefault(c => c.Name == columnName); - if(col == null) + if (col == null) { col = new Column(); columns.Add(col); @@ -76,4 +76,4 @@ namespace VAR.DatabaseExplorer.Code.DataAccess return columns; } } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Code/DataAccess/DatabaseDA.cs b/VAR.DatabaseExplorer/Code/DataAccess/DatabaseDA.cs index 0c468de..e9ce0ea 100644 --- a/VAR.DatabaseExplorer/Code/DataAccess/DatabaseDA.cs +++ b/VAR.DatabaseExplorer/Code/DataAccess/DatabaseDA.cs @@ -12,7 +12,7 @@ namespace VAR.DatabaseExplorer.Code.DataAccess { var databases = new List(); var cnx = new SqlConnection(connectionString); - + cnx.Open(); DataTable dt = cnx.GetSchema("Databases"); cnx.Close(); @@ -23,22 +23,21 @@ namespace VAR.DatabaseExplorer.Code.DataAccess { databases.Add(new Database { - Name = (string) dr["database_name"], - CreateDate = (DateTime) dr["create_date"] + Name = (string)dr["database_name"], + CreateDate = (DateTime)dr["create_date"] }); } return databases; } - public static Database GetInfo(string connectionString) { var cnx = new SqlConnection(connectionString); string strCmd = string.Format(@" - SELECT + SELECT [name] DatabaseName, [create_date] CreateDate - FROM sys.databases + FROM sys.databases WHERE database_id = DB_ID(); "); var da = new SqlDataAdapter(strCmd, cnx); @@ -55,4 +54,4 @@ namespace VAR.DatabaseExplorer.Code.DataAccess return database; } } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Code/DataAccess/ProcedureDA.cs b/VAR.DatabaseExplorer/Code/DataAccess/ProcedureDA.cs index 67f2cc2..057480f 100644 --- a/VAR.DatabaseExplorer/Code/DataAccess/ProcedureDA.cs +++ b/VAR.DatabaseExplorer/Code/DataAccess/ProcedureDA.cs @@ -21,7 +21,7 @@ namespace VAR.DatabaseExplorer.Code.DataAccess cnx.Open(); da.Fill(dt); cnx.Close(); - + foreach (DataRow dr in dt.Rows) { procedures.Add(new Procedure @@ -79,4 +79,4 @@ namespace VAR.DatabaseExplorer.Code.DataAccess return sbProc.ToString(); } } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Code/DataAccess/ServerDA.cs b/VAR.DatabaseExplorer/Code/DataAccess/ServerDA.cs index 1512679..e403b28 100644 --- a/VAR.DatabaseExplorer/Code/DataAccess/ServerDA.cs +++ b/VAR.DatabaseExplorer/Code/DataAccess/ServerDA.cs @@ -12,7 +12,7 @@ namespace VAR.DatabaseExplorer.Code.DataAccess { var servers = new List(); SqlDataSourceEnumerator enumerador = SqlDataSourceEnumerator.Instance; - + DataTable dtServers = enumerador.GetDataSources(); dtServers.DefaultView.Sort = "ServerName ASC, InstanceName ASC, Version ASC"; dtServers = dtServers.DefaultView.ToTable(); @@ -29,4 +29,4 @@ namespace VAR.DatabaseExplorer.Code.DataAccess return servers; } } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Code/DataAccess/TableDA.cs b/VAR.DatabaseExplorer/Code/DataAccess/TableDA.cs index 2d76023..5266a40 100644 --- a/VAR.DatabaseExplorer/Code/DataAccess/TableDA.cs +++ b/VAR.DatabaseExplorer/Code/DataAccess/TableDA.cs @@ -17,7 +17,7 @@ namespace VAR.DatabaseExplorer.Code.DataAccess cnx.Close(); dt.DefaultView.Sort = "TABLE_SCHEMA ASC, TABLE_NAME ASC, TABLE_TYPE ASC"; dt = dt.DefaultView.ToTable(); - + foreach (DataRow dr in dt.Rows) { Table table = new Table @@ -32,7 +32,7 @@ namespace VAR.DatabaseExplorer.Code.DataAccess return tables; } - + public static DataTable GetData(string connectionString, string tableFullName) { var cnx = new SqlConnection(connectionString); @@ -45,6 +45,5 @@ namespace VAR.DatabaseExplorer.Code.DataAccess return dt; } - } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Code/DataTableHelper.cs b/VAR.DatabaseExplorer/Code/DataTableHelper.cs index 73f1f42..f7d9702 100644 --- a/VAR.DatabaseExplorer/Code/DataTableHelper.cs +++ b/VAR.DatabaseExplorer/Code/DataTableHelper.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Data; using System.Globalization; using System.IO; @@ -12,7 +11,7 @@ namespace VAR.DatabaseExplorer.Code public static void DataTable_GenerateInserts(TextWriter txtWriter, DataTable dataTable, string destTable) { var nfi = new NumberFormatInfo { NumberDecimalSeparator = "." }; - + var sbColumns = new StringBuilder(); foreach (DataColumn dc in dataTable.Columns) { @@ -20,7 +19,7 @@ namespace VAR.DatabaseExplorer.Code if (sbColumns.Length > 0) { sbColumns.Append(", "); } sbColumns.AppendFormat("[{0}]", dc.ColumnName); } - + // Recorrer la tabla de datos foreach (DataRow dr in dataTable.Rows) { @@ -83,14 +82,13 @@ namespace VAR.DatabaseExplorer.Code // Otros sbValues.AppendFormat("'{0}'", valor.ToString()); } - } } // Insertar fila a la datatable destino - txtWriter.WriteLine(string.Format("INSERT INTO {0} ({1}) VALUES ({2});", + txtWriter.WriteLine(string.Format("INSERT INTO {0} ({1}) VALUES ({2});", destTable, sbColumns.ToString(), sbValues.ToString())); } } } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Code/DataTransfer/Column.cs b/VAR.DatabaseExplorer/Code/DataTransfer/Column.cs index f9c77f4..3e6c96f 100644 --- a/VAR.DatabaseExplorer/Code/DataTransfer/Column.cs +++ b/VAR.DatabaseExplorer/Code/DataTransfer/Column.cs @@ -1,5 +1,4 @@ - -using System; +using System; using System.Xml.Serialization; namespace VAR.DatabaseExplorer.Code.DataTransfer @@ -22,4 +21,4 @@ namespace VAR.DatabaseExplorer.Code.DataTransfer [XmlAttribute] public bool PK { get; set; } } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Code/DataTransfer/Database.cs b/VAR.DatabaseExplorer/Code/DataTransfer/Database.cs index 41eb411..8c3bfb3 100644 --- a/VAR.DatabaseExplorer/Code/DataTransfer/Database.cs +++ b/VAR.DatabaseExplorer/Code/DataTransfer/Database.cs @@ -1,5 +1,4 @@ - -using System; +using System; using System.Collections.Generic; using System.Xml.Serialization; @@ -20,4 +19,4 @@ namespace VAR.DatabaseExplorer.Code.DataTransfer [XmlArray] public List Procedures { get; set; } } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Code/DataTransfer/Procedure.cs b/VAR.DatabaseExplorer/Code/DataTransfer/Procedure.cs index 3271e93..17d3a61 100644 --- a/VAR.DatabaseExplorer/Code/DataTransfer/Procedure.cs +++ b/VAR.DatabaseExplorer/Code/DataTransfer/Procedure.cs @@ -21,4 +21,4 @@ namespace VAR.DatabaseExplorer.Code.DataTransfer [XmlElement] public string Definition { get; set; } } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Code/DataTransfer/Server.cs b/VAR.DatabaseExplorer/Code/DataTransfer/Server.cs index 8f6613e..98cc77c 100644 --- a/VAR.DatabaseExplorer/Code/DataTransfer/Server.cs +++ b/VAR.DatabaseExplorer/Code/DataTransfer/Server.cs @@ -22,4 +22,4 @@ namespace VAR.DatabaseExplorer.Code.DataTransfer [XmlArray] public List Databases { get; set; } } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Code/DataTransfer/Table.cs b/VAR.DatabaseExplorer/Code/DataTransfer/Table.cs index 1ca76b3..b682796 100644 --- a/VAR.DatabaseExplorer/Code/DataTransfer/Table.cs +++ b/VAR.DatabaseExplorer/Code/DataTransfer/Table.cs @@ -1,5 +1,4 @@ - -using System; +using System; using System.Collections.Generic; using System.Xml.Serialization; @@ -20,4 +19,4 @@ namespace VAR.DatabaseExplorer.Code.DataTransfer [XmlArray] public List Columns { get; set; } } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Code/DataTransfer/User.cs b/VAR.DatabaseExplorer/Code/DataTransfer/User.cs index 9454285..0b5f12d 100644 --- a/VAR.DatabaseExplorer/Code/DataTransfer/User.cs +++ b/VAR.DatabaseExplorer/Code/DataTransfer/User.cs @@ -15,4 +15,4 @@ namespace VAR.DatabaseExplorer.Code.DataTransfer [XmlAttribute] public string Password { get; set; } } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Controls/CustomListView.cs b/VAR.DatabaseExplorer/Controls/CustomListView.cs index c71cb60..3194e78 100644 --- a/VAR.DatabaseExplorer/Controls/CustomListView.cs +++ b/VAR.DatabaseExplorer/Controls/CustomListView.cs @@ -1,11 +1,8 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Collections; using System.ComponentModel; using System.Runtime.InteropServices; using System.Windows.Forms; -using System.Collections; namespace VAR.DatabaseExplorer.Controls { @@ -18,20 +15,21 @@ namespace VAR.DatabaseExplorer.Controls { #region Declarations - ListViewItemComparer itemComparer = new ListViewItemComparer(); + private ListViewItemComparer itemComparer = new ListViewItemComparer(); - #endregion + #endregion Declarations #region Properties private bool allowSorting = false; + public bool AllowSorting { get { return allowSorting; } set { allowSorting = value; } } - #endregion + #endregion Properties #region Control life cicle @@ -40,7 +38,7 @@ namespace VAR.DatabaseExplorer.Controls ColumnClick += CustomListView_ColumnClick; } - #endregion + #endregion Control life cicle #region Events @@ -52,7 +50,7 @@ namespace VAR.DatabaseExplorer.Controls Sort(); } - #endregion + #endregion Events } #region ListViewItemComparer @@ -70,8 +68,8 @@ namespace VAR.DatabaseExplorer.Controls public int Compare(object x, object y) { - var itemA = (ListViewItem) x; - var itemB = (ListViewItem) y; + var itemA = (ListViewItem)x; + var itemB = (ListViewItem)y; if (itemA.SubItems.Count <= _col || itemB.SubItems.Count <= _col) { @@ -83,5 +81,5 @@ namespace VAR.DatabaseExplorer.Controls } } - #endregion -} + #endregion ListViewItemComparer +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Controls/CustomTextBox.cs b/VAR.DatabaseExplorer/Controls/CustomTextBox.cs index 7f5eddf..69d5378 100644 --- a/VAR.DatabaseExplorer/Controls/CustomTextBox.cs +++ b/VAR.DatabaseExplorer/Controls/CustomTextBox.cs @@ -20,9 +20,10 @@ namespace VAR.DatabaseExplorer.Controls SendMessage(Handle, EM_SETTABSTOPS, 1, new int[] { tabWidth * 4 }); } - #endregion + #endregion SetTabWidth + + private int _tabWidth = 8; - private int _tabWidth=8; public int TabWidth { get { return _tabWidth; } @@ -33,4 +34,4 @@ namespace VAR.DatabaseExplorer.Controls } } } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Controls/WindowButton.cs b/VAR.DatabaseExplorer/Controls/WindowButton.cs index 8ba0c9d..0206031 100644 --- a/VAR.DatabaseExplorer/Controls/WindowButton.cs +++ b/VAR.DatabaseExplorer/Controls/WindowButton.cs @@ -9,6 +9,7 @@ namespace VAR.DatabaseExplorer.Controls #region Properties private Form _window = null; + public Form Window { get { return _window; } @@ -16,6 +17,7 @@ namespace VAR.DatabaseExplorer.Controls } private bool _active = false; + public bool Active { get { return _active; } @@ -26,7 +28,7 @@ namespace VAR.DatabaseExplorer.Controls } } - #endregion + #endregion Properties #region Creator @@ -37,16 +39,16 @@ namespace VAR.DatabaseExplorer.Controls Click += WindowButton_Click; } - #endregion + #endregion Creator #region Events - void WindowButton_Click(object sender, EventArgs e) + private void WindowButton_Click(object sender, EventArgs e) { if (_window == null) { return; } _window.Activate(); } - #endregion + #endregion Events } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Program.cs b/VAR.DatabaseExplorer/Program.cs index 399bfef..feb60c2 100644 --- a/VAR.DatabaseExplorer/Program.cs +++ b/VAR.DatabaseExplorer/Program.cs @@ -4,17 +4,17 @@ using VAR.DatabaseExplorer.UI; namespace VAR.DatabaseExplorer { - static class Program + internal static class Program { /// /// The main entry point for the application. /// [STAThread] - static void Main() + private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FrmPrincipal()); } } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/Properties/AssemblyInfo.cs b/VAR.DatabaseExplorer/Properties/AssemblyInfo.cs index 3427dfb..03c5780 100644 --- a/VAR.DatabaseExplorer/Properties/AssemblyInfo.cs +++ b/VAR.DatabaseExplorer/Properties/AssemblyInfo.cs @@ -11,4 +11,4 @@ using System.Runtime.InteropServices; [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("31f76805-336c-471c-8af2-a4c1364e97b9")] -[assembly: AssemblyVersion("1.0.0.*")] +[assembly: AssemblyVersion("1.0.0.*")] \ No newline at end of file diff --git a/VAR.DatabaseExplorer/UI/FrmBaseDatos.cs b/VAR.DatabaseExplorer/UI/FrmBaseDatos.cs index c01c665..9a3a976 100644 --- a/VAR.DatabaseExplorer/UI/FrmBaseDatos.cs +++ b/VAR.DatabaseExplorer/UI/FrmBaseDatos.cs @@ -1,10 +1,7 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; using System.IO; using System.Windows.Forms; -using System.Xml.Serialization; -using VAR.DatabaseExplorer.Code; using VAR.DatabaseExplorer.Code.BusinessLogic; using VAR.DatabaseExplorer.Code.DataAccess; using VAR.DatabaseExplorer.Code.DataTransfer; @@ -28,17 +25,17 @@ namespace VAR.DatabaseExplorer.UI item.SubItems.Add(table.Name); item.SubItems.Add(table.Type); } - + lsvColumnas.Items.Clear(); } - + public FrmBaseDatos(string connectionString) { InitializeComponent(); _connectionString = connectionString; txtConString.Text = connectionString; } - + private void frmBaseDatos_Load(object sender, EventArgs e) { Initialize(); @@ -55,13 +52,13 @@ namespace VAR.DatabaseExplorer.UI private void lsvTablas_SelectedIndexChanged(object sender, EventArgs e) { if (lsvTablas.SelectedItems.Count != 1) { return; } - + ListViewItem item = lsvTablas.SelectedItems[0]; _tableSchema = item.SubItems[0].Text; _tableName = item.SubItems[1].Text; - + lblTituloTabla.Text = _tableSchema + @"." + _tableName; - + List columns = ColumnDA.GetColumns(_connectionString, _tableSchema, _tableName); lsvColumnas.Items.Clear(); foreach (Column col in columns) @@ -73,16 +70,15 @@ namespace VAR.DatabaseExplorer.UI subitem.SubItems.Add(col.Nullable ? "Null" : "NotNull"); } } - + private void btnVerDatos_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(_tableSchema) || string.IsNullOrEmpty(_tableName)) { return; } - + var form = new FrmDatos(_connectionString, _tableSchema, _tableName); FrmPrincipal.AddForm(form); } - private void btnProcs_Click(object sender, EventArgs e) { var form = new FrmProcedimientos(_connectionString); @@ -94,21 +90,21 @@ namespace VAR.DatabaseExplorer.UI var form = new FrmExec(_connectionString); FrmPrincipal.AddForm(form); } - + private void btnDocGen_Click(object sender, EventArgs e) { Parent.Enabled = false; Database database = DatabaseBL.Database_GetSchema(connectionString: _connectionString, fillDefinitions: true); - + string fixedDatabaseName = database.Name.Replace(' ', '_'); var streamWriter = new StreamWriter(fixedDatabaseName + ".documentation.html"); DatabaseBL.Database_GenerateDocumentation(streamWriter, database); streamWriter.Close(); - + Parent.Enabled = true; } - + private void btnRefresh_Click(object sender, EventArgs e) { Initialize(); @@ -117,15 +113,14 @@ namespace VAR.DatabaseExplorer.UI private void btnExportData_Click(object sender, EventArgs e) { Parent.Enabled = false; - + Database database = DatabaseBL.Database_GetSchema(connectionString: _connectionString, fillDefinitions: false); string fixedDatabaseName = database.Name.Replace(' ', '_'); var streamWriter = new StreamWriter(fixedDatabaseName + ".data.sql"); DatabaseBL.Database_ExportData(streamWriter, _connectionString, database); streamWriter.Close(); - + Parent.Enabled = true; } - } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/UI/FrmDatos.cs b/VAR.DatabaseExplorer/UI/FrmDatos.cs index 5689ebe..0fc10be 100644 --- a/VAR.DatabaseExplorer/UI/FrmDatos.cs +++ b/VAR.DatabaseExplorer/UI/FrmDatos.cs @@ -1,9 +1,8 @@ using System; using System.Data; +using System.Data.SqlClient; using System.Drawing; using System.Windows.Forms; -using VAR.DatabaseExplorer.Code; -using System.Data.SqlClient; namespace VAR.DatabaseExplorer.UI { @@ -15,7 +14,7 @@ namespace VAR.DatabaseExplorer.UI private readonly string _tableSchema = string.Empty; private readonly string _tableName = string.Empty; - #endregion + #endregion Declarations #region Form life cycle @@ -28,14 +27,18 @@ namespace VAR.DatabaseExplorer.UI _conexionString = conexionString; LoadDataFromTable(); } - - private void frmDatos_Load(object sender, EventArgs e) { } - #endregion + private void frmDatos_Load(object sender, EventArgs e) + { + } + + #endregion Form life cycle #region Events - private void dgvDatos_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { } + private void dgvDatos_CellDoubleClick(object sender, DataGridViewCellEventArgs e) + { + } private void dgvDatos_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { @@ -53,7 +56,7 @@ namespace VAR.DatabaseExplorer.UI LoadDataFromTable(); } - #endregion + #endregion Events #region Private methods @@ -61,15 +64,15 @@ namespace VAR.DatabaseExplorer.UI { Text = _tableSchema + @"." + _tableName; string tableFullName = "[" + _tableSchema + "].[" + _tableName + "]"; - var dt= new DataTable(); + var dt = new DataTable(); var cnx = new SqlConnection(_conexionString); - var da = new SqlDataAdapter( "select * from " + tableFullName, cnx); + var da = new SqlDataAdapter("select * from " + tableFullName, cnx); cnx.Open(); da.Fill(dt); cnx.Close(); dgvDatos.DataSource = dt; } - #endregion + #endregion Private methods } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/UI/FrmExec.cs b/VAR.DatabaseExplorer/UI/FrmExec.cs index 7f19c93..d9d6d7b 100644 --- a/VAR.DatabaseExplorer/UI/FrmExec.cs +++ b/VAR.DatabaseExplorer/UI/FrmExec.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Drawing; @@ -15,7 +14,7 @@ namespace VAR.DatabaseExplorer.UI private readonly string _cnxString; - #endregion + #endregion Declarations #region Form life cycle @@ -26,7 +25,7 @@ namespace VAR.DatabaseExplorer.UI _cnxString = cnxString; } - #endregion + #endregion Form life cycle #region Events @@ -79,7 +78,7 @@ namespace VAR.DatabaseExplorer.UI } } - #endregion + #endregion Events #region Private methods @@ -98,6 +97,6 @@ namespace VAR.DatabaseExplorer.UI return dt; } - #endregion + #endregion Private methods } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/UI/FrmPrincipal.cs b/VAR.DatabaseExplorer/UI/FrmPrincipal.cs index dc46ab7..39980d8 100644 --- a/VAR.DatabaseExplorer/UI/FrmPrincipal.cs +++ b/VAR.DatabaseExplorer/UI/FrmPrincipal.cs @@ -11,7 +11,7 @@ namespace VAR.DatabaseExplorer.UI private static FrmPrincipal _currentInstance; - #endregion + #endregion Declarations #region Creator @@ -21,7 +21,7 @@ namespace VAR.DatabaseExplorer.UI InitializeComponent(); } - #endregion + #endregion Creator #region WindowList @@ -77,16 +77,16 @@ namespace VAR.DatabaseExplorer.UI } } - #endregion + #endregion WindowList #region Menus - + private void menuBuscarServidor_Click(object sender, EventArgs e) { var frm = new FrmServidores(); FrmPrincipal.AddForm(frm); } - - #endregion + + #endregion Menus } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/UI/FrmProcedimientos.cs b/VAR.DatabaseExplorer/UI/FrmProcedimientos.cs index f388512..df20a71 100644 --- a/VAR.DatabaseExplorer/UI/FrmProcedimientos.cs +++ b/VAR.DatabaseExplorer/UI/FrmProcedimientos.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Data; using System.Data.SqlClient; using System.Windows.Forms; using VAR.DatabaseExplorer.Code.DataAccess; @@ -16,7 +15,7 @@ namespace VAR.DatabaseExplorer.UI private readonly SqlConnection _cnx; - #endregion + #endregion Declarations #region Form life cycle @@ -33,7 +32,7 @@ namespace VAR.DatabaseExplorer.UI lsvProcs_LoadData(); } - #endregion + #endregion Form life cycle #region Events @@ -53,7 +52,7 @@ namespace VAR.DatabaseExplorer.UI lsvProcs_LoadData(); } - #endregion + #endregion Events #region Private methods @@ -71,6 +70,6 @@ namespace VAR.DatabaseExplorer.UI } } - #endregion + #endregion Private methods } -} +} \ No newline at end of file diff --git a/VAR.DatabaseExplorer/UI/FrmServidores.cs b/VAR.DatabaseExplorer/UI/FrmServidores.cs index 499343c..c995b56 100644 --- a/VAR.DatabaseExplorer/UI/FrmServidores.cs +++ b/VAR.DatabaseExplorer/UI/FrmServidores.cs @@ -52,7 +52,6 @@ namespace VAR.DatabaseExplorer.UI } } - private void lsvBBDD_DoubleClick(object sender, EventArgs e) { if (lsvBBDD.SelectedItems.Count != 1) return; @@ -83,4 +82,4 @@ namespace VAR.DatabaseExplorer.UI return constructor.ConnectionString; } } -} +} \ No newline at end of file