3198 lines
No EOL
113 KiB
C#
3198 lines
No EOL
113 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.Http;
|
|
using System.Data.Entity;
|
|
using Ultimus.Utilitarios;
|
|
using Ultimus.Interfaces.UltimusForm;
|
|
using Ultimus.Interfaces;
|
|
using ULA.Cathay.Credito.Json;
|
|
using ULA.Cathay.CreditoModel.Credito;
|
|
using ULA.Cathay.CreditoModel.BL.Credito;
|
|
using ULA.Cathay.Credito.WCFGenerales;
|
|
using Ultimus.Interfaces.UltimusIntegration;
|
|
using ULA.Cathay.CreditoModel.Entidades;
|
|
using ULA.Cathay.CreditoModel.DAL.Credito;
|
|
using System.Globalization;
|
|
using System.Threading;
|
|
using System.Text;
|
|
|
|
|
|
namespace ULA.Cathay.Credito.ControllersWebApi
|
|
{
|
|
public class GlobalAPIController : ApiController
|
|
{
|
|
UltimusLogs log = new UltimusLogs("GlobalAPIController");
|
|
|
|
public GlobalAPIController()
|
|
{
|
|
SetRegionalConfig();
|
|
}
|
|
|
|
|
|
#region SetRegionalConfig
|
|
public static void SetRegionalConfig()
|
|
{
|
|
try
|
|
{
|
|
CultureInfo CInfo_esCR = new CultureInfo("es-CR");
|
|
CInfo_esCR.NumberFormat.CurrencyDecimalDigits = 2;
|
|
CInfo_esCR.NumberFormat.CurrencyDecimalSeparator = ".";
|
|
CInfo_esCR.NumberFormat.CurrencyGroupSeparator = ",";
|
|
|
|
CInfo_esCR.NumberFormat.NumberDecimalDigits = 2;
|
|
CInfo_esCR.NumberFormat.NumberDecimalSeparator = ".";
|
|
CInfo_esCR.NumberFormat.NumberGroupSeparator = ",";
|
|
Thread.CurrentThread.CurrentCulture = CInfo_esCR;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Catalogos
|
|
|
|
#region ObtenerClasificacionCliente
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerClasificacionCliente(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.ClasificacionCliente.Where(t => t.Estado == true) : db.ClasificacionCliente.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdClasificacionCliente.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerConsultaCIC
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerConsultaCIC(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.ConsultaCIC.Where(t => t.Estado == true) : db.ConsultaCIC.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdConsultaCIC.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerCriterio
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerCriterio(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.Criterio.Where(t => t.Estado == true) : db.Criterio.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdCriterio.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerAreaResponsable
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerAreaResponsable(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.AreaResponsable.Where(t => t.Estado == true) : db.AreaResponsable.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true))
|
|
.Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdAreaResponsable.ToString(),
|
|
descripcion = t.Descripcion,
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerCriterioSeleccion
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerCriterioSeleccion(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.CriterioSeleccion.Where(t => t.Estado == true) : db.CriterioSeleccion.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true))
|
|
.Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdCriterioSeleccion.ToString(),
|
|
descripcion = t.Descripcion,
|
|
CodigoRespuesta = t.IdTipoControlCriterio.ToString()
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerMonedas
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerMonedas(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.Moneda.Where(t => t.Estado == true) : db.Moneda.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true))
|
|
.Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdMoneda.ToString(),
|
|
descripcion = t.Descripcion,
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerTipoCaratula
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoCaratula(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoCaratula.Where(t => t.Estado == true) : db.TipoCaratula.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true))
|
|
.Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoCaratula.ToString(),
|
|
descripcion = t.Descripcion,
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerTipoCambioCondiciones
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoCambioCondiciones(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoCambioCondiciones.Where(t => t.Estado == true) : db.TipoCambioCondiciones.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true))
|
|
.Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoCambioCondiciones.ToString(),
|
|
descripcion = t.Descripcion,
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerPlazoCartaCredito
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerPlazoCartaCredito(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
|
|
registros = new List<JsonCatalogos>() {
|
|
new JsonCatalogos(){ codigo = "1", descripcion = "A la vista"},
|
|
new JsonCatalogos(){ codigo = "2", descripcion = "90 días B/L"},
|
|
new JsonCatalogos(){ codigo = "3", descripcion = "90 días B/L"},
|
|
new JsonCatalogos(){ codigo = "4", descripcion = "Hasta 120 días"},
|
|
};
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerEstadoCCSS
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerEstadoCCSS(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
|
|
registros = new List<JsonCatalogos>() {
|
|
new JsonCatalogos(){ codigo = "1", descripcion = "Atrasado"},
|
|
new JsonCatalogos(){ codigo = "2", descripcion = "Al día"}
|
|
};
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerCategoriaOferta
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerCategoriaOferta(string filtro = null, int? id = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
if (id == null)
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoCategoria.Where(t => t.Estado == true) : db.TipoCategoria.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoCategoria.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
else
|
|
registros = db.CategoriaPorClasificacionCliente
|
|
.Include(t => t.TipoCategoria)
|
|
.Where(t => t.Estado == true
|
|
&& t.TipoCategoria.Estado == true
|
|
&& t.IdClasificacionCliente == id)
|
|
.Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.TipoCategoria.IdTipoCategoria.ToString(),
|
|
descripcion = t.TipoCategoria.Descripcion
|
|
}).ToList();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerFacilidadPorCategoriaOferta
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerFacilidadPorCategoriaOferta(string filtro = null, int? id = null)
|
|
{
|
|
List<JsonCatalogos> registros = new List<JsonCatalogos>();
|
|
try
|
|
{
|
|
using (CreditoContex dbContex = new CreditoContex())
|
|
{
|
|
registros = (from fa in dbContex.TipoFacilidad
|
|
join cafa in dbContex.CategoriasPorFacilidad on fa.IdTipoFacilidad equals cafa.IdTipoFacilidad
|
|
where fa.Estado == true && cafa.IdTipoCategoria == id && cafa.Estado == true
|
|
&& (fa.Descripcion.Contains(filtro) || filtro == null)
|
|
select new JsonCatalogos()
|
|
{
|
|
codigo = fa.IdTipoFacilidad.ToString(),
|
|
descripcion = fa.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerTiposPorFacilidadCategoriaOferta
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTiposPorFacilidadCategoriaOferta(string filtro = null, int? id = null, int? id2 = null)
|
|
{
|
|
List<JsonCatalogos> registros = new List<JsonCatalogos>();
|
|
|
|
try
|
|
{
|
|
using (CreditoContex dbContex = new CreditoContex())
|
|
{
|
|
var datos = (from fa in dbContex.TipoFacilidad
|
|
join cafa in dbContex.CategoriasPorFacilidad on fa.IdTipoFacilidad equals cafa.IdTipoFacilidad
|
|
where fa.Estado == true && cafa.IdTipoCategoria == id && cafa.IdTipoFacilidad == id2
|
|
select new
|
|
{
|
|
Linea = cafa.LineaCredito,
|
|
Especifico = cafa.Especifico
|
|
}).FirstOrDefault();
|
|
|
|
if (datos != null)
|
|
{
|
|
if (datos.Linea.Value) registros.Add(new JsonCatalogos() { codigo = "1", descripcion = "Linea" });
|
|
if (datos.Especifico.Value) registros.Add(new JsonCatalogos() { codigo = "2", descripcion = "Especifico" });
|
|
}
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerEjecutivo
|
|
[HttpGet]
|
|
public List<EjecutivoCatalogoJSON> ObtenerEjecutivo(string filtro = null)
|
|
{
|
|
List<EjecutivoCatalogoJSON> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.Ejecutivo.Where(t => t.Estado == true) : db.Ejecutivo.Where(t => t.Estado == true && t.Nombre.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new EjecutivoCatalogoJSON()
|
|
{
|
|
codigo = t.IdEjecutivo.ToString(),
|
|
descripcion = t.Nombre
|
|
}).ToList();
|
|
|
|
//registros = (
|
|
// from e in db.Ejecutivo.ToList()
|
|
// where
|
|
// (filtro == null ? true : e.Nombre.ToLower().Contains(filtro.ToLower()) && e.Estado == true )
|
|
// select new EjecutivoCatalogoJSON()
|
|
//{
|
|
// codigo = e.IdEjecutivo.ToString(),
|
|
// descripcion = e.Nombre
|
|
//}.CopyValueProperties(e)
|
|
|
|
//).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerAnalista
|
|
[HttpGet]
|
|
public List<EjecutivoCatalogoJSON> ObtenerAnalistas()
|
|
{
|
|
List<EjecutivoCatalogoJSON> model = new List<EjecutivoCatalogoJSON>();
|
|
try
|
|
{
|
|
using (UltimusIntegrationAPIController IntegrationClient = new UltimusIntegrationAPIController())
|
|
{
|
|
List<UltimusUser> ListaUsuarios;
|
|
|
|
ListaUsuarios = IntegrationClient.GetJobFunctionGroupMembers("Cathay OC", "Analista de crédito");
|
|
|
|
if (ListaUsuarios != null)
|
|
{
|
|
foreach (var item in ListaUsuarios)
|
|
{
|
|
model.Add(new EjecutivoCatalogoJSON
|
|
{
|
|
codigo = (ListaUsuarios.IndexOf(item) + 1).ToString(),
|
|
descripcion = item.strUserFullName,
|
|
UserId = item.strUserName
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return model;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ObtenerFormasPagos
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerFormasPagos(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.FormasPagos.Where(t => t.Estado == true) : db.FormasPagos.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdFormaPago.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerPermisoSBNBCCR
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerPermisoSBNBCCR(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.PermisoSBNBCCR.Where(t => t.Estado == true) : db.PermisoSBNBCCR.Where(t => t.Estado == true && t.DescPermisoSBNBCCR.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.CodigoPermisoSBNBCCR.ToString(),
|
|
descripcion = t.DescPermisoSBNBCCR
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerIncisoSugef
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerIncisoSugef(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.IncisoSugef.Where(t => t.Estado == true) : db.IncisoSugef.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdInciso.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerExcepciones
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerExcepciones(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.Excepciones.Where(t => t.Estado == true) : db.Excepciones.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdExcepcion.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerExcepcionesClasificacion
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerExcepcionesClasificacion(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.ExcepcionesClasificacion.Where(t => t.Estado == true) : db.ExcepcionesClasificacion.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdClasificacion.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerExcepcionesClasificacionSubsistencia
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerExcepcionesClasificacionSubsistencia(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.ExcepcionesClasificacionSubsistencia.Where(t => t.Estado == true) : db.ExcepcionesClasificacionSubsistencia.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdClasificacionSubsistencia.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerLey8262
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerLey8262(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.Ley8262.Where(t => t.Estado == true) : db.Ley8262.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdLey8262.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerCodigoCIIU
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerCodigoCIIU(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.GrupoCIIU.Where(t => t.Estado == true) : db.GrupoCIIU.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdGrupoCIIU.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).Distinct().ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerSUGEFDetallado
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerSUGEFDetallado(string filtro = null, string id = null, string id2 = null, string id3 = null, string id4 = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (from t in db.ClaseCIIU
|
|
where t.Estado == true
|
|
&& t.IdSeccionCIIU == id2
|
|
&& t.IdDivisionCIIU == id3
|
|
&& t.IdGrupoCIIU == id4
|
|
&& (filtro == null || t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()))
|
|
select new JsonCatalogos()
|
|
{
|
|
codigo = t.IdClaseCIIU.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerDepartamentoNegocios
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerDepartamentoNegocios(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.DepartamentoNegocios.Where(t => t.Estado == true) : db.DepartamentoNegocios.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdDepartamentoNegocios.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerGarantia
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerGarantia(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.Garantia.Where(t => t.Estado == true) : db.Garantia.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdGarantia.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerGarantia
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerRequisitoDocumental(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.RequisitoDocumental.Where(t => t.Estado == true) : db.RequisitoDocumental.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdRequisitoDocumental.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerStatusVisita
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerStatusVisita(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.StatusVisita.Where(t => t.Estado == true) : db.StatusVisita.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdStatusVisita.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerStatusVisita
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerSubtipoSeleccion(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
//registros = (string.IsNullOrWhiteSpace(filtro) ? db.SubtipoSeleccion.Where(t => t.Estado == true) : db.SubtipoSeleccion.Where(t => t.Estado == true && t.NombreProceso.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
//{
|
|
// codigo = t.IdSubtipoSeleccion.ToString(),
|
|
// descripcion = t.NombreProceso
|
|
//}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerTipoCliete
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoCliente(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoCliente.Where(t => t.Estado == true) : db.TipoCliente.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoCliente.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerTipoDato
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoDato(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoDato.Where(t => t.Estado == true) : db.TipoDato.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoDato.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerTipoFuenteIngreso
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoFuenteIngreso(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoFuenteIngreso.Where(t => t.Estado == true) : db.TipoFuenteIngreso.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoIngreso.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerTipoGestion
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoGestion(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoGestion.Where(t => t.Estado == true) : db.TipoGestion.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoGestion.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerTipoIdentificacion
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoIdentificacion(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoIdentificacion.Where(t => t.Estado == true) : db.TipoIdentificacion.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoIdentificacion.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerTipoTramite
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoTramite(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoTramite.Where(t => t.Estado == true) : db.TipoTramite.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoTramite.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerTipoValor
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoValor(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoValor.Where(t => t.Estado == true) : db.TipoValor.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoValor.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerDecision
|
|
[HttpGet]
|
|
public List<DecisionPorEtapaJSON> ObtenerDecision(string filtro = null, string Etapa = null, string NombreProceso = null)
|
|
{
|
|
List<DecisionPorEtapaJSON> respuesta = new List<DecisionPorEtapaJSON>();
|
|
ProcesosDAL ProcesosDal = new ProcesosDAL();
|
|
Procesos proceso;
|
|
try
|
|
{
|
|
NombreProceso = NombreProceso ?? "Credito";
|
|
proceso = ProcesosDal.Obtener(NombreProceso);
|
|
|
|
if (string.IsNullOrEmpty(Etapa))
|
|
return respuesta;
|
|
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
respuesta = (from d in db.DecisionPorEtapa
|
|
.Include(x => x.Decision)
|
|
.Include(x => x.Etapas)
|
|
.Include(x => x.Procesos)
|
|
.OrderBy(c => c.IdDecisionPorEtapa)
|
|
.Where(c => c.Etapas.DescripcionEtapa == Etapa && c.Procesos.NombreProceso == NombreProceso)
|
|
.ToList()
|
|
select new DecisionPorEtapaJSON()
|
|
{
|
|
codigo = d.IdDecision.ToString(),
|
|
descripcion = d.Decision.Descripcion
|
|
}.CopyValueProperties(d)
|
|
|
|
).ToList();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return respuesta;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerTipoIstitucion
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoIstitucion(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoInstitucion.Where(t => t.Estado == true) : db.TipoInstitucion.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoInstitucion.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerSucursal
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerSucursal(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.Sucursal.Where(t => t.Estado == true) : db.Sucursal.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true))
|
|
.Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdSucursal.ToString(),
|
|
descripcion = t.Descripcion,
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerBeneficiarioSBD
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerBeneficiarioSBD(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.BeneficiarioSBD.Where(t => t.Estado == true) : db.BeneficiarioSBD.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true))
|
|
.Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdBeneficiarioSBD.ToString(),
|
|
descripcion = t.Descripcion,
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerInciso
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerInciso(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.Inciso.Where(t => t.Estado == true) : db.Inciso.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true))
|
|
.Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdInciso.ToString(),
|
|
descripcion = t.Descripcion,
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerTipoSeguimientoCorreo
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoSeguimientoCorreo(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoSeguimientoCorreo.Where(t => t.Estado == true) : db.TipoSeguimientoCorreo.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true))
|
|
.Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoSeguimiento.ToString(),
|
|
descripcion = t.Descripcion,
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region DDl
|
|
|
|
#region ObtenerTipoClienteDDL
|
|
[HttpGet]
|
|
public ICollection<TipoCliente> ObtenerTipoClienteDDL()
|
|
{
|
|
ICollection<TipoCliente> tipocliente = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
tipocliente = db.TipoCliente.Where(d => d.Estado == false).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
return tipocliente;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerEjecutivoDDL
|
|
[HttpGet]
|
|
public ICollection<Ejecutivo> ObtenerEjecutivoDDL()
|
|
{
|
|
ICollection<Ejecutivo> ejecutivo = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
ejecutivo = db.Ejecutivo.Where(d => d.Estado == true).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
return ejecutivo;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerDepartamentoNegociosDDL
|
|
[HttpGet]
|
|
public ICollection<DepartamentoNegocios> ObtenerDepartamentoNegociosDDL()
|
|
{
|
|
ICollection<DepartamentoNegocios> departamentonegocios = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
departamentonegocios = db.DepartamentoNegocios.Where(d => d.Estado == true).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
return departamentonegocios;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerStatusVisitaDDL
|
|
[HttpGet]
|
|
public ICollection<StatusVisita> ObtenerStatusVisitaDDL()
|
|
{
|
|
ICollection<StatusVisita> statusvisita = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
statusvisita = db.StatusVisita.Where(d => d.Estado == true).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
return statusvisita;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerTipoGestionDDL
|
|
[HttpGet]
|
|
public ICollection<TipoGestion> ObtenerTipoGestionDDL()
|
|
{
|
|
ICollection<TipoGestion> tipogestion = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
tipogestion = db.TipoGestion.Where(d => d.Estado == true).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
return tipogestion;
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region ObtenerVehiculoControlVisita
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerVehiculoControlVisita(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
|
|
try
|
|
{
|
|
#region Catalogo de Ejecutivos
|
|
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
|
|
registros = db.Vehiculo
|
|
.Where(e => e.Estado == true && e.UserId.ToLower().Contains(filtro.ToLower()))
|
|
.Select(e => new JsonCatalogos()
|
|
{
|
|
codigo = e.IdVehiculo.ToString(),
|
|
descripcion = "Placa: " + e.Placa + " - Veh.: " + e.Marca,
|
|
CodigoRespuesta = (e.Default.HasValue ? e.Default.Value : false).ToString().ToLower()
|
|
}).ToList();
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerFuncionarioControlVisita
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerFuncionarioControlVisita(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
|
|
try
|
|
{
|
|
#region Catalogo de Ejecutivos
|
|
using (CreditoContex db = new CreditoContex())
|
|
|
|
registros = (from e in db.Ejecutivo.ToList()
|
|
where (filtro == null ? true : e.Nombre.ToLower().Contains(filtro.ToLower()))
|
|
select new JsonCatalogos()
|
|
{
|
|
codigo = e.UserId.Trim(),
|
|
descripcion = e.Nombre.Trim()
|
|
}).ToList();
|
|
#endregion
|
|
|
|
#region Catalogo de Analistas de Crédito
|
|
List<EjecutivoCatalogoJSON> FuncionariosAnalistasCredito = ObtenerUsuarios_JobFunction_Grupo(EnumRolFuncional.Analista, null);
|
|
|
|
if (FuncionariosAnalistasCredito != null && FuncionariosAnalistasCredito.Count > 0)
|
|
{
|
|
|
|
FuncionariosAnalistasCredito.ForEach(x =>
|
|
{
|
|
x.codigo = (x.codigo.Split(new char[] { '/' })[1]).Trim();
|
|
x.descripcion = x.descripcion.Trim();
|
|
});
|
|
|
|
|
|
if (!string.IsNullOrEmpty(filtro))
|
|
FuncionariosAnalistasCredito = FuncionariosAnalistasCredito.Where(x => x.descripcion.ToLower().Contains(filtro.ToLower())).ToList();
|
|
|
|
List<JsonCatalogos> FuncionariosAnalistasCreditoCatalogo = FuncionariosAnalistasCredito.Select(x => new JsonCatalogos() { codigo = x.codigo, descripcion = x.descripcion }).ToList();
|
|
|
|
registros.AddRange(FuncionariosAnalistasCreditoCatalogo);
|
|
}
|
|
|
|
#endregion
|
|
|
|
registros = registros
|
|
.GroupBy(p => p.codigo)
|
|
.Select(g => g.FirstOrDefault())
|
|
.OrderBy(x => x.descripcion).ToList();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
#endregion
|
|
|
|
#region TipoSeguimiento
|
|
[HttpGet]
|
|
public List<JsonCatalogos> TipoSeguimiento()
|
|
{
|
|
List<JsonCatalogos> model = new List<JsonCatalogos>();
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
model = (
|
|
from s in db.TipoSeguimiento.ToList()
|
|
select new JsonCatalogos
|
|
{
|
|
codigo = s.IdTipoSeguimiento.ToString(),
|
|
descripcion = s.Descripcion
|
|
}).ToList();
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return model;
|
|
}
|
|
#endregion
|
|
|
|
#region ClasificacionVentanaCartera
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ClasificacionVentanaCartera()
|
|
{
|
|
List<JsonCatalogos> model = new List<JsonCatalogos>();
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
model = (
|
|
from s in db.ClasificacionVentanaCartera.ToList()
|
|
select new JsonCatalogos
|
|
{
|
|
codigo = s.IdClasificacionVentanaCartera.ToString(),
|
|
descripcion = s.Descripcion
|
|
}).ToList();
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return model;
|
|
}
|
|
#endregion
|
|
|
|
#region Abogados
|
|
[HttpGet]
|
|
public List<JsonCatalogos> Abogados(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> model = new List<JsonCatalogos>();
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
model = (
|
|
from s in db.Abogados.Where(c => (filtro == null || c.NombreCompleto == filtro) == true).ToList()
|
|
select new JsonCatalogos
|
|
{
|
|
codigo = s.IdAbogado.ToString(),
|
|
descripcion = s.NombreCompleto
|
|
}).ToList();
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return model;
|
|
}
|
|
#endregion
|
|
|
|
#region CorredoraSeguros
|
|
[HttpGet]
|
|
public List<JsonCatalogos> CorredoraSeguros(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> model = new List<JsonCatalogos>();
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
model = (
|
|
from s in db.CorredoraSeguros.Where(c => (filtro == null || c.Nombre.ToLower().Contains(filtro.ToLower())) == true).ToList()
|
|
select new JsonCatalogos
|
|
{
|
|
codigo = s.IdCorredoraSeguros.ToString(),
|
|
descripcion = s.Nombre
|
|
}).ToList();
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return model;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerMorosidad
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerMorosidad(int? filtro = null)
|
|
{
|
|
List<JsonCatalogos> model = new List<JsonCatalogos>();
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
if (filtro == null)
|
|
{
|
|
model = (
|
|
from s in db.Morosidad.Where(c => c.Estado == true).ToList()
|
|
select new JsonCatalogos
|
|
{
|
|
codigo = s.IdMorosidad.ToString(),
|
|
descripcion = s.Descripcion
|
|
}).ToList();
|
|
}
|
|
else
|
|
{
|
|
var Items = db.Morosidad.Where(c => c.DiasTope >= filtro).ToList();
|
|
|
|
if (Items != null && Items.Count > 0)
|
|
{
|
|
var Item = Items.OrderBy(x => x.DiasTope).Select(s => new JsonCatalogos
|
|
{
|
|
codigo = s.IdMorosidad.ToString(),
|
|
descripcion = s.Descripcion
|
|
}).FirstOrDefault();
|
|
|
|
model.Add(Item);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return model;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerUsuarios_JobFunction_Grupo_ByIdRolFuncional
|
|
[HttpGet]
|
|
public List<EjecutivoCatalogoJSON> ObtenerUsuarios_JobFunction_Grupo_ByIdRolFuncional(int id)
|
|
{
|
|
return ObtenerUsuarios_JobFunction_Grupo(id, null);
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerUsuarios_JobFunction_Grupo_ByIdEstructuraOC
|
|
[HttpGet]
|
|
public List<EjecutivoCatalogoJSON> ObtenerUsuarios_JobFunction_Grupo_ByIdEstructuraOC(int id)
|
|
{
|
|
return ObtenerUsuarios_JobFunction_Grupo(null, id);
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerUsuarios_JobFunction_Grupo
|
|
[HttpGet]
|
|
public List<EjecutivoCatalogoJSON> ObtenerUsuarios_JobFunction_Grupo(int? IdRolFuncional = null, int? id = 1)
|
|
{
|
|
List<EstructuraOrgChart> ListaEstructuraOrgChart = null;
|
|
List<UltimusUser> ListaUsuarios = new List<UltimusUser>();
|
|
List<EjecutivoCatalogoJSON> model = new List<EjecutivoCatalogoJSON>();
|
|
|
|
try
|
|
{
|
|
|
|
ListaEstructuraOrgChart = new EstructuraOrgChartDAL().Obtener(IdRolFuncional, id);
|
|
|
|
if (ListaEstructuraOrgChart == null)
|
|
{
|
|
log.Trace(string.Format("No se encontro el jobfunction/Grupo con ID {0} configurado en la tabla EstructuraOrgChart", id));
|
|
return model;
|
|
}
|
|
|
|
|
|
using (UltimusIntegrationAPIController IntegrationClient = new UltimusIntegrationAPIController())
|
|
{
|
|
foreach (EstructuraOrgChart mEstructuraOrgChart in ListaEstructuraOrgChart)
|
|
{
|
|
switch (mEstructuraOrgChart.IdTipoEstructuraOrgChart)
|
|
{
|
|
case 1:
|
|
UltimusUser userJF = IntegrationClient.GetUserForJobFunction("Business Organization", "Cathay OC", mEstructuraOrgChart.Name.Trim());
|
|
if (userJF != null)
|
|
ListaUsuarios.Add(userJF);
|
|
break;
|
|
case 2:
|
|
List<UltimusUser> usersJFGroup = IntegrationClient.GetJobFunctionGroupMembers("Cathay OC", mEstructuraOrgChart.Name.Trim());
|
|
if (usersJFGroup != null && usersJFGroup.Count > 0)
|
|
ListaUsuarios.AddRange(usersJFGroup);
|
|
break;
|
|
case 3:
|
|
List<UltimusUser> usersGroup = IntegrationClient.GetGroupUserMembers(mEstructuraOrgChart.Name.Trim());
|
|
if (usersGroup != null && usersGroup.Count > 0)
|
|
ListaUsuarios.AddRange(usersGroup);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (ListaUsuarios != null && ListaUsuarios.Count > 0)
|
|
{
|
|
foreach (var item in ListaUsuarios.ToList())
|
|
{
|
|
model.Add(new EjecutivoCatalogoJSON
|
|
{
|
|
codigo = item.strUserName,
|
|
descripcion = item.strUserFullName,
|
|
UserId = item.strUserName,
|
|
Correo = item.EmailAddress
|
|
});
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return model;
|
|
}
|
|
#endregion
|
|
|
|
#region EstructuraOrgChart
|
|
[HttpGet]
|
|
public List<JsonCatalogos> EstructuraOrgChart(string FiltroEtapa = null)
|
|
{
|
|
List<JsonCatalogos> model = new List<JsonCatalogos>();
|
|
List<EstructuraOrgChart> Lista = new List<EstructuraOrgChart>();
|
|
|
|
try
|
|
{
|
|
switch (FiltroEtapa)
|
|
{
|
|
case EnumEtapas.FR_Asig_Caso:
|
|
Lista = new EstructuraOrgChartDAL().Obtener(EnumRolFuncional.Formalizador);
|
|
break;
|
|
default:
|
|
Lista = new EstructuraOrgChartDAL().Obtener();
|
|
break;
|
|
}
|
|
|
|
model = (
|
|
from s in Lista
|
|
select new JsonCatalogos
|
|
{
|
|
codigo = s.IdEstructuraOrgChart.ToString(),
|
|
descripcion = s.Name
|
|
}).ToList();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return model;
|
|
}
|
|
#endregion
|
|
|
|
#region FormaDesembolso
|
|
[HttpGet]
|
|
public List<JsonCatalogos> FormaDesembolso()
|
|
{
|
|
List<JsonCatalogos> model = new List<JsonCatalogos>();
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
model = (
|
|
from s in db.FormaDesembolso.ToList()
|
|
select new JsonCatalogos
|
|
{
|
|
codigo = s.IdFormaDesembolso.ToString(),
|
|
descripcion = s.Descripcion
|
|
}).ToList();
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return model;
|
|
}
|
|
#endregion
|
|
|
|
#region TipoRolCredito
|
|
[HttpGet]
|
|
public List<JsonCatalogos> TipoRolCredito()
|
|
{
|
|
List<JsonCatalogos> model = new List<JsonCatalogos>();
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
model = (
|
|
from s in db.TipoRolCredito.ToList()
|
|
select new JsonCatalogos
|
|
{
|
|
codigo = s.IdTipoRol.ToString(),
|
|
descripcion = s.Descripcion
|
|
}).ToList();
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return model;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerComitesCredito
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerComitesCredito()
|
|
{
|
|
List<JsonCatalogos> model = new List<JsonCatalogos>();
|
|
try
|
|
{
|
|
|
|
using (CreditoContex Conn = new CreditoContex())
|
|
{
|
|
model = (from s in Conn.ComiteCredito
|
|
select new JsonCatalogos
|
|
{
|
|
codigo = s.CodigoComite,
|
|
descripcion = s.NombreComite
|
|
}).ToList();
|
|
}
|
|
|
|
model.Insert(0, new JsonCatalogos { codigo = string.Empty, descripcion = string.Empty });
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return model;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerRazones
|
|
[HttpPost]
|
|
public List<JsonCatalogos> ObtenerRazones(RazonesJSON model)
|
|
{
|
|
List<JsonCatalogos> respuesta = new List<JsonCatalogos>();
|
|
RazonesDecisionDAL RazonesDecisionDal = new RazonesDecisionDAL();
|
|
try
|
|
{
|
|
if (!string.IsNullOrEmpty(model.UltimusProcess) && !string.IsNullOrEmpty(model.UltimusStep))
|
|
{
|
|
respuesta = (from d in RazonesDecisionDal.Obtener(model.UltimusProcess, model.UltimusStep, model.IdDecision)
|
|
select new JsonCatalogos()
|
|
{
|
|
codigo = d.IdRazonRechazo.ToString(),
|
|
descripcion = d.RazonesRechazo.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return respuesta;
|
|
}
|
|
#endregion
|
|
|
|
#region ObteneraTipoFacilidad
|
|
[HttpGet]
|
|
public List<TipoFacilidadJSON> ObteneraTipoFacilidad()
|
|
{
|
|
TipoFacilidadDAL TipoFacilidadDal = new TipoFacilidadDAL();
|
|
List<TipoFacilidadJSON> model = new List<TipoFacilidadJSON>();
|
|
try
|
|
{
|
|
model = (
|
|
from s in TipoFacilidadDal.Obtener()
|
|
select new TipoFacilidadJSON
|
|
{
|
|
codigo = s.IdTipoFacilidad.ToString(),
|
|
descripcion = s.Descripcion
|
|
}.CopyValueProperties(s)).ToList();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return model;
|
|
}
|
|
#endregion
|
|
|
|
#region TipoCuenta
|
|
[HttpGet]
|
|
public List<JsonCatalogos> TipoCuenta()
|
|
{
|
|
List<JsonCatalogos> model = new List<JsonCatalogos>();
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
model = (
|
|
from s in db.TipoCuenta.Where(c => c.Estado == true).ToList()
|
|
select new JsonCatalogos
|
|
{
|
|
codigo = s.IdTipoCuenta.ToString(),
|
|
descripcion = s.Descripcion
|
|
}).ToList();
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return model;
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region GESTIONES VARIAS
|
|
|
|
#region ObtenerGestionesVarias
|
|
[HttpGet]
|
|
|
|
public List<JsonGestionesVarias> ObtenerGestionesVarias(int IdSolicitud)
|
|
{
|
|
GestionesVariasBL bl = new GestionesVariasBL();
|
|
List<JsonGestionesVarias> gestion = null;
|
|
List<GestionesVarias> gestionesvarias = null;
|
|
try
|
|
{
|
|
|
|
gestionesvarias = new List<GestionesVarias>();
|
|
gestionesvarias = bl.ObtenerGestionesVarias(IdSolicitud);
|
|
|
|
gestion = (from g in gestionesvarias
|
|
select new JsonGestionesVarias
|
|
{
|
|
Hora = g.Hora,
|
|
Fecha = g.Fecha,
|
|
IdSolicitud = g.IdSolicitud,
|
|
Descripcion = g.Descripcion,
|
|
Etapa = g.Etapa,
|
|
NombreTipoEjecutivo = g.Usuario,
|
|
IdGestion = g.IdGestion,
|
|
DescripcionTipoGestion = g.TipoGestion != null ? (g.TipoGestion.Descripcion == null ? "" : g.TipoGestion.Descripcion) : "",
|
|
IdTipoGestion = g.IdTipoGestion,
|
|
FechaActual = DateTime.Now
|
|
}).ToList();
|
|
if (gestion == null || gestion.Count == 0)
|
|
{
|
|
JsonGestionesVarias fecha = new JsonGestionesVarias();
|
|
fecha.FechaActual = DateTime.Now;
|
|
gestion.Add(fecha);
|
|
}
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
return gestion;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Insertar
|
|
[HttpPost]
|
|
public BaseJsonMetadata InsertarGestionesVarias(JsonGestionesVarias model)
|
|
{
|
|
GestionesVariasBL GestionesVariasBL = new GestionesVariasBL();
|
|
EjecutivoBL ejecutivoBL = new EjecutivoBL();
|
|
EtapasBL etapaBL = new EtapasBL();
|
|
BaseJsonMetadata respuesta = new BaseJsonMetadata();
|
|
try
|
|
{
|
|
|
|
GestionesVarias gestiones = model.GestionesVarias;
|
|
respuesta.CodigoRespuesta = GestionesVariasBL.Insertar(gestiones);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
respuesta.CodigoRespuesta = TipoCodigoRespuesta.ERROR.ToString();
|
|
respuesta.DescripcionRespuesta = ex.Message;
|
|
}
|
|
finally
|
|
{
|
|
GestionesVariasBL = null;
|
|
}
|
|
return respuesta;
|
|
}
|
|
#endregion
|
|
|
|
#region Actualizar
|
|
[HttpPost]
|
|
public BaseJsonMetadata ActualizarGestionesVarias(JsonGestionesVarias model)
|
|
{
|
|
GestionesVariasBL GestionesVariasBL = new GestionesVariasBL();
|
|
EjecutivoBL ejecutivoBL = new EjecutivoBL();
|
|
EtapasBL etapaBL = new EtapasBL();
|
|
BaseJsonMetadata respuesta = new BaseJsonMetadata();
|
|
try
|
|
{
|
|
|
|
GestionesVarias gestiones = model.GestionesVarias;
|
|
respuesta.CodigoRespuesta = GestionesVariasBL.Actualizar(gestiones);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
respuesta.CodigoRespuesta = TipoCodigoRespuesta.ERROR.ToString();
|
|
}
|
|
finally
|
|
{
|
|
GestionesVariasBL = null;
|
|
}
|
|
return respuesta;
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region CONTROLVISITAS
|
|
|
|
#region ObtenerControlVisitas
|
|
[HttpGet]
|
|
public JsonControlvisitas ObtenerControlVisitas(int idsolicitud)
|
|
{
|
|
|
|
ControlVisitasBL bl = new ControlVisitasBL();
|
|
JsonControlvisitas listas = null;
|
|
|
|
try
|
|
{
|
|
listas = new JsonControlvisitas();
|
|
listas.ControlVisitas = bl.ObtenerControlVisitas(idsolicitud);
|
|
listas.Cliente = new ClienteDAL().ObtenerPrincipal(idsolicitud);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(log + " Error : ObtenerControlVisitas " + "=" + ex.Message + ex.StackTrace);
|
|
}
|
|
return listas;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region InsertarActualizar
|
|
[HttpPost]
|
|
public BaseJsonMetadata InsertarActualizar(ControlVisitas model)
|
|
{
|
|
|
|
BaseJsonMetadata respuesta = new BaseJsonMetadata();
|
|
ControlVisitasBL controlVisitasBL = new ControlVisitasBL();
|
|
try
|
|
{
|
|
respuesta.IdControlVisita = controlVisitasBL.InsertarActualizar(model);
|
|
respuesta.CodigoRespuesta = TipoCodigoRespuesta.EXITOSO.ToString();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(log + " Error : ObtenerControlVisitas " + "=" + ex.Message + ex.StackTrace);
|
|
respuesta.CodigoRespuesta = TipoCodigoRespuesta.ERROR.ToString();
|
|
}
|
|
|
|
return respuesta;
|
|
}
|
|
#endregion
|
|
|
|
#region EliminarControlVisita
|
|
[HttpPost]
|
|
public BaseJson EliminarControlVisita(ControlVisitas model)
|
|
{
|
|
|
|
BaseJson respuesta = new BaseJson();
|
|
ControlVisitasBL controlVisitasBL = new ControlVisitasBL();
|
|
try
|
|
{
|
|
respuesta = controlVisitasBL.EliminarControlVisita(model);
|
|
respuesta.CodigoRespuesta = TipoCodigoRespuesta.EXITOSO.ToString();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(log + " Error : ObtenerControlVisitas " + "=" + ex.Message + ex.StackTrace);
|
|
respuesta.CodigoRespuesta = TipoCodigoRespuesta.ERROR.ToString();
|
|
}
|
|
|
|
return respuesta;
|
|
}
|
|
#endregion
|
|
|
|
#region EnviarCorreoInvitados
|
|
|
|
|
|
[HttpPost]
|
|
public BaseJson EnviarCorreoInvitados(JsonControlVisitas model)
|
|
{
|
|
BaseJson res = new BaseJson();
|
|
EmailSolicitudBL EmailSolicitudBL = new EmailSolicitudBL();
|
|
ControlVisitasDAL ControlVisitasDAL = new ControlVisitasDAL();
|
|
EjecutivoDAL EjecutivoDAL = new EjecutivoDAL();
|
|
Solicitud solicitud;
|
|
SolicitanteDAL solicitanteDAL = new SolicitanteDAL();
|
|
SolicitudDAL solicitudDAL = new SolicitudDAL();
|
|
Solicitante SolicitantePrincipal;
|
|
|
|
string NombreEjecutivo = string.Empty;
|
|
string NombreCliente = string.Empty;
|
|
string Fecha = string.Empty;
|
|
string Hora = string.Empty;
|
|
string HoraF = string.Empty;
|
|
string Direccion = string.Empty;
|
|
string HoraInicio = string.Empty;
|
|
string HoraFin = string.Empty;
|
|
string Cuerpo = string.Empty;
|
|
|
|
StringBuilder CreateEvent = new StringBuilder();
|
|
|
|
|
|
List<string> emails = new List<string>();
|
|
try
|
|
{
|
|
List<EmailSolicitud> Invitados = EmailSolicitudBL.ObtenerEmailSolicitudPorControlVisita(model.ControlVisitas.IdControlVisitas, model.ControlVisitas.IdSolicitud);
|
|
|
|
ControlVisitas ControlVisitas = ControlVisitasDAL.ObtenerDatosCorreo(model.ControlVisitas.IdSolicitud, model.ControlVisitas.IdControlVisitas);
|
|
|
|
solicitud = solicitudDAL.Obtener(Convert.ToInt32(model.ControlVisitas.IdSolicitud));
|
|
|
|
solicitud.Solicitante = solicitanteDAL.Obtener(Convert.ToInt32(model.ControlVisitas.IdSolicitud));
|
|
|
|
SolicitantePrincipal = solicitud.Solicitante != null ? solicitud.Solicitante.Where(c => c.EsPrincipal == true).FirstOrDefault() : null;
|
|
|
|
if (ControlVisitas != null && ControlVisitas.UserId != null)
|
|
NombreEjecutivo = ControlVisitas.UserFullName;
|
|
|
|
NombreCliente = (SolicitantePrincipal != null && SolicitantePrincipal.Cliente != null ? (SolicitantePrincipal.Cliente.IdTipoCliente == 1 ? SolicitantePrincipal.Cliente.PrimerNombre.Trim() + " " + SolicitantePrincipal.Cliente.PrimerApellido.Trim() : SolicitantePrincipal.Cliente.RazonSocial.Trim()) : string.Empty);
|
|
|
|
if (ControlVisitas != null && ControlVisitas.FechaProgramada != null)
|
|
Fecha = ((DateTime)ControlVisitas.FechaProgramada).ToString("dd/MM/yyyy");
|
|
|
|
if (ControlVisitas != null && ControlVisitas.HoraProgramada != null)
|
|
Hora = ControlVisitas.HoraProgramada;
|
|
|
|
if (ControlVisitas != null && ControlVisitas.HoraProgramadaFin != null)
|
|
HoraF = ControlVisitas.HoraProgramadaFin;
|
|
|
|
if (ControlVisitas != null && ControlVisitas.Direccion != null)
|
|
Direccion = ControlVisitas.Direccion;
|
|
|
|
List<string> emailsInvitados = (from email in Invitados
|
|
from recipiente in email.RecipienteEmailSolicitud
|
|
select recipiente.Email).ToList();
|
|
|
|
if (emailsInvitados != null) { emails.AddRange(emailsInvitados); }
|
|
|
|
string Body = string.Empty;
|
|
if (emails != null && emails.Count > 0)
|
|
{
|
|
string Subject = "Visita - " + NombreCliente;
|
|
|
|
string destinatario = string.Empty;
|
|
|
|
foreach (var lista in emailsInvitados)
|
|
{
|
|
destinatario += lista + ";";
|
|
}
|
|
|
|
if (ControlVisitas != null && ControlVisitas.FechaProgramada != null)
|
|
HoraInicio = ((DateTime)ControlVisitas.FechaProgramada).ToString("yyyy-MM-dd");
|
|
|
|
if (ControlVisitas != null && ControlVisitas.FechaProgramada != null)
|
|
HoraFin = ((DateTime)ControlVisitas.FechaProgramada).ToString("yyyy-MM-dd");
|
|
|
|
HoraInicio += FormatoHora(Hora);
|
|
HoraFin += FormatoHora(HoraF);
|
|
|
|
|
|
if (ControlVisitas != null)
|
|
Cuerpo = NombreEjecutivo + " lo ha invitado a la siguiente cita: "
|
|
+ " Cliente: " + NombreCliente
|
|
+ " Fecha: " + Fecha
|
|
+ " Hora: " + Hora
|
|
+ " Dirección: " + Direccion;
|
|
|
|
CreateEvent.AppendFormat(new ObtieneParametros().GetValueKeyRegedit("CrearEventoOffice365", false));
|
|
CreateEvent.AppendFormat("?Destinatario={0}", destinatario);
|
|
CreateEvent.AppendFormat("&Asunto={0}", Subject);
|
|
CreateEvent.AppendFormat("&Cuerpo={0}", Cuerpo);
|
|
CreateEvent.AppendFormat("&Ubicacion={0}", Direccion);
|
|
CreateEvent.AppendFormat("&Inicio={0}", HoraInicio);
|
|
CreateEvent.AppendFormat("&Fin={0}", HoraFin);
|
|
|
|
res.CodigoRespuesta = TipoCodigoRespuesta.EXITOSO.ToString();
|
|
res.DescripcionRespuesta = CreateEvent.ToString();
|
|
log.Trace("Url: " + res.DescripcionRespuesta);
|
|
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
res.CodigoRespuesta = TipoCodigoRespuesta.ERROR.ToString();
|
|
log.Error(ex);
|
|
}
|
|
return res;
|
|
}
|
|
#endregion
|
|
|
|
public string FormatoHora(string hora)
|
|
{
|
|
string respuesta = string.Empty;
|
|
try
|
|
{
|
|
if (!string.IsNullOrEmpty(hora))
|
|
{
|
|
string[] mtzhora = hora.Split(':');
|
|
|
|
if (mtzhora[2] == "PM")
|
|
{
|
|
switch (mtzhora[0])
|
|
{
|
|
case "1":
|
|
mtzhora[0] = "13";
|
|
break;
|
|
case "2":
|
|
mtzhora[0] = "14";
|
|
break;
|
|
case "3":
|
|
mtzhora[0] = "15";
|
|
break;
|
|
case "4":
|
|
mtzhora[0] = "16";
|
|
break;
|
|
case "5":
|
|
mtzhora[0] = "17";
|
|
break;
|
|
case "6":
|
|
mtzhora[0] = "18";
|
|
break;
|
|
case "7":
|
|
mtzhora[0] = "19";
|
|
break;
|
|
case "8":
|
|
mtzhora[0] = "20";
|
|
break;
|
|
case "9":
|
|
mtzhora[0] = "21";
|
|
break;
|
|
case "10":
|
|
mtzhora[0] = "22";
|
|
break;
|
|
case "11":
|
|
mtzhora[0] = "23";
|
|
break;
|
|
}
|
|
}
|
|
else if (mtzhora[2] == "AM")
|
|
{
|
|
switch (mtzhora[0])
|
|
{
|
|
case "1":
|
|
mtzhora[0] = "01";
|
|
break;
|
|
case "2":
|
|
mtzhora[0] = "02";
|
|
break;
|
|
case "3":
|
|
mtzhora[0] = "03";
|
|
break;
|
|
case "4":
|
|
mtzhora[0] = "04";
|
|
break;
|
|
case "5":
|
|
mtzhora[0] = "05";
|
|
break;
|
|
case "6":
|
|
mtzhora[0] = "06";
|
|
break;
|
|
case "7":
|
|
mtzhora[0] = "07";
|
|
break;
|
|
case "8":
|
|
mtzhora[0] = "08";
|
|
break;
|
|
case "9":
|
|
mtzhora[0] = "09";
|
|
break;
|
|
case "10":
|
|
mtzhora[0] = "10";
|
|
break;
|
|
case "11":
|
|
mtzhora[0] = "11";
|
|
break;
|
|
case "12":
|
|
mtzhora[0] = "00";
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
respuesta = "T" + mtzhora[0] + ":" + mtzhora[1] + ":00";
|
|
}
|
|
return respuesta;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region WCFGENERALES
|
|
|
|
#region ConsultarBP
|
|
[HttpGet]
|
|
public ZConsultaBpResponse ConsultarBP(string CodigoCliente, string Id)
|
|
{
|
|
ZConsultaBpResponse respuesta = null;
|
|
EntidadBPMSoapClient Entidad = null;
|
|
|
|
try
|
|
{
|
|
respuesta = new ZConsultaBpResponse();
|
|
Entidad = new EntidadBPMSoapClient();
|
|
respuesta = Entidad.ConsultaBP(CodigoCliente, Id);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
return respuesta;
|
|
}
|
|
#endregion
|
|
|
|
#region ConsultaMorosidadCCSS
|
|
[HttpGet]
|
|
public int ConsultaMorosidadCCSS(string Identificacion)
|
|
{
|
|
|
|
EntidadBPMSoapClient Entidad = null;
|
|
int respuesta = 0;
|
|
try
|
|
{
|
|
|
|
Entidad = new EntidadBPMSoapClient();
|
|
respuesta = Entidad.ConsultaMorosidadCCSS(Identificacion);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
return respuesta;
|
|
}
|
|
#endregion
|
|
|
|
#region ConsultaRegistroCivil
|
|
[HttpGet]
|
|
public RespuestaRegistroCivil ConsultaRegistroCivil(string Identificacion)
|
|
{
|
|
|
|
EntidadBPMSoapClient Entidad = null;
|
|
RespuestaRegistroCivil respuesta = null;
|
|
|
|
try
|
|
{
|
|
respuesta = new RespuestaRegistroCivil();
|
|
Entidad = new EntidadBPMSoapClient();
|
|
respuesta = Entidad.ConsultaRegistroCivil(Identificacion);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
return respuesta;
|
|
}
|
|
#endregion
|
|
|
|
#region ConsultaRegistroNacional
|
|
[HttpGet]
|
|
public RespuestaRegistroNacional ConsultaRegistroNacional(string Identificacion)
|
|
{
|
|
|
|
EntidadBPMSoapClient Entidad = null;
|
|
RespuestaRegistroNacional respuesta = null;
|
|
|
|
try
|
|
{
|
|
respuesta = new RespuestaRegistroNacional();
|
|
Entidad = new EntidadBPMSoapClient();
|
|
respuesta = Entidad.ConsultaRegistroNacional(Identificacion);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
return respuesta;
|
|
}
|
|
#endregion
|
|
|
|
#region ConsultaSolicitud
|
|
[HttpGet]
|
|
public ZConsultaSolicitudResponse ConsultaSolicitud(string Num_Solicitud)
|
|
{
|
|
|
|
EntidadBPMSoapClient Entidad = null;
|
|
ZConsultaSolicitudResponse respuesta = null;
|
|
|
|
try
|
|
{
|
|
|
|
Entidad = new EntidadBPMSoapClient();
|
|
respuesta = new ZConsultaSolicitudResponse();
|
|
respuesta = Entidad.ConsultaSolicitud(Num_Solicitud);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
return respuesta;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerTipoCambioContable
|
|
[HttpGet]
|
|
public OBTENER_TIPO_CAMBIO_CONTABLEResponse ObtenerTipoCambioContable(string Num_Solicitud)
|
|
{
|
|
|
|
EntidadBPMSoapClient Entidad = new EntidadBPMSoapClient();
|
|
OBTENER_TIPO_CAMBIO_CONTABLEResponse respuesta = new OBTENER_TIPO_CAMBIO_CONTABLEResponse();
|
|
|
|
try
|
|
{
|
|
respuesta = Entidad.ObtenerTipoCambioContable();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
return respuesta;
|
|
}
|
|
#endregion
|
|
|
|
#region ConsultaLineasCliente
|
|
[HttpGet]
|
|
public ZConsultaLineasClienteResponse ConsultaLineasCliente(string Cod_Cliente)
|
|
{
|
|
|
|
EntidadBPMSoapClient Entidad = null;
|
|
ZConsultaLineasClienteResponse respuesta = null;
|
|
try
|
|
{
|
|
|
|
Entidad = new EntidadBPMSoapClient();
|
|
respuesta = new ZConsultaLineasClienteResponse();
|
|
respuesta = Entidad.ConsultaLineasCliente(Cod_Cliente);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
return respuesta;
|
|
}
|
|
|
|
#endregion
|
|
|
|
[HttpGet]
|
|
public ZConsultaLineaResponse ConsultarLinea(string NumeroLinea)
|
|
{
|
|
EntidadBPMSoapClient Entidad = null;
|
|
ZConsultaLineaResponse respuesta = null;
|
|
try
|
|
{
|
|
Entidad = new EntidadBPMSoapClient();
|
|
respuesta = new ZConsultaLineaResponse();
|
|
respuesta = Entidad.ConsultaLinea(NumeroLinea);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
return respuesta;
|
|
}
|
|
|
|
#region RegistrarLinea
|
|
public ZRegistrarLineaResponse RegistrarLinea(ZRegistrarLinea registrarLinea)
|
|
{
|
|
ZRegistrarLineaResponse respuesta = new ZRegistrarLineaResponse();
|
|
EntidadBPMSoapClient entidad = new EntidadBPMSoapClient();
|
|
|
|
try
|
|
{
|
|
respuesta = entidad.RegistrarLinea(registrarLinea);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
|
|
throw ex;
|
|
}
|
|
return respuesta;
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region EnvioPropuestas
|
|
|
|
#region ObtenerDocumentosCategorias
|
|
[HttpGet]
|
|
public List<DocumentosCategoria> ObtenerDocumentosCategorias(int IdSolicitud)
|
|
{
|
|
DocumentosCategoriaBL bl = new DocumentosCategoriaBL();
|
|
SolicitanteBL solicBL = new SolicitanteBL();
|
|
|
|
|
|
List<DocumentosCategoria> listadocumentos = null;
|
|
|
|
List<JsonDocumentosCategoria> prueba = null;
|
|
|
|
List<Solicitante> listasolicit = null;
|
|
|
|
|
|
|
|
|
|
try
|
|
{
|
|
|
|
listasolicit = new List<Solicitante>();
|
|
listasolicit = solicBL.Obtener(IdSolicitud);
|
|
|
|
prueba = (from l in listasolicit
|
|
select new JsonDocumentosCategoria
|
|
{
|
|
IdTipoCliente = l.Cliente.IdTipoCliente,
|
|
IdClasificacionCliente = l.Cliente.IdClasificacionCliente,
|
|
IdTipoIngreso = l.Cliente.IdTipoIngreso
|
|
}).ToList();
|
|
|
|
|
|
int? idtipocliente;
|
|
int? idtipocategoria;
|
|
int? idclasificliente;
|
|
|
|
|
|
foreach (var l in prueba)
|
|
{
|
|
idtipocliente = l.IdTipoCliente;
|
|
idtipocategoria = l.IdTipoCategoria;
|
|
idclasificliente = l.IdClasificacionCliente;
|
|
|
|
}
|
|
|
|
listadocumentos = new List<DocumentosCategoria>();
|
|
// listadocumentos = bl.ObtenerDocumentosCategoria(idtipocliente, idtipocategoria, idclasificliente, idtipoingreso);
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(log + " Error : ObtenerControlVisitas " + "=" + ex.Message + ex.StackTrace);
|
|
}
|
|
return listadocumentos;
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region TotalDiasHabiles
|
|
[HttpGet]
|
|
public int TotalDiasHabiles(DateTime FechaInicio, DateTime FechaFin)
|
|
{
|
|
int total_dias = 0;
|
|
int total_dias_habiles = 0;
|
|
int total_dias_feriados = 0;
|
|
int total_dias_libres = 0;
|
|
|
|
List<DiasJSON> DiasSemanles = new List<DiasJSON>();
|
|
List<ExclusionDay> DiasFeriados = new List<ExclusionDay>();
|
|
List<DayOfWeek> DiasLibres = new List<DayOfWeek>();
|
|
|
|
try
|
|
{
|
|
FechaInicio = FechaInicio.Date;
|
|
FechaFin = FechaFin.Date;
|
|
|
|
if (FechaFin < FechaInicio || FechaFin == FechaInicio)
|
|
return total_dias_habiles;
|
|
|
|
TimeSpan ts = FechaFin - FechaInicio; // Total duration
|
|
total_dias = ts.Days;
|
|
|
|
#region CALCULA DIAS POR SEMANA
|
|
int total_semanas = (int)Math.Floor(ts.TotalDays / 7); // Number of whole weeks
|
|
int remainder = (int)(ts.TotalDays % 7); // Number of remaining days
|
|
|
|
foreach (var dia in Enum.GetValues(typeof(DayOfWeek)).OfType<DayOfWeek>().ToList())
|
|
{
|
|
int total = total_semanas;
|
|
|
|
int sinceLastDay = (int)(FechaFin.DayOfWeek - dia); // Number of days since last [day]
|
|
if (sinceLastDay < 0) sinceLastDay += 7; // Adjust for negative days since last [day]
|
|
|
|
// If the days in excess of an even week are greater than or equal to the number days since the last [day], then count this one, too.
|
|
if (remainder >= sinceLastDay)
|
|
{ total++; }
|
|
|
|
DiasSemanles.Add(new DiasJSON
|
|
{
|
|
Dia = dia,
|
|
Total = total
|
|
});
|
|
}
|
|
#endregion
|
|
|
|
string error;
|
|
UltimusIntegrationAPIController InterfaceClient = new UltimusIntegrationAPIController();
|
|
using (UltimusIntegrationClient client = new UltimusIntegrationClient(InterfaceClient.wSHttpBinding, InterfaceClient.endpointAddress))
|
|
{
|
|
#region DIAS LIBRES
|
|
|
|
List<DayOfWeekJSON> OffDays;
|
|
|
|
if (client.GetOffDays(out OffDays, out error))
|
|
{
|
|
foreach (var item in OffDays)
|
|
{
|
|
DiasLibres.Add((DayOfWeek)item);
|
|
}
|
|
}
|
|
|
|
if (DiasSemanles.Count > 0 && DiasLibres.Count > 0)
|
|
total_dias_libres = DiasSemanles.Where(c => DiasLibres.Contains(c.Dia)).Sum(c => c.Total);
|
|
|
|
#endregion
|
|
|
|
#region DIAS FERIADOS
|
|
if (client.GetExclusionDays(out DiasFeriados, out error))
|
|
{
|
|
foreach (var item in DiasFeriados)
|
|
{
|
|
DateTime DiaFeriado = new DateTime(DateTime.Now.Year, item.Month, item.Day);
|
|
|
|
if (DiaFeriado >= FechaInicio && DiaFeriado <= FechaFin && !DiasLibres.Where(c => c == DiaFeriado.DayOfWeek).Any())
|
|
total_dias_feriados++;
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
//calcula los dias habiles
|
|
total_dias_habiles = total_dias - total_dias_feriados - total_dias_libres;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return total_dias_habiles;
|
|
}
|
|
#endregion
|
|
|
|
#region FechaADiasHabiles
|
|
[HttpGet]
|
|
public DateTime FechaADiasHabiles(DateTime FechaInicio, int DiasHabiles)
|
|
{
|
|
DateTime FechaCalculada = DateTime.Now;
|
|
int dias_calculados = 0;
|
|
bool CorrectDate = false;
|
|
|
|
try
|
|
{
|
|
if (DiasHabiles == 0)
|
|
{
|
|
FechaCalculada = FechaInicio;
|
|
}
|
|
else
|
|
{
|
|
|
|
//while (!CorrectDate)
|
|
//{
|
|
FechaCalculada = FechaCalculada.AddDays(DiasHabiles);
|
|
//dias_calculados = TotalDiasHabiles(FechaInicio, FechaCalculada);
|
|
|
|
// if (dias_calculados == DiasHabiles) CorrectDate = true;
|
|
// else if (dias_calculados > DiasHabiles)
|
|
// {
|
|
// DiasHabiles++;
|
|
// if (dias_calculados == DiasHabiles) CorrectDate = true;
|
|
// }
|
|
// else if (dias_calculados < DiasHabiles)
|
|
// {
|
|
// DiasHabiles--;
|
|
// if (dias_calculados == DiasHabiles) CorrectDate = true;
|
|
// }
|
|
//}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return FechaCalculada;
|
|
}
|
|
#endregion
|
|
|
|
#region Comentarios
|
|
[HttpPost]
|
|
public List<BitacoraComentarios> ObtenerBitacoraComentarios([FromBody] BitacoraComentarios bitacoraComentarios)
|
|
{
|
|
List<BitacoraComentarios> respuesta = new List<BitacoraComentarios>();
|
|
|
|
using (UltimusFormAPIController InterfaceClient = new UltimusFormAPIController())
|
|
{
|
|
respuesta = InterfaceClient.ObtenerComentariosProceso(bitacoraComentarios);
|
|
}
|
|
return respuesta;
|
|
}
|
|
|
|
[HttpPost]
|
|
public string GuardarComentarioProceso([FromBody] BitacoraComentarios bitacoraComentarios)
|
|
{
|
|
string respuesta = string.Empty;
|
|
using (UltimusFormAPIController InterfaceClient = new UltimusFormAPIController())
|
|
{
|
|
respuesta = InterfaceClient.GuardarComentarioProceso(bitacoraComentarios);
|
|
}
|
|
return respuesta;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerHistCaratula
|
|
[HttpGet]
|
|
public List<HistoricoCaratula> ObtenerHistCaratula(int idSolicitud)
|
|
{
|
|
List<HistoricoCaratula> listaHistoricCaratula = null;
|
|
try
|
|
{
|
|
listaHistoricCaratula = new List<HistoricoCaratula>();
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
listaHistoricCaratula = db.HistoricoCaratula.Where(x => x.IdSolicitud == idSolicitud && !string.IsNullOrEmpty(x.Name)).OrderByDescending(x => x.Fecha).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
return listaHistoricCaratula;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerVariableEsquemaUltimus
|
|
[HttpPost]
|
|
public UltimusValoresEsquema ObtenerVariableEsquemaUltimus(UltimusValoresEsquema model)
|
|
{
|
|
|
|
UltimusIntegrationAPIController UltimusIntegration = new UltimusIntegrationAPIController();
|
|
try
|
|
{
|
|
foreach (UltimusVariable Variable in model.ListaVariables)
|
|
{
|
|
string ValorRetorno = string.Empty;
|
|
UltimusIntegration.GetNodeValue(model.UltimusUserID, model.UltimusTaskId, Variable.Nombre, out ValorRetorno);
|
|
Variable.Valor = ValorRetorno;
|
|
}
|
|
|
|
model.CodigoRespuesta = TipoCodigoRespuesta.EXITOSO.ToString();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
|
|
model.CodigoRespuesta = TipoCodigoRespuesta.ERROR.ToString();
|
|
model.DescripcionRespuesta = ex.Message;
|
|
}
|
|
return model;
|
|
}
|
|
#endregion
|
|
|
|
#region ObtenerTipoSolicitante
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoSolicitante(string filtro = null, string notdeudor = null)
|
|
{
|
|
List<JsonCatalogos> model = new List<JsonCatalogos>();
|
|
TipoSolicitante TipoSolicitanteDeudor = null;
|
|
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
model = db.TipoSolicitante.Where(c => (string.IsNullOrEmpty(filtro) || c.Descripcion == filtro) == true)
|
|
.Select(c => new JsonCatalogos
|
|
{
|
|
codigo = c.IdTipoSolicitante.ToString(),
|
|
descripcion = c.Descripcion
|
|
}).ToList();
|
|
|
|
|
|
if (notdeudor == "true")
|
|
{
|
|
TipoSolicitanteDeudor = db.TipoSolicitante.Where(x => x.Descripcion.ToLower().Trim() == "deudor").FirstOrDefault();
|
|
var ItemToRemove = model.Where(x => x.codigo == TipoSolicitanteDeudor.IdTipoSolicitante.ToString()).FirstOrDefault();
|
|
model.Remove(ItemToRemove);
|
|
}
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return model;
|
|
}
|
|
#endregion
|
|
|
|
#region Catalogos SAP
|
|
|
|
#region - ObtenerSAPExposicionAcuerdoSUGEF
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="filtro"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<ULA.Cathay.Credito.ServicioSAP.Catalogo> ObtenerSAPExposicionAcuerdoSUGEF(string filtro = null, int id = 0)
|
|
{
|
|
|
|
List<ULA.Cathay.Credito.ServicioSAP.Catalogo> Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
try
|
|
{
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "1", descripcion = "No Aplica" });
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "2", descripcion = "Conformar /Actualizar" });
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "0", descripcion = "Problema al consultar SAP. No fue posible obtener la respueas de SAP" });
|
|
|
|
log.Error(ex);
|
|
}
|
|
|
|
return Resultados;
|
|
}
|
|
#endregion
|
|
|
|
#region - ObtenerSAPActividadEconomicaPIB
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="filtro"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<ULA.Cathay.Credito.ServicioSAP.Catalogo> ObtenerSAPActividadEconomicaPIB(string filtro = null, int id = 0)
|
|
{
|
|
|
|
List<ULA.Cathay.Credito.ServicioSAP.Catalogo> Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
try
|
|
{
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "1", descripcion = "No Aplica" });
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "0", descripcion = "Problema al consultar SAP. No fue posible obtener la respueas de SAP" });
|
|
|
|
log.Error(ex);
|
|
}
|
|
|
|
return Resultados;
|
|
}
|
|
#endregion
|
|
|
|
#region - ObtenerSAPActividadEconomicaSUGEFGeneral
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="filtro"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<ULA.Cathay.Credito.ServicioSAP.Catalogo> ObtenerSAPActividadEconomicaSUGEFGeneral(string filtro = null, int id = 0)
|
|
{
|
|
|
|
List<ULA.Cathay.Credito.ServicioSAP.Catalogo> Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
try
|
|
{
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "1", descripcion = "No Aplica" });
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "0", descripcion = "Problema al consultar SAP. No fue posible obtener la respueas de SAP" });
|
|
|
|
log.Error(ex);
|
|
}
|
|
|
|
return Resultados;
|
|
}
|
|
#endregion
|
|
|
|
#region 0 - ObtenerSAPProducto
|
|
/// <summary>
|
|
/// Numero de Catalogo = 0 - Clase Producto
|
|
/// </summary>
|
|
/// <param name="filtro"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<ULA.Cathay.Credito.ServicioSAP.Catalogo> ObtenerSAPProducto(string filtro = null, int id = 0)
|
|
{
|
|
|
|
List<ULA.Cathay.Credito.ServicioSAP.Catalogo> Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
try
|
|
{
|
|
Resultados = new SAPServicioIntegracionAPIController().ObtenerCatalogos(filtro, (int)ULA.Cathay.Credito.ServicioSAP.TiposCatalgo.ClaseProducto);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "0", descripcion = "Problema al consultar SAP. No fue posible obtener la respueas de SAP" });
|
|
|
|
log.Error(ex);
|
|
}
|
|
|
|
return Resultados;
|
|
}
|
|
#endregion
|
|
|
|
#region 1 - ObtenerSAPTipoDestinoUtilizacion
|
|
/// <summary>
|
|
/// Numero de Catalogo = 1 - Destino Utilizacion
|
|
/// </summary>
|
|
/// <param name="filtro"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<ULA.Cathay.Credito.ServicioSAP.Catalogo> ObtenerSAPTipoDestinoUtilizacion(string filtro = null, int id = 0)
|
|
{
|
|
|
|
List<ULA.Cathay.Credito.ServicioSAP.Catalogo> Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
try
|
|
{
|
|
Resultados = new SAPServicioIntegracionAPIController().ObtenerCatalogos(filtro, (int)ULA.Cathay.Credito.ServicioSAP.TiposCatalgo.DestinoUtilizacion);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "0", descripcion = "Problema al consultar SAP. No fue posible obtener la respueas de SAP" });
|
|
|
|
log.Error(ex);
|
|
}
|
|
|
|
return Resultados;
|
|
}
|
|
#endregion
|
|
|
|
#region 2 - ObtenerSAPEstadoOperacion
|
|
/// <summary>
|
|
/// Numero de Catalogo = 2 - Estado Operacion
|
|
/// </summary>
|
|
/// <param name="filtro"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<ULA.Cathay.Credito.ServicioSAP.Catalogo> ObtenerSAPEstadoOperacion(string filtro = null, int id = 0)
|
|
{
|
|
|
|
List<ULA.Cathay.Credito.ServicioSAP.Catalogo> Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
try
|
|
{
|
|
Resultados = new SAPServicioIntegracionAPIController().ObtenerCatalogos(filtro, (int)ULA.Cathay.Credito.ServicioSAP.TiposCatalgo.EstadoOperacion);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "0", descripcion = "Problema al consultar SAP. No fue posible obtener la respueas de SAP" });
|
|
|
|
log.Error(ex);
|
|
}
|
|
|
|
return Resultados;
|
|
}
|
|
#endregion
|
|
|
|
#region 3 - ObtenerSAPExposicionTipoGIE
|
|
/// <summary>
|
|
/// Numero de Catalogo = 3 - Grupo de Interes Economico GIE
|
|
/// </summary>
|
|
/// <param name="filtro"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<ULA.Cathay.Credito.ServicioSAP.Catalogo> ObtenerSAPExposicionTipoGIE(string filtro = null, int id = 0)
|
|
{
|
|
|
|
List<ULA.Cathay.Credito.ServicioSAP.Catalogo> Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
try
|
|
{
|
|
Resultados = new SAPServicioIntegracionAPIController().ObtenerCatalogos(filtro, (int)ULA.Cathay.Credito.ServicioSAP.TiposCatalgo.GIE);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "0", descripcion = "Problema al consultar SAP. No fue posible obtener la respueas de SAP" });
|
|
|
|
log.Error(ex);
|
|
}
|
|
|
|
return Resultados;
|
|
}
|
|
#endregion
|
|
|
|
#region 5 - ObtenerSAPNaturalezaGasto
|
|
/// <summary>
|
|
/// Numero de Catalogo = 5 - Naturaleza del Gasto
|
|
/// </summary>
|
|
/// <param name="filtro"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<ULA.Cathay.Credito.ServicioSAP.Catalogo> ObtenerSAPNaturalezaGasto(string filtro = null, int id = 0)
|
|
{
|
|
|
|
List<ULA.Cathay.Credito.ServicioSAP.Catalogo> Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
try
|
|
{
|
|
Resultados = new SAPServicioIntegracionAPIController().ObtenerCatalogos(filtro, (int)ULA.Cathay.Credito.ServicioSAP.TiposCatalgo.NaturalezaGasto);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "0", descripcion = "Problema al consultar SAP. No fue posible obtener la respueas de SAP" });
|
|
|
|
log.Error(ex);
|
|
}
|
|
|
|
return Resultados;
|
|
}
|
|
#endregion
|
|
|
|
#region 6 - ObtenerSAPTipoGarantia
|
|
/// <summary>
|
|
/// Numero de Catalogo = 6 - Tipo Garantía
|
|
/// </summary>
|
|
/// <param name="filtro"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<ULA.Cathay.Credito.ServicioSAP.Catalogo> ObtenerSAPTipoGarantia(string filtro = null, int id = 0)
|
|
{
|
|
|
|
List<ULA.Cathay.Credito.ServicioSAP.Catalogo> Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
try
|
|
{
|
|
Resultados = new SAPServicioIntegracionAPIController().ObtenerCatalogos(filtro, (int)ULA.Cathay.Credito.ServicioSAP.TiposCatalgo.TipoGarantia);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "0", descripcion = "Problema al consultar SAP. No fue posible obtener la respueas de SAP" });
|
|
|
|
log.Error(ex);
|
|
}
|
|
|
|
return Resultados;
|
|
}
|
|
#endregion
|
|
|
|
#region 8 - ObtenerSAPDeudoresNivelCapacidadPago
|
|
/// <summary>
|
|
/// Numero de Catalogo = 8 - Capacidad Pago
|
|
/// </summary>
|
|
/// <param name="filtro"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<ULA.Cathay.Credito.ServicioSAP.Catalogo> ObtenerSAPDeudoresNivelCapacidadPago(string filtro = null, int id = 0)
|
|
{
|
|
|
|
List<ULA.Cathay.Credito.ServicioSAP.Catalogo> Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
try
|
|
{
|
|
Resultados = new SAPServicioIntegracionAPIController().ObtenerCatalogos(filtro, (int)ULA.Cathay.Credito.ServicioSAP.TiposCatalgo.CapacidadPago);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "0", descripcion = "Problema al consultar SAP. No fue posible obtener la respueas de SAP" });
|
|
|
|
log.Error(ex);
|
|
}
|
|
|
|
return Resultados;
|
|
}
|
|
#endregion
|
|
|
|
#region 9 - ObtenerSAPDeudoresCategoriaRiesgo
|
|
/// <summary>
|
|
/// Numero de Catalogo = 9 - Categorio de Riesgo
|
|
/// </summary>
|
|
/// <param name="filtro"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<ULA.Cathay.Credito.ServicioSAP.Catalogo> ObtenerSAPDeudoresCategoriaRiesgo(string filtro = null, int id = 0)
|
|
{
|
|
|
|
List<ULA.Cathay.Credito.ServicioSAP.Catalogo> Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
try
|
|
{
|
|
Resultados = new SAPServicioIntegracionAPIController().ObtenerCatalogos(filtro, (int)ULA.Cathay.Credito.ServicioSAP.TiposCatalgo.CategoriaRiesgo);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "0", descripcion = "Problema al consultar SAP. No fue posible obtener la respueas de SAP" });
|
|
|
|
log.Error(ex);
|
|
}
|
|
|
|
return Resultados;
|
|
}
|
|
#endregion
|
|
|
|
#region 10 - ObtenerSAPDeudoresGeneracionMonedaExtranjera
|
|
/// <summary>
|
|
/// Numero de Catalogo = 10 - Generador Moneda Extranjera
|
|
/// </summary>
|
|
/// <param name="filtro"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<ULA.Cathay.Credito.ServicioSAP.Catalogo> ObtenerSAPDeudoresGeneracionMonedaExtranjera(string filtro = null, int id = 0)
|
|
{
|
|
|
|
List<ULA.Cathay.Credito.ServicioSAP.Catalogo> Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
try
|
|
{
|
|
Resultados = new SAPServicioIntegracionAPIController().ObtenerCatalogos(filtro, (int)ULA.Cathay.Credito.ServicioSAP.TiposCatalgo.GeneradorMonedaExtrangera);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "0", descripcion = "Problema al consultar SAP. No fue posible obtener la respueas de SAP" });
|
|
|
|
log.Error(ex);
|
|
}
|
|
|
|
return Resultados;
|
|
}
|
|
#endregion
|
|
|
|
#region 12 - ObtenerSAPActividadSectorEconomicoSUGEF
|
|
/// <summary>
|
|
/// Numero de Catalogo = 12 - Sector Economico
|
|
/// </summary>
|
|
/// <param name="filtro"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<ULA.Cathay.Credito.ServicioSAP.Catalogo> ObtenerSAPActividadSectorEconomicoSUGEF(string filtro = null, int id = 0)
|
|
{
|
|
|
|
List<ULA.Cathay.Credito.ServicioSAP.Catalogo> Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
try
|
|
{
|
|
Resultados = new SAPServicioIntegracionAPIController().ObtenerCatalogos(filtro, (int)ULA.Cathay.Credito.ServicioSAP.TiposCatalgo.SectorEconomico);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "0", descripcion = "Problema al consultar SAP. No fue posible obtener la respueas de SAP" });
|
|
|
|
log.Error(ex);
|
|
}
|
|
|
|
return Resultados;
|
|
}
|
|
#endregion
|
|
|
|
#region 13 - ObtenerSAPDeudoresRiesgoCambiario
|
|
/// <summary>
|
|
/// Numero de Catalogo = 13 - Riesgo Cambiario
|
|
/// </summary>
|
|
/// <param name="filtro"></param>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public List<ULA.Cathay.Credito.ServicioSAP.Catalogo> ObtenerSAPDeudoresRiesgoCambiario(string filtro = null, int id = 0)
|
|
{
|
|
|
|
List<ULA.Cathay.Credito.ServicioSAP.Catalogo> Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
try
|
|
{
|
|
Resultados = new SAPServicioIntegracionAPIController().ObtenerCatalogos(filtro, (int)ULA.Cathay.Credito.ServicioSAP.TiposCatalgo.RiesgoCambiario);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Resultados = new List<ULA.Cathay.Credito.ServicioSAP.Catalogo>();
|
|
Resultados.Add(new ULA.Cathay.Credito.ServicioSAP.Catalogo() { codigo = "0", descripcion = "Problema al consultar SAP. No fue posible obtener la respueas de SAP" });
|
|
|
|
log.Error(ex);
|
|
}
|
|
|
|
return Resultados;
|
|
}
|
|
#endregion
|
|
|
|
|
|
#endregion
|
|
|
|
#region Encriptar
|
|
[HttpGet]
|
|
public string Encriptar(string Cadena)
|
|
{
|
|
string repuesta = string.Empty;
|
|
Crypt crypt = new Crypt();
|
|
try
|
|
{
|
|
repuesta = crypt.EncryptString(Cadena);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
log.Error(ex);
|
|
}
|
|
return repuesta;
|
|
}
|
|
#endregion
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoHojaPendiente(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoHojaPendiente.Where(t => t.Estado == true) : db.TipoHojaPendiente.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoHojaPendiente.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
}
|
|
} |