TFS_ANTIGUO/SInCathay/ULA.Cathay.CreditoModel.BL/Credito/GestionesVariasBL.cs

94 lines
3 KiB
C#

using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ULA.Cathay.CreditoModel.Credito;
using ULA.Cathay.CreditoModel.DAL.Credito;
namespace ULA.Cathay.CreditoModel.BL.Credito
{
public class GestionesVariasBL
{
private static Logger logger = LogManager.GetLogger("GestionesVariasBL");
public string IDLogger;
public List<GestionesVarias> ObtenerGestionesVarias(int IdSolicitud)
{
GestionesVariasDAL gestionesvariasDAl = new GestionesVariasDAL();
EjecutivoDAL ejecutivoDal = new EjecutivoDAL();
TipoGestionDAL tipogestionDal = new TipoGestionDAL();
List<GestionesVarias> listagestiones = new List<GestionesVarias>();
List<Ejecutivo> listaEjecutivo = new List<Ejecutivo>();
List<TipoGestion> listaTipoGestion = new List<TipoGestion>();
try
{
listagestiones = gestionesvariasDAl.Obtener(IdSolicitud);
listaTipoGestion = tipogestionDal.Obtener();
foreach (var l in listagestiones)
{
l.TipoGestion = listaTipoGestion.Where(x => x.IdTipoGestion == l.IdTipoGestion).FirstOrDefault();
}
return listagestiones.Where(x => x.IdSolicitud == IdSolicitud).ToList();
}
catch (TimeoutException ex)
{
logger.Error(IDLogger + " Error : Obtener" + "=" + ex.Message + ex.StackTrace);
throw ex;
}
catch (Exception ex)
{
logger.Error(IDLogger + " Error : Obtener" + "=" + ex.Message + ex.StackTrace);
throw ex;
}
finally
{
gestionesvariasDAl = null;
ejecutivoDal = null;
tipogestionDal = null;
listagestiones = null;
listaEjecutivo = null;
listaTipoGestion = null;
}
}
public string Insertar(GestionesVarias model)
{
GestionesVariasDAL GestionesVariasDAL = new GestionesVariasDAL();
try
{
return GestionesVariasDAL.Insertar(model);
}
catch (Exception ex)
{
logger.Error(IDLogger + " Error : Insertar" + "=" + ex.Message + ex.StackTrace);
throw ex;
}
}
public string Actualizar (GestionesVarias model)
{
GestionesVariasDAL GestionesVariasDAL = new GestionesVariasDAL();
try
{
return GestionesVariasDAL.Actualizar(model);
}
catch (Exception ex)
{
logger.Error(IDLogger + " Error : Actualizar Gestiones Varias" + "=" + ex.Message + ex.StackTrace);
throw ex;
}
}
}
}