CapicuaGenGaspar 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/CapicuaGenGaspar.gemspec +60 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +33 -0
- data/LICENSE +165 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/CapicuaGenGaspar/Business/CSSqlEntitityInterface/Source/cs_sql_entity_interface_feature.rb +96 -0
- data/lib/CapicuaGenGaspar/Business/CSSqlEntitityInterface/Template/table_interface.erb +49 -0
- data/lib/CapicuaGenGaspar/Business/CSSqlEntity/Source/cs_sql_entity_feature.rb +103 -0
- data/lib/CapicuaGenGaspar/Business/CSSqlEntity/Template/table_entity.erb +51 -0
- data/lib/CapicuaGenGaspar/CodeTransformer/CSHeaderFooter/Source/cs_header_footer_feature.rb +148 -0
- data/lib/CapicuaGenGaspar/CodeTransformer/CSHeaderFooter/Template/footer.erb +37 -0
- data/lib/CapicuaGenGaspar/CodeTransformer/CSHeaderFooter/Template/header.erb +43 -0
- data/lib/CapicuaGenGaspar/CodeTransformer/CodeMaidCleaner/Bin/EnvDTE.dll +0 -0
- data/lib/CapicuaGenGaspar/CodeTransformer/CodeMaidCleaner/Bin/EnvDTE80.dll +0 -0
- data/lib/CapicuaGenGaspar/CodeTransformer/CodeMaidCleaner/Bin/RunCodeMaidCleaner.exe +0 -0
- data/lib/CapicuaGenGaspar/CodeTransformer/CodeMaidCleaner/Bin/RunCodeMaidCleaner.exe.config +52 -0
- data/lib/CapicuaGenGaspar/CodeTransformer/CodeMaidCleaner/Bin/stdole.dll +0 -0
- data/lib/CapicuaGenGaspar/CodeTransformer/CodeMaidCleaner/Source/code_maid_cleaner_feature.rb +162 -0
- data/lib/CapicuaGenGaspar/DataAccess/CSConnectionProvider/Source/cs_db_connection_provider_feature.rb +90 -0
- data/lib/CapicuaGenGaspar/DataAccess/CSSqlDataAccess/Source/cs_sql_data_access_feature.rb +106 -0
- data/lib/CapicuaGenGaspar/DataAccess/CSSqlDataAccess/Template/data_access.erb +154 -0
- data/lib/CapicuaGenGaspar/DataAccess/CSSqlDataAccess/Template/data_access_exception.erb +36 -0
- data/lib/CapicuaGenGaspar/DataAccess/CSSqlDataAccess/Template/data_access_table.erb +298 -0
- data/lib/CapicuaGenGaspar/Entities/CSEntity/Source/entity_field_schema.rb +100 -0
- data/lib/CapicuaGenGaspar/GUI/CSAboutWindowsForm/Source/cs_about_windows_form_feature.rb +85 -0
- data/lib/CapicuaGenGaspar/GUI/CSAboutWindowsForm/Template/AboutForm.designer.erb +211 -0
- data/lib/CapicuaGenGaspar/GUI/CSAboutWindowsForm/Template/AboutForm.erb +127 -0
- data/lib/CapicuaGenGaspar/GUI/CSAboutWindowsForm/Template/AboutForm.resx.erb +535 -0
- data/lib/CapicuaGenGaspar/GUI/CSCatalogWindowsForm/Source/cs_catalog_windows_form_feature.rb +146 -0
- data/lib/CapicuaGenGaspar/GUI/CSCatalogWindowsForm/Template/CatalogForm.Designer.erb +363 -0
- data/lib/CapicuaGenGaspar/GUI/CSCatalogWindowsForm/Template/CatalogForm.erb +320 -0
- data/lib/CapicuaGenGaspar/GUI/CSCatalogWindowsForm/Template/CatalogForm.resx.erb +2407 -0
- data/lib/CapicuaGenGaspar/GUI/CSCatalogWindowsForm/Template/CatalogState.erb +51 -0
- data/lib/CapicuaGenGaspar/GUI/CSMDIWindowsForm/Source/cs_mdi_windows_form_feature.rb +93 -0
- data/lib/CapicuaGenGaspar/GUI/CSMDIWindowsForm/Template/MainForm.Designer.erb +316 -0
- data/lib/CapicuaGenGaspar/GUI/CSMDIWindowsForm/Template/MainForm.erb +161 -0
- data/lib/CapicuaGenGaspar/GUI/CSMDIWindowsForm/Template/MainForm.resx.erb +2504 -0
- data/lib/CapicuaGenGaspar/GUI/CSMDIWindowsForm/Template/MsgboxConsts.erb +31 -0
- data/lib/CapicuaGenGaspar/GUI/CSSplashWindowsForm/Source/cs_splash_windows_feature.rb +87 -0
- data/lib/CapicuaGenGaspar/GUI/CSSplashWindowsForm/Template/SplashForm.designer.erb +141 -0
- data/lib/CapicuaGenGaspar/GUI/CSSplashWindowsForm/Template/SplashForm.erb +160 -0
- data/lib/CapicuaGenGaspar/GUI/CSSplashWindowsForm/Template/SplashForm.resx.erb +535 -0
- data/lib/CapicuaGenGaspar/Mixins/about_mixin.rb +55 -0
- data/lib/CapicuaGenGaspar/Mixins/catalog_mixin.rb +65 -0
- data/lib/CapicuaGenGaspar/Mixins/cs_app_config_mixin.rb +41 -0
- data/lib/CapicuaGenGaspar/Mixins/cs_db_connection_provider_mixin.rb +67 -0
- data/lib/CapicuaGenGaspar/Mixins/cs_namespace_mixin.rb +53 -0
- data/lib/CapicuaGenGaspar/Mixins/entity_interface_mixin.rb +57 -0
- data/lib/CapicuaGenGaspar/Mixins/entity_mixin.rb +58 -0
- data/lib/CapicuaGenGaspar/Mixins/entity_sql_table_mixin.rb +58 -0
- data/lib/CapicuaGenGaspar/Mixins/main_form_mixin.rb +55 -0
- data/lib/CapicuaGenGaspar/Mixins/splash_mixin.rb +54 -0
- data/lib/CapicuaGenGaspar/Proyect/CSProyect/Source/cs_proyect_feature.rb +140 -0
- data/lib/CapicuaGenGaspar/Proyect/CSProyectRESTFul/Source/cs_proyect_rest_ful_feature.rb +82 -0
- data/lib/CapicuaGenGaspar/Proyect/CSProyectRESTFul/Template/AssemblyInfo.erb +59 -0
- data/lib/CapicuaGenGaspar/Proyect/CSProyectRESTFul/Template/ExcepcionControlada.erb +38 -0
- data/lib/CapicuaGenGaspar/Proyect/CSProyectRESTFul/Template/Proyect.erb +114 -0
- data/lib/CapicuaGenGaspar/Proyect/CSProyectRESTFul/Template/Soluction.erb +54 -0
- data/lib/CapicuaGenGaspar/Proyect/CSProyectRESTFul/Template/Web.erb +66 -0
- data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Source/cs_proyect_windows_form_feature.rb +85 -0
- data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Template/App.erb +32 -0
- data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Template/AssemblyInfo.erb +59 -0
- data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Template/ControlExcepciones.erb +49 -0
- data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Template/ExcepcionControlada.erb +40 -0
- data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Template/Program.erb +46 -0
- data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Template/Proyect.erb +138 -0
- data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Template/Soluction.erb +55 -0
- data/lib/CapicuaGenGaspar/Tools/message_helper.rb +43 -0
- data/lib/CapicuaGenGaspar/WCFService/CSRESTFulCatalog/Source/cs_rest_ful_catalog_feature.rb +176 -0
- data/lib/CapicuaGenGaspar/WCFService/CSRESTFulCatalog/Template/CatalogState.erb +51 -0
- data/lib/CapicuaGenGaspar/WCFService/CSRESTFulCatalog/Template/Catalogs.erb +58 -0
- data/lib/CapicuaGenGaspar/WCFService/CSRESTFulCatalog/Template/Catalogs.svc.erb +24 -0
- data/lib/CapicuaGenGaspar/WCFService/CSRESTFulCatalog/Template/ICatalogs.erb +58 -0
- data/lib/CapicuaGenGaspar/gaspar.rb +44 -0
- data/lib/CapicuaGenGaspar/version.rb +3 -0
- metadata +216 -0
@@ -0,0 +1,320 @@
|
|
1
|
+
<%
|
2
|
+
#encoding: UTF-8
|
3
|
+
|
4
|
+
=begin
|
5
|
+
|
6
|
+
CapicuaGen
|
7
|
+
|
8
|
+
CapicuaGen es un software que ayuda a la creación automática de
|
9
|
+
sistemas empresariales a través de la definición y ensamblado de
|
10
|
+
diversos generadores de características.
|
11
|
+
|
12
|
+
El proyecto fue iniciado por José Luis Bautista Martin, el 6 de enero
|
13
|
+
del 2016.
|
14
|
+
|
15
|
+
Puede modificar y distribuir este software, según le plazca, y usarlo
|
16
|
+
para cualquier fin ya sea comercial, personal, educativo, o de cualquier
|
17
|
+
índole, siempre y cuando incluya este mensaje, y se permita acceso el
|
18
|
+
código fuente.
|
19
|
+
|
20
|
+
Este software es código libre, y se licencia bajo LGPL.
|
21
|
+
|
22
|
+
Para más información consultar http://www.gnu.org/licenses/lgpl.html
|
23
|
+
=end
|
24
|
+
%>using System;
|
25
|
+
using System.Windows.Forms;
|
26
|
+
<%=get_namespaces_text(:business_interfaces)
|
27
|
+
%><%=get_namespaces_text(:business_entities)
|
28
|
+
%><%=get_namespaces_text(:data_access)
|
29
|
+
%>
|
30
|
+
|
31
|
+
namespace <%=generation_attributes[:namespace]%>
|
32
|
+
{
|
33
|
+
partial class <%=template_target.class_name%>
|
34
|
+
{
|
35
|
+
#region Propiedades
|
36
|
+
|
37
|
+
/// <summary>
|
38
|
+
/// Acceso a datos
|
39
|
+
/// </summary>
|
40
|
+
protected <%=get_entity_data_access_full_name(template_target.entity_schema.name)%><<%=get_entity_name(template_target.entity_schema.name)%>> accesoDatos<%=template_target.entity_schema.name%>=new <%=get_entity_data_access_full_name(template_target.entity_schema.name)%><<%=get_entity_name(template_target.entity_schema.name)%>>();
|
41
|
+
|
42
|
+
/// <summary>
|
43
|
+
/// Estado Actual del catalogo
|
44
|
+
/// </summary>
|
45
|
+
protected EstadosCatalogo estadoCatalogo = EstadosCatalogo.Vista;
|
46
|
+
|
47
|
+
#endregion Propiedades
|
48
|
+
|
49
|
+
#region Contructor
|
50
|
+
|
51
|
+
public <%=template_target.class_name%>()
|
52
|
+
{
|
53
|
+
InitializeComponent();
|
54
|
+
}
|
55
|
+
|
56
|
+
#endregion Contructor
|
57
|
+
|
58
|
+
#region Eventos
|
59
|
+
|
60
|
+
protected virtual void <%=template_target.class_name%>_Load(object sender, EventArgs e)
|
61
|
+
{
|
62
|
+
//Cargo el estado inicial
|
63
|
+
CambiarEstado(EstadosCatalogo.Vista);
|
64
|
+
}
|
65
|
+
|
66
|
+
protected virtual void btnAgregar_Click(object sender, EventArgs e)
|
67
|
+
{
|
68
|
+
CambiarEstado(EstadosCatalogo.Nuevo);
|
69
|
+
}
|
70
|
+
|
71
|
+
protected virtual void btnEditar_Click(object sender, EventArgs e)
|
72
|
+
{
|
73
|
+
CambiarEstado(EstadosCatalogo.Edicion);
|
74
|
+
}
|
75
|
+
|
76
|
+
protected virtual void btnEliminar_Click(object sender, EventArgs e)
|
77
|
+
{
|
78
|
+
if (this.bindingSource.Current == null) return;
|
79
|
+
Borrar();
|
80
|
+
}
|
81
|
+
|
82
|
+
protected virtual void btnAceptar_Click(object sender, EventArgs e)
|
83
|
+
{
|
84
|
+
switch (this.estadoCatalogo)
|
85
|
+
{
|
86
|
+
case EstadosCatalogo.Nuevo:
|
87
|
+
Agregar();
|
88
|
+
break;
|
89
|
+
|
90
|
+
case EstadosCatalogo.Edicion:
|
91
|
+
Actualizar();
|
92
|
+
break;
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
protected virtual void btnCancelar_Click(object sender, EventArgs e)
|
97
|
+
{
|
98
|
+
CambiarEstado(EstadosCatalogo.Vista);
|
99
|
+
}
|
100
|
+
|
101
|
+
protected virtual void btnSalir_Click(object sender, EventArgs e)
|
102
|
+
{
|
103
|
+
this.Close();
|
104
|
+
}
|
105
|
+
|
106
|
+
protected virtual void bindingSource_CurrentChanged(object sender, EventArgs e)
|
107
|
+
{
|
108
|
+
if (this.bindingSource.Current != null)
|
109
|
+
{
|
110
|
+
<%=get_entity_full_name(template_target.entity_schema.name)%> registroBusqueda = this.bindingSource.Current as <%=get_entity_full_name(template_target.entity_schema.name)%>;
|
111
|
+
|
112
|
+
if (registroBusqueda == null)
|
113
|
+
{
|
114
|
+
return;
|
115
|
+
}
|
116
|
+
else
|
117
|
+
{
|
118
|
+
MostrarRegistro(registroBusqueda);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
#endregion Eventos
|
124
|
+
|
125
|
+
#region Metodos
|
126
|
+
|
127
|
+
/// <summary>
|
128
|
+
/// Carga la lista de compomentes completa
|
129
|
+
/// </summary>
|
130
|
+
protected virtual void CargarLista()
|
131
|
+
{
|
132
|
+
bindingSource.DataSource = accesoDatos<%=template_target.entity_schema.name%>.Listar();
|
133
|
+
dgvListado.AutoGenerateColumns = true;
|
134
|
+
dgvListado.DataSource = bindingSource;
|
135
|
+
}
|
136
|
+
|
137
|
+
/// <summary>
|
138
|
+
/// Agrego el registro
|
139
|
+
/// </summary>
|
140
|
+
protected virtual void Agregar()
|
141
|
+
{
|
142
|
+
try
|
143
|
+
{
|
144
|
+
if (!ValidarNulos()) return;
|
145
|
+
<%=get_entity_full_name(template_target.entity_schema.name)%> registro = ObtenerRegistro();
|
146
|
+
accesoDatos<%=template_target.entity_schema.name%>.Insertar(registro);
|
147
|
+
MessageBox.Show("Inserción completada", "Operación exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
148
|
+
CambiarEstado(EstadosCatalogo.Vista);
|
149
|
+
}
|
150
|
+
catch (Exception ex)
|
151
|
+
{
|
152
|
+
ControlExcepciones.MostrarExcepcion(ex);
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
/// <summary>
|
157
|
+
/// Actualizo el registro
|
158
|
+
/// </summary>
|
159
|
+
protected virtual void Actualizar()
|
160
|
+
{
|
161
|
+
try
|
162
|
+
{
|
163
|
+
if (!ValidarNulos()) return;
|
164
|
+
<%=get_entity_full_name(template_target.entity_schema.name)%> registro = ObtenerRegistro();
|
165
|
+
accesoDatos<%=template_target.entity_schema.name%>.Actualizar(registro);
|
166
|
+
MessageBox.Show("Actualización completada", "Operación exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
167
|
+
CambiarEstado(EstadosCatalogo.Vista);
|
168
|
+
}
|
169
|
+
catch (Exception ex)
|
170
|
+
{
|
171
|
+
ControlExcepciones.MostrarExcepcion(ex);
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
/// <summary>
|
176
|
+
/// Borro el registro
|
177
|
+
/// </summary>
|
178
|
+
protected virtual void Borrar()
|
179
|
+
{
|
180
|
+
try
|
181
|
+
{
|
182
|
+
<%=get_entity_full_name(template_target.entity_schema.name)%> registroBusqueda = ObtenerRegistro();
|
183
|
+
accesoDatos<%=template_target.entity_schema.name%>.Eliminar(registroBusqueda);
|
184
|
+
MessageBox.Show("Borrado completo", "Operación exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
185
|
+
CambiarEstado(EstadosCatalogo.Vista);
|
186
|
+
}
|
187
|
+
catch (Exception ex)
|
188
|
+
{
|
189
|
+
ControlExcepciones.MostrarExcepcion(ex);
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
/// <summary>
|
194
|
+
/// Estado actual del catalogo.
|
195
|
+
/// </summary>
|
196
|
+
/// <param name="estado">El estado</param>
|
197
|
+
protected virtual void CambiarEstado(EstadosCatalogo estado)
|
198
|
+
{
|
199
|
+
switch (estado)
|
200
|
+
{
|
201
|
+
case EstadosCatalogo.Vista:
|
202
|
+
|
203
|
+
//Configuro los campos
|
204
|
+
<%
|
205
|
+
template_target.entity_schema.fields.each { |field|
|
206
|
+
%>this.txt<%=field.name%>.Text = "";
|
207
|
+
this.txt<%=field.name%>.Enabled = false;
|
208
|
+
<%}%>
|
209
|
+
|
210
|
+
//Configuro el datagrid
|
211
|
+
dgvListado.Enabled = true;
|
212
|
+
|
213
|
+
//Configuro los botonos
|
214
|
+
btnAgregar.Enabled = true;
|
215
|
+
btnEditar.Enabled = true;
|
216
|
+
btnEliminar.Enabled = true;
|
217
|
+
btnAceptar.Enabled = false;
|
218
|
+
btnCancelar.Enabled = false;
|
219
|
+
btnSalir.Enabled = true;
|
220
|
+
|
221
|
+
//Cargo el listado
|
222
|
+
CargarLista();
|
223
|
+
|
224
|
+
break;
|
225
|
+
|
226
|
+
case EstadosCatalogo.Nuevo:
|
227
|
+
|
228
|
+
//Configuro los campos
|
229
|
+
<%
|
230
|
+
template_target.entity_schema.fields.each { |field|
|
231
|
+
%>this.txt<%=field.name%>.Text = "";
|
232
|
+
<%next if field.identity%>this.txt<%=field.name%>.Enabled = true;
|
233
|
+
<%}%>
|
234
|
+
|
235
|
+
//Configuro el datagrid
|
236
|
+
dgvListado.Enabled = false;
|
237
|
+
|
238
|
+
//Configuro los botonos
|
239
|
+
btnAgregar.Enabled = false;
|
240
|
+
btnEditar.Enabled = false;
|
241
|
+
btnEliminar.Enabled = false;
|
242
|
+
btnAceptar.Enabled = true;
|
243
|
+
btnCancelar.Enabled = true;
|
244
|
+
btnSalir.Enabled = false;
|
245
|
+
|
246
|
+
break;
|
247
|
+
|
248
|
+
case EstadosCatalogo.Edicion:
|
249
|
+
if (this.bindingSource.Current == null) return;
|
250
|
+
|
251
|
+
//Configuro los campos
|
252
|
+
<%
|
253
|
+
template_target.entity_schema.fields.each { |field|
|
254
|
+
next if field.primary_key
|
255
|
+
%>this.txt<%=field.name%>.Enabled = true;
|
256
|
+
<%}%>
|
257
|
+
//Configuro el datagrid
|
258
|
+
dgvListado.Enabled = false;
|
259
|
+
|
260
|
+
//Configuro los botonos
|
261
|
+
btnAgregar.Enabled = false;
|
262
|
+
btnEditar.Enabled = false;
|
263
|
+
btnEliminar.Enabled = false;
|
264
|
+
btnAceptar.Enabled = true;
|
265
|
+
btnCancelar.Enabled = true;
|
266
|
+
btnSalir.Enabled = false;
|
267
|
+
break;
|
268
|
+
|
269
|
+
default:
|
270
|
+
break;
|
271
|
+
}
|
272
|
+
this.estadoCatalogo = estado;
|
273
|
+
}
|
274
|
+
|
275
|
+
protected virtual bool ValidarNulos()
|
276
|
+
{
|
277
|
+
<%
|
278
|
+
template_target.entity_schema.fields.each { |field|
|
279
|
+
next if field.allow_null or field.identity
|
280
|
+
%>if (txt<%=field.name%>.Text.Trim() == "")
|
281
|
+
{
|
282
|
+
MessageBox.Show("El campo <%=field.name%> no puede estar vacio", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
283
|
+
return false;
|
284
|
+
}
|
285
|
+
<%}%>
|
286
|
+
|
287
|
+
return true;
|
288
|
+
}
|
289
|
+
|
290
|
+
/// <summary>
|
291
|
+
/// Muestra un registro en pantalla
|
292
|
+
/// </summary>
|
293
|
+
/// <param name="tabla1">Registro a mostrar</param>
|
294
|
+
protected virtual void MostrarRegistro(<%=get_entity_full_name(template_target.entity_schema.name)%> <%=template_target.entity_schema.name%> )
|
295
|
+
{
|
296
|
+
<%
|
297
|
+
template_target.entity_schema.fields.each { |field|
|
298
|
+
%>this.txt<%=field.name%>.Text = String.Format("{0}",<%=template_target.entity_schema.name%>.<%=field.name%>);
|
299
|
+
<%}%>
|
300
|
+
}
|
301
|
+
|
302
|
+
/// <summary>
|
303
|
+
/// Obtiene un registro para su guardado
|
304
|
+
/// </summary>
|
305
|
+
/// <returns>Registro a guardar</returns>
|
306
|
+
protected virtual <%=get_entity_full_name(template_target.entity_schema.name)%> ObtenerRegistro()
|
307
|
+
{
|
308
|
+
<%=get_entity_full_name(template_target.entity_schema.name)%> <%=template_target.entity_schema.name%> = new <%=get_entity_full_name(template_target.entity_schema.name)%> ();
|
309
|
+
|
310
|
+
<%
|
311
|
+
template_target.entity_schema.fields.each { |field|
|
312
|
+
%>if (this.txt<%=field.name%>.Text.Trim()!="") <%=template_target.entity_schema.name%>.<%=field.name%> = <%=field.convert_from_text%>this.txt<%=field.name%>.Text.Trim());
|
313
|
+
<%}%>
|
314
|
+
|
315
|
+
return <%=template_target.entity_schema.name%>;
|
316
|
+
}
|
317
|
+
|
318
|
+
#endregion Metodos
|
319
|
+
}
|
320
|
+
}
|