112 lines
No EOL
3.9 KiB
C#
112 lines
No EOL
3.9 KiB
C#
using System;
|
|
using System.Web.Http;
|
|
using Ultimus.Interfaces;
|
|
using Ultimus.Utilitarios;
|
|
|
|
namespace ULA.Cathay.Credito.ControllersWebApi
|
|
{
|
|
public class MetodosCathayServicioAPIController : ApiController
|
|
{
|
|
|
|
private UltimusLogs logs = new UltimusLogs("MetodosCathayServicioAPI");
|
|
|
|
private System.ServiceModel.BasicHttpBinding BindingSAP;
|
|
private System.ServiceModel.EndpointAddress EndpointSAP;
|
|
|
|
public MetodosCathayServicioAPIController()
|
|
{
|
|
try
|
|
{
|
|
GlobalAPIController.SetRegionalConfig();
|
|
|
|
EndpointSAP = new System.ServiceModel.EndpointAddress(new ObtieneParametros().GetValueKeyRegedit("Cathay.WCFMetodosCathayUrl", false));
|
|
|
|
BindingSAP = new System.ServiceModel.BasicHttpBinding();
|
|
BindingSAP.MaxReceivedMessageSize = int.MaxValue;
|
|
BindingSAP.MaxBufferPoolSize = int.MaxValue;
|
|
System.ServiceModel.HttpTransportSecurity security = new System.ServiceModel.HttpTransportSecurity();
|
|
security.ClientCredentialType = System.ServiceModel.HttpClientCredentialType.None;
|
|
BindingSAP.Security.Transport = security;
|
|
|
|
BindingSAP.OpenTimeout = new TimeSpan(0, 2, 0);
|
|
BindingSAP.CloseTimeout = new TimeSpan(0, 2, 0);
|
|
BindingSAP.SendTimeout = new TimeSpan(0, 2, 0);
|
|
BindingSAP.ReceiveTimeout = new TimeSpan(0, 2, 0);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logs.Error(ex);
|
|
}
|
|
}
|
|
|
|
|
|
public ServicioMetodosCathay.UExcelJson LeerExcel(ServicioMetodosCathay.UExcelJson oUExcel)
|
|
{
|
|
|
|
try
|
|
{
|
|
using (ServicioMetodosCathay.MetodosCathaySoapClient conn = new ServicioMetodosCathay.MetodosCathaySoapClient(BindingSAP, EndpointSAP))
|
|
{
|
|
oUExcel = conn.ExtraerValoresExcel(oUExcel);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
oUExcel.CodigoRespuesta = TipoCodigoRespuesta.ERROR.ToString();
|
|
oUExcel.DescripcionRespuesta = ex.Message;
|
|
logs.Error(ex);
|
|
}
|
|
|
|
return oUExcel;
|
|
}
|
|
|
|
|
|
public ServicioMetodosCathay.UExcelJson CargarExcel(ServicioMetodosCathay.UExcelJson oUExcel)
|
|
{
|
|
try
|
|
{
|
|
using (ServicioMetodosCathay.MetodosCathaySoapClient conn = new ServicioMetodosCathay.MetodosCathaySoapClient(BindingSAP, EndpointSAP))
|
|
{
|
|
oUExcel = conn.CargarValoresExcel(oUExcel);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
oUExcel.CodigoRespuesta = TipoCodigoRespuesta.ERROR.ToString();
|
|
oUExcel.DescripcionRespuesta = ex.Message;
|
|
logs.Error(ex);
|
|
}
|
|
|
|
return oUExcel;
|
|
}
|
|
|
|
|
|
public BaseJson GeneraIncidentes_Seguimiento(int IncidenteCredito)
|
|
{
|
|
ServicioMetodosCathay.BaseJson respServicio = null;
|
|
BaseJson resp = new BaseJson();
|
|
|
|
try
|
|
{
|
|
resp.CodigoRespuesta = TipoCodigoRespuesta.EXITOSO.ToString();
|
|
|
|
using (ServicioMetodosCathay.MetodosCathaySoapClient conn = new ServicioMetodosCathay.MetodosCathaySoapClient(BindingSAP, EndpointSAP))
|
|
{
|
|
respServicio = conn.GeneraIncidentes_Seguimiento(IncidenteCredito);
|
|
|
|
if (respServicio.CodigoRespuesta != TipoCodigoRespuesta.EXITOSO.ToString())
|
|
throw new Exception(respServicio.DescripcionRespuesta);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
resp.CodigoRespuesta = TipoCodigoRespuesta.ERROR.ToString();
|
|
resp.DescripcionRespuesta = ex.Message;
|
|
logs.Error(ex);
|
|
}
|
|
|
|
return resp;
|
|
}
|
|
|
|
}
|
|
} |