88 lines
2.5 KiB
C#
88 lines
2.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using ULA.Cathay.CreditoModel.Credito;
|
|
using Ultimus.Utilitarios;
|
|
using ULA.Cathay.CreditoModel.Entidades;
|
|
|
|
namespace ULA.Cathay.CreditoModel.DAL.Credito
|
|
{
|
|
public class EtapasDAL
|
|
{
|
|
private UltimusLogs logger = new UltimusLogs("ClienteDAL");
|
|
|
|
|
|
#region Obtener
|
|
|
|
public List<Etapas> Obtener(string DescripcionEtapa = null,int? CodigoProceso=EnumProcesos.Credito )
|
|
{
|
|
List<Etapas> listaEtapas = null;
|
|
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
listaEtapas = new List<Etapas>();
|
|
listaEtapas = db.Etapas.Where(x => x.IdProceso == CodigoProceso && (DescripcionEtapa == null || x.DescripcionEtapa == DescripcionEtapa)).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Error(ex);
|
|
throw ex;
|
|
}
|
|
return listaEtapas;
|
|
}
|
|
|
|
public Etapas ObtenerEtapa(string UltimusStep, string NombreProceso = null)
|
|
{
|
|
Etapas etapa = new Etapas();
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(NombreProceso))
|
|
etapa = db.Etapas.Where(c => c.DescripcionEtapa == UltimusStep).FirstOrDefault();
|
|
else
|
|
etapa = (
|
|
from e in db.Etapas
|
|
join p in db.Procesos on e.IdProceso equals p.IdProceso
|
|
where p.NombreProceso == NombreProceso && e.DescripcionEtapa == UltimusStep
|
|
select e).FirstOrDefault();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Error(ex);
|
|
throw ex;
|
|
}
|
|
return etapa;
|
|
}
|
|
|
|
public Etapas ObtenerEtapa(int IdEtapa)
|
|
{
|
|
Etapas respuesta = new Etapas();
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
|
|
respuesta = db.Etapas.Where(x => x.IdEtapa == IdEtapa).FirstOrDefault();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Error(ex);
|
|
throw ex;
|
|
}
|
|
return respuesta;
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|