Ajustes para Usuario
This commit is contained in:
parent
320bd6a774
commit
c8a4832b60
@ -21,9 +21,14 @@ namespace MSAdminUsuarios.Context
|
|||||||
public string? TX_PASSWORD_USUMS { get; set; }
|
public string? TX_PASSWORD_USUMS { get; set; }
|
||||||
public int? NU_TIPODOC_USUMS { get; set; }
|
public int? NU_TIPODOC_USUMS { get; set; }
|
||||||
public int? NU_PK_USUMS { get; set; }
|
public int? NU_PK_USUMS { get; set; }
|
||||||
|
|
||||||
public string? CL_FIRMA_USUMS { get; set; }
|
public string? CL_FIRMA_USUMS { get; set; }
|
||||||
|
public int? BL_PERTENCEIPS_USUMS { get; set; }
|
||||||
|
public string? TX_NOMBRE_PVD { get; set; }
|
||||||
|
public int? BL_VIENELDAP_USUMS { get; set; }
|
||||||
|
public int? NU_GRUPO_USUMS { get; set; }
|
||||||
|
public int? NU_CARGO_USUMS { get; set; }
|
||||||
|
public int? NU_MODALIDADCTT_USUMS { get; set; }
|
||||||
|
public string? TX_SEDES_USUMS { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using Security;
|
|||||||
using MSAdminUsuarios.Models;
|
using MSAdminUsuarios.Models;
|
||||||
using Microsoft.AspNetCore.Components.Forms;
|
using Microsoft.AspNetCore.Components.Forms;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.Configuration;
|
||||||
|
|
||||||
namespace MSAdminUsuarios.Controllers
|
namespace MSAdminUsuarios.Controllers
|
||||||
{
|
{
|
||||||
@ -86,11 +87,11 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<USUARIO> consulta = new List<USUARIO>();
|
List<UsuarioDTO> consulta = new List<UsuarioDTO>();
|
||||||
|
|
||||||
consulta = (from dm in _context.USUARIOSMs
|
consulta = (from dm in _context.USUARIOSMs
|
||||||
where dm.NU_ESTADO_USUMS >= 0
|
where dm.NU_ESTADO_USUMS >= 0
|
||||||
select dm).ToList();
|
select new UsuarioDTO(dm)).ToList();
|
||||||
|
|
||||||
return Ok(consulta);
|
return Ok(consulta);
|
||||||
}
|
}
|
||||||
@ -100,6 +101,66 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* identificacion public string TX_PKDOC_USUMS { get; set; } = null!;
|
||||||
|
* pk public int? NU_PK_USUMS { get; set; }
|
||||||
|
*/
|
||||||
|
[HttpGet("/Usuario")]
|
||||||
|
public async Task<IActionResult> GetUsuario(int? clave, string? documento)
|
||||||
|
{
|
||||||
|
ErrorModel _errorModel = new ErrorModel();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (clave == null && documento == null)
|
||||||
|
{
|
||||||
|
_errorModel.error = true;
|
||||||
|
_errorModel.cuerpo.Add("Sin datos de busqueda.");
|
||||||
|
return Conflict(_errorModel);
|
||||||
|
}
|
||||||
|
if (clave != null) {
|
||||||
|
var consulta = await _context.USUARIOSMs.FirstOrDefaultAsync(u => u.NU_PK_USUMS == clave);
|
||||||
|
if (consulta != null) return Ok(consulta);
|
||||||
|
}
|
||||||
|
if (documento != null) {
|
||||||
|
|
||||||
|
var consulta = await _context.USUARIOSMs.FirstOrDefaultAsync(u => u.TX_PKDOC_USUMS == documento);
|
||||||
|
if (consulta != null) return Ok(consulta);
|
||||||
|
}
|
||||||
|
_errorModel.error = true;
|
||||||
|
_errorModel.cuerpo.Add("No se encontró coincidencia.");
|
||||||
|
return Conflict(_errorModel);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_errorModel.error = true;
|
||||||
|
_errorModel.cuerpo.Add("Problema con la base de datos.");
|
||||||
|
return BadRequest(_errorModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*[HttpGet("ConsultaFirma")]
|
||||||
|
public async Task<IActionResult> GetFirma(string TX_IDENTIFICACION_AFIL)
|
||||||
|
{
|
||||||
|
ErrorModel _errorModel = new ErrorModel();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
USUARIO usuario = await _context.USUARIOSMs.OrderBy(u => u.NU_PK_USUMS).FirstOrDefaultAsync(u => u.TX_PKDOC_USUMS == TX_IDENTIFICACION_AFIL);
|
||||||
|
|
||||||
|
if (usuario == null)
|
||||||
|
{
|
||||||
|
_errorModel.error = true;
|
||||||
|
_errorModel.cuerpo.Add("Usuario no existe");
|
||||||
|
return Conflict(_errorModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(usuario.CL_FIRMA_USUMS);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IActionResult> GuardarUsuarios(USUARIO usuario)
|
public async Task<IActionResult> GuardarUsuarios(USUARIO usuario)
|
||||||
@ -174,13 +235,22 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
existe.TX_TELEFONO_USUMS = editado.TX_TELEFONO_USUMS;
|
existe.TX_TELEFONO_USUMS = editado.TX_TELEFONO_USUMS;
|
||||||
existe.TX_CORREO_USUMS = editado.TX_CORREO_USUMS;
|
existe.TX_CORREO_USUMS = editado.TX_CORREO_USUMS;
|
||||||
existe.TX_DIRECCION_USUMS = editado.TX_DIRECCION_USUMS;
|
existe.TX_DIRECCION_USUMS = editado.TX_DIRECCION_USUMS;
|
||||||
|
existe.BL_PERTENCEIPS_USUMS = editado.BL_PERTENCEIPS_USUMS;
|
||||||
|
existe.TX_NOMBRE_PVD = editado.TX_NOMBRE_PVD;
|
||||||
|
existe.BL_VIENELDAP_USUMS = editado.BL_VIENELDAP_USUMS;
|
||||||
|
existe.NU_GRUPO_USUMS = editado.NU_GRUPO_USUMS;
|
||||||
|
existe.NU_CARGO_USUMS = editado.NU_CARGO_USUMS;
|
||||||
|
existe.NU_MODALIDADCTT_USUMS = editado.NU_MODALIDADCTT_USUMS;
|
||||||
|
existe.TX_SEDES_USUMS = editado.TX_SEDES_USUMS;
|
||||||
|
|
||||||
|
|
||||||
ErrorModel errorPFLxUSUMS = await ActualizarRelaciones(existe.TX_PKDOC_USUMS, editado.TX_PKDOC_USUMS);
|
ErrorModel errorPFLxUSUMS = await ActualizarRelaciones(existe.TX_PKDOC_USUMS, editado.TX_PKDOC_USUMS);
|
||||||
|
|
||||||
if (errorPFLxUSUMS.error == true)
|
if (errorPFLxUSUMS.error == true)
|
||||||
{
|
{
|
||||||
_errorModel.listaErrores.Add(errorPFLxUSUMS.cuerpo[0]);
|
_errorModel.listaErrores.Add(errorPFLxUSUMS.cuerpo[0]);
|
||||||
return Conflict(_errorModel);
|
//return Conflict(_errorModel);
|
||||||
|
throw new Exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
_errorModel.listaErrores.Add(errorPFLxUSUMS.cuerpo[0]);
|
_errorModel.listaErrores.Add(errorPFLxUSUMS.cuerpo[0]);
|
||||||
|
@ -1,7 +1,21 @@
|
|||||||
namespace MSAdminUsuarios.Dto
|
using System.Reflection;
|
||||||
|
using MSAdminUsuarios.Context;
|
||||||
|
|
||||||
|
namespace MSAdminUsuarios.Dto
|
||||||
{
|
{
|
||||||
public class UsuarioDTO
|
public class UsuarioDTO
|
||||||
{
|
{
|
||||||
|
public UsuarioDTO(USUARIO usuario)
|
||||||
|
{
|
||||||
|
foreach (PropertyInfo prop in usuario.GetType().GetProperties())
|
||||||
|
{
|
||||||
|
var valor = prop.GetValue(usuario, null);
|
||||||
|
string key = prop.Name;
|
||||||
|
if (valor == null) continue;
|
||||||
|
|
||||||
|
this.GetType().GetProperty(key)?.SetValue(this, valor);
|
||||||
|
}
|
||||||
|
}
|
||||||
public string TX_PKDOC_USUMS { get; set; } = null!;
|
public string TX_PKDOC_USUMS { get; set; } = null!;
|
||||||
public string? TX_LOGINNAME_USUMS { get; set; }
|
public string? TX_LOGINNAME_USUMS { get; set; }
|
||||||
public string? TX_PRIMERNOM_USUMS { get; set; }
|
public string? TX_PRIMERNOM_USUMS { get; set; }
|
||||||
@ -12,9 +26,16 @@
|
|||||||
public string? TX_TELEFONO_USUMS { get; set; }
|
public string? TX_TELEFONO_USUMS { get; set; }
|
||||||
public string? TX_CELULAR_USUMS { get; set; }
|
public string? TX_CELULAR_USUMS { get; set; }
|
||||||
public string? TX_CORREO_USUMS { get; set; }
|
public string? TX_CORREO_USUMS { get; set; }
|
||||||
public int? NU_ESTADO_USUMS { get; set; } = 1;
|
public int? NU_ESTADO_USUMS { get; set; }
|
||||||
public string? TX_PASSWORD_USUMS { get; set; }
|
public string? TX_PASSWORD_USUMS { get; set; }
|
||||||
public int? NU_TIPODOC_USUMS { get; set; }
|
public int? NU_TIPODOC_USUMS { get; set; }
|
||||||
public int? NU_PK_USUMS { get; set; }
|
public int? NU_PK_USUMS { get; set; }
|
||||||
|
public int? BL_PERTENCEIPS_USUMS { get; set; }
|
||||||
|
public string? TX_NOMBRE_PVD { get; set; }
|
||||||
|
public int? BL_VIENELDAP_USUMS { get; set; }
|
||||||
|
public int? NU_GRUPO_USUMS { get; set; }
|
||||||
|
public int? NU_CARGO_USUMS { get; set; }
|
||||||
|
public int? NU_MODALIDADCTT_USUMS { get; set; }
|
||||||
|
public string? TX_SEDES_USUMS { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user