879 lines
No EOL
32 KiB
C#
879 lines
No EOL
32 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Http;
|
|
using ULA.Cathay.ModuloMantenimiento.Json;
|
|
using ULA.Cathay.ModuloMantenimiento.Commons;
|
|
using Ultimus.Interfaces.UltimusForm;
|
|
using Ultimus.Interfaces;
|
|
using Ultimus.Utilitarios;
|
|
using ULA.Cathay.CreditoModel.Credito;
|
|
using ULA.Cathay.CreditoModel.Entidades;
|
|
using System.Data.Entity;
|
|
using Ultimus.Interfaces.UltimusIntegration;
|
|
using ULA.Cathay.CreditoModel.DAL.Credito;
|
|
|
|
|
|
namespace ULA.Cathay.ModuloMantenimiento.ControllersWebApi
|
|
{
|
|
public class GlobalAPIController : ApiController
|
|
{
|
|
UltimusLogs log = new UltimusLogs("GlobalAPI");
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoCategoria(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
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();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
#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<JsonCatalogos> 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();
|
|
|
|
registros.AddRange(FuncionariosAnalistasCredito);
|
|
}
|
|
#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
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoFacilidad(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoFacilidad.Where(t => t.Estado == true) : db.TipoFacilidad.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoFacilidad.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoControlCriterio(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoControlCriterio.Where(t => t.Estado == true) : db.TipoControlCriterio.Where(t => t.Estado == true && t.DescripcionTipoCriterio.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoControlCriterio.ToString(),
|
|
descripcion = t.DescripcionTipoCriterio
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerSubTipoSeleccion(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoSeleccion.Where(t => t.Estado == true) : db.TipoSeleccion.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoSeleccion.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[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;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerNacionalidad(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.Nacionalidad.Where(t => t.Estado == true) : db.Nacionalidad.Where(t => t.Estado == true && t.Pais.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdNacionalidad.ToString(),
|
|
descripcion = t.Pais
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerSeleccion(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoSeleccion.Where(t => t.Estado == true) : db.TipoSeleccion.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoSeleccion.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[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
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[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;
|
|
}
|
|
|
|
[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;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoIngreso(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;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoDocumento(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoDocumento.Where(t => t.Estado == true) : db.TipoDocumento.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoDocumento.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerCategoriaTipoDocumento(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.CategoriaTipoDocumento.Where(t => t.Estado == true) : db.CategoriaTipoDocumento.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdCategoriaTipoDocumento.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoExpediente(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoExpediente.Where(t => t.Estado == true) : db.TipoExpediente.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoExpediente.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerUbicacion(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.UbicacionEPower.Where(t => t.Estado == true) : db.UbicacionEPower.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdUbicacionEp.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerComiteCredito(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.ComiteCredito.Where(t => t.Estado == true) : db.ComiteCredito.Where(t => t.Estado == true && t.NombreComite.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.CodigoComite.ToString(),
|
|
descripcion = t.NombreComite
|
|
}).ToList();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerEstructuraOrgChart(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.EstructuraOrgChart.Where(t => t.Estado == true) : db.EstructuraOrgChart.Where(t => t.Estado == true && t.Name.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdEstructuraOrgChart.ToString(),
|
|
descripcion = t.Name
|
|
}).ToList();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoEstructuraOrgChart(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoEstructuraOrgChart.Where(t => t.Estado == true) : db.TipoEstructuraOrgChart.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoEstructuraOrgChart.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerRolFuncional(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.RolFuncional.Where(t => t.Estado == true) : db.RolFuncional.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdRolFuncional.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoCondicion(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoCondicion.Where(t => t.Estado == true) : db.TipoCondicion.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoCondicion.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerEtapas(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.Etapas.Where(t => t.Estado == true) : db.Etapas.Where(t => t.Estado == true && t.DescripcionEtapa.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdEtapa.ToString(),
|
|
descripcion = t.DescripcionEtapa
|
|
}).ToList();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerVarianteConfiguracionDocumentosLegales(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.VarianteConfiguracionDocumentosLegales : db.VarianteConfiguracionDocumentosLegales.Where(t => t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdVariante.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerCondicionesGeneralesCredito(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.CondicionesGeneralesCredito.Where(t => t.Habilitado == true) : db.CondicionesGeneralesCredito.Where(t => t.Habilitado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdCondicion.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerProcesos(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.Procesos.Where(t => t.Estado == true) : db.Procesos.Where(t => t.Estado == true && t.NombreProceso.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdProceso.ToString(),
|
|
descripcion = t.NombreProceso
|
|
}).ToList();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoRequisito(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoRequisito.Where(t => t.Estado == true) : db.TipoRequisito.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoRequisito.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoSolicitante(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.TipoSolicitante.Where(t => t.Estado == true) : db.TipoSolicitante.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoSolicitante.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerTipoDocumentoEpower(int? filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (filtro == null ? db.TipoDocumentoEpower.Where(t => t.Estado == true) : db.TipoDocumentoEpower.Where(t => t.Estado == true && t.IdUbicacionEp == filtro)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdTipoDocumentoEpower.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerUsuarios_JobFunction_Grupo(int? IdRolFuncional, int? IdEstructuraOrgChart)
|
|
{
|
|
List<UltimusUser> ListaUsuarios = new List<UltimusUser>();
|
|
List<EstructuraOrgChart> ListaEstructuraOrgChart = null;
|
|
List<JsonCatalogos> model = new List<JsonCatalogos>();
|
|
|
|
try
|
|
{
|
|
|
|
ListaEstructuraOrgChart = new EstructuraOrgChartDAL().Obtener(IdRolFuncional, IdEstructuraOrgChart);
|
|
|
|
if (ListaEstructuraOrgChart == null)
|
|
{
|
|
log.Trace(string.Format("No se encontro el jobfunction/Grupo para el Rol Funcional {0} y Estructura Org Chart {1} configurado en la tabla EstructuraOrgChart", IdRolFuncional, IdEstructuraOrgChart));
|
|
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 JsonCatalogos
|
|
{
|
|
codigo = item.strUserName,
|
|
descripcion = item.strUserFullName
|
|
});
|
|
}
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return model;
|
|
}
|
|
|
|
[HttpGet]
|
|
public List<JsonCatalogos> ObtenerSector(string filtro = null)
|
|
{
|
|
List<JsonCatalogos> registros = null;
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
registros = (string.IsNullOrWhiteSpace(filtro) ? db.Sector.Where(t => t.Estado == true) : db.Sector.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true)).Select(t => new JsonCatalogos()
|
|
{
|
|
codigo = t.IdSector.ToString(),
|
|
descripcion = t.Descripcion
|
|
}).ToList();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex);
|
|
}
|
|
|
|
return registros;
|
|
}
|
|
|
|
[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;
|
|
}
|
|
|
|
[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;
|
|
}
|
|
|
|
#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
|
|
|
|
}
|
|
} |