2 using System.Collections.Generic;
12 internal class EntidadInfo
21 get {
return _cCodigo; }
22 private set { _cCodigo = value; }
24 private string _cCodigo =
"";
31 get {
return _cNombre; }
32 private set { _cNombre = value; }
34 private string _cNombre =
"";
39 public string _Pantalla
41 get {
return _cPantalla; }
42 private set { _cPantalla = value; }
44 private string _cPantalla =
"";
49 public string _TxtCodlabel
51 get {
return _cTxtCodlabel; }
52 private set { _cTxtCodlabel = value; }
54 private string _cTxtCodlabel =
"";
59 public string _Formulario
61 get {
return _cFormulario; }
62 private set { _cFormulario = value; }
64 private string _cFormulario =
"";
66 #endregion Propiedades 73 private EntidadInfo() { }
79 public EntidadInfo(DataRow tdrDatos)
82 _cCodigo = Convert.ToString(tdrDatos[
"CODIGO"]).Trim();
83 _cPantalla = Convert.ToString(tdrDatos[
"PANTALLA"]).Trim();
84 _cTxtCodlabel = Convert.ToString(tdrDatos[
"TXTCODLABEL"]).Trim();
85 _cFormulario = Convert.ToString(tdrDatos[
"FORMULARIO"]).Trim();
86 _cNombre = Convert.ToString(tdrDatos[
"NOMBRE"]).Trim();
89 #endregion Constructores 96 internal static EntidadInfo ExisteFiltroAsociadoAlFormulario(
string tcNombreFormulario)
98 Trace.WriteLineIf(Debugger.IsAttached,
"EntidadInfo => buscando datos de la entidad asociada al formulario " + tcNombreFormulario);
100 return EntidadesInfo.BuscarPorFormulario(tcNombreFormulario);
108 internal static EntidadInfo ExisteEntidadAsociadaParaLaPantalla(
string tcNombreClase)
110 Trace.WriteLineIf(Debugger.IsAttached,
"EntidadInfo => buscando datos de la entidad asociada a la pantalla " + tcNombreClase);
112 return EntidadesInfo.BuscarPorPantalla(tcNombreClase);
120 public static EntidadInfo ObtenerEntidad(String tcCodigo)
122 return String.IsNullOrEmpty(tcCodigo) ? null : EntidadesInfo._EntidadesInstanciables.Where(loEle => loEle._Codigo == tcCodigo).FirstOrDefault();
143 internal static class EntidadesInfo
148 internal static List<EntidadInfo> _EntidadesInstanciables
152 if (_lisInstanciables == null)
154 _lisInstanciables =
new List<EntidadInfo>();
155 obtenerDatosInstanciamientoEntidadC();
157 return _lisInstanciables;
159 private set { _lisInstanciables = value; }
161 private static List<EntidadInfo> _lisInstanciables = null;
166 internal static bool _ClientesPorContabilidad
170 if (llClientesPorContabilidad == null)
171 llClientesPorContabilidad = Mantes.ExtensionMantenimientoEmpresa._UsarContabilidadParaGestionarClientes();
172 return (
bool)llClientesPorContabilidad;
175 private static bool? llClientesPorContabilidad = null;
180 internal static bool _ProveedoresPorContabilidad
184 if (llProveedoresPorContabilidad == null)
185 llProveedoresPorContabilidad = Mantes.ExtensionMantenimientoEmpresa._UsarContabilidadParaGestionarProveedores();
186 return (
bool)llProveedoresPorContabilidad;
189 private static bool? llProveedoresPorContabilidad = null;
194 private static void obtenerDatosInstanciamientoEntidadC()
196 DataTable ldtResultados =
new DataTable();
197 string lcSQL =
"SELECT CODIGO, NOMBRE, PANTALLA, TXTCODLABEL, FORMULARIO FROM " +
198 DB.SQLDatabase(
"RGPD",
"ENTIDAD_C");
200 if (DB.SQLExec(lcSQL, ref ldtResultados) && ldtResultados.Rows.Count > 0)
202 _EntidadesInstanciables.Clear();
203 ldtResultados.AsEnumerable().Cast<DataRow>().ToList().ForEach(loRow => _EntidadesInstanciables.Add(
new EntidadInfo(loRow)));
212 public static EntidadInfo BuscarPorPantalla(
string tcNombreBusqueda)
214 tcNombreBusqueda = tcNombreBusqueda.Trim().ToUpper();
215 var informacionEntidades = _EntidadesInstanciables.Where(loEntidad => loEntidad._Pantalla.Trim().ToUpper() == tcNombreBusqueda).ToList();
216 return filtrarPorGestionDesdeContabilidad(informacionEntidades);
224 public static EntidadInfo BuscarPorFormulario(
string tcNombreBusqueda)
226 tcNombreBusqueda = tcNombreBusqueda.Trim().ToUpper();
227 var informacionEntidades = _EntidadesInstanciables.Where(loEntidad => loEntidad._Formulario.Trim().ToUpper() == tcNombreBusqueda).ToList();
228 return filtrarPorGestionDesdeContabilidad(informacionEntidades);
231 private static EntidadInfo filtrarPorGestionDesdeContabilidad(IEnumerable<EntidadInfo> tlisEntidades)
233 if (tlisEntidades.Any())
235 if (_ClientesPorContabilidad || _ProveedoresPorContabilidad)
237 if (_ClientesPorContabilidad)
238 tlisEntidades = tlisEntidades.Where(loEle => loEle._Codigo !=
"00000001").ToList();
240 if (tlisEntidades.Any())
242 if (_ProveedoresPorContabilidad)
243 tlisEntidades = tlisEntidades.Where(loEle => loEle._Codigo !=
"00000007").ToList();
244 if (tlisEntidades.Any())
245 return tlisEntidades.First();
254 tlisEntidades = tlisEntidades.Where(loEle => loEle._Codigo !=
"00000003").ToList();
255 return tlisEntidades.FirstOrDefault();
Es como el tipo de entrada asientos pero por negocio, sin formulario, pq quiero que me haga las propu...
Clase para uso de funciones genéricas
Clase base para controles de tipo txtcodlabelf