75 lines
2.2 KiB
C#
75 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using ULA.Cathay.CreditoModel.ComponentManager;
|
|
using Ultimus.Utilitarios;
|
|
using System.Data.Entity.Validation;
|
|
using System.Reflection;
|
|
using System.Data.Entity;
|
|
|
|
namespace ULA.Cathay.CreditoModel.DAL.ComponentManager
|
|
{
|
|
public class DocumentosAdjuntosDAL
|
|
{
|
|
private UltimusLogs logger = new UltimusLogs("DocumentosAdjuntosDAL");
|
|
|
|
public List<DocumentosAdjuntos> Obtener(int Idsolicitud, string Etapa)
|
|
{
|
|
List<DocumentosAdjuntos> respuesta = new List<DocumentosAdjuntos>();
|
|
try
|
|
{
|
|
using(ComponentContex db = new ComponentContex())
|
|
{
|
|
respuesta = db.DocumentosAdjuntos.Where(x => x.CodSolicitud == Idsolicitud && x.Etapa == Etapa).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Error(ex);
|
|
throw ex;
|
|
}
|
|
return respuesta;
|
|
}
|
|
|
|
public DocumentosAdjuntos Obtener(long ? CodDocumento)
|
|
{
|
|
DocumentosAdjuntos respuesta = new DocumentosAdjuntos();
|
|
try
|
|
{
|
|
using (ComponentContex db = new ComponentContex())
|
|
{
|
|
respuesta = db.DocumentosAdjuntos.Where(x => x.CodDocumento == CodDocumento).FirstOrDefault();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Error(ex);
|
|
throw ex;
|
|
}
|
|
return respuesta;
|
|
}
|
|
|
|
public DocumentosAdjuntos Insertar(DocumentosAdjuntos model)
|
|
{
|
|
DocumentosAdjuntos repuesta = new DocumentosAdjuntos();
|
|
try
|
|
{
|
|
using (ComponentContex db = new ComponentContex())
|
|
{
|
|
db.DocumentosAdjuntos.Add(model);
|
|
db.SaveChanges();
|
|
repuesta.CodDocumento = model.CodDocumento;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Error(ex);
|
|
throw ex;
|
|
}
|
|
return repuesta;
|
|
|
|
}
|
|
}
|
|
}
|