ConfiguracionModelos115.cs
1 using System;
2 using System.ComponentModel;
3 using System.Windows.Forms;
4 using sage.ew.interficies;
5 using Sage.ES.S50.Modelos.Clases;
6 
7 namespace Sage.ES.S50.Modelos.UserControls
8 {
12  public partial class ConfiguracionModelos115
14  {
15  # region PROPIEDADES
16  private IEmpresa _oEmpresa;
17  private Boolean _bReadOnly = false;
18  private ConfigModelo115 _oTiposModeloIVA;
19 
23  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
24  public string _Arrendamiento
25  {
26  get
27  {
28  return _oTiposModeloIVA._ArrendamientoInmueblesUrbanos;
29  }
30  set
31  {
32  _oTiposModeloIVA._ArrendamientoInmueblesUrbanos = value;
33  }
34  }
35 
39  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
40  public IEmpresa _Empresa
41  {
42  get
43  {
44  return _oEmpresa;
45  }
46  set
47  {
48  _oEmpresa = value;
49  }
50  }
51 
55  public Boolean _ReadOnly
56  {
57  get
58  {
59  return _bReadOnly;
60  }
61  set
62  {
63  _bReadOnly = value;
64  if (Created) _SetReadOnly(_bReadOnly);
65  }
66  }
67 
71  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
72  public ITiposModeloBase _TiposModeloIVA
73  {
74  get
75  {
76  return _oTiposModeloIVA;
77  }
78  set
79  {
80  if (value != null && value != _oTiposModeloIVA && _oTiposModeloIVA != value && value is ConfigModelo115)
81  {
82  _oTiposModeloIVA = (ConfigModelo115)value;
83 
84  ((ConfigModelo115)value)._LinkForm = true; // Marcamos que está linkado con una clase visual para poder presentar mensajes
85 
86  SubscripcionEventos();
87  }
88  }
89  }
90 
91 
92  #endregion PROPIEDADES
93 
94 
95  # region CONSTRUCTOR
100  {
101  InitializeComponent();
102  }
103 
104  # endregion CONSTRUCTOR
105 
106  #region METODOS PÚBLICOS
107 
108 
112  public void _Binding()
113  {
114  BindearControlPropiedad(txtGrupoContribuyente, "_Codigo", "_Arrendamiento");
115  }
116 
117  #endregion METODOS PÚBLICOS
118 
119  #region METODOS PRIVADOS
120 
124  private void SubscripcionEventos()
125  {
126  if (_oTiposModeloIVA != null)
127  {
128  ConfigModelo115 loConfigModelo115 = (ConfigModelo115)_oTiposModeloIVA;
129 
130  loConfigModelo115._RefreshVisual -= ConfiguracionModelos115__RefreshVisual;
131  loConfigModelo115._RefreshVisual += ConfiguracionModelos115__RefreshVisual;
132  }
133  }
134 
139  private void ConfiguracionModelos115__RefreshVisual(string tcTipo)
140  {
141  BindearControlPropiedad(txtGrupoContribuyente, "_Codigo", "_Arrendamiento", tlClear: true);
142  }
143 
144  private void _SetReadOnly(Boolean tbReadOnly)
145  {
146  txtGrupoContribuyente._ReadOnly = tbReadOnly;
147  }
148 
149 
150  private void ConfiguracionModelos_Load(object sender, EventArgs e)
151  {
152  _SetReadOnly(_ReadOnly);
153  }
154 
155 
163  private void BindearControlPropiedad(Control toControl, string tcNombrePropiedadControl, string tcNombrePropiedadNegocio, bool tlClear = false)
164  {
165  if (tlClear)
166  toControl.DataBindings.Clear();
167 
168  Binding loBind = toControl.DataBindings[tcNombrePropiedadControl];
169 
170  if (loBind != null)
171  toControl.DataBindings[0].ReadValue();
172  else
173  toControl.DataBindings.Add(tcNombrePropiedadControl, this, tcNombrePropiedadNegocio, true);
174  }
175 
176  #endregion METODOS PRIVADOS
177 
178 
179 
180  }
181 }
Interficie para empresas
Definition: IEmpresa.cs:11
Definición base de Tipos de modelo
string _ArrendamientoInmueblesUrbanos
Arrendamiento o subarrendamiento de inmuebles urbanos
Definition: Modelo115.cs:152
Interficie para los UserControl de configuración de modelos
bool _LinkForm
Si la clase de negocio trabaja bajo formulario
_RefreshVisual_Handler _RefreshVisual
Desencadena el evento para refrescar la capa visual
Configuración del modelo 115
Definition: Modelo115.cs:144