Code clean up

This commit is contained in:
2018-10-24 21:28:27 +02:00
parent 4b5ce5b834
commit 4da1292698
27 changed files with 110 additions and 123 deletions

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@
*.user
*/bin/*
*/obj/*
/.vs/*

View File

@@ -1,5 +1,4 @@
using System;
using System.IO;
using System.IO;
using VAR.DatabaseExplorer.Code.DataAccess;
using VAR.DatabaseExplorer.Code.DataTransfer;

View File

@@ -18,6 +18,5 @@ namespace VAR.DatabaseExplorer.Code.BusinessLogic
}
return procedures;
}
}
}

View File

@@ -34,6 +34,5 @@ namespace VAR.DatabaseExplorer.Code.BusinessLogic
txtWriter.WriteLine("GO");
txtWriter.WriteLine(string.Empty);
}
}
}

View File

@@ -30,7 +30,6 @@ namespace VAR.DatabaseExplorer.Code.DataAccess
return databases;
}
public static Database GetInfo(string connectionString)
{
var cnx = new SqlConnection(connectionString);

View File

@@ -45,6 +45,5 @@ namespace VAR.DatabaseExplorer.Code.DataAccess
return dt;
}
}
}

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.IO;
@@ -83,7 +82,6 @@ namespace VAR.DatabaseExplorer.Code
// Otros
sbValues.AppendFormat("'{0}'", valor.ToString());
}
}
}

View File

@@ -1,5 +1,4 @@
using System;
using System;
using System.Xml.Serialization;
namespace VAR.DatabaseExplorer.Code.DataTransfer

View File

@@ -1,5 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Xml.Serialization;

View File

@@ -1,5 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Xml.Serialization;

View File

@@ -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
@@ -83,5 +81,5 @@ namespace VAR.DatabaseExplorer.Controls
}
}
#endregion
#endregion ListViewItemComparer
}

View File

@@ -20,9 +20,10 @@ namespace VAR.DatabaseExplorer.Controls
SendMessage(Handle, EM_SETTABSTOPS, 1, new int[] { tabWidth * 4 });
}
#endregion
#endregion SetTabWidth
private int _tabWidth = 8;
public int TabWidth
{
get { return _tabWidth; }

View File

@@ -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
}
}

View File

@@ -4,13 +4,13 @@ using VAR.DatabaseExplorer.UI;
namespace VAR.DatabaseExplorer
{
static class Program
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
private static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

View File

@@ -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;
@@ -82,7 +79,6 @@ namespace VAR.DatabaseExplorer.UI
FrmPrincipal.AddForm(form);
}
private void btnProcs_Click(object sender, EventArgs e)
{
var form = new FrmProcedimientos(_connectionString);
@@ -126,6 +122,5 @@ namespace VAR.DatabaseExplorer.UI
Parent.Enabled = true;
}
}
}

View File

@@ -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
@@ -29,13 +28,17 @@ namespace VAR.DatabaseExplorer.UI
LoadDataFromTable();
}
private void frmDatos_Load(object sender, EventArgs e) { }
private void frmDatos_Load(object sender, EventArgs e)
{
}
#endregion
#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
@@ -70,6 +73,6 @@ namespace VAR.DatabaseExplorer.UI
dgvDatos.DataSource = dt;
}
#endregion
#endregion Private methods
}
}

View File

@@ -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
}
}

View File

@@ -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,7 +77,7 @@ namespace VAR.DatabaseExplorer.UI
}
}
#endregion
#endregion WindowList
#region Menus
@@ -87,6 +87,6 @@ namespace VAR.DatabaseExplorer.UI
FrmPrincipal.AddForm(frm);
}
#endregion
#endregion Menus
}
}

View File

@@ -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
}
}

View File

@@ -52,7 +52,6 @@ namespace VAR.DatabaseExplorer.UI
}
}
private void lsvBBDD_DoubleClick(object sender, EventArgs e)
{
if (lsvBBDD.SelectedItems.Count != 1) return;