Quitar CodeGen y formulario de configuración
This commit is contained in:
@@ -1,382 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Data;
|
||||
using ServerExplorer.Code;
|
||||
|
||||
namespace ServerExplorer
|
||||
{
|
||||
public class CodeGen
|
||||
{
|
||||
private static string FixNombre(string strIn)
|
||||
{
|
||||
return strIn.Replace(' ', '_');
|
||||
}
|
||||
|
||||
|
||||
public static void GeneraDTO(Config config, TablaDesc t)
|
||||
{
|
||||
string nombreObj = FixNombre(t.Esquema) + "_" + FixNombre(t.Nombre);
|
||||
string nombreFichero = config.PathDTO + "/" + nombreObj + "_DTO.cs";
|
||||
EscritorCodigo escritor = new EscritorCodigo(nombreFichero);
|
||||
|
||||
// Cabecera
|
||||
escritor.Escribe("using System;");
|
||||
escritor.Escribe("using System.Data;");
|
||||
escritor.Escribe("");
|
||||
escritor.EscribeInd("namespace " + config.NamespaceDTO);
|
||||
|
||||
// El objeto de la tabla
|
||||
escritor.EscribeInd("public partial class " + nombreObj);
|
||||
foreach (ColumnaDesc c in t.Columnas)
|
||||
{
|
||||
string nombre = FixNombre(c.Nombre);
|
||||
TipoCol tipo = c.GetTipo();
|
||||
string sTipo = null;
|
||||
|
||||
// Determinar el tipo a usar
|
||||
switch (tipo)
|
||||
{
|
||||
case TipoCol.Numerico:
|
||||
sTipo = "int"; break;
|
||||
case TipoCol.Texto:
|
||||
sTipo = "string"; break;
|
||||
case TipoCol.AproxNumerico:
|
||||
sTipo = "double"; break;
|
||||
case TipoCol.Tiempo:
|
||||
sTipo = "DateTime"; break;
|
||||
case TipoCol.Booleano:
|
||||
sTipo = "bool"; break;
|
||||
case TipoCol.Binario:
|
||||
sTipo = "byte[]"; break;
|
||||
}
|
||||
if (sTipo == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// El atributo privado para cada columna
|
||||
escritor.Escribe("private " + sTipo + " _" + nombre + ";");
|
||||
|
||||
// La propiedad publica para cada columna
|
||||
escritor.EscribeInd("public " + sTipo + " " + nombre);
|
||||
escritor.EscribeInd("get");
|
||||
escritor.Escribe("return _" + nombre + ";");
|
||||
escritor.DeInd();
|
||||
escritor.EscribeInd("set");
|
||||
escritor.Escribe("_" + nombre + " = value;");
|
||||
escritor.DeInd();
|
||||
escritor.DeInd();
|
||||
escritor.Escribe("");
|
||||
}
|
||||
escritor.DeInd();
|
||||
|
||||
// El Pie
|
||||
escritor.DeInd();
|
||||
|
||||
// Cerrar ficheros
|
||||
escritor.Cerrar();
|
||||
}
|
||||
|
||||
private static void GenerarDALParametrosTabla
|
||||
(TablaDesc t, String varPrm, String varCmd, String varDTO, bool input, EscritorCodigo escritor)
|
||||
{
|
||||
foreach (ColumnaDesc c in t.Columnas)
|
||||
{
|
||||
string nombre = FixNombre(c.Nombre);
|
||||
TipoCol tipo = c.GetTipo();
|
||||
|
||||
// Establecer el tipo del parametro
|
||||
switch (tipo)
|
||||
{
|
||||
case TipoCol.Numerico:
|
||||
escritor.Escribe(varPrm + " = new SqlParameter(\"@[" + c.Nombre + "]\",SqlDbType.Int);"); break;
|
||||
case TipoCol.Texto:
|
||||
escritor.Escribe(varPrm + " = new SqlParameter(\"@[" + c.Nombre + "]\", " +
|
||||
"SqlDbType.VarChar, " + c.Tamanho + ");"); break;
|
||||
case TipoCol.AproxNumerico:
|
||||
escritor.Escribe(varPrm + " = new SqlParameter(\"@[" + c.Nombre + "]\", SqlDbType.Real);"); break;
|
||||
case TipoCol.Tiempo:
|
||||
escritor.Escribe(varPrm + " = new SqlParameter(\"@[" + c.Nombre + "]\", SqlDbType.DateTime);"); break;
|
||||
case TipoCol.Booleano:
|
||||
escritor.Escribe(varPrm + " = new SqlParameter(\"@[" + c.Nombre + "]\", SqlDbType.Bit);"); break;
|
||||
case TipoCol.Binario:
|
||||
if (c.Tamanho > 0)
|
||||
{
|
||||
escritor.Escribe(varPrm + " = new SqlParameter(\"@[" + c.Nombre + "]\", " +
|
||||
"SqlDbType.VarBinary, " + c.Tamanho + ");");
|
||||
}
|
||||
else
|
||||
{
|
||||
escritor.Escribe(varPrm + " = new SqlParameter(\"@[" + c.Nombre + "]\", SqlDbType.Binary);");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if (input)
|
||||
{
|
||||
escritor.Escribe(varPrm + ".Direction = ParameterDirection.Input;");
|
||||
}
|
||||
else
|
||||
{
|
||||
escritor.Escribe(varPrm + ".Direction = ParameterDirection.Output;");
|
||||
}
|
||||
escritor.Escribe(varPrm + ".Value = " + varDTO + "." + nombre + ";");
|
||||
escritor.Escribe(varCmd + ".Parameters.Add(" + varPrm + ");");
|
||||
}
|
||||
escritor.Escribe("");
|
||||
}
|
||||
|
||||
private static void GenerarDALInsert(Config config, TablaDesc t, EscritorCodigo escritor)
|
||||
{
|
||||
string nombreObj = FixNombre(t.Esquema) + "_" + FixNombre(t.Nombre);
|
||||
string strInsert1, strInsert2;
|
||||
|
||||
// Cabecera y variables del metodo
|
||||
escritor.EscribeInd("public bool Insertar(" + nombreObj + " reg)");
|
||||
escritor.Escribe("SqlCommand cmd;");
|
||||
escritor.Escribe("SqlParameter prm;");
|
||||
escritor.Escribe("int nRows;");
|
||||
escritor.Escribe("");
|
||||
|
||||
// Preparacion del comando
|
||||
strInsert1 = String.Empty;
|
||||
strInsert2 = String.Empty;
|
||||
foreach (ColumnaDesc c in t.Columnas)
|
||||
{
|
||||
TipoCol tipo = c.GetTipo();
|
||||
|
||||
if (tipo == TipoCol.Otro)
|
||||
continue;
|
||||
|
||||
if (strInsert1 == String.Empty)
|
||||
{
|
||||
// Primera columna
|
||||
strInsert1 += "[" + c.Nombre + "]";
|
||||
strInsert2 += "@[" + c.Nombre + "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Cualquier otra columna
|
||||
strInsert1 += ", [" + c.Nombre + "]";
|
||||
strInsert2 += ", @[" + c.Nombre + "]";
|
||||
}
|
||||
}
|
||||
escritor.Escribe("cmd = new SqlCommand(\"INSERT INTO [" + t.Esquema + "].[" + t.Nombre + "] " +
|
||||
"(" + strInsert1 + ") " +
|
||||
"VALUES (" + strInsert2 + "\");");
|
||||
escritor.Escribe("");
|
||||
|
||||
// Preparacion de los parametros
|
||||
GenerarDALParametrosTabla(t, "prm", "cmd", "reg", true, escritor);
|
||||
|
||||
// Ejecucion
|
||||
escritor.Escribe("cnx.Open();");
|
||||
escritor.Escribe("nRows = cmd.ExecuteNonQuery()");
|
||||
escritor.Escribe("cnx.Close();");
|
||||
escritor.Escribe("");
|
||||
|
||||
// Pie
|
||||
escritor.Escribe("return (nRows>0);");
|
||||
escritor.DeInd();
|
||||
escritor.Escribe("");
|
||||
}
|
||||
|
||||
private static void GenerarDALActualizar(Config config, TablaDesc t, EscritorCodigo escritor)
|
||||
{
|
||||
string nombreObj = FixNombre(t.Esquema) + "_" + FixNombre(t.Nombre);
|
||||
string strActualizar, strFiltroPrimario;
|
||||
|
||||
// Cabecera y variables del metodo
|
||||
escritor.EscribeInd("public bool Actualizar(" + nombreObj + " reg)");
|
||||
escritor.Escribe("SqlCommand cmd;");
|
||||
escritor.Escribe("SqlParameter prm;");
|
||||
escritor.Escribe("int nRows;");
|
||||
escritor.Escribe("");
|
||||
|
||||
// Preparacion del comando
|
||||
strActualizar = String.Empty;
|
||||
foreach (ColumnaDesc c in t.Columnas)
|
||||
{
|
||||
TipoCol tipo = c.GetTipo();
|
||||
|
||||
if (tipo == TipoCol.Otro)
|
||||
continue;
|
||||
if (c.Primaria)
|
||||
continue;
|
||||
|
||||
if (strActualizar != String.Empty)
|
||||
{
|
||||
strActualizar += ",";
|
||||
}
|
||||
strActualizar += "[" + c.Nombre + "]=@[" + c.Nombre + "]";
|
||||
}
|
||||
strFiltroPrimario = String.Empty;
|
||||
foreach (ColumnaDesc c in t.Columnas)
|
||||
{
|
||||
TipoCol tipo = c.GetTipo();
|
||||
|
||||
if (!c.Primaria)
|
||||
continue;
|
||||
|
||||
if (strFiltroPrimario != String.Empty)
|
||||
{
|
||||
strFiltroPrimario += " AND ";
|
||||
}
|
||||
strFiltroPrimario += "[" + c.Nombre + "]=@[" + c.Nombre + "]";
|
||||
}
|
||||
escritor.Escribe("cmd = new SqlCommand(\"UPDATE [" + t.Esquema + "].[" + t.Nombre + "] " +
|
||||
"SET " + strActualizar + " " +
|
||||
"WHERE " + strFiltroPrimario + "\");");
|
||||
escritor.Escribe("");
|
||||
|
||||
// Preparacion de los parametros
|
||||
GenerarDALParametrosTabla(t, "prm", "cmd", "reg", true, escritor);
|
||||
|
||||
// Ejecucion
|
||||
escritor.Escribe("cnx.Open();");
|
||||
escritor.Escribe("nRows = cmd.ExecuteNonQuery();");
|
||||
escritor.Escribe("cnx.Close();");
|
||||
escritor.Escribe("");
|
||||
|
||||
// Pie
|
||||
escritor.Escribe("return (nRows>0);");
|
||||
escritor.DeInd();
|
||||
escritor.Escribe("");
|
||||
}
|
||||
|
||||
|
||||
public static void GeneraDAL(Config config, TablaDesc t)
|
||||
{
|
||||
string nombreObj = FixNombre(t.Esquema) + "_" + FixNombre(t.Nombre);
|
||||
string nombreDAL = FixNombre(t.Esquema) + "_" + FixNombre(t.Nombre) + "_DAL";
|
||||
string nombreFichero = config.PathDTO + "/" + nombreDAL + ".cs";
|
||||
EscritorCodigo escritor = new EscritorCodigo(nombreFichero);
|
||||
|
||||
// Cabecera.
|
||||
escritor.Escribe("using System;");
|
||||
escritor.Escribe("using System.Data;");
|
||||
escritor.Escribe("using System.Data.Sql;");
|
||||
escritor.Escribe("using System.Data.SqlClient;");
|
||||
escritor.Escribe("");
|
||||
escritor.Escribe("using " + config.NamespaceDTO + ";");
|
||||
escritor.Escribe("");
|
||||
escritor.EscribeInd("namespace " + config.NamespaceDAL);
|
||||
|
||||
// El objeto DAL.
|
||||
escritor.EscribeInd("public partial class " + nombreDAL);
|
||||
|
||||
// Atributos internos
|
||||
escritor.Escribe("SqlConnexion cnx;");
|
||||
escritor.Escribe("");
|
||||
|
||||
// Constructor
|
||||
escritor.EscribeInd("public " + nombreDAL + "(SqlConnexion cnx)");
|
||||
escritor.Escribe("this.cnx = cnx;");
|
||||
escritor.DeInd();
|
||||
escritor.Escribe("");
|
||||
|
||||
// Metodo Insertar.
|
||||
GenerarDALInsert(config, t, escritor);
|
||||
|
||||
// Metodo Actualizar.
|
||||
GenerarDALActualizar(config, t, escritor);
|
||||
|
||||
// FIXME: Metodo Borrar.
|
||||
|
||||
// FIXME: Metodo Leer.
|
||||
|
||||
// FIXME: Metodo LeerTodos
|
||||
|
||||
// Cerrar objeto DAL.
|
||||
escritor.DeInd();
|
||||
|
||||
// El Pie
|
||||
escritor.DeInd();
|
||||
|
||||
// Cerrar ficheros.
|
||||
escritor.Cerrar();
|
||||
}
|
||||
|
||||
public static Boolean GenerarCodigo(Config config, DatabaseDesc database)
|
||||
{
|
||||
// Asegura la existencia de los directorios destinos
|
||||
if (!Directory.Exists(config.PathRaiz)) { Utiles.CrearDirectorio(config.PathRaiz); }
|
||||
if (!Directory.Exists(config.PathDTO)) { Utiles.CrearDirectorio(config.PathDTO); }
|
||||
if (!Directory.Exists(config.PathDAL)) { Utiles.CrearDirectorio(config.PathDAL); }
|
||||
if (!Directory.Exists(config.PathExtra)) { Utiles.CrearDirectorio(config.PathExtra); }
|
||||
|
||||
// Itera por cada tabla para crear sus DTO y DAL
|
||||
foreach (TablaDesc t in database.Tablas)
|
||||
{
|
||||
GeneraDTO(config, t);
|
||||
GeneraDAL(config, t);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private class Indentado
|
||||
{
|
||||
private int indentado = 0;
|
||||
private StringBuilder sb = new StringBuilder();
|
||||
|
||||
public void Inc()
|
||||
{
|
||||
indentado++;
|
||||
}
|
||||
public void Dec()
|
||||
{
|
||||
indentado--;
|
||||
if (indentado < 0)
|
||||
{
|
||||
indentado = 0;
|
||||
}
|
||||
}
|
||||
public string Str()
|
||||
{
|
||||
sb.Remove(0, sb.Length);
|
||||
for (int i = 0; i < indentado; i++)
|
||||
{
|
||||
sb.Append("\t");
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private class EscritorCodigo
|
||||
{
|
||||
StreamWriter escritor;
|
||||
Indentado indentado;
|
||||
|
||||
public EscritorCodigo(string nombreFichero)
|
||||
{
|
||||
escritor = new StreamWriter(nombreFichero);
|
||||
indentado = new Indentado();
|
||||
}
|
||||
public void Cerrar()
|
||||
{
|
||||
escritor.Close();
|
||||
}
|
||||
|
||||
public void Escribe(String str)
|
||||
{
|
||||
escritor.WriteLine(indentado.Str() + str);
|
||||
}
|
||||
public void EscribeInd(String str)
|
||||
{
|
||||
escritor.WriteLine(indentado.Str() + str);
|
||||
escritor.WriteLine(indentado.Str() + "{");
|
||||
indentado.Inc();
|
||||
}
|
||||
public void DeInd()
|
||||
{
|
||||
indentado.Dec();
|
||||
escritor.WriteLine(indentado.Str() + "}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,6 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CodeGen.cs" />
|
||||
<Compile Include="Config.cs" />
|
||||
<Compile Include="DatabaseDesc.cs" />
|
||||
<Compile Include="DocGen.cs" />
|
||||
@@ -79,12 +78,6 @@
|
||||
<Compile Include="FrmBaseDatos.Designer.cs">
|
||||
<DependentUpon>FrmBaseDatos.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FrmCodeGenConfig.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FrmCodeGenConfig.Designer.cs">
|
||||
<DependentUpon>FrmCodeGenConfig.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FrmDatos.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -122,9 +115,6 @@
|
||||
<EmbeddedResource Include="FrmBaseDatos.resx">
|
||||
<DependentUpon>FrmBaseDatos.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="FrmCodeGenConfig.resx">
|
||||
<DependentUpon>FrmCodeGenConfig.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="FrmDatos.resx">
|
||||
<DependentUpon>FrmDatos.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
@@ -215,9 +215,9 @@ namespace ServerExplorer
|
||||
|
||||
private void menuConfiguracion_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Llamar a la ventana de configuracion
|
||||
FrmCodeGenConfig frm = new FrmCodeGenConfig(config);
|
||||
frm.ShowDialog();
|
||||
//// Llamar a la ventana de configuracion
|
||||
//FrmCodeGenConfig frm = new FrmCodeGenConfig(config);
|
||||
//frm.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnVerDatos_Click(object sender, EventArgs e)
|
||||
@@ -291,10 +291,10 @@ namespace ServerExplorer
|
||||
tablas_delistview();
|
||||
DatabaseDesc db = CrearDatabaseDesc();
|
||||
|
||||
//XmlSerializer seriador = new XmlSerializer(typeof(DatabaseDesc));
|
||||
//seriador.Serialize(System.Console.Out, db);
|
||||
XmlSerializer seriador = new XmlSerializer(typeof(DatabaseDesc));
|
||||
seriador.Serialize(System.Console.Out, db);
|
||||
|
||||
CodeGen.GenerarCodigo(config, db);
|
||||
//CodeGen.GenerarCodigo(config, db);
|
||||
}
|
||||
|
||||
private void btnDocGen_Click(object sender, EventArgs e)
|
||||
|
||||
307
ServerExplorer/frmCodeGenConfig.Designer.cs
generated
307
ServerExplorer/frmCodeGenConfig.Designer.cs
generated
@@ -1,307 +0,0 @@
|
||||
namespace ServerExplorer
|
||||
{
|
||||
partial class FrmCodeGenConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.lblConString = new System.Windows.Forms.Label();
|
||||
this.txtConString = new System.Windows.Forms.TextBox();
|
||||
this.lblPathRaiz = new System.Windows.Forms.Label();
|
||||
this.txtPathRaiz = new System.Windows.Forms.TextBox();
|
||||
this.btnPathRaiz = new System.Windows.Forms.Button();
|
||||
this.btnPathDAL = new System.Windows.Forms.Button();
|
||||
this.txtPathDAL = new System.Windows.Forms.TextBox();
|
||||
this.lblPathDAL = new System.Windows.Forms.Label();
|
||||
this.btnPathDTO = new System.Windows.Forms.Button();
|
||||
this.txtPathDTO = new System.Windows.Forms.TextBox();
|
||||
this.lblPathDTO = new System.Windows.Forms.Label();
|
||||
this.btnPathExtra = new System.Windows.Forms.Button();
|
||||
this.txtPathExtra = new System.Windows.Forms.TextBox();
|
||||
this.lblPathExtra = new System.Windows.Forms.Label();
|
||||
this.btnCancelar = new System.Windows.Forms.Button();
|
||||
this.btnAceptar = new System.Windows.Forms.Button();
|
||||
this.lblNSDAL = new System.Windows.Forms.Label();
|
||||
this.lblNSDTO = new System.Windows.Forms.Label();
|
||||
this.txtNSDAL = new System.Windows.Forms.TextBox();
|
||||
this.txtNSDTO = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lblConString
|
||||
//
|
||||
this.lblConString.AutoSize = true;
|
||||
this.lblConString.Location = new System.Drawing.Point(12, 9);
|
||||
this.lblConString.Name = "lblConString";
|
||||
this.lblConString.Size = new System.Drawing.Size(106, 13);
|
||||
this.lblConString.TabIndex = 0;
|
||||
this.lblConString.Text = "Cadena de Conexion";
|
||||
//
|
||||
// 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.Location = new System.Drawing.Point(125, 6);
|
||||
this.txtConString.Multiline = true;
|
||||
this.txtConString.Name = "txtConString";
|
||||
this.txtConString.ReadOnly = true;
|
||||
this.txtConString.Size = new System.Drawing.Size(330, 45);
|
||||
this.txtConString.TabIndex = 1;
|
||||
//
|
||||
// lblPathRaiz
|
||||
//
|
||||
this.lblPathRaiz.AutoSize = true;
|
||||
this.lblPathRaiz.Location = new System.Drawing.Point(12, 64);
|
||||
this.lblPathRaiz.Name = "lblPathRaiz";
|
||||
this.lblPathRaiz.Size = new System.Drawing.Size(53, 13);
|
||||
this.lblPathRaiz.TabIndex = 2;
|
||||
this.lblPathRaiz.Text = "Path Raiz";
|
||||
//
|
||||
// txtPathRaiz
|
||||
//
|
||||
this.txtPathRaiz.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtPathRaiz.Location = new System.Drawing.Point(125, 61);
|
||||
this.txtPathRaiz.Name = "txtPathRaiz";
|
||||
this.txtPathRaiz.ReadOnly = true;
|
||||
this.txtPathRaiz.Size = new System.Drawing.Size(296, 20);
|
||||
this.txtPathRaiz.TabIndex = 4;
|
||||
//
|
||||
// btnPathRaiz
|
||||
//
|
||||
this.btnPathRaiz.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnPathRaiz.Location = new System.Drawing.Point(427, 58);
|
||||
this.btnPathRaiz.Name = "btnPathRaiz";
|
||||
this.btnPathRaiz.Size = new System.Drawing.Size(28, 23);
|
||||
this.btnPathRaiz.TabIndex = 5;
|
||||
this.btnPathRaiz.Text = "...";
|
||||
this.btnPathRaiz.UseVisualStyleBackColor = true;
|
||||
this.btnPathRaiz.Click += new System.EventHandler(this.btnPathRaiz_Click);
|
||||
//
|
||||
// btnPathDAL
|
||||
//
|
||||
this.btnPathDAL.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnPathDAL.Location = new System.Drawing.Point(427, 84);
|
||||
this.btnPathDAL.Name = "btnPathDAL";
|
||||
this.btnPathDAL.Size = new System.Drawing.Size(28, 23);
|
||||
this.btnPathDAL.TabIndex = 8;
|
||||
this.btnPathDAL.Text = "...";
|
||||
this.btnPathDAL.UseVisualStyleBackColor = true;
|
||||
this.btnPathDAL.Click += new System.EventHandler(this.btnPathDAL_Click);
|
||||
//
|
||||
// txtPathDAL
|
||||
//
|
||||
this.txtPathDAL.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtPathDAL.Location = new System.Drawing.Point(125, 87);
|
||||
this.txtPathDAL.Name = "txtPathDAL";
|
||||
this.txtPathDAL.ReadOnly = true;
|
||||
this.txtPathDAL.Size = new System.Drawing.Size(296, 20);
|
||||
this.txtPathDAL.TabIndex = 7;
|
||||
//
|
||||
// lblPathDAL
|
||||
//
|
||||
this.lblPathDAL.AutoSize = true;
|
||||
this.lblPathDAL.Location = new System.Drawing.Point(12, 90);
|
||||
this.lblPathDAL.Name = "lblPathDAL";
|
||||
this.lblPathDAL.Size = new System.Drawing.Size(53, 13);
|
||||
this.lblPathDAL.TabIndex = 6;
|
||||
this.lblPathDAL.Text = "Path DAL";
|
||||
//
|
||||
// btnPathDTO
|
||||
//
|
||||
this.btnPathDTO.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnPathDTO.Location = new System.Drawing.Point(427, 110);
|
||||
this.btnPathDTO.Name = "btnPathDTO";
|
||||
this.btnPathDTO.Size = new System.Drawing.Size(28, 23);
|
||||
this.btnPathDTO.TabIndex = 11;
|
||||
this.btnPathDTO.Text = "...";
|
||||
this.btnPathDTO.UseVisualStyleBackColor = true;
|
||||
this.btnPathDTO.Click += new System.EventHandler(this.btnPathDTO_Click);
|
||||
//
|
||||
// txtPathDTO
|
||||
//
|
||||
this.txtPathDTO.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtPathDTO.Location = new System.Drawing.Point(125, 113);
|
||||
this.txtPathDTO.Name = "txtPathDTO";
|
||||
this.txtPathDTO.ReadOnly = true;
|
||||
this.txtPathDTO.Size = new System.Drawing.Size(296, 20);
|
||||
this.txtPathDTO.TabIndex = 10;
|
||||
//
|
||||
// lblPathDTO
|
||||
//
|
||||
this.lblPathDTO.AutoSize = true;
|
||||
this.lblPathDTO.Location = new System.Drawing.Point(12, 116);
|
||||
this.lblPathDTO.Name = "lblPathDTO";
|
||||
this.lblPathDTO.Size = new System.Drawing.Size(55, 13);
|
||||
this.lblPathDTO.TabIndex = 9;
|
||||
this.lblPathDTO.Text = "Path DTO";
|
||||
//
|
||||
// btnPathExtra
|
||||
//
|
||||
this.btnPathExtra.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnPathExtra.Location = new System.Drawing.Point(427, 136);
|
||||
this.btnPathExtra.Name = "btnPathExtra";
|
||||
this.btnPathExtra.Size = new System.Drawing.Size(28, 23);
|
||||
this.btnPathExtra.TabIndex = 14;
|
||||
this.btnPathExtra.Text = "...";
|
||||
this.btnPathExtra.UseVisualStyleBackColor = true;
|
||||
this.btnPathExtra.Click += new System.EventHandler(this.btnPathExtra_Click);
|
||||
//
|
||||
// txtPathExtra
|
||||
//
|
||||
this.txtPathExtra.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtPathExtra.Location = new System.Drawing.Point(125, 139);
|
||||
this.txtPathExtra.Name = "txtPathExtra";
|
||||
this.txtPathExtra.ReadOnly = true;
|
||||
this.txtPathExtra.Size = new System.Drawing.Size(296, 20);
|
||||
this.txtPathExtra.TabIndex = 13;
|
||||
//
|
||||
// lblPathExtra
|
||||
//
|
||||
this.lblPathExtra.AutoSize = true;
|
||||
this.lblPathExtra.Location = new System.Drawing.Point(12, 142);
|
||||
this.lblPathExtra.Name = "lblPathExtra";
|
||||
this.lblPathExtra.Size = new System.Drawing.Size(56, 13);
|
||||
this.lblPathExtra.TabIndex = 12;
|
||||
this.lblPathExtra.Text = "Path Extra";
|
||||
//
|
||||
// btnCancelar
|
||||
//
|
||||
this.btnCancelar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCancelar.Location = new System.Drawing.Point(380, 286);
|
||||
this.btnCancelar.Name = "btnCancelar";
|
||||
this.btnCancelar.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnCancelar.TabIndex = 15;
|
||||
this.btnCancelar.Text = "Cancelar";
|
||||
this.btnCancelar.UseVisualStyleBackColor = true;
|
||||
this.btnCancelar.Click += new System.EventHandler(this.btnCancelar_Click);
|
||||
//
|
||||
// btnAceptar
|
||||
//
|
||||
this.btnAceptar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnAceptar.Location = new System.Drawing.Point(299, 286);
|
||||
this.btnAceptar.Name = "btnAceptar";
|
||||
this.btnAceptar.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnAceptar.TabIndex = 16;
|
||||
this.btnAceptar.Text = "Aceptar";
|
||||
this.btnAceptar.UseVisualStyleBackColor = true;
|
||||
this.btnAceptar.Click += new System.EventHandler(this.btnAceptar_Click);
|
||||
//
|
||||
// lblNSDAL
|
||||
//
|
||||
this.lblNSDAL.AutoSize = true;
|
||||
this.lblNSDAL.Location = new System.Drawing.Point(12, 169);
|
||||
this.lblNSDAL.Name = "lblNSDAL";
|
||||
this.lblNSDAL.Size = new System.Drawing.Size(46, 13);
|
||||
this.lblNSDAL.TabIndex = 17;
|
||||
this.lblNSDAL.Text = "NS DAL";
|
||||
//
|
||||
// lblNSDTO
|
||||
//
|
||||
this.lblNSDTO.AutoSize = true;
|
||||
this.lblNSDTO.Location = new System.Drawing.Point(12, 195);
|
||||
this.lblNSDTO.Name = "lblNSDTO";
|
||||
this.lblNSDTO.Size = new System.Drawing.Size(48, 13);
|
||||
this.lblNSDTO.TabIndex = 18;
|
||||
this.lblNSDTO.Text = "NS DTO";
|
||||
//
|
||||
// txtNSDAL
|
||||
//
|
||||
this.txtNSDAL.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtNSDAL.Location = new System.Drawing.Point(125, 166);
|
||||
this.txtNSDAL.Name = "txtNSDAL";
|
||||
this.txtNSDAL.Size = new System.Drawing.Size(330, 20);
|
||||
this.txtNSDAL.TabIndex = 19;
|
||||
//
|
||||
// txtNSDTO
|
||||
//
|
||||
this.txtNSDTO.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtNSDTO.Location = new System.Drawing.Point(125, 192);
|
||||
this.txtNSDTO.Name = "txtNSDTO";
|
||||
this.txtNSDTO.Size = new System.Drawing.Size(330, 20);
|
||||
this.txtNSDTO.TabIndex = 20;
|
||||
//
|
||||
// frmCodeGenConfig
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(467, 321);
|
||||
this.Controls.Add(this.txtNSDTO);
|
||||
this.Controls.Add(this.txtNSDAL);
|
||||
this.Controls.Add(this.lblNSDTO);
|
||||
this.Controls.Add(this.lblNSDAL);
|
||||
this.Controls.Add(this.btnAceptar);
|
||||
this.Controls.Add(this.btnCancelar);
|
||||
this.Controls.Add(this.btnPathExtra);
|
||||
this.Controls.Add(this.txtPathExtra);
|
||||
this.Controls.Add(this.lblPathExtra);
|
||||
this.Controls.Add(this.btnPathDTO);
|
||||
this.Controls.Add(this.txtPathDTO);
|
||||
this.Controls.Add(this.lblPathDTO);
|
||||
this.Controls.Add(this.btnPathDAL);
|
||||
this.Controls.Add(this.txtPathDAL);
|
||||
this.Controls.Add(this.lblPathDAL);
|
||||
this.Controls.Add(this.btnPathRaiz);
|
||||
this.Controls.Add(this.txtPathRaiz);
|
||||
this.Controls.Add(this.lblPathRaiz);
|
||||
this.Controls.Add(this.txtConString);
|
||||
this.Controls.Add(this.lblConString);
|
||||
this.Name = "frmCodeGenConfig";
|
||||
this.Text = "Configuracion del Generador de Codigo";
|
||||
this.Load += new System.EventHandler(this.FrmCodeGenConfig_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label lblConString;
|
||||
private System.Windows.Forms.TextBox txtConString;
|
||||
private System.Windows.Forms.Label lblPathRaiz;
|
||||
private System.Windows.Forms.TextBox txtPathRaiz;
|
||||
private System.Windows.Forms.Button btnPathRaiz;
|
||||
private System.Windows.Forms.Button btnPathDAL;
|
||||
private System.Windows.Forms.TextBox txtPathDAL;
|
||||
private System.Windows.Forms.Label lblPathDAL;
|
||||
private System.Windows.Forms.Button btnPathDTO;
|
||||
private System.Windows.Forms.TextBox txtPathDTO;
|
||||
private System.Windows.Forms.Label lblPathDTO;
|
||||
private System.Windows.Forms.Button btnPathExtra;
|
||||
private System.Windows.Forms.TextBox txtPathExtra;
|
||||
private System.Windows.Forms.Label lblPathExtra;
|
||||
private System.Windows.Forms.Button btnCancelar;
|
||||
private System.Windows.Forms.Button btnAceptar;
|
||||
private System.Windows.Forms.Label lblNSDAL;
|
||||
private System.Windows.Forms.Label lblNSDTO;
|
||||
private System.Windows.Forms.TextBox txtNSDAL;
|
||||
private System.Windows.Forms.TextBox txtNSDTO;
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ServerExplorer
|
||||
{
|
||||
public partial class FrmCodeGenConfig : Form
|
||||
{
|
||||
Config _config;
|
||||
|
||||
public FrmCodeGenConfig(Config config)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_config = config;
|
||||
}
|
||||
|
||||
private void FrmCodeGenConfig_Load(object sender, EventArgs e)
|
||||
{
|
||||
txtConString.Text = _config.ConString;
|
||||
txtPathRaiz.Text = _config.PathRaiz;
|
||||
txtPathDAL.Text = _config.PathDAL;
|
||||
txtPathDTO.Text = _config.PathDTO;
|
||||
txtPathExtra.Text = _config.PathExtra;
|
||||
txtNSDAL.Text = _config.NamespaceDAL;
|
||||
txtNSDTO.Text = _config.NamespaceDTO;
|
||||
}
|
||||
|
||||
private void btnPathRaiz_Click(object sender, EventArgs e)
|
||||
{
|
||||
FolderBrowserDialog dialog = new FolderBrowserDialog();
|
||||
dialog.SelectedPath = txtPathRaiz.Text;
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
txtPathRaiz.Text = dialog.SelectedPath;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnPathDAL_Click(object sender, EventArgs e)
|
||||
{
|
||||
FolderBrowserDialog dialog = new FolderBrowserDialog();
|
||||
dialog.SelectedPath = txtPathDAL.Text;
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
txtPathDAL.Text = dialog.SelectedPath;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnPathDTO_Click(object sender, EventArgs e)
|
||||
{
|
||||
FolderBrowserDialog dialog = new FolderBrowserDialog();
|
||||
dialog.SelectedPath = txtPathDTO.Text;
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
txtPathDTO.Text = dialog.SelectedPath;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnPathExtra_Click(object sender, EventArgs e)
|
||||
{
|
||||
FolderBrowserDialog dialog = new FolderBrowserDialog();
|
||||
dialog.SelectedPath = txtPathExtra.Text;
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
txtPathExtra.Text = dialog.SelectedPath;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAceptar_Click(object sender, EventArgs e)
|
||||
{
|
||||
_config.PathRaiz = txtPathRaiz.Text;
|
||||
_config.PathDAL = txtPathDAL.Text;
|
||||
_config.PathDTO = txtPathDTO.Text;
|
||||
_config.PathExtra = txtPathExtra.Text;
|
||||
_config.NamespaceDAL = txtNSDAL.Text;
|
||||
_config.NamespaceDTO = txtNSDTO.Text;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnCancelar_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Reference in New Issue
Block a user