Exferia/Exferia_KairosPro/Exferia_KairosPRO/4_Vistas/P_Configuracion.cs

212 lines
10 KiB
C#

using Exferia_Aplicacion.General;
using Exferia_Aplicacion.Visualizacion;
using Exferia_EntityFramework;
using Exferia_Formularios;
using Exferia_General;
using Exferia_KairosPRO.General;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
namespace Exferia_KairosPRO._4_Vistas
{
public partial class P_Configuracion : Exferia_Formularios.P_Base_Mantenimientos
{
#region Constructor
public P_Configuracion(INTERNO_ValoresGenerales_Modelo _mdl_INTERNO_ValoresGenerales_Modelo, DateTime _dtt_FechaTrabajo, PRV_OpcionesDetalle _mdl_PRV_OpcionesDetalle)
{
InitializeComponent();
try
{
Repintar.Empezar(this);
CheckForIllegalCrossThreadCalls = false;
//Empresa seleccionada y fecha de trabajo ....................................................
P_Base_ValoresGenerales = _mdl_INTERNO_ValoresGenerales_Modelo;
P_Base_FechaTrabajo = _dtt_FechaTrabajo;
//Titulo de la Pantalla .............................................................................
P_Base_TituloPantalla = _mdl_PRV_OpcionesDetalle.descripcion_TituloMantenimiento;
// Label con Empresa Seleccionada
if (P_Base_ValoresGenerales != null)
{
try
{
P_Base_Mantenimientos_InformacionEmpresaSeleccionada = P_Base_ValoresGenerales.str_Empresa_Descripcion + " - " +
"(" + P_Base_FechaTrabajo.ToString("dd/MM/yyyy") + ")";
}
catch (Exception ex)
{
//No se muestra mensaje pero se guarda en el log
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Configuracion) + "/" + nameof(P_Configuracion));
}
}
//....................................................................................................
//Bloquear pantalla hasta que termine la carga por defecto .....
Enabled = false;
//.............................................................
}
catch (Control_Errores)
{ }
catch (Exception ex)
{
//No se muestra mensaje pero se guarda en el log
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Configuracion) + "/" + nameof(P_Configuracion));
}
finally
{
//Bloquear pantalla hasta que termine la carga por defecto .....
Enabled = true;
//.............................................................
}
}
#endregion
#region Botones
private void ex_btn_P_Configuracion_EmailEnvioInformes_Click(object sender, EventArgs e)
{
EmailEnvioInformes();
}
private void EmailEnvioInformes()
{
try
{
INTERNO_OpcionesDetalle_Modelo mdl_INTERNO_OpcionesDetalle_Modelo = Datos_Generales.PRV_Opciones_Buscar_Detalles(Variables.G_STR_OPCION_KRS_EMAILS);
if (mdl_INTERNO_OpcionesDetalle_Modelo != null)
{
//Cargamos el ensamblado
Assembly m_assembly = Assembly.LoadFrom(Variables.G_STR_LIBRERIA_RUTAINICIAL + @"\" + Variables.G_STR_LIBRERIA_KAIROSPRO + ".dll");
//Obtenemos el tipo de la clase
Type m_type = m_assembly.GetType(Variables.G_STR_LIBRERIA_KAIROSPRO + "." + 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);
//Obtener valores
object[] arr_Parametros = { mdl_INTERNO_OpcionesDetalle_Modelo.opcion, false, 0, null, Variables.G_MDL_INTERNO_VALORESGENERALES_MODELO, Variables.G_DTT_FECHA_INICIAL_PORDEFECTO, "", "", false, false, null, null, null, null,null,null };
//Pasamos los parametros al metodo y lo ejecutamos
obj_MethodInfo.Invoke(obj_Clase, arr_Parametros);
}
}
catch (Exception ex)
{
Control_Errores.Errores_Log("", ex, nameof(P_Configuracion) + "/" + nameof(EmailEnvioInformes));
}
}
private void ex_btn_P_Configuracion_SeleccionServidoresCorreo_Click(object sender, EventArgs e)
{
SeleccionServidoresCorreo();
}
private void SeleccionServidoresCorreo()
{
try
{
INTERNO_OpcionesDetalle_Modelo mdl_INTERNO_OpcionesDetalle_Modelo = Datos_Generales.PRV_Opciones_Buscar_Detalles(Variables.G_STR_OPCION_KRS_VALORESGENERALES);
if (mdl_INTERNO_OpcionesDetalle_Modelo != null)
{
//Cargamos el ensamblado
Assembly m_assembly = Assembly.LoadFrom(Variables.G_STR_LIBRERIA_RUTAINICIAL + @"\" + Variables.G_STR_LIBRERIA_KAIROSPRO + ".dll");
//Obtenemos el tipo de la clase
Type m_type = m_assembly.GetType(Variables.G_STR_LIBRERIA_KAIROSPRO + "." + 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_MOSTRAR_EN_MANTENIMIENTO, BindingFlags.Instance | BindingFlags.NonPublic);
//Obtener valores
object[] arr_Parametros = { mdl_INTERNO_OpcionesDetalle_Modelo.opcion, null, null, Variables.G_MDL_INTERNO_VALORESGENERALES_MODELO, Variables.G_DTT_FECHA_INICIAL_PORDEFECTO, mdl_INTERNO_OpcionesDetalle_Modelo, -1, "", "", null ,null};
//Pasamos los parametros al metodo y lo ejecutamos
obj_MethodInfo.Invoke(obj_Clase, arr_Parametros);
}
}
catch (Exception ex)
{
Control_Errores.Errores_Log("", ex, nameof(P_Configuracion) + "/" + nameof(SeleccionServidoresCorreo));
}
}
private void ex_btn_P_Configuracion_Configuraciones_Click(object sender, EventArgs e)
{
Configuraciones();
}
private void Configuraciones()
{
try
{
INTERNO_OpcionesDetalle_Modelo mdl_INTERNO_OpcionesDetalle_Modelo = Datos_Generales.PRV_Opciones_Buscar_Detalles(Variables.G_STR_OPCION_KRS_CONFIGURACIONES);
if (mdl_INTERNO_OpcionesDetalle_Modelo != null)
{
//Cargamos el ensamblado
Assembly m_assembly = Assembly.LoadFrom(Variables.G_STR_LIBRERIA_RUTAINICIAL + @"\" + Variables.G_STR_LIBRERIA_KAIROSPRO + ".dll");
//Obtenemos el tipo de la clase
Type m_type = m_assembly.GetType(Variables.G_STR_LIBRERIA_KAIROSPRO + "." + 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);
//Obtener valores
object[] arr_Parametros = { mdl_INTERNO_OpcionesDetalle_Modelo.opcion, false, 0, null, Variables.G_MDL_INTERNO_VALORESGENERALES_MODELO, Variables.G_DTT_FECHA_INICIAL_PORDEFECTO, "", "", false, false, null, null, null, null,null,null };
//Pasamos los parametros al metodo y lo ejecutamos
obj_MethodInfo.Invoke(obj_Clase, arr_Parametros);
}
}
catch (Exception ex)
{
Control_Errores.Errores_Log("", ex, nameof(P_Configuracion) + "/" + nameof(Configuraciones));
}
}
private void ex_btn_P_Configuracion_ConfiguracionColoresEmpleadosPresenciales_Click(object sender, EventArgs e)
{
ConfiguracionesColoresEmpleadosPresenciales();
}
private void ConfiguracionesColoresEmpleadosPresenciales()
{
try
{
INTERNO_OpcionesDetalle_Modelo mdl_INTERNO_OpcionesDetalle_Modelo = Datos_Generales.PRV_Opciones_Buscar_Detalles(Variables.G_STR_OPCION_KRS_SOLICITUDESAUSENCIASPROGRAMADASCOLORES);
if (mdl_INTERNO_OpcionesDetalle_Modelo != null)
{
//Cargamos el ensamblado
Assembly m_assembly = Assembly.LoadFrom(Variables.G_STR_LIBRERIA_RUTAINICIAL + @"\" + Variables.G_STR_LIBRERIA_KAIROSPRO + ".dll");
//Obtenemos el tipo de la clase
Type m_type = m_assembly.GetType(Variables.G_STR_LIBRERIA_KAIROSPRO + "." + 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_MOSTRAR_EN_MANTENIMIENTO, BindingFlags.Instance | BindingFlags.NonPublic);
//Obtener valores
object[] arr_Parametros = { mdl_INTERNO_OpcionesDetalle_Modelo.opcion, null, null, Variables.G_MDL_INTERNO_VALORESGENERALES_MODELO, Variables.G_DTT_FECHA_INICIAL_PORDEFECTO, mdl_INTERNO_OpcionesDetalle_Modelo, -1, "", "", null, null };
//Pasamos los parametros al metodo y lo ejecutamos
obj_MethodInfo.Invoke(obj_Clase, arr_Parametros);
}
}
catch (Exception ex)
{
Control_Errores.Errores_Log("", ex, nameof(P_Configuracion) + "/" + nameof(Configuraciones));
}
}
#endregion
}
}