Refactorings
This commit is contained in:
55
ServerExplorer/UI/FrmBaseDatos.Designer.cs
generated
55
ServerExplorer/UI/FrmBaseDatos.Designer.cs
generated
@@ -45,8 +45,8 @@
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.btnRefresh = new System.Windows.Forms.Button();
|
||||
this.lsvTablas = new ServerExplorer.Controls.CustomListView();
|
||||
this.colNombreTabla = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colEsquema = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colNombreTabla = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colTipo = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.lsvColumnas = new ServerExplorer.Controls.CustomListView();
|
||||
this.colNombreColumna = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
@@ -83,13 +83,12 @@
|
||||
//
|
||||
// menuBaseDatos
|
||||
//
|
||||
this.menuBaseDatos.Dock = System.Windows.Forms.DockStyle.None;
|
||||
this.menuBaseDatos.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.archivoToolStripMenuItem,
|
||||
this.menuConfiguracion});
|
||||
this.menuBaseDatos.Location = new System.Drawing.Point(7, 195);
|
||||
this.menuBaseDatos.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuBaseDatos.Name = "menuBaseDatos";
|
||||
this.menuBaseDatos.Size = new System.Drawing.Size(195, 24);
|
||||
this.menuBaseDatos.Size = new System.Drawing.Size(806, 24);
|
||||
this.menuBaseDatos.TabIndex = 9;
|
||||
this.menuBaseDatos.Text = "menuBaseDatos";
|
||||
this.menuBaseDatos.Visible = false;
|
||||
@@ -100,6 +99,7 @@
|
||||
this.archivoToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.menuCargar,
|
||||
this.menuGuardar});
|
||||
this.archivoToolStripMenuItem.MergeIndex = 0;
|
||||
this.archivoToolStripMenuItem.Name = "archivoToolStripMenuItem";
|
||||
this.archivoToolStripMenuItem.Size = new System.Drawing.Size(92, 20);
|
||||
this.archivoToolStripMenuItem.Text = "Base de Datos";
|
||||
@@ -107,14 +107,14 @@
|
||||
// menuCargar
|
||||
//
|
||||
this.menuCargar.Name = "menuCargar";
|
||||
this.menuCargar.Size = new System.Drawing.Size(116, 22);
|
||||
this.menuCargar.Size = new System.Drawing.Size(152, 22);
|
||||
this.menuCargar.Text = "Cargar";
|
||||
this.menuCargar.Click += new System.EventHandler(this.menuCargar_Click);
|
||||
//
|
||||
// menuGuardar
|
||||
//
|
||||
this.menuGuardar.Name = "menuGuardar";
|
||||
this.menuGuardar.Size = new System.Drawing.Size(116, 22);
|
||||
this.menuGuardar.Size = new System.Drawing.Size(152, 22);
|
||||
this.menuGuardar.Text = "Guardar";
|
||||
this.menuGuardar.Click += new System.EventHandler(this.menuGuardar_Click);
|
||||
//
|
||||
@@ -149,8 +149,8 @@
|
||||
//
|
||||
// lblTituloTabla
|
||||
//
|
||||
this.lblTituloTabla.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblTituloTabla.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblTituloTabla.BackColor = System.Drawing.SystemColors.ControlDarkDark;
|
||||
this.lblTituloTabla.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblTituloTabla.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
@@ -163,8 +163,8 @@
|
||||
//
|
||||
// lblTituloDB
|
||||
//
|
||||
this.lblTituloDB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblTituloDB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblTituloDB.BackColor = System.Drawing.SystemColors.ControlDarkDark;
|
||||
this.lblTituloDB.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblTituloDB.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
@@ -210,9 +210,9 @@
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(1, 32);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
@@ -231,7 +231,6 @@
|
||||
this.splitContainer1.Panel2.Controls.Add(this.lblTituloTabla);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.btnDocGen);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.lsvColumnas);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.menuBaseDatos);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.btnGenerar);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.btnVerDatos);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(806, 511);
|
||||
@@ -252,13 +251,13 @@
|
||||
// lsvTablas
|
||||
//
|
||||
this.lsvTablas.AllowSorting = true;
|
||||
this.lsvTablas.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lsvTablas.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lsvTablas.CheckBoxes = true;
|
||||
this.lsvTablas.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.colNombreTabla,
|
||||
this.colEsquema,
|
||||
this.colNombreTabla,
|
||||
this.colTipo});
|
||||
this.lsvTablas.FullRowSelect = true;
|
||||
this.lsvTablas.Location = new System.Drawing.Point(3, 40);
|
||||
@@ -270,15 +269,15 @@
|
||||
this.lsvTablas.View = System.Windows.Forms.View.Details;
|
||||
this.lsvTablas.SelectedIndexChanged += new System.EventHandler(this.lsvTablas_SelectedIndexChanged);
|
||||
//
|
||||
// colEsquema
|
||||
//
|
||||
this.colEsquema.Text = "Esquema";
|
||||
//
|
||||
// colNombreTabla
|
||||
//
|
||||
this.colNombreTabla.Text = "Tabla";
|
||||
this.colNombreTabla.Width = 169;
|
||||
//
|
||||
// colEsquema
|
||||
//
|
||||
this.colEsquema.Text = "Esquema";
|
||||
//
|
||||
// colTipo
|
||||
//
|
||||
this.colTipo.Text = "Tipo";
|
||||
@@ -287,9 +286,9 @@
|
||||
// lsvColumnas
|
||||
//
|
||||
this.lsvColumnas.AllowSorting = false;
|
||||
this.lsvColumnas.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lsvColumnas.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lsvColumnas.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.colNombreColumna,
|
||||
this.colTipoDatos,
|
||||
@@ -329,8 +328,8 @@
|
||||
//
|
||||
// txtConString
|
||||
//
|
||||
this.txtConString.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtConString.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtConString.Location = new System.Drawing.Point(120, 6);
|
||||
this.txtConString.Name = "txtConString";
|
||||
this.txtConString.ReadOnly = true;
|
||||
@@ -346,6 +345,7 @@
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Controls.Add(this.btnCopiarConString);
|
||||
this.Controls.Add(this.lblConString);
|
||||
this.Controls.Add(this.menuBaseDatos);
|
||||
this.Controls.Add(this.txtConString);
|
||||
this.MainMenuStrip = this.menuBaseDatos;
|
||||
this.Name = "FrmBaseDatos";
|
||||
@@ -355,7 +355,6 @@
|
||||
this.menuBaseDatos.PerformLayout();
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.PerformLayout();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -4,6 +4,9 @@ using System.Windows.Forms;
|
||||
using System.Data.SqlClient;
|
||||
using System.Xml.Serialization;
|
||||
using ServerExplorer.Code;
|
||||
using System.Collections.Generic;
|
||||
using ServerExplorer.Code.DataTransfer;
|
||||
using ServerExplorer.Code.DataAccess;
|
||||
|
||||
namespace ServerExplorer.UI
|
||||
{
|
||||
@@ -20,22 +23,16 @@ namespace ServerExplorer.UI
|
||||
txtConString.Text = _config.ConnectionString;
|
||||
_cnx = new SqlConnection(_config.ConnectionString);
|
||||
|
||||
// Obtener lista de tablas
|
||||
_cnx.Open();
|
||||
DataTable dt = _cnx.GetSchema("Tables");
|
||||
_cnx.Close();
|
||||
|
||||
// Mostrar todas las tablas
|
||||
List<Table> tables = TableDA.Table_GetRegs(_config.ConnectionString);
|
||||
lsvTablas.Items.Clear();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
foreach (Table table in tables)
|
||||
{
|
||||
ListViewItem item = lsvTablas.Items.Add((String)dr["TABLE_NAME"]);
|
||||
item.SubItems.Add((String)dr["TABLE_SCHEMA"]);
|
||||
item.SubItems.Add((String)dr["TABLE_TYPE"]);
|
||||
ListViewItem item = lsvTablas.Items.Add(table.Schema);
|
||||
item.SubItems.Add(table.Name);
|
||||
item.SubItems.Add(table.Type);
|
||||
}
|
||||
TablesToListView();
|
||||
|
||||
// Limpiar Columnas
|
||||
TablesToListView();
|
||||
lsvColumnas.Items.Clear();
|
||||
}
|
||||
|
||||
@@ -51,8 +48,8 @@ namespace ServerExplorer.UI
|
||||
{
|
||||
_config.Tablas.Add(new TablaInfo
|
||||
{
|
||||
Esquema = item.SubItems[1].Text,
|
||||
Nombre = item.SubItems[0].Text
|
||||
Esquema = item.SubItems[0].Text,
|
||||
Nombre = item.SubItems[1].Text
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -81,8 +78,8 @@ namespace ServerExplorer.UI
|
||||
item.Checked = false;
|
||||
do
|
||||
{
|
||||
if (String.Compare(_config.Tablas[i].Esquema, item.SubItems[1].Text, StringComparison.Ordinal) == 0 &&
|
||||
String.Compare(_config.Tablas[i].Nombre, item.SubItems[0].Text, StringComparison.Ordinal) == 0)
|
||||
if (String.Compare(_config.Tablas[i].Esquema, item.SubItems[0].Text, StringComparison.Ordinal) == 0 &&
|
||||
String.Compare(_config.Tablas[i].Nombre, item.SubItems[1].Text, StringComparison.Ordinal) == 0)
|
||||
{
|
||||
item.Checked = true;
|
||||
break;
|
||||
@@ -120,8 +117,6 @@ namespace ServerExplorer.UI
|
||||
_config = config;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void frmBaseDatos_Load(object sender, EventArgs e)
|
||||
{
|
||||
Initialize();
|
||||
@@ -145,8 +140,8 @@ namespace ServerExplorer.UI
|
||||
ListViewItem item = lsvTablas.SelectedItems[0];
|
||||
|
||||
// Recordar tabla seleccionada
|
||||
_tableSchema = item.SubItems[1].Text;
|
||||
_tableName = item.SubItems[0].Text;
|
||||
_tableSchema = item.SubItems[0].Text;
|
||||
_tableName = item.SubItems[1].Text;
|
||||
|
||||
// Establecer titulo de la lista de columnas
|
||||
lblTituloTabla.Text = _tableSchema + @"." + _tableName;
|
||||
|
||||
Reference in New Issue
Block a user