1936 lines
100 KiB
C#
1936 lines
100 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using Exferia_Aplicacion.Visualizacion;
|
|
using System.Reflection;
|
|
using Exferia_Aplicacion.General;
|
|
using System.Threading;
|
|
using Exferia_Formularios;
|
|
using static Exferia_Aplicacion.General.Enumerados;
|
|
using Exferia_EntityFramework;
|
|
using Exferia_General;
|
|
|
|
namespace Exferia_Controles
|
|
{
|
|
public partial class Exferia_F3_SoloSeleccion : UserControl
|
|
{
|
|
//Se utiliza para entrar en el codigo desde otra libreria
|
|
public void Prueba()
|
|
{}
|
|
|
|
#region Propiedades Privadas
|
|
private BackgroundWorker g_TareaAsincrona_Buscar;
|
|
private BackgroundWorker g_TareaAsincrona_Buscar_RegistroPorId;
|
|
|
|
private string g_str_Filtro = "";
|
|
private string g_str_CampoBusqueda = "";
|
|
|
|
private ABS_F3 g_obj_ABS_F3 = null;
|
|
private INTERNO_OpcionesDetalle_Modelo g_mdl_INTERNO_OpcionesDetalle_Modelo = null;
|
|
|
|
private bool g_bol_Cambio_Codigo = false;
|
|
private bool g_bol_Cambio_Descripcion = false;
|
|
|
|
private PE_Esperando g_frm_PE_Esperando;
|
|
|
|
internal List<INTERNO_Permisos_Modelo> g_lst_INTERNO_Permisos_Modelo = null;
|
|
|
|
#endregion
|
|
|
|
#region Propiedades Publicas
|
|
|
|
bool g_bol_Bloqueable = true;
|
|
public bool Exferia_F3_SoloSeleccion_Bloqueable
|
|
{
|
|
set
|
|
{
|
|
g_bol_Bloqueable = value;
|
|
}
|
|
get
|
|
{
|
|
return g_bol_Bloqueable;
|
|
}
|
|
}
|
|
|
|
public void Colores_Inciales()
|
|
{
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
}
|
|
|
|
internal P_Base g_P_Base_Contenedor = null;
|
|
public P_Base Exferia_F3_SoloSeleccion_PantallaContenedora
|
|
{
|
|
set
|
|
{
|
|
g_P_Base_Contenedor = value;
|
|
}
|
|
}
|
|
|
|
internal object g_obj_Filtro_Auxiliar = null;
|
|
public object Exferia_F3_SoloSeleccion_Filtro_Auxiliar
|
|
{
|
|
set
|
|
{
|
|
g_obj_Filtro_Auxiliar = value;
|
|
}
|
|
}
|
|
|
|
private ABS_Listado g_obj_ABS_Listado = null;
|
|
public ABS_Listado Exferia_F3_SoloSeleccion_ABS_Listado
|
|
{
|
|
set
|
|
{
|
|
g_obj_ABS_Listado = value;
|
|
}
|
|
}
|
|
|
|
internal string g_str_NombreOpcion_BuscarDatos = "";
|
|
public string Exferia_F3_SoloSeleccion_PRINCIPAL_Opcion_BuscarDatos
|
|
{
|
|
set
|
|
{
|
|
g_str_NombreOpcion_BuscarDatos = value;
|
|
|
|
//Buscar los Permisos
|
|
if (value != null && value.Trim().Length >0)
|
|
{
|
|
g_lst_INTERNO_Permisos_Modelo = Datos_Generales.Permisos_Buscar(value);
|
|
}
|
|
}
|
|
get
|
|
{
|
|
return g_str_NombreOpcion_BuscarDatos;
|
|
}
|
|
}
|
|
|
|
internal G_ENUM_F3_TITULO g_enum_F3_AnchoTitulo = G_ENUM_F3_TITULO.Normal;
|
|
public G_ENUM_F3_TITULO Exferia_F3_SoloSeleccion_Ancho_Titulo
|
|
{
|
|
set
|
|
{
|
|
g_enum_F3_AnchoTitulo = value;
|
|
|
|
//Normal
|
|
int int_AnchoTitulo = 100;
|
|
|
|
if (g_enum_F3_AnchoTitulo.Equals(G_ENUM_F3_TITULO.Medio))
|
|
{
|
|
int_AnchoTitulo = 175;
|
|
}
|
|
//Grande
|
|
else if (g_enum_F3_AnchoTitulo.Equals(G_ENUM_F3_TITULO.Grande))
|
|
{
|
|
int_AnchoTitulo = 250;
|
|
}
|
|
//SuperGrande
|
|
else if (g_enum_F3_AnchoTitulo.Equals(G_ENUM_F3_TITULO.SuperGrande))
|
|
{
|
|
int_AnchoTitulo = 350;
|
|
}
|
|
//Pequeno
|
|
else if (g_enum_F3_AnchoTitulo.Equals(G_ENUM_F3_TITULO.Pequeno))
|
|
{
|
|
int_AnchoTitulo = 60;
|
|
}
|
|
//SuperPequeno
|
|
else if (g_enum_F3_AnchoTitulo.Equals(G_ENUM_F3_TITULO.SuperPequeno))
|
|
{
|
|
int_AnchoTitulo = 40;
|
|
}
|
|
//MedioPequeno
|
|
else if (g_enum_F3_AnchoTitulo.Equals(G_ENUM_F3_TITULO.MedioPequeno))
|
|
{
|
|
int_AnchoTitulo = 130;
|
|
}
|
|
|
|
ex_lbl_Titulo.Size = new Size(int_AnchoTitulo, ex_lbl_Titulo.Size.Height);
|
|
|
|
ex_txt_Codigo.Location = new Point(int_AnchoTitulo + 6, ex_txt_Codigo.Location.Y);
|
|
ex_btn_F3_Codigo.Location = new Point((ex_txt_Codigo.Size.Width + int_AnchoTitulo + 6 + 3), ex_btn_F3_Codigo.Location.Y);
|
|
ex_txt_Descripcion.Location = new Point((ex_btn_F3_Codigo.Size.Width + ex_btn_F3_Codigo.Location.X + 9), ex_txt_Descripcion.Location.Y);
|
|
ex_txt_Descripcion.Size = new Size(((ex_btn_F3_Descripcion.Location.X - ex_txt_Descripcion.Location.X) - 3), ex_txt_Descripcion.Size.Height);
|
|
|
|
}
|
|
get
|
|
{
|
|
return g_enum_F3_AnchoTitulo;
|
|
}
|
|
}
|
|
|
|
internal G_ENUM_F3_CODIGO g_enum_F3_AnchoCodigo = G_ENUM_F3_CODIGO.Normal;
|
|
public G_ENUM_F3_CODIGO Exferia_F3_SoloSeleccion_Ancho_Codigo
|
|
{
|
|
set
|
|
{
|
|
g_enum_F3_AnchoCodigo = value;
|
|
|
|
//Normal
|
|
int int_AnchoCodigo = 91;
|
|
|
|
if (g_enum_F3_AnchoCodigo.Equals(G_ENUM_F3_CODIGO.Grande))
|
|
{
|
|
int_AnchoCodigo = 150;
|
|
}
|
|
//SuperGrande
|
|
else if(g_enum_F3_AnchoCodigo.Equals(G_ENUM_F3_CODIGO.SuperGrande))
|
|
{
|
|
int_AnchoCodigo = 350;
|
|
}
|
|
|
|
|
|
ex_txt_Codigo.Size = new Size(int_AnchoCodigo, ex_txt_Codigo.Size.Height);
|
|
ex_btn_F3_Codigo.Location = new Point((int_AnchoCodigo + ex_txt_Codigo.Location.X + 3), ex_btn_F3_Codigo.Location.Y);
|
|
ex_txt_Descripcion.Location = new Point((ex_btn_F3_Codigo.Size.Width + ex_btn_F3_Codigo.Location.X + 9), ex_txt_Descripcion.Location.Y);
|
|
ex_txt_Descripcion.Size = new Size(((ex_btn_F3_Descripcion.Location.X - ex_txt_Descripcion.Location.X) - 3), ex_txt_Descripcion.Size.Height);
|
|
|
|
}
|
|
get
|
|
{
|
|
return g_enum_F3_AnchoCodigo;
|
|
}
|
|
}
|
|
|
|
internal bool g_bol_BuscarTitulo_OpcionesDetalle = true;
|
|
public bool Exferia_F3_SoloSeleccion_PRINCIPAL_BUSCARTITULO
|
|
{
|
|
set
|
|
{
|
|
g_bol_BuscarTitulo_OpcionesDetalle = value;
|
|
}
|
|
}
|
|
|
|
internal bool g_bol_Obligatorio = false;
|
|
public bool Exferia_F3_SoloSeleccion_PRINCIPAL_Obligatorio
|
|
{
|
|
set
|
|
{
|
|
g_bol_Obligatorio = value;
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Color.White;
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Color.White;
|
|
}
|
|
}
|
|
get
|
|
{
|
|
return g_bol_Obligatorio;
|
|
}
|
|
}
|
|
|
|
//Mayor
|
|
internal bool g_bol_AutoCompletadoMayor = false;
|
|
public bool Exferia_F3_SoloSeleccion_PRINCIPAL_AutoCompletado_Mayor
|
|
{
|
|
set
|
|
{
|
|
g_bol_AutoCompletadoMayor = value;
|
|
if (g_bol_AutoCompletadoMayor)
|
|
{
|
|
if (g_P_Base_Contenedor != null)
|
|
{
|
|
ex_txt_Codigo.Exferia_TextBox_Tipos = G_ENUM_TEXTBOX_TIPODATO.AutoCompletado_Mayor;
|
|
ex_txt_Codigo.Exferia_TextBox_AutoCompletar_Mayor(g_P_Base_Contenedor.P_Base_ValoresGenerales);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Codigo.Exferia_TextBox_Tipos = G_ENUM_TEXTBOX_TIPODATO.Textos;
|
|
ex_txt_Codigo.Exferia_TextBox_AutoCompletar_Mayor(null);
|
|
}
|
|
}
|
|
}
|
|
|
|
#region Objetos codigo y Descripcion
|
|
|
|
public Exferia_TextBox Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo
|
|
{
|
|
get
|
|
{
|
|
return ex_txt_Codigo;
|
|
}
|
|
}
|
|
public Exferia_TextBox Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion
|
|
{
|
|
get
|
|
{
|
|
return ex_txt_Descripcion;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
public string Exferia_F3_SoloSeleccion_Titulo
|
|
{
|
|
set
|
|
{
|
|
ex_lbl_Titulo.Text = value;
|
|
}
|
|
get
|
|
{
|
|
return ex_lbl_Titulo.Text;
|
|
}
|
|
}
|
|
|
|
internal long g_lng_id = -1;
|
|
public long Exferia_F3_SoloSeleccion_Id
|
|
{
|
|
set
|
|
{
|
|
g_lng_id = value;
|
|
|
|
//Si tiene Relacionado otro F3
|
|
//Si este el Padre, cada vez que busque, borro los datos del hijo y desbloqueo los controles
|
|
if (g_enum_TipoRelacion == Exferia_F3_SoloSeleccion_TipoRelacion.Padre)
|
|
{
|
|
if (g_lst_ExferiaF3_Relacionados_Hijos != null)
|
|
{
|
|
foreach (Exferia_F3_SoloSeleccion obj_Exferia_F3_SoloSeleccion in g_lst_ExferiaF3_Relacionados_Hijos)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Id = -1;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Codigo = "";
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Descripcion = "";
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_FechaBorrado = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_1 = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_2 = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_3 = null;
|
|
|
|
//Poner los colores inciales
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
|
|
if (g_lng_id > 0)
|
|
{
|
|
//Desbloqueo
|
|
obj_Exferia_F3_SoloSeleccion.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
//Desbloqueo
|
|
obj_Exferia_F3_SoloSeleccion.Enabled = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
get
|
|
{
|
|
return g_lng_id;
|
|
}
|
|
}
|
|
|
|
public string Exferia_F3_SoloSeleccion_Codigo
|
|
{
|
|
set
|
|
{
|
|
ex_txt_Codigo.Text = value;
|
|
}
|
|
get
|
|
{
|
|
return ex_txt_Codigo.Text;
|
|
}
|
|
}
|
|
|
|
public string Exferia_F3_SoloSeleccion_Descripcion
|
|
{
|
|
set
|
|
{
|
|
ex_txt_Descripcion.Text = value;
|
|
}
|
|
get
|
|
{
|
|
return ex_txt_Descripcion.Text;
|
|
}
|
|
}
|
|
|
|
internal DateTime? g_dtt_FechaBorrado = null;
|
|
public DateTime? Exferia_F3_SoloSeleccion_FechaBorrado
|
|
{
|
|
set
|
|
{
|
|
g_dtt_FechaBorrado = value;
|
|
|
|
if (g_dtt_FechaBorrado != null)
|
|
{
|
|
ex_txt_Codigo.Exferia_TextBox_FuenteTexto(Fuentes.G_FONT_TEXTOS_TACHADA);
|
|
ex_txt_Codigo.Exferia_TextBox_ColorTexto(Colores.G_COLOR_ATENCION);
|
|
|
|
ex_txt_Descripcion.Exferia_TextBox_FuenteTexto(Fuentes.G_FONT_TEXTOS_TACHADA);
|
|
ex_txt_Descripcion.Exferia_TextBox_ColorTexto(Colores.G_COLOR_ATENCION);
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Codigo.Exferia_TextBox_FuenteTexto(Fuentes.G_FONT_TEXTOS);
|
|
ex_txt_Codigo.Exferia_TextBox_ColorTexto(Colores.G_COLOR_TEXTO_ESCRITO);
|
|
|
|
ex_txt_Descripcion.Exferia_TextBox_FuenteTexto(Fuentes.G_FONT_TEXTOS);
|
|
ex_txt_Descripcion.Exferia_TextBox_ColorTexto(Colores.G_COLOR_TEXTO_ESCRITO);
|
|
}
|
|
}
|
|
get
|
|
{
|
|
return g_dtt_FechaBorrado;
|
|
}
|
|
}
|
|
|
|
internal long? g_lng_idEjercicio_baja = null;
|
|
public long? Exferia_F3_SoloSeleccion_IdEjercicio_Baja
|
|
{
|
|
set
|
|
{
|
|
g_lng_idEjercicio_baja = value;
|
|
|
|
if (g_lng_idEjercicio_baja != null && g_lng_idEjercicio_baja.Value > -1)
|
|
{
|
|
//Comparar fecha temporadafin del ejericio de baja si lo tuviera con la fecha de trabajo actual
|
|
if (Datos_Generales.GEN_EjerciciosActivos_Empresa_Registro_DadoDeBaja_Por_EjercicioFecha(g_lng_idEjercicio_baja.Value, g_P_Base_Contenedor.P_Base_FechaTrabajo))
|
|
{
|
|
ex_txt_Codigo.Exferia_TextBox_FuenteTexto(Fuentes.G_FONT_TEXTOS_TACHADA);
|
|
ex_txt_Codigo.Exferia_TextBox_ColorTexto(Colores.G_COLOR_DADODEBAJA);
|
|
|
|
ex_txt_Descripcion.Exferia_TextBox_FuenteTexto(Fuentes.G_FONT_TEXTOS_TACHADA);
|
|
ex_txt_Descripcion.Exferia_TextBox_ColorTexto(Colores.G_COLOR_DADODEBAJA);
|
|
}
|
|
else
|
|
{
|
|
if (g_dtt_FechaBorrado != null)
|
|
{
|
|
ex_txt_Codigo.Exferia_TextBox_FuenteTexto(Fuentes.G_FONT_TEXTOS_TACHADA);
|
|
ex_txt_Codigo.Exferia_TextBox_ColorTexto(Colores.G_COLOR_ATENCION);
|
|
|
|
ex_txt_Descripcion.Exferia_TextBox_FuenteTexto(Fuentes.G_FONT_TEXTOS_TACHADA);
|
|
ex_txt_Descripcion.Exferia_TextBox_ColorTexto(Colores.G_COLOR_ATENCION);
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Codigo.Exferia_TextBox_FuenteTexto(Fuentes.G_FONT_TEXTOS);
|
|
ex_txt_Codigo.Exferia_TextBox_ColorTexto(Colores.G_COLOR_TEXTO_ESCRITO);
|
|
|
|
ex_txt_Descripcion.Exferia_TextBox_FuenteTexto(Fuentes.G_FONT_TEXTOS);
|
|
ex_txt_Descripcion.Exferia_TextBox_ColorTexto(Colores.G_COLOR_TEXTO_ESCRITO);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (g_dtt_FechaBorrado != null)
|
|
{
|
|
ex_txt_Codigo.Exferia_TextBox_FuenteTexto(Fuentes.G_FONT_TEXTOS_TACHADA);
|
|
ex_txt_Codigo.Exferia_TextBox_ColorTexto(Colores.G_COLOR_ATENCION);
|
|
|
|
ex_txt_Descripcion.Exferia_TextBox_FuenteTexto(Fuentes.G_FONT_TEXTOS_TACHADA);
|
|
ex_txt_Descripcion.Exferia_TextBox_ColorTexto(Colores.G_COLOR_ATENCION);
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Codigo.Exferia_TextBox_FuenteTexto(Fuentes.G_FONT_TEXTOS);
|
|
ex_txt_Codigo.Exferia_TextBox_ColorTexto(Colores.G_COLOR_TEXTO_ESCRITO);
|
|
|
|
ex_txt_Descripcion.Exferia_TextBox_FuenteTexto(Fuentes.G_FONT_TEXTOS);
|
|
ex_txt_Descripcion.Exferia_TextBox_ColorTexto(Colores.G_COLOR_TEXTO_ESCRITO);
|
|
}
|
|
}
|
|
}
|
|
get
|
|
{
|
|
return g_lng_idEjercicio_baja;
|
|
}
|
|
}
|
|
|
|
internal object g_obj_DatosAuxiliares_1 = null;
|
|
public object Exferia_F3_SoloSeleccion_DatosAuxiliares_1
|
|
{
|
|
set
|
|
{
|
|
g_obj_DatosAuxiliares_1 = value;
|
|
}
|
|
get
|
|
{
|
|
return g_obj_DatosAuxiliares_1;
|
|
}
|
|
}
|
|
internal object g_obj_DatosAuxiliares_2 = null;
|
|
public object Exferia_F3_SoloSeleccion_DatosAuxiliares_2
|
|
{
|
|
set
|
|
{
|
|
g_obj_DatosAuxiliares_2 = value;
|
|
}
|
|
get
|
|
{
|
|
return g_obj_DatosAuxiliares_2;
|
|
}
|
|
}
|
|
internal object g_obj_DatosAuxiliares_3 = null;
|
|
public object Exferia_F3_SoloSeleccion_DatosAuxiliares_3
|
|
{
|
|
set
|
|
{
|
|
g_obj_DatosAuxiliares_3 = value;
|
|
}
|
|
get
|
|
{
|
|
return g_obj_DatosAuxiliares_3;
|
|
}
|
|
}
|
|
|
|
#region Objeto Relacionado
|
|
internal List<INTERNO_Filtro_OpcionPadre_Modelo> g_lst_INTERNO_Filtro_OpcionPadre_Modelo = null;
|
|
public List<INTERNO_Filtro_OpcionPadre_Modelo> Exferia_F3_SoloSeleccion_RELACIONADOS
|
|
{
|
|
set
|
|
{
|
|
g_lst_INTERNO_Filtro_OpcionPadre_Modelo = value;
|
|
}
|
|
}
|
|
|
|
// Enumerado que define el tipo de relacion que puede existir entre dos Objetos Exferia_F3_SoloSeleccion
|
|
public enum Exferia_F3_SoloSeleccion_TipoRelacion
|
|
{
|
|
Ninguna,
|
|
Padre,
|
|
Hijo
|
|
}
|
|
|
|
// Tipo de Relacion con otro Objeto Exferia_F3_SoloSeleccion
|
|
internal Exferia_F3_SoloSeleccion_TipoRelacion g_enum_TipoRelacion = Exferia_F3_SoloSeleccion_TipoRelacion.Ninguna;
|
|
public Exferia_F3_SoloSeleccion_TipoRelacion Exferia_F3_SoloSeleccion_RELACIONAL_TipoRelacion
|
|
{
|
|
set
|
|
{
|
|
g_enum_TipoRelacion = value;
|
|
|
|
if (value==Exferia_F3_SoloSeleccion_TipoRelacion.Hijo)
|
|
{
|
|
Tag = "1";
|
|
}
|
|
else
|
|
{
|
|
Tag = "";
|
|
}
|
|
}
|
|
get
|
|
{
|
|
return g_enum_TipoRelacion;
|
|
}
|
|
}
|
|
|
|
// Objetos hijos Exferia_F3_SoloSeleccion Relacionados
|
|
internal List<Exferia_F3_SoloSeleccion> g_lst_ExferiaF3_Relacionados_Hijos;
|
|
public List<Exferia_F3_SoloSeleccion> Exferia_F3_SoloSeleccion_RELACIONADOS_Objetos_Hijos
|
|
{
|
|
set
|
|
{
|
|
g_lst_ExferiaF3_Relacionados_Hijos = value;
|
|
}
|
|
get
|
|
{
|
|
return g_lst_ExferiaF3_Relacionados_Hijos;
|
|
}
|
|
}
|
|
|
|
// Objeto padre Exferia_F3_SoloSeleccion Relacionado
|
|
internal Exferia_F3_SoloSeleccion g_obj_ExferiaF3_Relacionado_Padre;
|
|
public Exferia_F3_SoloSeleccion Exferia_F3_SoloSeleccion_RELACIONADOS_Objeto_Padre
|
|
{
|
|
set
|
|
{
|
|
g_obj_ExferiaF3_Relacionado_Padre = value;
|
|
}
|
|
}
|
|
|
|
// Valores del padre Exferia_F3_SoloSeleccion Relacionado sin Objeto
|
|
internal long g_lng_ExferiaF3_Relacionado_Padre_ID=-1;
|
|
public long Exferia_F3_SoloSeleccion_RELACIONADOS_Padre_ID
|
|
{
|
|
set
|
|
{
|
|
g_lng_ExferiaF3_Relacionado_Padre_ID = value;
|
|
}
|
|
}
|
|
internal string g_str_ExferiaF3_Relacionado_Padre_OPCION = "";
|
|
public string Exferia_F3_SoloSeleccion_RELACIONADOS_Padre_OPCION
|
|
{
|
|
set
|
|
{
|
|
g_str_ExferiaF3_Relacionado_Padre_OPCION = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
public void Exferia_F3_SoloSeleccion_Foco ()
|
|
{
|
|
ex_txt_Codigo.Exferia_TextBox_Foco();
|
|
}
|
|
|
|
// Objetos hijos Exferia_F3_SoloSeleccion Relacionados
|
|
internal Exferia_F3_SoloSeleccion g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion;
|
|
public Exferia_F3_SoloSeleccion Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion
|
|
{
|
|
set
|
|
{
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion = value;
|
|
}
|
|
}
|
|
|
|
internal Dictionary<string, object> g_dct_ListadoFiltros = null;
|
|
public Dictionary<string, object> Exferia_F3_SoloSeleccion_FiltrosAvanzados
|
|
{
|
|
set
|
|
{
|
|
g_dct_ListadoFiltros = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Eventos publicos
|
|
public event EventHandler Exferia_F3_SoloSeleccion_Evento_TextChanged;
|
|
|
|
public event EventHandler Exferia_F3_SoloSeleccion_Evento_TerminoBusqueda;
|
|
|
|
#endregion
|
|
|
|
public Exferia_F3_SoloSeleccion()
|
|
{
|
|
InitializeComponent();
|
|
|
|
// (Tarea Asincrona) Buscar ###############################################################
|
|
g_TareaAsincrona_Buscar = new BackgroundWorker();
|
|
g_TareaAsincrona_Buscar.DoWork += new DoWorkEventHandler(TareaAsincrona_Buscar_DoWork);
|
|
g_TareaAsincrona_Buscar.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_Buscar_Completed);
|
|
g_TareaAsincrona_Buscar.WorkerReportsProgress = false;
|
|
g_TareaAsincrona_Buscar.WorkerSupportsCancellation = true;
|
|
// ##############################################################################################
|
|
|
|
// (Tarea Asincrona) BuscarPorId ###############################################################
|
|
g_TareaAsincrona_Buscar_RegistroPorId = new BackgroundWorker();
|
|
g_TareaAsincrona_Buscar_RegistroPorId.DoWork += new DoWorkEventHandler(TareaAsincrona_Buscar_RegistroPorId_DoWork);
|
|
g_TareaAsincrona_Buscar_RegistroPorId.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_Buscar_RegistroPorId_Completed);
|
|
g_TareaAsincrona_Buscar_RegistroPorId.WorkerReportsProgress = false;
|
|
g_TareaAsincrona_Buscar_RegistroPorId.WorkerSupportsCancellation = true;
|
|
// ##############################################################################################
|
|
|
|
}
|
|
|
|
private void Exferia_F3_SoloSeleccion_Load(object sender, EventArgs e)
|
|
{
|
|
CargaInicial();
|
|
}
|
|
public void CargaInicial()
|
|
{
|
|
try
|
|
{
|
|
//Buscar los datos del Arbol
|
|
g_mdl_INTERNO_OpcionesDetalle_Modelo = Datos_Generales.PRV_Opciones_Buscar_Detalles(g_str_NombreOpcion_BuscarDatos);
|
|
|
|
//Buscar el Titulo en el Arbol
|
|
if (g_bol_BuscarTitulo_OpcionesDetalle && g_mdl_INTERNO_OpcionesDetalle_Modelo != null)
|
|
{
|
|
Exferia_F3_SoloSeleccion_Titulo = g_mdl_INTERNO_OpcionesDetalle_Modelo.descripcion_Singular;
|
|
}
|
|
|
|
//Bloquear hijos si el padre no esta relleno
|
|
if (g_lng_id < 1)
|
|
{
|
|
if (g_lst_ExferiaF3_Relacionados_Hijos != null)
|
|
{
|
|
foreach (Exferia_F3_SoloSeleccion obj_Exferia_F3_SoloSeleccion in g_lst_ExferiaF3_Relacionados_Hijos)
|
|
{
|
|
//Bloqueo
|
|
obj_Exferia_F3_SoloSeleccion.Enabled = false;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
//Cargamos el ensamblado
|
|
Assembly m_assembly = Assembly.LoadFrom(Variables.G_STR_LIBRERIA_RUTAINICIAL + @"\" + g_mdl_INTERNO_OpcionesDetalle_Modelo.nombreLibreria + ".dll");
|
|
//Obtenemos el tipo de la clase
|
|
Type m_type = m_assembly.GetType(g_mdl_INTERNO_OpcionesDetalle_Modelo.nombreLibreria + "." + Variables.G_STR_LIBRERIA_OPCIONES);
|
|
//creamos la instancia
|
|
var obj_Clase = Activator.CreateInstance(m_type);
|
|
//Cargamos el metodo solicitado
|
|
MethodInfo obj_MethodInfo = obj_Clase.GetType().GetMethod(Variables.G_STR_LIBRERIA_OPCIONES_PROCEDIMIENTO_OBTENCION_ABS_F3, BindingFlags.Instance | BindingFlags.NonPublic);
|
|
|
|
//Obtener valores
|
|
object[] arr_Parametros = { g_str_NombreOpcion_BuscarDatos };
|
|
//Pasamos los parametros al metodo y lo ejecutamos
|
|
g_obj_ABS_F3 = (ABS_F3)obj_MethodInfo.Invoke(obj_Clase, arr_Parametros);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Control_Errores.Errores_Log(g_str_NombreOpcion_BuscarDatos, ex, nameof(Exferia_F3_SoloSeleccion) + "/" + nameof(Exferia_F3_SoloSeleccion_Load));
|
|
}
|
|
}
|
|
|
|
#region Poner el Foco en TextBox
|
|
/// <summary>
|
|
/// Poner el Fodo en el TextBox de Codigo
|
|
/// </summary>
|
|
public void Foco_Codigo()
|
|
{
|
|
ex_txt_Codigo.Exferia_TextBox_Foco();
|
|
}
|
|
/// <summary>
|
|
/// Poner el Fodo en el TextBox de Descripcion
|
|
/// </summary>
|
|
public void Foco_Descripcion()
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Foco();
|
|
}
|
|
#endregion
|
|
|
|
#region Codigo
|
|
private void ex_btn_F3_Codigo_Click(object sender, EventArgs e)
|
|
{
|
|
F3_Pulsado(ex_txt_Codigo);
|
|
}
|
|
private void ex_txt_Codigo_Exferia_TextBox_Evento_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
switch (e.KeyCode)
|
|
{
|
|
case Keys.F3:
|
|
{
|
|
F3_Pulsado(sender as Exferia_TextBox);
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
g_bol_Cambio_Codigo = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
private void ex_txt_Codigo_Exferia_TextBox_Evento_GotFocus(object sender, EventArgs e)
|
|
{
|
|
ex_txt_Codigo.Tag = ex_txt_Codigo.Text;
|
|
}
|
|
private void ex_txt_Codigo_Exferia_TextBox_Evento_LostFocus(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (g_bol_Cambio_Codigo)
|
|
{
|
|
g_bol_Cambio_Codigo = false;
|
|
if (!ex_txt_Codigo.Tag.ToString().Equals(ex_txt_Codigo.Text))
|
|
{
|
|
g_str_Filtro = ex_txt_Codigo.Text;
|
|
g_str_CampoBusqueda = g_obj_ABS_F3.NOMBRE_CAMPO_CODIGO();
|
|
|
|
Buscar(g_str_Filtro, g_str_CampoBusqueda);
|
|
}
|
|
}
|
|
g_bol_Cambio_Codigo = false;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Control_Errores.Errores_Log("", ex, nameof(Exferia_F3_SoloSeleccion) + "/" + nameof(ex_txt_Codigo_Exferia_TextBox_Evento_LostFocus));
|
|
}
|
|
}
|
|
private void ex_txt_Codigo_Exferia_TextBox_Evento_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (g_P_Base_Contenedor.Enabled)
|
|
{
|
|
g_P_Base_Contenedor.P_Base_SeModificoDatosPantalla = true;
|
|
}
|
|
|
|
//Salta el Evento de TextChange
|
|
Exferia_F3_SoloSeleccion_Evento_TextChanged?.Invoke(this, e);
|
|
}
|
|
#endregion
|
|
|
|
#region Descripcion
|
|
private void ex_btn_F3_Descripcion_Click(object sender, EventArgs e)
|
|
{
|
|
F3_Pulsado(ex_txt_Descripcion);
|
|
}
|
|
private void ex_txt_Descripcion_Exferia_TextBox_Evento_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
switch (e.KeyCode)
|
|
{
|
|
case Keys.F3:
|
|
{
|
|
F3_Pulsado(sender as Exferia_TextBox);
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
g_bol_Cambio_Descripcion = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
private void ex_txt_Descripcion_Exferia_TextBox_Evento_GotFocus(object sender, EventArgs e)
|
|
{
|
|
ex_txt_Descripcion.Tag = ex_txt_Descripcion.Text;
|
|
}
|
|
private void ex_txt_Descripcion_Exferia_TextBox_Evento_LostFocus(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (g_bol_Cambio_Descripcion)
|
|
{
|
|
g_bol_Cambio_Descripcion = false;
|
|
if (!ex_txt_Descripcion.Tag.ToString().Equals(ex_txt_Descripcion.Text))
|
|
{
|
|
g_str_Filtro = ex_txt_Descripcion.Text;
|
|
g_str_CampoBusqueda = g_obj_ABS_F3.NOMBRE_CAMPO_DESCRIPCION();
|
|
|
|
Buscar(g_str_Filtro, g_str_CampoBusqueda);
|
|
}
|
|
}
|
|
g_bol_Cambio_Descripcion = false;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Control_Errores.Errores_Log("", ex, nameof(Exferia_F3_SoloSeleccion) + "/" + nameof(ex_txt_Descripcion_Exferia_TextBox_Evento_LostFocus));
|
|
}
|
|
}
|
|
private void ex_txt_Descripcion_Exferia_TextBox_Evento_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (g_P_Base_Contenedor.Enabled)
|
|
{
|
|
g_P_Base_Contenedor.P_Base_SeModificoDatosPantalla = true;
|
|
}
|
|
|
|
//Salta el Evento de TextChange
|
|
Exferia_F3_SoloSeleccion_Evento_TextChanged?.Invoke(this, e);
|
|
}
|
|
#endregion
|
|
|
|
private void F3_Pulsado(Exferia_TextBox _ex_txt_Actual)
|
|
{
|
|
if (Datos_Generales.Permisos_Comprobar(g_str_NombreOpcion_BuscarDatos, g_lst_INTERNO_Permisos_Modelo, (int)G_ENUM_PERMISOS.Seleccionar, true))
|
|
{
|
|
string str_NombreCampo_Seleccionado = g_obj_ABS_F3.NOMBRE_CAMPO_CODIGO();
|
|
string str_Valor_Seleccionado = ex_txt_Codigo.Text;
|
|
if (_ex_txt_Actual.Name.Equals("ex_txt_Descripcion"))
|
|
{
|
|
str_NombreCampo_Seleccionado = g_obj_ABS_F3.NOMBRE_CAMPO_DESCRIPCION();
|
|
str_Valor_Seleccionado = ex_txt_Descripcion.Text;
|
|
}
|
|
|
|
//Cargamos el ensamblado
|
|
Assembly m_assembly = Assembly.LoadFrom(Variables.G_STR_LIBRERIA_RUTAINICIAL + @"\" + g_mdl_INTERNO_OpcionesDetalle_Modelo.nombreLibreria + ".dll");
|
|
//Obtenemos el tipo de la clase
|
|
Type m_type = m_assembly.GetType(g_mdl_INTERNO_OpcionesDetalle_Modelo.nombreLibreria + "." + Variables.G_STR_LIBRERIA_OPCIONES);
|
|
//creamos la instancia
|
|
var obj_Clase = Activator.CreateInstance(m_type);
|
|
//Cargamos el metodo solicitado
|
|
MethodInfo obj_MethodInfo = obj_Clase.GetType().GetMethod(Variables.G_STR_LIBRERIA_OPCIONES_PROCEDIMIENTO_CARGAR_LISTADO, BindingFlags.Instance | BindingFlags.NonPublic);
|
|
|
|
//Evento Registro Seleccionado .........................................
|
|
MethodInfo obj_EventoAlqueSeRedirige_RegistroSeleccionado = typeof(Exferia_F3_SoloSeleccion).GetMethod("Evento_RegistroSeleccionado", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
EventInfo obj_Evento_Publico_RegistroSeleccionado = obj_Clase.GetType().GetEvent(Variables.G_STR_LIBRERIA_OPCIONES_EVENTO_REGISTROSELECCIONADO);
|
|
Type obj_TipoEventoPublico_RegistroSeleccionado = obj_Evento_Publico_RegistroSeleccionado.EventHandlerType;
|
|
Delegate obj_Delegado_RegistroSeleccionado = Delegate.CreateDelegate(obj_TipoEventoPublico_RegistroSeleccionado, this, obj_EventoAlqueSeRedirige_RegistroSeleccionado);
|
|
obj_Evento_Publico_RegistroSeleccionado.AddEventHandler(obj_Clase, obj_Delegado_RegistroSeleccionado);
|
|
//..................................................................
|
|
|
|
List<INTERNO_Filtro_OpcionPadre_Modelo> lst_INTERNO_Filtro_OpcionPadre_Modelo = null;
|
|
if (g_lst_INTERNO_Filtro_OpcionPadre_Modelo != null)
|
|
{
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo = new List<INTERNO_Filtro_OpcionPadre_Modelo>();
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo.AddRange(g_lst_INTERNO_Filtro_OpcionPadre_Modelo);
|
|
}
|
|
|
|
|
|
//Si es Hijo y el padre tiene algo seleccionado se le envia al listado para que filtre por ahi tambien
|
|
if (g_str_ExferiaF3_Relacionado_Padre_OPCION != "")
|
|
{
|
|
if (lst_INTERNO_Filtro_OpcionPadre_Modelo == null)
|
|
{
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo = new List<INTERNO_Filtro_OpcionPadre_Modelo>();
|
|
}
|
|
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo.Add(new INTERNO_Filtro_OpcionPadre_Modelo(g_str_ExferiaF3_Relacionado_Padre_OPCION, g_lng_ExferiaF3_Relacionado_Padre_ID));
|
|
}
|
|
else if (g_enum_TipoRelacion == Exferia_F3_SoloSeleccion_TipoRelacion.Hijo)
|
|
{
|
|
if (g_obj_ExferiaF3_Relacionado_Padre != null)
|
|
{
|
|
if (lst_INTERNO_Filtro_OpcionPadre_Modelo == null)
|
|
{
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo = new List<INTERNO_Filtro_OpcionPadre_Modelo>();
|
|
}
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo.Add(new INTERNO_Filtro_OpcionPadre_Modelo(g_obj_ExferiaF3_Relacionado_Padre.Exferia_F3_SoloSeleccion_PRINCIPAL_Opcion_BuscarDatos, g_obj_ExferiaF3_Relacionado_Padre.Exferia_F3_SoloSeleccion_Id));
|
|
}
|
|
else if (g_lng_ExferiaF3_Relacionado_Padre_ID > -1)
|
|
{
|
|
if (lst_INTERNO_Filtro_OpcionPadre_Modelo == null)
|
|
{
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo = new List<INTERNO_Filtro_OpcionPadre_Modelo>();
|
|
}
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo.Add(new INTERNO_Filtro_OpcionPadre_Modelo(g_str_ExferiaF3_Relacionado_Padre_OPCION, g_lng_ExferiaF3_Relacionado_Padre_ID));
|
|
}
|
|
}
|
|
|
|
//Obtener valores
|
|
object[] arr_Parametros = { g_str_NombreOpcion_BuscarDatos,
|
|
true,
|
|
111,
|
|
g_P_Base_Contenedor,
|
|
g_P_Base_Contenedor.P_Base_ValoresGenerales,
|
|
g_P_Base_Contenedor.P_Base_FechaTrabajo,
|
|
str_NombreCampo_Seleccionado,
|
|
str_Valor_Seleccionado,
|
|
false,
|
|
false,
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo,
|
|
null,
|
|
g_dct_ListadoFiltros,
|
|
g_lng_ExferiaF3_Relacionado_Padre_ID,
|
|
g_obj_Filtro_Auxiliar,
|
|
g_obj_ABS_Listado};
|
|
|
|
//Pasamos los parametros al metodo y lo ejecutamos
|
|
obj_MethodInfo.Invoke(obj_Clase, arr_Parametros);
|
|
}
|
|
}
|
|
|
|
#region Eventos del Listado llamado
|
|
|
|
void Evento_RegistroSeleccionado(object sender, INTERNO_EventArgs_Listado e)
|
|
{
|
|
if (e.REGISTRO_SELECCIONADO != null)
|
|
{
|
|
var obj_id = e.REGISTRO_SELECCIONADO.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_ID()).GetValue(e.REGISTRO_SELECCIONADO, null);
|
|
if (obj_id != null)
|
|
{
|
|
long _lng_id_Antiguo = g_lng_id;
|
|
|
|
//Poner los colores inciales
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
|
|
g_lng_id = obj_id;
|
|
|
|
var obj_Codigo = e.REGISTRO_SELECCIONADO.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_CODIGO()).GetValue(e.REGISTRO_SELECCIONADO, null);
|
|
if (obj_Codigo != null)
|
|
{
|
|
ex_txt_Codigo.Text = Convert.ToString(obj_Codigo);
|
|
}
|
|
|
|
var obj_Descripcion = e.REGISTRO_SELECCIONADO.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_DESCRIPCION()).GetValue(e.REGISTRO_SELECCIONADO, null);
|
|
if (obj_Descripcion != null)
|
|
{
|
|
ex_txt_Descripcion.Text = obj_Descripcion;
|
|
}
|
|
|
|
//fechaBorrado
|
|
DateTime? dtt_FechaBorrado = null;
|
|
var obj_FechaBorrado = e.REGISTRO_SELECCIONADO.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_FECHABORRADO()).GetValue(e.REGISTRO_SELECCIONADO, null);
|
|
if (obj_FechaBorrado != null)
|
|
{
|
|
dtt_FechaBorrado = obj_FechaBorrado;
|
|
}
|
|
Exferia_F3_SoloSeleccion_FechaBorrado = dtt_FechaBorrado;
|
|
|
|
//Si tuviera el nombre del Ejercicio_Baja se pone el valor
|
|
if (g_obj_ABS_F3.NOMBRE_CAMPO_IDEJERCICIO_BAJA() != null && g_obj_ABS_F3.NOMBRE_CAMPO_IDEJERCICIO_BAJA().Trim().Length > 0)
|
|
{
|
|
long? lng_idEjercicio_Baja = null;
|
|
var obj_idEjercicio_Baja = e.REGISTRO_SELECCIONADO.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_IDEJERCICIO_BAJA()).GetValue(e.REGISTRO_SELECCIONADO, null);
|
|
if (obj_idEjercicio_Baja != null)
|
|
{
|
|
lng_idEjercicio_Baja = obj_idEjercicio_Baja;
|
|
}
|
|
Exferia_F3_SoloSeleccion_IdEjercicio_Baja = lng_idEjercicio_Baja;
|
|
}
|
|
|
|
//Si tuviera el nombre CAMPO DatosAuxiliares 1
|
|
if (g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_1() != null && g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_1().Trim().Length > 0)
|
|
{
|
|
Exferia_F3_SoloSeleccion_DatosAuxiliares_1 = e.REGISTRO_SELECCIONADO.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_1()).GetValue(e.REGISTRO_SELECCIONADO, null);
|
|
}
|
|
|
|
//Si tuviera el nombre CAMPO DatosAuxiliares 2
|
|
if (g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_2() != null && g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_2().Trim().Length > 0)
|
|
{
|
|
Exferia_F3_SoloSeleccion_DatosAuxiliares_2 = e.REGISTRO_SELECCIONADO.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_2()).GetValue(e.REGISTRO_SELECCIONADO, null);
|
|
}
|
|
|
|
//Si tuviera el nombre CAMPO DatosAuxiliares 3
|
|
if (g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_3() != null && g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_3().Trim().Length > 0)
|
|
{
|
|
Exferia_F3_SoloSeleccion_DatosAuxiliares_3 = e.REGISTRO_SELECCIONADO.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_3()).GetValue(e.REGISTRO_SELECCIONADO, null);
|
|
}
|
|
|
|
//Si tiene Relacionado otro F3
|
|
//Si este el Padre, cada vez que busque, borro los datos del hijo y desbloqueo los controles
|
|
if (g_enum_TipoRelacion == Exferia_F3_SoloSeleccion_TipoRelacion.Padre)
|
|
{
|
|
if (g_lst_ExferiaF3_Relacionados_Hijos != null)
|
|
{
|
|
foreach (Exferia_F3_SoloSeleccion obj_Exferia_F3_SoloSeleccion in g_lst_ExferiaF3_Relacionados_Hijos)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Id = -1;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Codigo = "";
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Descripcion = "";
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_FechaBorrado = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_IdEjercicio_Baja = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_1 = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_2 = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_3 = null;
|
|
|
|
//Poner los colores inciales
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
|
|
//Desbloqueo
|
|
obj_Exferia_F3_SoloSeleccion.Enabled = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
//#################################################################################################
|
|
//Copiar la informacion si estuviera a vacio o incorrecto
|
|
if (g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion != null)
|
|
{
|
|
if (g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_Id==-1 &&
|
|
g_lng_id>-1 &&
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Enabled)
|
|
{
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_Id = g_lng_id;
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_Codigo = ex_txt_Codigo.Text;
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_Descripcion = ex_txt_Descripcion.Text;
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_FechaBorrado = Exferia_F3_SoloSeleccion_FechaBorrado;
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_IdEjercicio_Baja = Exferia_F3_SoloSeleccion_IdEjercicio_Baja;
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_DatosAuxiliares_1 = Exferia_F3_SoloSeleccion_DatosAuxiliares_1;
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_DatosAuxiliares_2 = Exferia_F3_SoloSeleccion_DatosAuxiliares_2;
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_DatosAuxiliares_3 = Exferia_F3_SoloSeleccion_DatosAuxiliares_3;
|
|
|
|
//Hijos
|
|
if (g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_RELACIONAL_TipoRelacion == Exferia_F3_SoloSeleccion_TipoRelacion.Padre)
|
|
{
|
|
if (g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_RELACIONADOS_Objetos_Hijos != null)
|
|
{
|
|
foreach (Exferia_F3_SoloSeleccion obj_Exferia_F3_SoloSeleccion_Copiar in g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_RELACIONADOS_Objetos_Hijos)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_Id = -1;
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_Codigo = "";
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_Descripcion = "";
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_FechaBorrado = null;
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_IdEjercicio_Baja = null;
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_DatosAuxiliares_1 = null;
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_DatosAuxiliares_2 = null;
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_DatosAuxiliares_3 = null;
|
|
|
|
//Poner los colores inciales
|
|
if (obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_PRINCIPAL_Obligatorio)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
|
|
//Desbloqueo
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Enabled = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//##################################################################################################
|
|
|
|
if (g_lng_id!=_lng_id_Antiguo)
|
|
{
|
|
//Salta el Evento de TerminoBusqueda
|
|
Exferia_F3_SoloSeleccion_Evento_TerminoBusqueda?.Invoke(this, new EventArgs());
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
//Salta el Evento de TerminoBusqueda
|
|
Exferia_F3_SoloSeleccion_Evento_TerminoBusqueda?.Invoke(this, new EventArgs());
|
|
}
|
|
|
|
}
|
|
|
|
//Poner Foco
|
|
ex_txt_Codigo.Exferia_TextBox_Foco();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Actualiza los registros cuando se abre el mantenimiento directo y se graba o borra
|
|
public void Exferia_F3_SoloSeleccion_ActualizarRegistro(long _lng_id, G_ENUM_TIPOACCION _enum_TipoAccion)
|
|
{
|
|
try
|
|
{
|
|
//Eliminar
|
|
if (_enum_TipoAccion.Equals(G_ENUM_TIPOACCION.INT_ELIMINAR))
|
|
{
|
|
//Poner los colores inciales
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
|
|
g_lng_id = -1;
|
|
//Descripcion
|
|
ex_txt_Codigo.Text = "";
|
|
ex_txt_Descripcion.Text = "";
|
|
|
|
if (g_enum_TipoRelacion == Exferia_F3_SoloSeleccion_TipoRelacion.Padre)
|
|
{
|
|
if (g_lst_ExferiaF3_Relacionados_Hijos != null)
|
|
{
|
|
foreach (Exferia_F3_SoloSeleccion obj_Exferia_F3_SoloSeleccion in g_lst_ExferiaF3_Relacionados_Hijos)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Id = -1;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Codigo = "";
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Descripcion = "";
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_FechaBorrado = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_1 = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_2 = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_3 = null;
|
|
|
|
//Poner los colores inciales
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
|
|
//Bloqueo
|
|
obj_Exferia_F3_SoloSeleccion.Enabled = false;
|
|
}
|
|
}
|
|
}
|
|
//Poner Foco
|
|
ex_txt_Codigo.Exferia_TextBox_Foco();
|
|
}
|
|
else if (_enum_TipoAccion.Equals(G_ENUM_TIPOACCION.INT_NADA))
|
|
{
|
|
//Poner Foco
|
|
ex_txt_Codigo.Exferia_TextBox_Foco();
|
|
|
|
//Salta el Evento de TerminoBusqueda
|
|
Exferia_F3_SoloSeleccion_Evento_TerminoBusqueda?.Invoke(this, new EventArgs());
|
|
}
|
|
//Actualizar e Insertar
|
|
else
|
|
{
|
|
g_TareaAsincrona_Buscar_RegistroPorId.RunWorkerAsync(_lng_id);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Control_Errores.Errores_Log(ex.Message, nameof(Exferia_F3_SoloSeleccion) +"/" + nameof(Exferia_F3_SoloSeleccion_ActualizarRegistro));
|
|
Mensajes.MostrarMensaje(Mensajes.G_EXFERIA_F3_ERROR_BUSCAR());
|
|
}
|
|
}
|
|
|
|
private void TareaAsincrona_Buscar_RegistroPorId_DoWork(object sender, DoWorkEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
// Parametros ######################################################
|
|
long lng_id = (long)e.Argument ;
|
|
// #################################################################
|
|
|
|
List<INTERNO_Filtro_OpcionPadre_Modelo> lst_INTERNO_Filtro_OpcionPadre_Modelo = null;
|
|
if (g_lst_INTERNO_Filtro_OpcionPadre_Modelo != null)
|
|
{
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo = new List<INTERNO_Filtro_OpcionPadre_Modelo>();
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo.AddRange(g_lst_INTERNO_Filtro_OpcionPadre_Modelo);
|
|
}
|
|
|
|
|
|
//Si es Hijo y el padre tiene algo seleccionado se le envia al listado para que filtre por ahi tambien
|
|
if (g_str_ExferiaF3_Relacionado_Padre_OPCION != "")
|
|
{
|
|
if (lst_INTERNO_Filtro_OpcionPadre_Modelo == null)
|
|
{
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo = new List<INTERNO_Filtro_OpcionPadre_Modelo>();
|
|
}
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo.Add(new INTERNO_Filtro_OpcionPadre_Modelo(g_str_ExferiaF3_Relacionado_Padre_OPCION, g_lng_ExferiaF3_Relacionado_Padre_ID));
|
|
}
|
|
else if (g_enum_TipoRelacion == Exferia_F3_SoloSeleccion_TipoRelacion.Hijo)
|
|
{
|
|
if (g_obj_ExferiaF3_Relacionado_Padre != null)
|
|
{
|
|
if (lst_INTERNO_Filtro_OpcionPadre_Modelo == null)
|
|
{
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo = new List<INTERNO_Filtro_OpcionPadre_Modelo>();
|
|
}
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo.Add(new INTERNO_Filtro_OpcionPadre_Modelo(g_obj_ExferiaF3_Relacionado_Padre.Exferia_F3_SoloSeleccion_PRINCIPAL_Opcion_BuscarDatos, g_obj_ExferiaF3_Relacionado_Padre.Exferia_F3_SoloSeleccion_Id));
|
|
}
|
|
}
|
|
|
|
//Cargamos el ensamblado
|
|
Assembly m_assembly = Assembly.LoadFrom(Variables.G_STR_LIBRERIA_RUTAINICIAL + @"\" + g_mdl_INTERNO_OpcionesDetalle_Modelo.nombreLibreria + ".dll");
|
|
//Obtenemos el tipo de la clase
|
|
Type m_type = m_assembly.GetType("" + g_mdl_INTERNO_OpcionesDetalle_Modelo.nombreLibreria + "." + Variables.G_STR_LIBRERIA_OPCIONES);
|
|
//creamos la instancia
|
|
var obj_Clase = Activator.CreateInstance(m_type);
|
|
//Cargamos el metodo solicitado
|
|
MethodInfo obj_MethodInfo = obj_Clase.GetType().GetMethod(Variables.G_STR_LIBRERIA_OPCIONES_PROCEDIMIENTO_OBTENER_REGISTRO_F3_PORID, BindingFlags.Instance | BindingFlags.NonPublic);
|
|
|
|
//Obtener valores
|
|
object[] arr_Parametros = {
|
|
g_str_NombreOpcion_BuscarDatos,
|
|
lng_id,
|
|
g_P_Base_Contenedor.P_Base_ValoresGenerales.lng_idEmpresa,
|
|
g_P_Base_Contenedor.P_Base_ValoresGenerales.EjercicioActivo.id,
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo,
|
|
null};
|
|
|
|
//Pasamos los parametros al metodo y lo ejecutamos
|
|
e.Result = obj_MethodInfo.Invoke(obj_Clase, arr_Parametros);
|
|
}
|
|
catch (ThreadAbortException)
|
|
{
|
|
e.Cancel = true;
|
|
Thread.ResetAbort();
|
|
}
|
|
catch (Control_Errores)
|
|
{
|
|
e.Cancel = true;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
e.Cancel = true;
|
|
}
|
|
}
|
|
|
|
private void TareaAsincrona_Buscar_RegistroPorId_Completed(object sender, RunWorkerCompletedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (e.Cancelled == false)
|
|
{
|
|
if (e.Result != null)
|
|
{
|
|
dynamic dnm_Valor = e.Result;
|
|
if (dnm_Valor != null)
|
|
{
|
|
var obj_id = dnm_Valor.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_ID()).GetValue(dnm_Valor, null);
|
|
if (obj_id != null)
|
|
{
|
|
long _lng_id_Antiguo = g_lng_id;
|
|
|
|
//Poner los colores inciales
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
|
|
g_lng_id = obj_id;
|
|
|
|
var obj_Codigo = dnm_Valor.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_CODIGO()).GetValue(dnm_Valor, null);
|
|
if (obj_Codigo != null)
|
|
{
|
|
ex_txt_Codigo.Text = Convert.ToString(obj_Codigo);
|
|
}
|
|
|
|
var obj_Descripcion = dnm_Valor.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_DESCRIPCION()).GetValue(dnm_Valor, null);
|
|
if (obj_Descripcion != null)
|
|
{
|
|
ex_txt_Descripcion.Text = obj_Descripcion;
|
|
}
|
|
|
|
//fecha Borrado
|
|
DateTime? dtt_FechaBorrado = null;
|
|
var obj_FechaBorrado = dnm_Valor.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_FECHABORRADO()).GetValue(dnm_Valor, null);
|
|
if (obj_FechaBorrado != null)
|
|
{
|
|
dtt_FechaBorrado = obj_FechaBorrado;
|
|
}
|
|
Exferia_F3_SoloSeleccion_FechaBorrado = dtt_FechaBorrado;
|
|
|
|
//Si tuviera el nombre CAMPO DatosAuxiliares 1
|
|
if (g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_1() != null && g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_1().Trim().Length > 0)
|
|
{
|
|
Exferia_F3_SoloSeleccion_DatosAuxiliares_1 = dnm_Valor.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_1()).GetValue(dnm_Valor, null);
|
|
}
|
|
|
|
//Si tuviera el nombre CAMPO DatosAuxiliares 2
|
|
if (g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_2() != null && g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_2().Trim().Length > 0)
|
|
{
|
|
Exferia_F3_SoloSeleccion_DatosAuxiliares_2 = dnm_Valor.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_2()).GetValue(dnm_Valor, null);
|
|
}
|
|
|
|
//Si tuviera el nombre CAMPO DatosAuxiliares 3
|
|
if (g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_3() != null && g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_3().Trim().Length > 0)
|
|
{
|
|
Exferia_F3_SoloSeleccion_DatosAuxiliares_3 = dnm_Valor.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_3()).GetValue(dnm_Valor, null);
|
|
}
|
|
|
|
//Si tiene Relacionado otro F3
|
|
//Si este el Padre, cada vez que busque, borro los datos del hijo
|
|
if (g_enum_TipoRelacion == Exferia_F3_SoloSeleccion_TipoRelacion.Padre)
|
|
{
|
|
if (g_lst_ExferiaF3_Relacionados_Hijos != null)
|
|
{
|
|
foreach (Exferia_F3_SoloSeleccion obj_Exferia_F3_SoloSeleccion in g_lst_ExferiaF3_Relacionados_Hijos)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Id = -1;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Codigo = "";
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Descripcion = "";
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_FechaBorrado = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_1 = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_2 = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_3 = null;
|
|
|
|
//Poner los colores inciales
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
|
|
//Desbloqueo
|
|
obj_Exferia_F3_SoloSeleccion.Enabled = true;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
if (g_lng_id != _lng_id_Antiguo)
|
|
{
|
|
//Salta el Evento de TerminoBusqueda
|
|
Exferia_F3_SoloSeleccion_Evento_TerminoBusqueda?.Invoke(this, new EventArgs());
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
//Salta el Evento de TerminoBusqueda
|
|
Exferia_F3_SoloSeleccion_Evento_TerminoBusqueda?.Invoke(this, new EventArgs());
|
|
}
|
|
|
|
}
|
|
|
|
//Poner Foco
|
|
ex_txt_Codigo.Exferia_TextBox_Foco();
|
|
}
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{ }
|
|
}
|
|
#endregion
|
|
|
|
#region Tarea asíncrona para buscar en la base de datos
|
|
|
|
private void Buscar(string _str_filtro, string _str_CampoBusqueda)
|
|
{
|
|
try
|
|
{
|
|
//Mostrar la pantalla de espera
|
|
g_frm_PE_Esperando = new PE_Esperando();
|
|
|
|
// Si la tarea asincrona esta en marcha la paro
|
|
g_TareaAsincrona_Buscar.CancelAsync();
|
|
while (g_TareaAsincrona_Buscar.IsBusy)
|
|
Application.DoEvents();
|
|
|
|
//Argumentos
|
|
List<object> lst_Argumentos = new List<object>();
|
|
lst_Argumentos.Add(_str_filtro);
|
|
lst_Argumentos.Add(_str_CampoBusqueda);
|
|
//Llamar a la tarea asincrona
|
|
g_TareaAsincrona_Buscar.RunWorkerAsync(lst_Argumentos);
|
|
|
|
//Mostrar pantalla de espera
|
|
g_frm_PE_Esperando.ShowDialog();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
if (g_frm_PE_Esperando != null)
|
|
{
|
|
g_frm_PE_Esperando.Close();
|
|
g_frm_PE_Esperando = null;
|
|
}
|
|
|
|
Control_Errores.Errores_Log(ex.Message, nameof(Exferia_F3_SoloSeleccion) + "/" + nameof(Buscar));
|
|
Mensajes.MostrarMensaje(Mensajes.G_EXFERIA_F3_ERROR_BUSCAR());
|
|
}
|
|
}
|
|
|
|
private void TareaAsincrona_Buscar_DoWork(object sender, DoWorkEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
// Parametros ######################################################
|
|
List<object> lst_Argumentos = e.Argument as List<object>;
|
|
string str_filtro = lst_Argumentos[0].ToString();
|
|
string str_CampoBusqueda = lst_Argumentos[1].ToString();
|
|
// #################################################################
|
|
|
|
dynamic dnm_RegistroF3 = null;
|
|
if (str_filtro.Trim().Length > 0)
|
|
{
|
|
List<INTERNO_Filtro_OpcionPadre_Modelo> lst_INTERNO_Filtro_OpcionPadre_Modelo = null;
|
|
if (g_lst_INTERNO_Filtro_OpcionPadre_Modelo != null)
|
|
{
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo = new List<INTERNO_Filtro_OpcionPadre_Modelo>();
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo.AddRange(g_lst_INTERNO_Filtro_OpcionPadre_Modelo);
|
|
}
|
|
|
|
//Si es Hijo y el padre tiene algo seleccionado se le envia al listado para que filtre por ahi tambien
|
|
if (g_str_ExferiaF3_Relacionado_Padre_OPCION != "")
|
|
{
|
|
if (lst_INTERNO_Filtro_OpcionPadre_Modelo == null)
|
|
{
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo = new List<INTERNO_Filtro_OpcionPadre_Modelo>();
|
|
}
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo.Add(new INTERNO_Filtro_OpcionPadre_Modelo(g_str_ExferiaF3_Relacionado_Padre_OPCION, g_lng_ExferiaF3_Relacionado_Padre_ID));
|
|
}
|
|
else if (g_enum_TipoRelacion == Exferia_F3_SoloSeleccion_TipoRelacion.Hijo)
|
|
{
|
|
if (g_obj_ExferiaF3_Relacionado_Padre != null)
|
|
{
|
|
if (lst_INTERNO_Filtro_OpcionPadre_Modelo == null)
|
|
{
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo = new List<INTERNO_Filtro_OpcionPadre_Modelo>();
|
|
}
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo.Add(new INTERNO_Filtro_OpcionPadre_Modelo(g_obj_ExferiaF3_Relacionado_Padre.Exferia_F3_SoloSeleccion_PRINCIPAL_Opcion_BuscarDatos, g_obj_ExferiaF3_Relacionado_Padre.Exferia_F3_SoloSeleccion_Id));
|
|
}
|
|
else if (g_lng_ExferiaF3_Relacionado_Padre_ID > -1)
|
|
{
|
|
if (lst_INTERNO_Filtro_OpcionPadre_Modelo == null)
|
|
{
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo = new List<INTERNO_Filtro_OpcionPadre_Modelo>();
|
|
}
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo.Add(new INTERNO_Filtro_OpcionPadre_Modelo(g_str_ExferiaF3_Relacionado_Padre_OPCION, g_lng_ExferiaF3_Relacionado_Padre_ID));
|
|
}
|
|
}
|
|
|
|
//Cargamos el ensamblado
|
|
Assembly m_assembly = Assembly.LoadFrom(Variables.G_STR_LIBRERIA_RUTAINICIAL + @"\" + g_mdl_INTERNO_OpcionesDetalle_Modelo.nombreLibreria + ".dll");
|
|
//Obtenemos el tipo de la clase
|
|
Type m_type = m_assembly.GetType("" + g_mdl_INTERNO_OpcionesDetalle_Modelo.nombreLibreria + "." + Variables.G_STR_LIBRERIA_OPCIONES);
|
|
//creamos la instancia
|
|
var obj_Clase = Activator.CreateInstance(m_type);
|
|
//Cargamos el metodo solicitado
|
|
MethodInfo obj_MethodInfo = obj_Clase.GetType().GetMethod(Variables.G_STR_LIBRERIA_OPCIONES_PROCEDIMIENTO_OBTENER_REGISTRO_F3, BindingFlags.Instance | BindingFlags.NonPublic);
|
|
|
|
//Obtener valores
|
|
object[] arr_Parametros = { g_str_NombreOpcion_BuscarDatos,
|
|
str_filtro,
|
|
str_CampoBusqueda,
|
|
(g_P_Base_Contenedor.P_Base_ValoresGenerales!=null ? g_P_Base_Contenedor.P_Base_ValoresGenerales.lng_idEmpresa : -1),
|
|
((g_P_Base_Contenedor.P_Base_ValoresGenerales!=null && g_P_Base_Contenedor.P_Base_ValoresGenerales.EjercicioActivo!=null) ? g_P_Base_Contenedor.P_Base_ValoresGenerales.EjercicioActivo.id: -1),
|
|
lst_INTERNO_Filtro_OpcionPadre_Modelo,
|
|
null,
|
|
g_obj_Filtro_Auxiliar};
|
|
|
|
//Pasamos los parametros al metodo y lo ejecutamos
|
|
dnm_RegistroF3 = obj_MethodInfo.Invoke(obj_Clase, arr_Parametros);
|
|
}
|
|
|
|
// Valores a Devolver
|
|
List<object> lst_ValoresADevolver = new List<object>();
|
|
lst_ValoresADevolver.Add(dnm_RegistroF3);
|
|
lst_ValoresADevolver.Add(str_CampoBusqueda);
|
|
e.Result = lst_ValoresADevolver;
|
|
}
|
|
catch (ThreadAbortException)
|
|
{
|
|
e.Cancel = true;
|
|
}
|
|
catch (Control_Errores)
|
|
{
|
|
e.Cancel = true;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
e.Cancel = true;
|
|
}
|
|
}
|
|
private void TareaAsincrona_Buscar_Completed(object sender, RunWorkerCompletedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//Quitar Pantala de espera
|
|
if (g_frm_PE_Esperando != null)
|
|
{
|
|
g_frm_PE_Esperando.Close();
|
|
g_frm_PE_Esperando = null;
|
|
}
|
|
Thread.Sleep(10);
|
|
|
|
if (e.Cancelled == false)
|
|
{
|
|
if (e.Result != null)
|
|
{
|
|
List<object> lst_ValoresADevolver = e.Result as List<object>;
|
|
string str_CampoBusqueda = lst_ValoresADevolver[1].ToString();
|
|
long lng_id_Antiguo = g_lng_id;
|
|
if (lst_ValoresADevolver[0] != null)
|
|
{
|
|
dynamic dnm_Valor = lst_ValoresADevolver[0] as dynamic;
|
|
if (dnm_Valor != null)
|
|
{
|
|
var obj_id = dnm_Valor.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_ID()).GetValue(dnm_Valor, null);
|
|
if (obj_id != null)
|
|
{
|
|
//Poner los colores inciales
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
|
|
g_lng_id = obj_id;
|
|
|
|
//Busqueda por Descripcion
|
|
if (str_CampoBusqueda.Equals(g_obj_ABS_F3.NOMBRE_CAMPO_DESCRIPCION()))
|
|
{
|
|
var obj_Codigo = dnm_Valor.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_CODIGO()).GetValue(dnm_Valor, null);
|
|
if (obj_Codigo != null)
|
|
{
|
|
ex_txt_Codigo.Text = Convert.ToString(obj_Codigo);
|
|
}
|
|
}
|
|
//Busqueda por Codigo
|
|
else
|
|
{
|
|
var obj_Descripcion = dnm_Valor.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_DESCRIPCION()).GetValue(dnm_Valor, null);
|
|
if (obj_Descripcion != null)
|
|
{
|
|
ex_txt_Descripcion.Text = obj_Descripcion;
|
|
}
|
|
}
|
|
|
|
//fecha Borrado
|
|
DateTime? dtt_FechaBorrado = null;
|
|
var obj_FechaBorrado = dnm_Valor.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_FECHABORRADO()).GetValue(dnm_Valor, null);
|
|
if (obj_FechaBorrado != null)
|
|
{
|
|
dtt_FechaBorrado = obj_FechaBorrado;
|
|
}
|
|
Exferia_F3_SoloSeleccion_FechaBorrado = dtt_FechaBorrado;
|
|
|
|
//Si tuviera el nombre del Ejercicio_Baja se pone el valor
|
|
if (g_obj_ABS_F3.NOMBRE_CAMPO_IDEJERCICIO_BAJA()!=null && g_obj_ABS_F3.NOMBRE_CAMPO_IDEJERCICIO_BAJA().Trim().Length>0)
|
|
{
|
|
long? lng_idEjercicio_Baja = null;
|
|
var obj_idEjercicio_Baja = dnm_Valor.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_IDEJERCICIO_BAJA()).GetValue(dnm_Valor, null);
|
|
if (obj_idEjercicio_Baja != null)
|
|
{
|
|
lng_idEjercicio_Baja = obj_idEjercicio_Baja;
|
|
}
|
|
Exferia_F3_SoloSeleccion_IdEjercicio_Baja = lng_idEjercicio_Baja;
|
|
}
|
|
|
|
//Si tuviera el nombre CAMPO DatosAuxiliares 1
|
|
if (g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_1() != null && g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_1().Trim().Length > 0)
|
|
{
|
|
Exferia_F3_SoloSeleccion_DatosAuxiliares_1 = dnm_Valor.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_1()).GetValue(dnm_Valor, null);
|
|
}
|
|
|
|
//Si tuviera el nombre CAMPO DatosAuxiliares 2
|
|
if (g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_2() != null && g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_2().Trim().Length > 0)
|
|
{
|
|
Exferia_F3_SoloSeleccion_DatosAuxiliares_2 = dnm_Valor.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_2()).GetValue(dnm_Valor, null);
|
|
}
|
|
|
|
//Si tuviera el nombre CAMPO DatosAuxiliares 3
|
|
if (g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_3() != null && g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_3().Trim().Length > 0)
|
|
{
|
|
Exferia_F3_SoloSeleccion_DatosAuxiliares_3 = dnm_Valor.GetType().GetProperty(g_obj_ABS_F3.NOMBRE_CAMPO_DATOSAUXILIARES_3()).GetValue(dnm_Valor, null);
|
|
}
|
|
|
|
//Si tiene Relacionado otro F3
|
|
//Si este el Padre, cada vez que busque, borro los datos del hijo
|
|
if (g_enum_TipoRelacion == Exferia_F3_SoloSeleccion_TipoRelacion.Padre)
|
|
{
|
|
if (g_lst_ExferiaF3_Relacionados_Hijos != null)
|
|
{
|
|
foreach (Exferia_F3_SoloSeleccion obj_Exferia_F3_SoloSeleccion in g_lst_ExferiaF3_Relacionados_Hijos)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Id = -1;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Codigo = "";
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Descripcion = "";
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_FechaBorrado = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_IdEjercicio_Baja = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_1 = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_2 = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_3 = null;
|
|
|
|
//Poner los colores inciales
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
|
|
//Desbloqueo
|
|
obj_Exferia_F3_SoloSeleccion.Enabled = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
//#################################################################################################
|
|
//Copiar la informacion si estuviera a vacio o incorrecto
|
|
if (g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion != null)
|
|
{
|
|
if (g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_Id == -1 &&
|
|
g_lng_id > -1 &&
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Enabled)
|
|
{
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_Id = g_lng_id;
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_Codigo = ex_txt_Codigo.Text;
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_Descripcion = ex_txt_Descripcion.Text;
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_FechaBorrado = Exferia_F3_SoloSeleccion_FechaBorrado;
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_IdEjercicio_Baja = Exferia_F3_SoloSeleccion_IdEjercicio_Baja;
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_DatosAuxiliares_1 = Exferia_F3_SoloSeleccion_DatosAuxiliares_1;
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_DatosAuxiliares_2 = Exferia_F3_SoloSeleccion_DatosAuxiliares_2;
|
|
g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_DatosAuxiliares_3 = Exferia_F3_SoloSeleccion_DatosAuxiliares_3;
|
|
|
|
if (g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_RELACIONAL_TipoRelacion == Exferia_F3_SoloSeleccion_TipoRelacion.Padre)
|
|
{
|
|
if (g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_RELACIONADOS_Objetos_Hijos != null)
|
|
{
|
|
foreach (Exferia_F3_SoloSeleccion obj_Exferia_F3_SoloSeleccion_Copiar in g_Exferia_F3_SoloSeleccion_Objeto_CopiarInformacion.Exferia_F3_SoloSeleccion_RELACIONADOS_Objetos_Hijos)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_Id = -1;
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_Codigo = "";
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_Descripcion = "";
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_FechaBorrado = null;
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_IdEjercicio_Baja = null;
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_DatosAuxiliares_1 = null;
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_DatosAuxiliares_2 = null;
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_DatosAuxiliares_3 = null;
|
|
|
|
//Poner los colores inciales
|
|
if (obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_PRINCIPAL_Obligatorio)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
|
|
//Desbloqueo
|
|
obj_Exferia_F3_SoloSeleccion_Copiar.Enabled = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//##################################################################################################
|
|
}
|
|
else
|
|
{
|
|
//Descripcion
|
|
if (str_CampoBusqueda.Equals(g_obj_ABS_F3.NOMBRE_CAMPO_DESCRIPCION()))
|
|
{
|
|
ex_txt_Codigo.Text = "";
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_ERROR;
|
|
|
|
//Si la descripcion esta vacia, se pinta del color que tiene que ir
|
|
if (ex_txt_Descripcion.Text.Trim() == "")
|
|
{
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
}
|
|
}
|
|
//Codigo
|
|
else
|
|
{
|
|
ex_txt_Descripcion.Text = "";
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_ERROR;
|
|
|
|
//Si el codigo esta vacio, se pinta del color que tiene que ir
|
|
if (ex_txt_Codigo.Text.Trim() == "")
|
|
{
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
g_lng_id = -1;
|
|
//Descripcion
|
|
if (str_CampoBusqueda.Equals(g_obj_ABS_F3.NOMBRE_CAMPO_DESCRIPCION()))
|
|
{
|
|
ex_txt_Codigo.Text = "";
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_ERROR;
|
|
|
|
//Si la descripcion esta vacia, se pinta del color que tiene que ir
|
|
if (ex_txt_Descripcion.Text.Trim() == "")
|
|
{
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
}
|
|
}
|
|
//Codigo
|
|
else
|
|
{
|
|
ex_txt_Descripcion.Text = "";
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_ERROR;
|
|
|
|
//Si el codigo esta vacio, se pinta del color que tiene que ir
|
|
if (ex_txt_Codigo.Text.Trim() == "")
|
|
{
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (g_enum_TipoRelacion == Exferia_F3_SoloSeleccion_TipoRelacion.Padre)
|
|
{
|
|
if (g_lst_ExferiaF3_Relacionados_Hijos != null)
|
|
{
|
|
foreach (Exferia_F3_SoloSeleccion obj_Exferia_F3_SoloSeleccion in g_lst_ExferiaF3_Relacionados_Hijos)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Id = -1;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Codigo = "";
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Descripcion = "";
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_FechaBorrado = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_IdEjercicio_Baja = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_1 = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_2 = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_3 = null;
|
|
|
|
//Poner los colores inciales
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
|
|
//Bloqueo
|
|
obj_Exferia_F3_SoloSeleccion.Enabled = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
g_lng_id = -1;
|
|
|
|
//Descripcion
|
|
if (str_CampoBusqueda.Equals(g_obj_ABS_F3.NOMBRE_CAMPO_DESCRIPCION()))
|
|
{
|
|
ex_txt_Codigo.Text = "";
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_ERROR;
|
|
|
|
//Si la descripcion esta vacia, se pinta del color que tiene que ir
|
|
if (ex_txt_Descripcion.Text.Trim() == "")
|
|
{
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
}
|
|
}
|
|
//Codigo
|
|
else
|
|
{
|
|
ex_txt_Descripcion.Text = "";
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_ERROR;
|
|
|
|
//Si el codigo esta vacio, se pinta del color que tiene que ir
|
|
if (ex_txt_Codigo.Text.Trim() == "")
|
|
{
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
ex_txt_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
ex_txt_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (g_enum_TipoRelacion == Exferia_F3_SoloSeleccion_TipoRelacion.Padre)
|
|
{
|
|
if (g_lst_ExferiaF3_Relacionados_Hijos != null)
|
|
{
|
|
foreach (Exferia_F3_SoloSeleccion obj_Exferia_F3_SoloSeleccion in g_lst_ExferiaF3_Relacionados_Hijos)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Id = -1;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Codigo = "";
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_Descripcion = "";
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_FechaBorrado = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_IdEjercicio_Baja = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_1 = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_2 = null;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_DatosAuxiliares_3 = null;
|
|
|
|
//Poner los colores inciales
|
|
if (g_bol_Obligatorio)
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_OBLIGATORIO;
|
|
}
|
|
else
|
|
{
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Descripcion.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
obj_Exferia_F3_SoloSeleccion.Exferia_F3_SoloSeleccion_PRINCIPAL_TextBox_Codigo.Exferia_TextBox_Fondo = Colores.G_COLOR_FONDO_BASE;
|
|
}
|
|
|
|
//Bloqueo
|
|
obj_Exferia_F3_SoloSeleccion.Enabled = false;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (g_lng_id!=lng_id_Antiguo)
|
|
{
|
|
//Salta el Evento de TerminoBusqueda
|
|
Exferia_F3_SoloSeleccion_Evento_TerminoBusqueda?.Invoke(this, new EventArgs());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{ }
|
|
finally
|
|
{
|
|
if (g_frm_PE_Esperando != null)
|
|
{
|
|
g_frm_PE_Esperando.Close();
|
|
g_frm_PE_Esperando = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
}
|