150 lines
4.4 KiB
C#
150 lines
4.4 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Web.Http;
|
|||
|
|
using ULA.Cathay.CreditoModel.Credito;
|
|||
|
|
using ULA.Cathay.CreditoModel.DAL.Credito;
|
|||
|
|
using Ultimus.Interfaces;
|
|||
|
|
using Ultimus.Utilitarios;
|
|||
|
|
|
|||
|
|
namespace ULA.Cathay.Credito.ControllersWebApi.Aprobaciones
|
|||
|
|
{
|
|||
|
|
public class AnalizarCasoAPIController : ApiBaseController
|
|||
|
|
{
|
|||
|
|
UltimusLogs logs = new UltimusLogs("AnalizarCasoAPIController");
|
|||
|
|
|
|||
|
|
public AnalizarCasoAPIController()
|
|||
|
|
{
|
|||
|
|
GlobalAPIController.SetRegionalConfig();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region ConsultarDatosAprobacion
|
|||
|
|
/// <summary>
|
|||
|
|
///
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="Modelo"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPost]
|
|||
|
|
public AprobacionesComite ConsultarDatosAprobacion(AprobacionesComite Modelo)
|
|||
|
|
{
|
|||
|
|
CaratulaCreditoDAL ConnCaratula = new CaratulaCreditoDAL();
|
|||
|
|
List<AprobacionesComite> ModeloAprobacionesComite = new List<AprobacionesComite>();
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
ModeloAprobacionesComite = ConnCaratula.ObtenerAprobacionActual(Modelo.IdSolicitud, Modelo.UserName, Modelo.UsuarioModificado);
|
|||
|
|
|
|||
|
|
if (ModeloAprobacionesComite != null && ModeloAprobacionesComite.Count > 0)
|
|||
|
|
Modelo = ModeloAprobacionesComite.OrderBy(x => x.Orden).FirstOrDefault();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
logs.Error(ex);
|
|||
|
|
}
|
|||
|
|
finally
|
|||
|
|
{
|
|||
|
|
ConnCaratula = null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Modelo;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region ConsultarAprobaciones
|
|||
|
|
/// <summary>
|
|||
|
|
///
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="Modelo"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPost]
|
|||
|
|
public List<AprobacionesComite> ConsultarAprobaciones(AprobacionesComite Modelo)
|
|||
|
|
{
|
|||
|
|
CaratulaCreditoDAL ConnCaratula = new CaratulaCreditoDAL();
|
|||
|
|
List<AprobacionesComite> Aprobaciones = new List<AprobacionesComite>();
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
Aprobaciones = ConnCaratula.ObtenerAprobacionesActuales(Modelo.IdSolicitud);
|
|||
|
|
Aprobaciones = Aprobaciones.Count() > 0 ? Aprobaciones.Where(q => q.IdDecision != null).ToList() : null;
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
logs.Error(ex);
|
|||
|
|
}
|
|||
|
|
finally
|
|||
|
|
{
|
|||
|
|
ConnCaratula = null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Aprobaciones;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region GuardarDatosAprobacion
|
|||
|
|
/// <summary>
|
|||
|
|
///
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="Modelo"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPost]
|
|||
|
|
public BaseJson GuardarDatosAprobacion(AprobacionesComite Modelo)
|
|||
|
|
{
|
|||
|
|
CaratulaCreditoDAL ConnCaratula = new CaratulaCreditoDAL();
|
|||
|
|
BaseJson ValorRetorno = new BaseJson();
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
ValorRetorno = ConnCaratula.ActualizarAprobacionComite(Modelo);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
ValorRetorno.CodigoRespuesta = TipoCodigoRespuesta.ERROR.ToString();
|
|||
|
|
logs.Error(ex);
|
|||
|
|
}
|
|||
|
|
finally
|
|||
|
|
{
|
|||
|
|
ConnCaratula = null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return ValorRetorno;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
[HttpPost]
|
|||
|
|
public BaseJson InsertarActualizarComentario(ComentariosEvaluacionCaso model)
|
|||
|
|
{
|
|||
|
|
BaseJson respuesta = new BaseJson();
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
new ComentariosEvaluacionCasoDAL().InsertarActualizar(model);
|
|||
|
|
respuesta.CodigoRespuesta = TipoCodigoRespuesta.EXITOSO.ToString();
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
respuesta.CodigoRespuesta = TipoCodigoRespuesta.ERROR.ToString();
|
|||
|
|
logs.Error(ex);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
return respuesta;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[HttpGet]
|
|||
|
|
public ComentariosEvaluacionCaso ObtenerComentario(int IdSolicitud)
|
|||
|
|
{
|
|||
|
|
ComentariosEvaluacionCaso respuesta = new ComentariosEvaluacionCaso();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
respuesta= new ComentariosEvaluacionCasoDAL().Obtener(IdSolicitud);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
logs.Error(ex);
|
|||
|
|
}
|
|||
|
|
return respuesta;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|