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

111 lines
4.9 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_Utilidades_Exferia : Exferia_Formularios.P_Base_Mantenimientos
{
#region Constructor
public P_Utilidades_Exferia(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_Utilidades_Exferia) + "/" + nameof(P_Utilidades_Exferia));
}
}
//....................................................................................................
//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, nameof(P_Utilidades_Exferia) + "/" + nameof(P_Utilidades_Exferia));
}
finally
{
//Bloquear pantalla hasta que termine la carga por defecto .....
Enabled = true;
//.............................................................
}
}
#endregion
#region Botones
private void ex_btn_P_Utilidades_Exferia_GeneracionFichajeAutomaticos_Click(object sender, EventArgs e)
{
GeneracionFichajesAutomaticos();
}
private void GeneracionFichajesAutomaticos()
{
try
{
INTERNO_OpcionesDetalle_Modelo mdl_INTERNO_OpcionesDetalle_Modelo = Datos_Generales.PRV_Opciones_Buscar_Detalles(Variables.G_STR_OPCION_KRS_FICHAJESAUTOMATICOS_GENERACION);
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_Utilidades_Exferia) + "/" + nameof(GeneracionFichajesAutomaticos));
}
}
#endregion
}
}