EmpresaPaginaGeneralDatosRegistrales.cs
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Drawing;
5 using System.Data;
6 using System.Linq;
7 using System.Text;
8 using System.Windows.Forms;
9 using System.IO;
10 using sage.ew.ewbase;
11 using sage.ew.interficies;
13 using sage.ew.formul;
15 using sage.ew.functions;
16 using sage.ew.global;
17 
18 namespace sage.ew.empresa.UserControls
19 {
24  {
25  #region PROPIEDADES PRIVADAS
26 
27 
31  private bool _lReadOnly = false;
32 
33 
34  #endregion PROPIEDADES PRIVADAS
35 
36 
37  #region PROPIEDADES PUBLICAS
38 
39 
43  public Empresa _oEmpresa
44  {
45  get { return (Empresa)this._ewMante; }
46  }
47 
48 
52  public string _Empresa
53  {
54  get { return this._ewMante._Codigo; }
55  }
56 
57 
58  #endregion PROPIEDADES PUBLICAS
59 
60 
61  #region CONSTRUCTOR
62 
63 
71  {
72  InitializeComponent();
73 
74  if (!this.DesignMode)
75  {
76  this.eventosControles();
77  this.constructorVarios();
78  }
79  }
80 
81 
90  public EmpresaPaginaGeneralDatosRegistrales(ewMante toEmpresa, FormBase loForm = null)
91  {
92  InitializeComponent();
93 
94  if (!this.DesignMode)
95  {
96  this.eventosControles();
97 
98  this._ewMante = toEmpresa;
99 
100  this._oForm = loForm;
101 
102  this.constructorVarios();
103  }
104  }
105 
106 
110  private void constructorVarios()
111  {
112  return;
113  }
114 
115 
116  #endregion CONSTRUCTOR
117 
118 
119  #region METODOS PROTECTED OVERRIDE
120 
121 
125  protected override void eventosControles()
126  {
127  // this.txtRutaLegaLibros.Enter += this.txtRutaLegaLibros_Enter;
128  // this.txtRutaLegaLibros._Evento_Seleccion_Realizada += this.txtRutaLegaLibros__Evento_Seleccion_Realizada;
129 
130  return;
131  }
132 
133 
134  #endregion METODOS PROTECTED OVERRIDE
135 
136 
137  #region METODOS PRIVADOS
138 
139 
145  //private void txtRutaLegaLibros_Enter(object sender, EventArgs e)
146  //{
147  // txtSelDirectorio loTxtSelDirectorio = (txtSelDirectorio)sender;
148 
149  // loTxtSelDirectorio.Tag = loTxtSelDirectorio._Text;
150 
151  // return;
152  //}
153 
154 
159  //private void txtRutaLegaLibros__Evento_Seleccion_Realizada(object sender, string tcRuta)
160  //{
161  // txtSelDirectorio loTxtSelDirectorio = (txtSelDirectorio)sender;
162 
163  // if (string.IsNullOrWhiteSpace(tcRuta))
164  // return;
165 
166  // if (loTxtSelDirectorio.Tag == null)
167  // // Solo hacemos la comprobacion si ha habido un cambio interactivo por parte del usuario.
168  // return;
169 
170  // if (tcRuta.Contains(" ") || tcRuta.Contains("."))
171  // {
172  // FUNCTIONS._MessageBox("No es posible seleccionar una carpeta en cuyo nombre haya espacios ni puntos.", "Configuración empresa", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
173  // if (loTxtSelDirectorio._Text != Convert.ToString(loTxtSelDirectorio.Tag))
174  // loTxtSelDirectorio._Text = Convert.ToString(loTxtSelDirectorio.Tag);
175  // else
176  // loTxtSelDirectorio._Text = "";
177  // }
178 
179  // return;
180  //}
181 
182 
186  private void crearDirectorioLibros()
187  {
188  string lcRutaServidor = Convert.ToString(EW_GLOBAL._GetVariable("wc_iniservidor"));
189  if (!string.IsNullOrEmpty(lcRutaServidor))
190  {
191  string lcRutaLibros = Path.Combine(lcRutaServidor.ToUpper(), "LIBROS\\");
192  if (!Directory.Exists(lcRutaLibros))
193  Directory.CreateDirectory(lcRutaLibros);
194  }
195 
196  return;
197  }
198 
199 
200  #endregion METODOS PRIVADOS
201 
202 
203  #region MÉTODOS PUBLICOS OVERRIDE
204 
205 
210  public override void _BloquearControles(bool llReadOnlyPaginas)
211  {
212  this._lReadOnly = llReadOnlyPaginas;
213 
214  this.ewtxtCodRegistro.ReadOnly = llReadOnlyPaginas;
215  this.ewtxtNumeroTomo.ReadOnly = llReadOnlyPaginas;
216  this.ewtxtNumLibro.ReadOnly = llReadOnlyPaginas;
217  this.ewtxtNumSeccion.ReadOnly = llReadOnlyPaginas;
218  this.ewtxtNumFolio.ReadOnly = llReadOnlyPaginas;
219  this.ewtxtNumHoja.ReadOnly = llReadOnlyPaginas;
220  this.ewtxtTipoRegPublico.ReadOnly = llReadOnlyPaginas;
221  this.ewtxtOtros.ReadOnly = llReadOnlyPaginas;
222  this.ewtxtRegMercantil.ReadOnly = llReadOnlyPaginas;
223 
224  this.txtRutaLegaLibros._ReadOnly = llReadOnlyPaginas;
225 
226  return;
227  }
228 
229 
233  public override void _Binding()
234  {
235  this.ewtxtCodRegistro.DataBindings.Clear();
236  this.ewtxtNumeroTomo.DataBindings.Clear();
237  this.ewtxtNumLibro.DataBindings.Clear();
238  this.ewtxtNumSeccion.DataBindings.Clear();
239  this.ewtxtNumFolio.DataBindings.Clear();
240  this.ewtxtNumHoja.DataBindings.Clear();
241  this.ewtxtTipoRegPublico.DataBindings.Clear();
242  this.ewtxtOtros.DataBindings.Clear();
243  this.ewtxtRegMercantil.DataBindings.Clear();
244  this.txtRutaLegaLibros.DataBindings.Clear();
245 
246 
247  if (!string.IsNullOrWhiteSpace(this._oEmpresa._Codigo))
248  {
249  if (this._oEmpresa._Estado == ewMante._EstadosMantenimiento.EditandoRegistro || this._oEmpresa._Estado == ewMante._EstadosMantenimiento.EntrandoNuevo)
250  {
251  if (string.IsNullOrWhiteSpace(this._oEmpresa._RutaLibros))
252  {
253  // Si editan o creando empresa el campo de ruta para la generación de libros está vacío ofreceremos la
254  // ruta EUROSERV\LIBROS.
255 
256  // Primero creamos la carpeta si no existe.
257  //
258  this.crearDirectorioLibros();
259 
260  // Ahora mostramos la ruta en el control de selección de rutas.
261  //
262  string lcIniServidor = Path.Combine(Convert.ToString(EW_GLOBAL._GetVariable("wc_iniservidor")).ToUpper(), "LIBROS\\");
263  this._oEmpresa._RutaLibros = lcIniServidor;
264 
265  this.txtRutaLegaLibros.DataBindings.Clear();
266  this.txtRutaLegaLibros.DataBindings.Add("_Text", this._oEmpresa, "_RutaLibros", true);
267  this.txtRutaLegaLibros.Refresh();
268  }
269  }
270 
271  this.bindearControlPropiedadMante(ewtxtCodRegistro, _ewMante, nameof(ewtxtCodRegistro.Text), nameof(this._oEmpresa._CodigoAdministracion));
272  this.bindearControlPropiedadMante(ewtxtNumeroTomo, _ewMante, nameof(ewtxtNumeroTomo.Text), nameof(this._oEmpresa._NumeroTomoRegistro));
273  this.bindearControlPropiedadMante(ewtxtNumLibro, _ewMante, nameof(ewtxtNumLibro.Text), nameof(this._oEmpresa._NumeroLibroRegistro));
274  this.bindearControlPropiedadMante(ewtxtNumSeccion, _ewMante, nameof(ewtxtNumSeccion.Text), nameof(this._oEmpresa._NumeroSeccionRegistro));
275  this.bindearControlPropiedadMante(ewtxtNumFolio, _ewMante, nameof(ewtxtNumFolio.Text), nameof(this._oEmpresa._NumeroFolioRegistro));
276  this.bindearControlPropiedadMante(ewtxtNumHoja, _ewMante, nameof(ewtxtNumHoja.Text), nameof(this._oEmpresa._NumeroHojaRegistro));
277  this.bindearControlPropiedadMante(ewtxtTipoRegPublico, _ewMante, nameof(ewtxtTipoRegPublico.Text), nameof(this._oEmpresa._TipoRegistroPublico));
278  this.bindearControlPropiedadMante(ewtxtOtros, _ewMante, nameof(ewtxtOtros.Text), nameof(this._oEmpresa._OtrosRegistro));
279  this.bindearControlPropiedadMante(ewtxtRegMercantil, _ewMante, nameof(ewtxtRegMercantil.Text), nameof(this._oEmpresa._RegistroMercantil));
280  this.bindearControlPropiedadMante(txtRutaLegaLibros, _ewMante, nameof(txtRutaLegaLibros._Text), nameof(this._oEmpresa._RutaLibros));
281  }
282  else
283  {
284  this.ewtxtCodRegistro.Text = "";
285  this.ewtxtNumeroTomo.Text = "";
286  this.ewtxtNumLibro.Text = "";
287  this.ewtxtNumSeccion.Text = "";
288  this.ewtxtNumFolio.Text = "";
289  this.ewtxtNumHoja.Text = "";
290  this.ewtxtTipoRegPublico.Text = "";
291  this.ewtxtOtros.Text = "";
292  this.ewtxtRegMercantil.Text = "";
293  this.txtRutaLegaLibros._Text = "";
294  }
295  }
296 
297 
304  public override object _ObtenerDato(string tcNombreDato)
305  {
306  object obj = null;
307 
308  switch (tcNombreDato)
309  {
310  case "NmbreDatoConsultar":
312  //bool llFocused = (this.txtMarca._GetTextBox().Focused || this.txtFamilia._GetTextBox().Focused || this.txtSubFamilia._GetTextBox().Focused ||
313  // this.txtTipoIVA._GetTextBox().Focused || this.txtCaracteristica._GetTextBox().Focused);
314  //obj = llFocused;
315  break;
316  }
317 
318  return obj;
319  }
320 
321 
322  #endregion MÉTODOS PUBLICOS OVERRIDE
323  }
324 }
Clase de negocio base para mantenimientos
Definition: clsEwBase.cs:1643
Definición de la interfície necesaria para las páginas(tabPage) a utilizar en formularios de tipo For...
Definition: ITabMante.cs:13
Classe empresa basada en sage.ew.ewmante
Definition: clsEmpresa.cs:48
EmpresaPaginaGeneralDatosRegistrales(ewMante toEmpresa, FormBase loForm=null)
Constructor
Usercontrol para la pestaña "General" –> "Datos registrales" del formulario frmEmpresa. Debe cumpliar ITabMante (_ewMante, _ BloquearControles(), _Binding())
override string _Codigo
Sobreescribe el metodo _Codigo para cargar la configuración del TPV cuando se estableza el valor del ...
Definition: clsEmpresa.cs:2518
override object _ObtenerDato(string tcNombreDato)
Responde a la ficha de empresa cuando ésta le consulta al usercontrol de pestaña General.DatosRegistrales por el valor de algún dato interno de la pestaña.
override void eventosControles()
Programación de eventos de los controles contenido en este UserControl.
Formulario base de Eurowin
Definition: clsFormul.cs:400
override void _BloquearControles(bool llReadOnlyPaginas)
Bloquear controles del usercontrol (interficie ITabMante).
_EstadosMantenimiento
Declaro un enum para los estados del mantenimiento.
Definition: clsEwBase.cs:1671
override void _Binding()
Bindear los objetos contenidos en la página (interficie ITabMante)
Clase base para usercontrols en los que se alojará todo el contenido de determinadas pestañas de mant...