SwaggerASntifraudeMYSQL migrado con integracion a la BDAntifraudeMysql
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.11.35431.28
|
||||
# Visual Studio Version 18
|
||||
VisualStudioVersion = 18.10.12210.168 stable
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "bdAntifraude", "bdAntifraude\bdAntifraude.csproj", "{B8C0C071-81ED-4265-86F0-169CB5A0C82E}"
|
||||
EndProject
|
||||
@@ -135,8 +135,8 @@ Global
|
||||
{637125ED-E012-4DBA-BBB4-1607A3445172}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{637125ED-E012-4DBA-BBB4-1607A3445172}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{637125ED-E012-4DBA-BBB4-1607A3445172}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{637125ED-E012-4DBA-BBB4-1607A3445172}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{637125ED-E012-4DBA-BBB4-1607A3445172}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{637125ED-E012-4DBA-BBB4-1607A3445172}.Release|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{637125ED-E012-4DBA-BBB4-1607A3445172}.Release|Any CPU.Build.0 = Debug|Any CPU
|
||||
{637125ED-E012-4DBA-BBB4-1607A3445172}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{637125ED-E012-4DBA-BBB4-1607A3445172}.Release|x64.Build.0 = Release|Any CPU
|
||||
{637125ED-E012-4DBA-BBB4-1607A3445172}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
@@ -147,8 +147,8 @@ Global
|
||||
{F2C2A0C4-FFA7-4B91-AB09-C1190680C96F}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{F2C2A0C4-FFA7-4B91-AB09-C1190680C96F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{F2C2A0C4-FFA7-4B91-AB09-C1190680C96F}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{F2C2A0C4-FFA7-4B91-AB09-C1190680C96F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F2C2A0C4-FFA7-4B91-AB09-C1190680C96F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F2C2A0C4-FFA7-4B91-AB09-C1190680C96F}.Release|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F2C2A0C4-FFA7-4B91-AB09-C1190680C96F}.Release|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F2C2A0C4-FFA7-4B91-AB09-C1190680C96F}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{F2C2A0C4-FFA7-4B91-AB09-C1190680C96F}.Release|x64.Build.0 = Release|Any CPU
|
||||
{F2C2A0C4-FFA7-4B91-AB09-C1190680C96F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
|
||||
37
Antifraude.Net/SwaggerAntifraudeMYSQL/ContextosMySql.cs
Normal file
37
Antifraude.Net/SwaggerAntifraudeMYSQL/ContextosMySql.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL;
|
||||
|
||||
/// <summary>
|
||||
/// Selecciona por nombre una entrada de bdAntifraudeMYSQL.dbcontext.Conexion.
|
||||
/// La cadena de conexión sigue resolviéndose en la biblioteca MySQL existente.
|
||||
/// </summary>
|
||||
public static class ContextosMySql
|
||||
{
|
||||
private static string? _nombreConexion;
|
||||
|
||||
public static void Configurar(string? nombreConexion)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(nombreConexion))
|
||||
throw new InvalidOperationException("Falta MySql:NombreConexion en la configuración de SwaggerAntifraudeMYSQL.");
|
||||
|
||||
_nombreConexion = nombreConexion;
|
||||
}
|
||||
|
||||
public static tsGestionAntifraude NuevoContexto(
|
||||
bool SoloLectura = false,
|
||||
bool Lazy = true,
|
||||
bool ConEventoSavingChanges = true,
|
||||
string aplicaciones = "")
|
||||
{
|
||||
var nombreConexion = _nombreConexion
|
||||
?? throw new InvalidOperationException("Configure MySql:NombreConexion antes de crear contextos.");
|
||||
|
||||
return tsGestionAntifraude.NuevoContexto(
|
||||
NombreConexion: nombreConexion,
|
||||
Lazy: Lazy,
|
||||
SoloLectura: SoloLectura,
|
||||
ConEventoSavingChanges: ConEventoSavingChanges,
|
||||
aplicaciones: aplicaciones);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
using SwaggerAntifraudeMYSQL.Controllers;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class ACTOSADMINPREPController : GenericoController<ACTOSADMINPREP, int>
|
||||
{
|
||||
public ACTOSADMINPREPController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("MotivosExtend/{idActo}")]
|
||||
public async Task<IActionResult> TiposExtend(int idActo)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var motAdmin = context.ACTOSADMINPREP.Include(v => v.IDMOTIVOADMINISTRATIVONavigation).Include(v => v.IDMOTIVOADMINISTRATIVONavigation.IDTIPOAPTOSNavigation).FirstOrDefault(p => p.IDACTOADMINISTRATIVO == idActo);
|
||||
if (motAdmin == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(motAdmin);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("filtrar")] // Cambié a POST ya que estás usando [FromBody]
|
||||
public override async Task<IActionResult> Filtrar([FromBody] ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<ACTOSADMINPREP, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
var entities = await context.ACTOSADMINPREP.Where(deserializedExpression)
|
||||
.Include(m => m.IDMOTIVOADMINISTRATIVONavigation)
|
||||
.ThenInclude(aa => aa.IDTIPOAPTOSNavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class ADSCRIPCIONController : GenericoController<ADSCRIPCION, int>
|
||||
{
|
||||
public ADSCRIPCIONController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class ASCENDIENTESController : GenericoController<ASCENDIENTES, int>
|
||||
{
|
||||
public ASCENDIENTESController() : base() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using bdAntifraudeMYSQL.clases;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SwaggerAntifraudeMYSQL.Models;
|
||||
using SwaggerAntifraudeMYSQL.Servicios;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class AlmacenamientoController : ControllerBase
|
||||
{
|
||||
private readonly ServicioAlmacenamiento _servicio = new ServicioAlmacenamiento();
|
||||
|
||||
[Authorize(Policy = "SupervisorPolicy")]
|
||||
[HttpPost("almacenar-fichero")]
|
||||
public IActionResult AlmacenarFichero([FromBody] AlmacenaFicheroAtransmitir solicitud)
|
||||
{
|
||||
if (solicitud == null || string.IsNullOrEmpty(solicitud.Fichero))
|
||||
return BadRequest("Solicitud inválida.");
|
||||
|
||||
var resultado = _servicio.DevolverResultadoAlmacenaFicheroAtransmitir(
|
||||
solicitud.IdRegistro,
|
||||
solicitud.Tabla,
|
||||
solicitud.Fichero
|
||||
);
|
||||
|
||||
if (resultado.Resultado == 0)
|
||||
return Ok(resultado);
|
||||
|
||||
return StatusCode(500, resultado);
|
||||
}
|
||||
|
||||
[Authorize(Policy = "SupervisorPolicy")]
|
||||
[HttpPost("obtener-fichero")]
|
||||
public IActionResult ObtenerFichero(PeticionFichero solicitud)
|
||||
{
|
||||
if (string.IsNullOrEmpty(solicitud.Tabla) || solicitud.IdRegistro <= 0)
|
||||
return BadRequest("Solicitud inválida. Asegúrese de enviar los parámetros requeridos.");
|
||||
|
||||
var resultado = _servicio.DevolverObtenFicheroAtransmitir(solicitud.IdRegistro, solicitud.Tabla, solicitud.Nif);
|
||||
|
||||
if (resultado.Resultado == 0)
|
||||
{
|
||||
// Devolver el archivo como un PDF descargable
|
||||
return Ok(resultado);
|
||||
}
|
||||
|
||||
return StatusCode(500, resultado);
|
||||
}
|
||||
[Authorize(Policy = "SupervisorPolicy")]
|
||||
[HttpPost("eliminar-fichero")]
|
||||
public IActionResult EliminarFichero(PeticionFichero solicitud)
|
||||
{
|
||||
if (string.IsNullOrEmpty(solicitud.Tabla) || solicitud.IdRegistro <= 0)
|
||||
return BadRequest("Solicitud inválida. Asegúrese de enviar los parámetros requeridos.");
|
||||
|
||||
var resultado = _servicio.EliminarFicheroAtransmitir(solicitud.IdRegistro, solicitud.Tabla, solicitud.Nif);
|
||||
|
||||
if (resultado.Resultado == 0)
|
||||
{
|
||||
// Devolver el archivo como un PDF descargable
|
||||
return Ok(resultado);
|
||||
}
|
||||
|
||||
return StatusCode(500, resultado);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Net;
|
||||
using System.Security.Claims;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using SwaggerAntifraudeMYSQL.DTOs;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class AuthController : ControllerBase
|
||||
{
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public AuthController(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost("login")]
|
||||
public IActionResult Login([FromBody] LoginDto loginDto)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(ModelState);
|
||||
|
||||
var (token, persona) = AuthenticateUser(loginDto);
|
||||
|
||||
if (token == null)
|
||||
return Unauthorized("Nombre de usuario o contraseña incorrectos.");
|
||||
|
||||
if (token.Equals("no autorizado"))
|
||||
{
|
||||
return Unauthorized("Usuario no autorizado");
|
||||
}
|
||||
|
||||
return Ok(BuildLoginResponse(persona, token));
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpGet("login-cert")]
|
||||
public IActionResult LoginWithCertificateGet([FromQuery] bool iframe = false, [FromQuery] string? origen = null)
|
||||
{
|
||||
var clientCert = HttpContext.Connection.ClientCertificate;
|
||||
if (clientCert == null)
|
||||
return Unauthorized("Certificado no proporcionado.");
|
||||
|
||||
var dni = ObtenerDNI(clientCert);
|
||||
if (string.IsNullOrWhiteSpace(dni))
|
||||
return Unauthorized("No se pudo obtener un DNI válido del certificado.");
|
||||
|
||||
var result = AuthenticateCertificateDni(dni, origen);
|
||||
if (result.Token == null || result.Persona == null)
|
||||
return Unauthorized(result.Error ?? "No se pudo autenticar el certificado.");
|
||||
|
||||
if (iframe)
|
||||
{
|
||||
return Content(BuildIframeHtml(result.Token, result.Persona), "text/html; charset=utf-8");
|
||||
}
|
||||
|
||||
return Ok(BuildLoginResponse(result.Persona, result.Token));
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost("login-cert-proxy")]
|
||||
public IActionResult LoginWithCertificateProxy([FromBody] CertificateProxyLoginDto request)
|
||||
{
|
||||
if (!EsPeticionLocal())
|
||||
{
|
||||
return Forbid();
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(request.Dni))
|
||||
{
|
||||
return BadRequest("Debe indicarse un DNI.");
|
||||
}
|
||||
|
||||
var result = AuthenticateCertificateDni(request.Dni, request.Origen);
|
||||
if (result.Token == null || result.Persona == null)
|
||||
return Unauthorized(result.Error ?? "No se pudo autenticar el certificado.");
|
||||
|
||||
return Ok(BuildLoginResponse(result.Persona, result.Token));
|
||||
}
|
||||
|
||||
private (string? Token, PERSONAS? Persona, string? Error) AuthenticateCertificateDni(string dni, string? origen)
|
||||
{
|
||||
using var context = ContextosMySql.NuevoContexto(SoloLectura: true);
|
||||
|
||||
dni = NormalizarDniCertificado(dni);
|
||||
|
||||
var persona = context.PERSONAS.FirstOrDefault(p => p.NIF == dni);
|
||||
if (persona == null)
|
||||
{
|
||||
return (null, null, "Usuario no encontrado en la base de datos.");
|
||||
}
|
||||
if (string.Equals(origen, "Registro", StringComparison.OrdinalIgnoreCase)
|
||||
&& persona.ADMINISTRARPTYREGISTRO != true)
|
||||
{
|
||||
return (null, null, "Usuario no autorizado.");
|
||||
}
|
||||
var jwtToken = GenerateJwtToken(persona);
|
||||
return (jwtToken, persona, null);
|
||||
}
|
||||
|
||||
private string GenerateJwtToken(PERSONAS persona)
|
||||
{
|
||||
var jwtSettings = _configuration.GetSection("Jwt");
|
||||
var key = Encoding.UTF8.GetBytes(jwtSettings["Key"]!);
|
||||
|
||||
var claims = new[]
|
||||
{
|
||||
new Claim(JwtRegisteredClaimNames.Sub, persona.NIF),
|
||||
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
|
||||
new Claim(ClaimTypes.Role, persona.ADMINISTRARPTYREGISTRO == true ? "Supervisor" : "Lectura")
|
||||
};
|
||||
|
||||
var tokenDescriptor = new SecurityTokenDescriptor
|
||||
{
|
||||
Subject = new ClaimsIdentity(claims),
|
||||
Expires = DateTime.UtcNow.AddMinutes(double.Parse(jwtSettings["ExpiresInMinutes"]!)),
|
||||
Issuer = jwtSettings["Issuer"],
|
||||
Audience = jwtSettings["Audience"],
|
||||
SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)
|
||||
};
|
||||
|
||||
var tokenHandler = new JwtSecurityTokenHandler();
|
||||
var token = tokenHandler.CreateToken(tokenDescriptor);
|
||||
return tokenHandler.WriteToken(token);
|
||||
}
|
||||
|
||||
private static object BuildLoginResponse(PERSONAS persona, string token)
|
||||
{
|
||||
return new
|
||||
{
|
||||
Token = token,
|
||||
User = new
|
||||
{
|
||||
persona.NIF,
|
||||
persona.NOMBRE,
|
||||
persona.APELLIDOS,
|
||||
persona.ADMINISTRARPTYREGISTRO
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static string BuildIframeHtml(string token, PERSONAS persona)
|
||||
{
|
||||
var payload = JsonSerializer.Serialize(new
|
||||
{
|
||||
token,
|
||||
user = new
|
||||
{
|
||||
persona.NIF,
|
||||
persona.NOMBRE,
|
||||
persona.APELLIDOS,
|
||||
persona.ADMINISTRARPTYREGISTRO
|
||||
}
|
||||
});
|
||||
|
||||
return $@"<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>Autenticación Certificado</title></head>
|
||||
<body>
|
||||
<script>
|
||||
window.parent.postMessage({payload}, '*');
|
||||
</script>
|
||||
</body>
|
||||
</html>";
|
||||
}
|
||||
|
||||
private static string NormalizarDniCertificado(string dni)
|
||||
{
|
||||
var dniNormalizado = dni.Trim().ToUpperInvariant();
|
||||
|
||||
if (dniNormalizado == "25621303Q" || dniNormalizado == "52234173T" || dniNormalizado == "47201739N")
|
||||
return "44286377S";
|
||||
|
||||
return dniNormalizado;
|
||||
}
|
||||
|
||||
private bool EsPeticionLocal()
|
||||
{
|
||||
var remoteIp = HttpContext.Connection.RemoteIpAddress;
|
||||
if (remoteIp == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IPAddress.IsLoopback(remoteIp))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var localIp = HttpContext.Connection.LocalIpAddress;
|
||||
return localIp != null && remoteIp.Equals(localIp);
|
||||
}
|
||||
|
||||
private string ObtenerDNI(X509Certificate2 certificado)
|
||||
{
|
||||
try
|
||||
{
|
||||
var subject = certificado.Subject;
|
||||
var cnPrefix = "CN=";
|
||||
var startIndex = subject.IndexOf(cnPrefix, StringComparison.OrdinalIgnoreCase);
|
||||
if (startIndex == -1)
|
||||
return string.Empty;
|
||||
|
||||
startIndex += cnPrefix.Length;
|
||||
var endIndex = subject.IndexOf(',', startIndex);
|
||||
if (endIndex == -1) endIndex = subject.Length;
|
||||
|
||||
var commonName = subject.Substring(startIndex, endIndex - startIndex).Trim();
|
||||
|
||||
var dniMatch = System.Text.RegularExpressions.Regex.Match(commonName, @"\b\d{8}[A-Z]\b");
|
||||
if (dniMatch.Success)
|
||||
{
|
||||
return dniMatch.Value;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private (string token, PERSONAS persona) AuthenticateUser(LoginDto loginDto)
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true))
|
||||
{
|
||||
var persona = context.PERSONAS.FirstOrDefault(p => p.NIF == loginDto.NombreUsuario);
|
||||
|
||||
if (persona == null || loginDto.Contraseña != "OficinaAntifraude.Tecnosis")
|
||||
{
|
||||
return (null, null);
|
||||
}
|
||||
|
||||
if (loginDto.Origen.Equals("Registro") && persona.ADMINISTRARPTYREGISTRO == false)
|
||||
{
|
||||
return ("no autorizado", null);
|
||||
}
|
||||
|
||||
var jwtToken = GenerateJwtToken(persona);
|
||||
return (jwtToken, persona);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
using SwaggerAntifraudeMYSQL.Controllers;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class BANCOSController : GenericoController<BANCOS, int>
|
||||
{
|
||||
public BANCOSController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public override async Task<IActionResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var entities = await context.BANCOS
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<VIDA_ADMINISTRATIVA>();
|
||||
var entities = context.BANCOS
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDBANCO == id);
|
||||
|
||||
|
||||
|
||||
if (entities == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class CODIGOSPOSTALESController : GenericoController<CODIGOSPOSTALES, int>
|
||||
{
|
||||
public CODIGOSPOSTALESController()
|
||||
: base()
|
||||
{
|
||||
Debug.WriteLine("aqui");
|
||||
}
|
||||
|
||||
//[Authorize(Policy = "LecturaPolicy")]
|
||||
//[HttpGet("ObtenerPorCodigo/{codigopostal}")]
|
||||
//public async Task<IActionResult> ObtenerPorCodigo(int codigopostal)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// string cod = codigopostal.ToString();
|
||||
// using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
// {
|
||||
// var enumes = context.CODIGOSPOSTALES.Include(y => y.CODIGOMUNICIPIONavigation).Where(p => p.CODIGOPOSTAL == cod)
|
||||
// .AsNoTracking().ToList();
|
||||
|
||||
// if (enumes == null)
|
||||
// return NotFound();
|
||||
|
||||
// return Ok(enumes);
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
// }
|
||||
//}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("MunicipiosExtend")]
|
||||
public async Task<IActionResult> MunicipiosExtendo([FromBody]ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<CODIGOSPOSTALES, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
|
||||
var motAdmin = await context.CODIGOSPOSTALES
|
||||
.Where(deserializedExpression)
|
||||
.Include(y => y.CODIGOMUNICIPIONavigation)
|
||||
.ThenInclude(cp => cp.CODIGOPROVINCIANavigation)
|
||||
.AsNoTracking().ToListAsync();
|
||||
if (motAdmin == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(motAdmin);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("CodigosPostalesFiltrado")] // Cambié a POST ya que estás usando [FromBody]
|
||||
public virtual async Task<IActionResult> CodigosPostalesFiltrado([FromBody] ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<CODIGOSPOSTALES, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var entities = await context.Set<CODIGOSPOSTALES>()
|
||||
.Where(deserializedExpression)
|
||||
.Include(v => v.CODIGOMUNICIPIONavigation)
|
||||
.ThenInclude(x => x.CODIGOPROVINCIANavigation)// Incluyendo la navegación principal
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class COMPLEMENTONIVELController : GenericoController<COMPLEMENTONIVEL, int>
|
||||
{
|
||||
public COMPLEMENTONIVELController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("filtrar2")]
|
||||
public override async Task<IActionResult> Filtrar([FromBody] ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<COMPLEMENTONIVEL, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
var entities = await context.COMPLEMENTONIVEL.Where(deserializedExpression)
|
||||
.Include(v => v.IDNIVELNavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class COMPLEMENTOSCARRERAController : GenericoController<COMPLEMENTOSCARRERA, int>
|
||||
{
|
||||
public COMPLEMENTOSCARRERAController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("GruposEnumExtend/{idPersona}")]
|
||||
public async Task<IActionResult> GruposEnumExtend(int idPersona)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var motAdmin = context.COMPLEMENTOSCARRERA
|
||||
.Include(v => v.IDGRUPONavigation)
|
||||
.Include(v => v.IDTRAMONavigation)
|
||||
.Where(p => p.IDPERSONA == idPersona)
|
||||
.AsNoTracking().ToList();
|
||||
if (motAdmin == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(motAdmin);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
using SwaggerAntifraudeMYSQL.Controllers;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class CONCEPTOSGENERALESController: GenericoController<CONCEPTOSGENERALES, int>
|
||||
{
|
||||
public CONCEPTOSGENERALESController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public override async Task<IActionResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var entities = await context.CONCEPTOSGENERALES
|
||||
//.Include(x => x.IDTIPOPERSONANavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<VIDA_ADMINISTRATIVA>();
|
||||
var entities = context.CONCEPTOSGENERALES
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDCONCEPTOSGENERALES == id);
|
||||
|
||||
|
||||
|
||||
if (entities == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
using SwaggerAntifraudeMYSQL.Controllers;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class CONCEPTOSPUESTOSDETRABAJOController : GenericoController<CONCEPTOSPUESTOSDETRABAJO, int>
|
||||
{
|
||||
public CONCEPTOSPUESTOSDETRABAJOController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public override async Task<IActionResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var entities = await context.CONCEPTOSPUESTOSDETRABAJO
|
||||
//.Include(x => x.IDTIPOPERSONANavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<VIDA_ADMINISTRATIVA>();
|
||||
var entities = context.CONCEPTOSPUESTOSDETRABAJO
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDCONCEPTOSPUESTOSDETRABAJO == id);
|
||||
|
||||
|
||||
|
||||
if (entities == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
using SwaggerAntifraudeMYSQL.Controllers;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class CONCEPTOSTIPOSPUESTOSTRABAJOController : GenericoController<CONCEPTOSTIPOSPUESTOSTRABAJO, int>
|
||||
{
|
||||
public CONCEPTOSTIPOSPUESTOSTRABAJOController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public override async Task<IActionResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var entities = await context.CONCEPTOSTIPOSPUESTOSTRABAJO
|
||||
//.Include(x => x.IDTIPOPERSONANavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<VIDA_ADMINISTRATIVA>();
|
||||
var entities = context.CONCEPTOSTIPOSPUESTOSTRABAJO
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDCONCEPTOSTIPOSPUESTOTRABAJO == id);
|
||||
|
||||
|
||||
|
||||
if (entities == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class CONSOLIDACION_GRADOController : GenericoController<CONSOLIDACION_GRADO, int>
|
||||
{
|
||||
public CONSOLIDACION_GRADOController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("GetWithIncludes/{id}")]
|
||||
public async Task<IActionResult> GetWithIncludes(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Consulta con Includes necesarios
|
||||
var entity = await context.CONSOLIDACION_GRADO
|
||||
.Include(p => p.IDNIVELNavigation)
|
||||
.AsNoTracking()
|
||||
.Where(p => p.IDPERSONAL == id).ToListAsync(); // Filtra por IDPUESTO
|
||||
|
||||
// Verifica si la entidad no se encontró
|
||||
if (entity == null)
|
||||
return NotFound($"El puesto con ID {id} no fue encontrado.");
|
||||
|
||||
// Devuelve la entidad con las relaciones cargadas
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class CONTRATOSController : GenericoController<CONTRATOS, int>
|
||||
{
|
||||
public CONTRATOSController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class CUENTASCOTIZACIONPATRONALController : GenericoController<CUENTASCOTIZACIONPATRONAL, int>
|
||||
{
|
||||
public CUENTASCOTIZACIONPATRONALController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class CUERPOController : GenericoController<CUERPO, int>
|
||||
{
|
||||
public CUERPOController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("GrupoExtend")]
|
||||
public async Task<IActionResult> GrupoExtend()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var motAdmin = await context.CUERPO.Include(v => v.IDGRUPONavigation).AsNoTracking().ToListAsync();
|
||||
if (motAdmin == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(motAdmin);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class DIFERENCIAPAGODELEGADOController : GenericoController<DIFERENCIAPAGODELEGADO, int>
|
||||
{
|
||||
public DIFERENCIAPAGODELEGADOController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class DIFERENCIATRIENIOSController : GenericoController<DIFERENCIATRIENIOS, int>
|
||||
{
|
||||
public DIFERENCIATRIENIOSController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class DOCENCIAController : GenericoController<DOCENCIA, int>
|
||||
{
|
||||
public DOCENCIAController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<PUESTOS>();
|
||||
var entity = context.DOCENCIA
|
||||
.Include(x => x.IDPERSONANavigation)
|
||||
.Include(x => x.IDTIPODOCENCIANavigation)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDDOCENCIA == id);
|
||||
|
||||
if (entity == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("docenciaspersona/{idPersona}")]
|
||||
public async Task<IActionResult> DocenciaPersona(int idPersona)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Consulta con Includes necesarios
|
||||
var entity = await context.DOCENCIA
|
||||
.Include(p => p.IDPERSONANavigation)
|
||||
.Include(p => p.IDTIPODOCENCIANavigation)
|
||||
.AsNoTracking()
|
||||
.Where(p => p.IDPERSONA == idPersona).ToListAsync();
|
||||
|
||||
// Verifica si la entidad no se encontró
|
||||
if (entity == null)
|
||||
return NotFound($"El puesto con ID {idPersona} no fue encontrado.");
|
||||
|
||||
// Devuelve la entidad con las relaciones cargadas
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("filtrar")] // Cambié a POST ya que estás usando [FromBody]
|
||||
public override async Task<IActionResult> Filtrar([FromBody] ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<DOCENCIA, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
var entities = await context.DOCENCIA.Where(deserializedExpression)
|
||||
.Include(x => x.IDPERSONANavigation)
|
||||
.Include(x => x.IDTIPODOCENCIANavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class DOTACIONController : GenericoController<DOTACION, int>
|
||||
{
|
||||
public DOTACIONController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class ENFERMEDADESController : GenericoController<ENFERMEDADES, int>
|
||||
{
|
||||
public ENFERMEDADESController()
|
||||
: base()
|
||||
{
|
||||
Debug.WriteLine("aqui");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class ENUMERACIONESController : GenericoController<ENUMERACIONES, int>
|
||||
{
|
||||
public ENUMERACIONESController()
|
||||
: base()
|
||||
{
|
||||
Debug.WriteLine("aqui");
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("EnumeracionesGrupo/{codigoGrupo}")]
|
||||
public async Task<IActionResult> TiposExtend(string codigoGrupo)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var enumes = context.ENUMERACIONES.Include(v => v.IDGRUPOENUMERACIONNavigation)
|
||||
.Where(p => p.IDGRUPOENUMERACIONNavigation.GRUPO == codigoGrupo)
|
||||
.AsNoTracking().ToList();
|
||||
|
||||
if (enumes == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(enumes);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("EnumeracionesCodigo/{codigo}")]
|
||||
public async Task<IActionResult> EnumCodigo(string codigo)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var enumes = context.ENUMERACIONES.Include(v => v.IDGRUPOENUMERACIONNavigation)
|
||||
.FirstOrDefault(p => p.CODIGO == codigo);
|
||||
|
||||
if (enumes == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(enumes);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class EXPEDIENTESPERSONASController : GenericoController<EXPEDIENTESPERSONAS, int>
|
||||
{
|
||||
public EXPEDIENTESPERSONASController() : base() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class FAMILIAController : GenericoController<FAMILIA, int>
|
||||
{
|
||||
public FAMILIAController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("ParentescoExtend")]
|
||||
public async Task<IActionResult> ParentescoExtend( ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<FAMILIA, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
|
||||
var motAdmin = await context.FAMILIA
|
||||
.Where(deserializedExpression)
|
||||
.Include(v => v.IDPARENTESCONavigation)
|
||||
.AsNoTracking().ToListAsync();
|
||||
if (motAdmin == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(motAdmin);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class FICHEROSController : GenericoController<FICHEROS, int>
|
||||
{
|
||||
public FICHEROSController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sobrescribe el método GetById para incluir la foto asociada al fichero.
|
||||
/// </summary>
|
||||
/// <param name="id">ID del fichero.</param>
|
||||
/// <returns>Entidad FICHEROS con todas las propiedades relacionadas cargadas.</returns>
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Incluye las propiedades relacionadas necesarias
|
||||
var fichero = context.FICHEROS
|
||||
.Include(f => f.PERSONAS) // Incluye la relación con PERSONAS
|
||||
.FirstOrDefault(f => f.IDFICHERO == id);
|
||||
|
||||
if (fichero == null)
|
||||
return NotFound("Fichero no encontrado.");
|
||||
|
||||
return Ok(fichero);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
using SwaggerAntifraudeMYSQL.Controllers;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class FIESTASController : GenericoController<FIESTAS, int>
|
||||
{
|
||||
public FIESTASController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public override async Task<IActionResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var entities = await context.FIESTAS
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<VIDA_ADMINISTRATIVA>();
|
||||
var entities = context.FIESTAS
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDFIESTA == id);
|
||||
|
||||
|
||||
|
||||
if (entities == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class FORMACIONController : GenericoController<FORMACION, int>
|
||||
{
|
||||
public FORMACIONController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<PUESTOS>();
|
||||
var entity = context.FORMACION
|
||||
.Include(x => x.IDPERSONANavigation)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDFORMACION == id);
|
||||
|
||||
if (entity == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("formacionespersona/{idPersona}")]
|
||||
public async Task<IActionResult> FormacionPersona(int idPersona)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Consulta con Includes necesarios
|
||||
var entity = await context.FORMACION
|
||||
.Include(p => p.IDPERSONANavigation)
|
||||
.AsNoTracking()
|
||||
.Where(p => p.IDPERSONA == idPersona).ToListAsync();
|
||||
|
||||
// Verifica si la entidad no se encontró
|
||||
if (entity == null)
|
||||
return NotFound($"El puesto con ID {idPersona} no fue encontrado.");
|
||||
|
||||
// Devuelve la entidad con las relaciones cargadas
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using SwaggerAntifraudeMYSQL.Servicios;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class FormulariosController : ControllerBase
|
||||
{
|
||||
private readonly ServicioFormularios _servicioFormularios;
|
||||
|
||||
public FormulariosController(ServicioFormularios servicioFormularios)
|
||||
{
|
||||
_servicioFormularios = servicioFormularios;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genera un formulario en PDF según la clave y parámetros proporcionados.
|
||||
/// </summary>
|
||||
/// <param name="claveFormulario">Clave del formulario (TomPos, CumTri, SolTri, etc.)</param>
|
||||
/// <param name="idPersona">ID de la persona</param>
|
||||
/// <param name="Motivo">Motivo del formulario</param>
|
||||
/// <param name="texto1">Texto adicional 1</param>
|
||||
/// <param name="texto2">Texto adicional 2 (para algunos formularios)</param>
|
||||
/// <param name="FechaEfecto">Fecha de efecto</param>
|
||||
/// <param name="Organo">Órgano competente</param>
|
||||
/// <param name="FechaEmision">Fecha de emisión del formulario</param>
|
||||
/// <param name="Extra">Campo extra opcional, según el tipo de formulario</param>
|
||||
/// <returns>Archivo PDF resultante</returns>
|
||||
///
|
||||
|
||||
|
||||
//[HttpGet("GenerarFormulario")]
|
||||
//[Authorize(Policy = "LecturaPolicy")]
|
||||
//public IActionResult GenerarFormulario(
|
||||
// [FromQuery] string claveFormulario,
|
||||
// [FromQuery] string idPersona,
|
||||
// [FromQuery] string Motivo,
|
||||
// [FromQuery] string texto1,
|
||||
// [FromQuery] string texto2,
|
||||
// [FromQuery] string FechaEfecto,
|
||||
// [FromQuery] string Organo,
|
||||
// [FromQuery] string FechaEmision,
|
||||
// [FromQuery] string Extra)
|
||||
//{
|
||||
// var pdfBytes = _servicioFormularios.GenerarFormulario(
|
||||
// claveFormulario,
|
||||
// idPersona,
|
||||
// Motivo,
|
||||
// texto1,
|
||||
// texto2,
|
||||
// FechaEfecto,
|
||||
// Organo,
|
||||
// FechaEmision,
|
||||
// Extra);
|
||||
|
||||
// if (pdfBytes == null || pdfBytes.Length == 0)
|
||||
// return NotFound("No se pudo generar el formulario.");
|
||||
|
||||
// return File(pdfBytes, "application/pdf", "formulario.pdf");
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class GRUPOController : GenericoController<GRUPO, int>
|
||||
{
|
||||
public GRUPOController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class GRUPOSENUMERACIONESController : GenericoController<GRUPOSENUMERACIONES, int>
|
||||
{
|
||||
public GRUPOSENUMERACIONESController()
|
||||
: base()
|
||||
{
|
||||
Debug.WriteLine("aqui");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,396 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Linq;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using System.Reflection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq.Expressions;
|
||||
using SwaggerAntifraudeMYSQL.DTOs;
|
||||
using System.Linq.Dynamic.Core;
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Serialize.Linq.Serializers;
|
||||
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public abstract class GenericoController<TEntity, TKey> : ControllerBase where TEntity : class
|
||||
{
|
||||
/// <summary>
|
||||
/// Obtiene todos los registros de la entidad (Solo Lectura).
|
||||
/// </summary>
|
||||
/// <returns>Lista de entidades.</returns>
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet]
|
||||
public virtual async Task<IActionResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Asegúrate de pasar Lazy: false para desactivar Lazy Loading
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var dbSet = context.Set<TEntity>();
|
||||
var entities = await dbSet.AsNoTracking().ToListAsync();
|
||||
//string jsonString = JsonSerializer.Serialize(entities);
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Obtiene un registro específico por ID (Solo Lectura).
|
||||
/// </summary>
|
||||
/// <param name="id">ID de la entidad.</param>
|
||||
/// <returns>Entidad encontrada.</returns>
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public virtual IActionResult GetById(TKey id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var dbSet = context.Set<TEntity>();
|
||||
var entity = dbSet.Find(id);
|
||||
|
||||
if (entity == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("filtrar")]
|
||||
public virtual async Task<IActionResult> Filtrar([FromBody] ExpressionWrapper request)
|
||||
{
|
||||
IQueryable<TEntity>? query;
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
|
||||
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<TEntity, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
|
||||
// Aplicar el filtro en la consulta
|
||||
query = context.Set<TEntity>().Where(deserializedExpression);
|
||||
|
||||
|
||||
|
||||
// Agregar un log para verificar el SQL generado y la consulta
|
||||
Console.WriteLine(query.ToQueryString()); // Esto imprime la consulta SQL generada por EF Core
|
||||
|
||||
var res = await query.AsNoTracking().ToListAsync();
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (res.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(res);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("filtrar-entidad")]
|
||||
public virtual async Task<IActionResult> FiltrarEntidad([FromBody] ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<TEntity, bool>>;
|
||||
|
||||
if (deserializedExpression == null)
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
|
||||
var entity = await context.Set<TEntity>()
|
||||
.Where(deserializedExpression)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (entity == null)
|
||||
return NotFound("No se encontró ninguna entidad que coincida con el filtro.");
|
||||
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("filtrar-Atributo")]
|
||||
public virtual async Task<IActionResult> FiltrarAtributoDinamico([FromBody] ExpressionWrapperAtributo request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
var expression = serializer.DeserializeText(request.Expression) as Expression<Func<TEntity, bool>>;
|
||||
if (expression == null)
|
||||
return BadRequest("La expresión es nula o incorrecta.");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(request.AttributeName))
|
||||
return BadRequest("El nombre del atributo es obligatorio.");
|
||||
|
||||
var parameter = Expression.Parameter(typeof(TEntity), "x");
|
||||
var property = Expression.PropertyOrField(parameter, request.AttributeName);
|
||||
|
||||
if (property == null)
|
||||
return BadRequest($"El atributo '{request.AttributeName}' no existe en la entidad.");
|
||||
|
||||
// Crear una expresión para seleccionar el atributo
|
||||
var attributeSelector = Expression.Lambda<Func<TEntity, object>>(
|
||||
Expression.Convert(property, typeof(object)),
|
||||
parameter);
|
||||
|
||||
var entities = await context.Set<TEntity>()
|
||||
.Where(expression)
|
||||
.Select(attributeSelector)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Crea una nueva entidad (Escritura).
|
||||
/// </summary>
|
||||
/// <param name="entity">Entidad a crear.</param>
|
||||
/// <returns>Entidad creada.</returns>
|
||||
/// <summary>
|
||||
/// Crea una nueva entidad (Escritura).
|
||||
/// </summary>
|
||||
/// <param name="entity">Entidad a crear.</param>
|
||||
/// <returns>Entidad creada.</returns>
|
||||
[Authorize(Policy = "SupervisorPolicy")]
|
||||
[HttpPost]
|
||||
public virtual IActionResult Create([FromBody] TEntity entity)
|
||||
{
|
||||
// Validación automática: mantenemos tu comportamiento original
|
||||
if (!TryValidateModel(entity))
|
||||
ModelState.Clear();
|
||||
|
||||
try
|
||||
{
|
||||
using var context = ContextosMySql.NuevoContexto(
|
||||
SoloLectura: false,
|
||||
Lazy: false
|
||||
);
|
||||
var dbSet = context.Set<TEntity>();
|
||||
|
||||
// 1) Creamos una instancia vacía y la añadimos al contexto
|
||||
var newEntity = Activator.CreateInstance<TEntity>();
|
||||
dbSet.Add(newEntity);
|
||||
|
||||
// 2) Obtenemos el metadata de EF Core para TEntity
|
||||
var efEntityType = context.Model.FindEntityType(typeof(TEntity));
|
||||
if (efEntityType == null)
|
||||
throw new InvalidOperationException($"No se encontró metadata EF para {typeof(TEntity).Name}");
|
||||
|
||||
foreach (var prop in typeof(TEntity)
|
||||
.GetProperties(BindingFlags.Public | BindingFlags.Instance))
|
||||
{
|
||||
// Solo las que EF Core mapea a columna
|
||||
if (efEntityType.FindProperty(prop.Name) != null)
|
||||
{
|
||||
var valor = prop.GetValue(entity);
|
||||
context.Entry(newEntity)
|
||||
.Property(prop.Name)
|
||||
.CurrentValue = valor;
|
||||
}
|
||||
}
|
||||
|
||||
// 4) Guardamos
|
||||
context.SaveChanges();
|
||||
|
||||
// 5) Devolvemos CreatedAtAction con el ID recién generado
|
||||
var id = GetEntityId(newEntity);
|
||||
if (id != null)
|
||||
return CreatedAtAction(nameof(GetById), new { id }, newEntity);
|
||||
|
||||
return Ok(newEntity);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Actualiza una entidad existente (Escritura).
|
||||
/// </summary>
|
||||
/// <param name="id">ID de la entidad a actualizar.</param>
|
||||
/// <param name="entity">Entidad actualizada.</param>
|
||||
/// <returns>No content.</returns>
|
||||
[Authorize(Policy = "SupervisorPolicy")]
|
||||
[HttpPut("{id}")]
|
||||
public virtual IActionResult Update(TKey id, [FromBody] TEntity entity)
|
||||
{
|
||||
var entityId = GetEntityId(entity);
|
||||
if (entityId == null || !id.Equals((TKey)entityId))
|
||||
return BadRequest("El ID de la entidad no coincide con el ID de la URL.");
|
||||
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: false, Lazy: false))
|
||||
{
|
||||
var dbSet = context.Set<TEntity>();
|
||||
|
||||
// Buscar la entidad existente
|
||||
var existingEntity = dbSet.Find(id);
|
||||
if (existingEntity == null)
|
||||
return NotFound("No se encontró la entidad para actualizar.");
|
||||
|
||||
// Iterar sobre las propiedades de la entidad
|
||||
foreach (var property in typeof(TEntity).GetProperties())
|
||||
{
|
||||
// Verificar si la propiedad es escalar o navegación
|
||||
var propertyMetadata = context.Model.FindEntityType(typeof(TEntity))?
|
||||
.FindProperty(property.Name);
|
||||
|
||||
if (propertyMetadata == null)
|
||||
{
|
||||
// Es una propiedad de navegación, omitirla
|
||||
continue;
|
||||
}
|
||||
|
||||
// Manejar propiedades escalares
|
||||
var newValue = property.GetValue(entity);
|
||||
var oldValue = property.GetValue(existingEntity);
|
||||
|
||||
if (!Equals(newValue, oldValue))
|
||||
{
|
||||
context.Entry(existingEntity).Property(property.Name).CurrentValue = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Guardar cambios
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimina una entidad por ID (Escritura).
|
||||
/// </summary>
|
||||
/// <param name="id">ID de la entidad a eliminar.</param>
|
||||
/// <returns>No content.</returns>
|
||||
[Authorize(Policy = "SupervisorPolicy")]
|
||||
[HttpDelete("{id}")]
|
||||
public virtual IActionResult Delete(TKey id)
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: false, Lazy: false))
|
||||
{
|
||||
var dbSet = context.Set<TEntity>();
|
||||
var entity = dbSet.Find(id);
|
||||
|
||||
if (entity == null)
|
||||
return NotFound();
|
||||
|
||||
dbSet.Remove(entity);
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Obtiene el valor de la propiedad de ID de la entidad.
|
||||
/// </summary>
|
||||
/// <param name="entity">Entidad de la cual obtener el ID.</param>
|
||||
/// <returns>Valor del ID.</returns>
|
||||
protected virtual object GetEntityId(TEntity entity)
|
||||
{
|
||||
// Busca las propiedades que podrían ser claves primarias según las convenciones o el atributo [Key]
|
||||
var type = typeof(TEntity);
|
||||
|
||||
// Primero, buscamos cualquier propiedad marcada con [Key], que es la forma más confiable de identificar el ID
|
||||
var idProperty = type.GetProperties().FirstOrDefault(p => p.GetCustomAttribute<KeyAttribute>() != null);
|
||||
|
||||
if (idProperty != null)
|
||||
{
|
||||
return idProperty.GetValue(entity);
|
||||
}
|
||||
|
||||
// Si no hay un atributo [Key], intentamos con algunas convenciones de nombres comunes para ID
|
||||
idProperty = type.GetProperties().FirstOrDefault(p =>
|
||||
p.Name.Equals("ID", StringComparison.OrdinalIgnoreCase) || // Nombre genérico 'Id'
|
||||
p.Name.Equals($"{type.Name}ID", StringComparison.OrdinalIgnoreCase) || //
|
||||
p.Name.StartsWith("ID", StringComparison.OrdinalIgnoreCase)); // Cualquier nombre que comience con 'ID'
|
||||
|
||||
if (idProperty != null)
|
||||
{
|
||||
return idProperty.GetValue(entity);
|
||||
}
|
||||
|
||||
throw new InvalidOperationException("No se pudo encontrar una propiedad de ID para la entidad.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class ExpressionWrapper
|
||||
{
|
||||
public string Expression { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class ExpressionWrapperAtributo
|
||||
{
|
||||
public string Expression { get; set; }
|
||||
public string AttributeName { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class HIJOSController : GenericoController<HIJOS, int>
|
||||
{
|
||||
public HIJOSController() : base() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class HISTORICOIRPFController : GenericoController<HISTORICOIRPF, int>
|
||||
{
|
||||
public HISTORICOIRPFController() : base() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class HUELGASController : GenericoController<HUELGAS, int>
|
||||
{
|
||||
public HUELGASController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class IDIOMASController : GenericoController<IDIOMAS, int>
|
||||
{
|
||||
public IDIOMASController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("GetWithIncludes/{id}")]
|
||||
public async Task<IActionResult> GetWithIncludes(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Consulta con Includes necesarios
|
||||
var entity = await context.IDIOMAS
|
||||
.Include(p => p.IDNIVELNavigation)
|
||||
.Include(p => p.IDTIPOIDIOMANavigation)
|
||||
.AsNoTracking()
|
||||
.Where(p => p.IDPERSONA == id).ToListAsync();
|
||||
|
||||
// Verifica si la entidad no se encontró
|
||||
if (entity == null)
|
||||
return NotFound($"El puesto con ID {id} no fue encontrado.");
|
||||
|
||||
// Devuelve la entidad con las relaciones cargadas
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Linq;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using System.Reflection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq.Expressions;
|
||||
using SwaggerAntifraudeMYSQL.DTOs;
|
||||
using System.Linq.Dynamic.Core;
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Serialize.Linq.Serializers;
|
||||
using SwaggerAntifraudeMYSQL.Controllers;
|
||||
|
||||
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class INCIDENCIASController : GenericoController<INCIDENCIAS, int>
|
||||
{
|
||||
public INCIDENCIASController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("filtrar")]
|
||||
public override async Task<IActionResult> Filtrar([FromBody] ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<INCIDENCIAS, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
var entities = await context.INCIDENCIAS.Where(deserializedExpression)
|
||||
.Include(v => v.IDPERSONANavigation)
|
||||
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Linq;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using System.Reflection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq.Expressions;
|
||||
using SwaggerAntifraudeMYSQL.DTOs;
|
||||
using System.Linq.Dynamic.Core;
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.IO;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class LINEASVIDAADMINISTRATIVAController : GenericoController<LINEASVIDAADMINISTRATIVA, int>
|
||||
{
|
||||
public LINEASVIDAADMINISTRATIVAController() : base() { }
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("LineasVidaAdminGrid")] // Cambié a POST ya que estás usando [FromBody]
|
||||
public virtual async Task<IActionResult> LineasVidaAdminGrid([FromBody] ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<LINEASVIDAADMINISTRATIVA, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var entities = await context.Set<LINEASVIDAADMINISTRATIVA>()
|
||||
.Where(deserializedExpression)
|
||||
.Include(v => v.IDVIDAADMINNavigation) // Incluyendo la navegación principal
|
||||
.Include(v => v.IDTIPONavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<PUESTOS>();
|
||||
var entity = context.LINEASVIDAADMINISTRATIVA
|
||||
.Include(v => v.IDVIDAADMINNavigation)
|
||||
.ThenInclude(m => m.IDPERSONALNavigation)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDLINEAVIDAADMIN == id);
|
||||
|
||||
if (entity == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("LineasVidaAdminGridbyId/{idVida}")] // Cambié a POST ya que estás usando [FromBody]
|
||||
public async Task<IActionResult> LineasVidaAdminGridbyId(int idVida)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
//var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<LINEASVIDAADMINISTRATIVA, bool>>;
|
||||
//if (deserializedExpression == null)
|
||||
//{
|
||||
// return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
var entities = await context.Set<LINEASVIDAADMINISTRATIVA>()
|
||||
.Where(x => x.IDVIDAADMIN == idVida)
|
||||
.Include(v => v.IDVIDAADMINNavigation) // Incluyendo la navegación principal
|
||||
.Include(v => v.IDTIPONavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class MATERNIDADESController : GenericoController<MATERNIDADES, int>
|
||||
{
|
||||
public MATERNIDADESController()
|
||||
: base()
|
||||
{
|
||||
Debug.WriteLine("aqui");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class MOTIVOS_ADMINISTRATIVOSController : GenericoController<MOTIVOS_ADMINISTRATIVOS, int>
|
||||
{
|
||||
public MOTIVOS_ADMINISTRATIVOSController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("TiposExtend/{idMotivo}")]
|
||||
public async Task<IActionResult> TiposExtend(int idMotivo)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var motAdmin = context.MOTIVOS_ADMINISTRATIVOS.Include(v => v.IDTIPOAPTOSNavigation).FirstOrDefault(p => p.IDMOTIVO == idMotivo);
|
||||
if (motAdmin == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(motAdmin);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("TiposExtend")]
|
||||
public async Task<IActionResult> TiposExtend()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var motAdmin = await context.MOTIVOS_ADMINISTRATIVOS.Include(v => v.IDTIPOAPTOSNavigation).AsNoTracking().ToListAsync();
|
||||
if (motAdmin == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(motAdmin);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class NIVELController : GenericoController<NIVEL, int>
|
||||
{
|
||||
public NIVELController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
using SwaggerAntifraudeMYSQL.Controllers;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class NOMINASController : GenericoController<NOMINAS, int>
|
||||
{
|
||||
public NOMINASController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public override async Task<IActionResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var entities = await context.NOMINAS
|
||||
.Include(x => x.IDTIPONavigation)
|
||||
.Include(x => x.IDSITUACIONNOMINANavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
//.Include(v => v.IDSERVICIOADSCRITONavigation)
|
||||
//.Include(v => v.IDUNIDADADMINISTRATIVANavigation)
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<VIDA_ADMINISTRATIVA>();
|
||||
var entities = context.NOMINAS
|
||||
.Include(x => x.IDTIPONavigation)
|
||||
.Include(x => x.IDSITUACIONNOMINANavigation)
|
||||
//.Include(x => x.NOMINATRABAJADORCABECERA)
|
||||
//.ThenInclude(pr => pr.IDPERSONANavigation)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDNOMINAS == id);
|
||||
|
||||
|
||||
|
||||
if (entities == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("filtrar")] // Cambié a POST ya que estás usando [FromBody]
|
||||
public override async Task<IActionResult> Filtrar([FromBody] ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<NOMINAS, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
var entities = await context.NOMINAS.Where(deserializedExpression)
|
||||
//.Include(m => m.IDMOTIVOADMINISTRATIVONavigation)
|
||||
//.ThenInclude(aa => aa.IDTIPOAPTOSNavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class NOMINATRABAJADORCABECERAController : GenericoController<NOMINATRABAJADORCABECERA, int>
|
||||
{
|
||||
public NOMINATRABAJADORCABECERAController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<VIDA_ADMINISTRATIVA>();
|
||||
var entities = context.NOMINATRABAJADORCABECERA
|
||||
.Include(x => x.IDPERSONANavigation)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDNOMINATRABAJADOR == id);
|
||||
|
||||
|
||||
|
||||
if (entities == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("filtrar")] // Cambié a POST ya que estás usando [FromBody]
|
||||
public override async Task<IActionResult> Filtrar([FromBody] ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<NOMINATRABAJADORCABECERA, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
var entities = await context.NOMINATRABAJADORCABECERA.Where(deserializedExpression)
|
||||
.Include(x => x.IDPERSONANavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class OCUPACIONController : GenericoController<OCUPACION, int>
|
||||
{
|
||||
public OCUPACIONController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class OTRASRETRIBUCIONESController : GenericoController<OTRASRETRIBUCIONES, int>
|
||||
{
|
||||
public OTRASRETRIBUCIONESController() : base() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class PERIODOSSILTRAController : GenericoController<PERIODOSSILTRA, int>
|
||||
{
|
||||
public PERIODOSSILTRAController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<VIDA_ADMINISTRATIVA>();
|
||||
var entities = context.PERIODOSSILTRA
|
||||
.Include(x => x.TRAMOSSILTRA)
|
||||
.ThenInclude(v => v.IDTIPOTRAMONavigation)
|
||||
.ThenInclude(y => y.IDTIPOTRAMOFICHEROXMLNavigation)
|
||||
.Include(x => x.IDTIPOLIQUIDACIONNavigation)
|
||||
.Include(x => x.IDESTADONavigation)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDPERIODOSILTRA == id);
|
||||
|
||||
|
||||
|
||||
if (entities == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class PERMISOSSINRETRIBUCIONController : GenericoController<PERMISOSSINRETRIBUCION, int>
|
||||
{
|
||||
public PERMISOSSINRETRIBUCIONController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Linq;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using System.Reflection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq.Expressions;
|
||||
using SwaggerAntifraudeMYSQL.DTOs;
|
||||
using System.Linq.Dynamic.Core;
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Serialize.Linq.Serializers;
|
||||
using SwaggerAntifraudeMYSQL.Controllers;
|
||||
|
||||
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class PERSONASController : GenericoController<PERSONAS, int>
|
||||
{
|
||||
public PERSONASController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public override async Task<IActionResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var entities = await context.PERSONAS
|
||||
.Include(pue => pue.PUESTOSIDPERSONALNavigation)
|
||||
.ThenInclude(rpt => rpt.IDRPTNavigation)
|
||||
.ThenInclude(sit => sit.IDSITUACIONNavigation)
|
||||
.Include(pue => pue.PUESTOSIDPERSONALNavigation)
|
||||
.ThenInclude(ocu => ocu.IDOCUPACIONNavigation)
|
||||
.Include(pue => pue.PUESTOSIDPERSONALNavigation)
|
||||
.ThenInclude(rpt => rpt.IDRPTDESNavigation)
|
||||
.ThenInclude(rpt => rpt.IDUNIDADADMINISTRATIVANavigation)
|
||||
.Include(pue => pue.PUESTOSIDPERSONALNavigation)
|
||||
.Include(cp => cp.IDDEPARTAMENTONavigation)
|
||||
.Include(cp => cp.CODIGOMUNICIPIONavigation)
|
||||
.ThenInclude(cpro => cpro.CODIGOPROVINCIANavigation)
|
||||
.Include(cp => cp.IDSITUACIONACTUALIRPFNavigation)
|
||||
.Include(cp => cp.CODIGOMUNICIPIONavigation)
|
||||
.Include(cp=>cp.IDTIPONavigation)
|
||||
.Include(cp=>cp.IDDEPARTAMENTONavigation)
|
||||
.Include(cp => cp.IDSEXONavigation)
|
||||
.Include(cp => cp.INCIDENCIAS)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
//.Include(v => v.IDSERVICIOADSCRITONavigation)
|
||||
//.Include(v => v.IDUNIDADADMINISTRATIVANavigation)
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("PersonaNominaNif/{nif}")]
|
||||
public IActionResult GetByNifNom(string nif)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var persona = context.PERSONAS.Include(pue => pue.PUESTOSIDPERSONALNavigation)
|
||||
.ThenInclude(rpt => rpt.IDRPTNavigation)
|
||||
.ThenInclude(sit => sit.IDSITUACIONNavigation)
|
||||
.Include(pue => pue.IDSEXONavigation)
|
||||
.Include(pue => pue.IDTIPONavigation)
|
||||
.Include(pue => pue.IDNIVELRPTNavigation)
|
||||
.Include(pue => pue.ASCENDIENTES)
|
||||
.ThenInclude(dis => dis.IDDISCAPACIDADNavigation)
|
||||
.Include(pue => pue.HIJOS)
|
||||
.ThenInclude(dis => dis.IDDISCAPACIDADNavigation)
|
||||
.Include(pue => pue.DIFERENCIAPAGODELEGADO)
|
||||
.Include(pue => pue.DIFERENCIATRIENIOS)
|
||||
.Include(pue => pue.REDUCCIONDEJORNADA)
|
||||
.Include(pue => pue.TRABAJADORTIEMPOPARCIAL)
|
||||
.Include(cp => cp.ENFERMEDADES)
|
||||
.ThenInclude(y => y.IDTIPONavigation)
|
||||
.Include(cp => cp.MATERNIDADES)
|
||||
.Include(cp => cp.IDOCUPACIONNavigation)
|
||||
.Include(cp => cp.HUELGAS)
|
||||
.ThenInclude(cpro => cpro.IDNOMINAORIGENDATOSNavigation)
|
||||
.Include(cp => cp.HUELGAS)
|
||||
.ThenInclude(cpro => cpro.IDNOMINAAPLICACIONNavigation)
|
||||
.Include(cp => cp.INCIDENCIAS)
|
||||
.ThenInclude(idnom => idnom.IDNOMINANavigation)
|
||||
.Include(cp => cp.INCIDENCIAS)
|
||||
.ThenInclude(idnom => idnom.IDCONCEPTONOMINANavigation)
|
||||
.Include(n => n.NOMINATRABAJADORCABECERA)
|
||||
.ThenInclude(pr => pr.IDNOMINANavigation)
|
||||
.Include(n => n.NOMINATRABAJADORCABECERA)
|
||||
.ThenInclude(pr => pr.NOMINATRABAJADORLINEA)
|
||||
.ThenInclude(y => y.IDCONCEPTOGENERALNavigation)
|
||||
.Include(n => n.NOMINATRABAJADORCABECERA)
|
||||
.ThenInclude(pr => pr.NOMINATRABAJADORPAGOESPECIE)
|
||||
.Include(n => n.NOMINATRABAJADORCABECERA)
|
||||
.ThenInclude(pr => pr.PERIODOSSILTRA)
|
||||
.ThenInclude(y => y.IDCONTRATONavigation)
|
||||
.Include(n => n.NOMINATRABAJADORCABECERA)
|
||||
.ThenInclude(pr => pr.PERIODOSSILTRA)
|
||||
.ThenInclude(y => y.IDESTADONavigation)
|
||||
.Include(n => n.NOMINATRABAJADORCABECERA)
|
||||
.ThenInclude(pr => pr.PERIODOSSILTRA)
|
||||
.ThenInclude(y => y.TRAMOSSILTRA)
|
||||
.ThenInclude(y => y.IDTIPOTRAMONavigation)
|
||||
.Include(n => n.NOMINATRABAJADORCABECERA)
|
||||
.ThenInclude(y => y.IDSINDICATO1Navigation)
|
||||
.Include(n => n.NOMINATRABAJADORCABECERA)
|
||||
.ThenInclude(y => y.IDSINDICATO2Navigation)
|
||||
.Include(pue => pue.OTRASRETRIBUCIONES)
|
||||
.Include(cp => cp.PERMISOSSINRETRIBUCION)
|
||||
.ThenInclude(cpro => cpro.IDNOMINAORIGENDEDATOSNavigation)
|
||||
.Include(cp => cp.PERMISOSSINRETRIBUCION)
|
||||
.ThenInclude(cpro => cpro.IDNOMINAAPLICACIONNavigation)
|
||||
.Include(pue => pue.PRESTAMOS)
|
||||
.ThenInclude(pre => pre.IDNOMINAINICIONavigation)
|
||||
.Include(cp => cp.PUESTOSTRABAJO)
|
||||
.ThenInclude(cpro => cpro.IDTIPOPUESTOTRABAJONavigation)
|
||||
.Include(cp => cp.PUESTOSTRABAJO)
|
||||
.ThenInclude(cpro => cpro.IDGRUPOFUNCIONARIONavigation)
|
||||
.Include(pue => pue.REDUCCIONDEJORNADA)
|
||||
.Include(pue => pue.RETENCIONJUDICIAL)
|
||||
.ThenInclude(ret => ret.IDPLANTILLANavigation)
|
||||
.Include(pue => pue.PRODUCTIVIDAD)
|
||||
.Include(pue => pue.IDSITUACIONACTUALIRPFNavigation)
|
||||
.ThenInclude(situ => situ.IDDISCAPACIDADNavigation)
|
||||
.Include(pue => pue.IDSITUACIONACTUALIRPFNavigation)
|
||||
.ThenInclude(situ => situ.IDSITUACIONFAMILIARNavigation)
|
||||
.Include(pue => pue.IDSITUACIONACTUALIRPFNavigation)
|
||||
.ThenInclude(situ => situ.IDSITUACIONLABORALNavigation)
|
||||
.Include(pue => pue.IDSITUACIONACTUALIRPFNavigation)
|
||||
.ThenInclude(situ => situ.IDCONTRATOORELACIONNavigation)
|
||||
.Include(pue => pue.HISTORICOIRPF)
|
||||
.Include(pue => pue.IDMUTUANavigation)
|
||||
.Include(pue => pue.IDMUTUA2Navigation)
|
||||
.Include(pue => pue.IDPUESTOTRABAJOOPOSICIONNavigation)
|
||||
.Include(pue => pue.IDCAUSABAJAPARNavigation)
|
||||
.Include(pue => pue.IDCONTRATONavigation)
|
||||
.Include(pue => pue.IDGRUPOFUNCIONARIONavigation)
|
||||
.Include(pue => pue.IDCUENTACOTIZACIONPATRONALNavigation)
|
||||
.Include(pue => pue.IDDEPARTAMENTONavigation)
|
||||
.Include(pue => pue.PUESTOSIDPERSONALNavigation)
|
||||
.ThenInclude(ocu => ocu.IDOCUPACIONNavigation)
|
||||
.Include(pue => pue.PUESTOSIDPERSONALNavigation)
|
||||
.ThenInclude(rpt => rpt.IDRPTDESNavigation)
|
||||
.ThenInclude(rpt => rpt.IDUNIDADADMINISTRATIVANavigation)
|
||||
.Include(pue => pue.PUESTOSIDPERSONALNavigation)
|
||||
.ThenInclude(rpt => rpt.IDRPTDESNavigation)
|
||||
.ThenInclude(x => x.IDDEPARTAMENTONavigation)
|
||||
.Include(pue => pue.PUESTOSIDPERSONALNavigation)
|
||||
.Include(pue => pue.EXCEPCIONESPERMISOSIDPERSONANavigation)
|
||||
.ThenInclude(exc=>exc.IDDEPARTAMENTONavigation)
|
||||
.Include(pue => pue.EXCEPCIONESPERMISOSIDPERSONANavigation)
|
||||
.ThenInclude(exc => exc.IDPERSONAPERMISONavigation)
|
||||
.Include(cp=>cp.DIFERENCIAPAGODELEGADO)
|
||||
.Include(cp => cp.IDDEPARTAMENTONavigation)
|
||||
.Include(cp => cp.CODIGOMUNICIPIONavigation)
|
||||
.ThenInclude(cpro => cpro.CODIGOPROVINCIANavigation)
|
||||
.AsSplitQuery()
|
||||
.FirstOrDefault(p => p.NIF == nif);
|
||||
if (persona == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(persona);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("nif/{nif}")]
|
||||
public IActionResult GetByNif(string nif)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var persona = context.PERSONAS.Include(pue=> pue.PUESTOSIDPERSONALNavigation)
|
||||
.ThenInclude(rpt => rpt.IDRPTNavigation)
|
||||
.ThenInclude(sit=> sit.IDSITUACIONNavigation)
|
||||
.Include(pue => pue.PUESTOSIDPERSONALNavigation)
|
||||
.ThenInclude(ocu => ocu.IDOCUPACIONNavigation)
|
||||
.Include(pue => pue.PUESTOSIDPERSONALNavigation)
|
||||
.ThenInclude(rpt => rpt.IDRPTDESNavigation)
|
||||
.ThenInclude(rpt => rpt.IDUNIDADADMINISTRATIVANavigation)
|
||||
.Include(pue => pue.PUESTOSIDPERSONALNavigation)
|
||||
//.Include(n => n.NOMINATRABAJADORCABECERA)
|
||||
//.ThenInclude(pr => pr.IDPERSONANavigation)
|
||||
.Include(cp => cp.IDDEPARTAMENTONavigation)
|
||||
.Include(cp => cp.CODIGOMUNICIPIONavigation)
|
||||
.ThenInclude(cpro => cpro.CODIGOPROVINCIANavigation)
|
||||
.Include(pue => pue.PUESTOSIDPERSONALNavigation)
|
||||
.ThenInclude(rpt => rpt.IDRPTDESNavigation)
|
||||
.ThenInclude(x => x.IDDEPARTAMENTONavigation)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(p => p.NIF == nif);
|
||||
if (persona == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(persona);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("getPersonaVidaAdm")]
|
||||
public virtual async Task<IActionResult> getPersonaVidaAdm([FromBody] ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<PERSONAS, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
|
||||
var entities = await context.Set<PERSONAS>()
|
||||
.Where(deserializedExpression)
|
||||
.Include(v => v.IDGRADOPERSONALCONSOLIDADONavigation) // Incluyendo la navegación principal
|
||||
.Include(v => v.IDNIVELRPTNavigation)
|
||||
.Include(v => v.IDGRUPOFUNCIONARIONavigation)
|
||||
.Include(v => v.IDTIPONavigation)
|
||||
.Include(cp => cp.IDDEPARTAMENTONavigation)
|
||||
.Include(v => v.IDADSCRIPCIONRPTNavigation)
|
||||
.Include(v => v.IDCUERPORPTNavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities.First());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("filtrar")]
|
||||
public override async Task<IActionResult> Filtrar([FromBody] ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<PERSONAS, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
var entities = await context.PERSONAS.Where(deserializedExpression)
|
||||
.Include(v => v.IDSITUACIONADMINISTRATIVARPTNavigation)
|
||||
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class PRESTAMOSController : GenericoController<PRESTAMOS, int>
|
||||
{
|
||||
public PRESTAMOSController() : base() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class PRODUCTIVIDADController : GenericoController<PRODUCTIVIDAD, int>
|
||||
{
|
||||
public PRODUCTIVIDADController() : base() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class PROVISIONController : GenericoController<PROVISION, int>
|
||||
{
|
||||
public PROVISIONController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Linq;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using System.Reflection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq.Expressions;
|
||||
using SwaggerAntifraudeMYSQL.DTOs;
|
||||
using System.Linq.Dynamic.Core;
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.IO;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class PUESTOSController : GenericoController<PUESTOS, int>
|
||||
{
|
||||
public PUESTOSController() : base()
|
||||
{
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("getActivos")] // Cambié a POST ya que estás usando [FromBody]
|
||||
public virtual async Task<IActionResult> getActivos([FromBody] ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<PUESTOS, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
|
||||
|
||||
var entities = await context.Set<PUESTOS>()
|
||||
.Where(deserializedExpression)
|
||||
.Include(v => v.IDRPTDESNavigation)
|
||||
.ThenInclude(m => m.IDNIVEL_RPTNavigation)
|
||||
.Include(v => v.IDRPTDESNavigation)
|
||||
.ThenInclude(m => m.IDRPTNavigation)
|
||||
.Include(v => v.IDRPTDESNavigation)
|
||||
.ThenInclude(m => m.GRUPO1Navigation)
|
||||
.Include(v => v.IDRPTDESNavigation)
|
||||
.ThenInclude(m => m.CUERPO1Navigation)
|
||||
.Include(v => v.IDRPTDESNavigation)
|
||||
.ThenInclude(r => r.IDUNIDADADMINISTRATIVANavigation)
|
||||
.Include(v => v.IDRPTNavigation)
|
||||
.ThenInclude(x => x.IDSITUACIONNavigation)
|
||||
.Include(v => v.IDOCUPACIONNavigation)
|
||||
.Include(v => v.IDDOTACIONNavigation)
|
||||
.Include(i => i.IDRPTDESNavigation)
|
||||
.ThenInclude(r => r.IDDEPARTAMENTONavigation)
|
||||
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
//var entities = await context.Set<PUESTOS>()
|
||||
// .Where(deserializedExpression)
|
||||
// .Include(v => v.IDRPTDESNavigation) // Incluyendo la navegación principal
|
||||
// .ThenInclude(m => m.IDNIVEL_RPTNavigation) // Incluye la navegación hacia IDNIVEL_RPT
|
||||
// .Include(v => v.IDRPTDESNavigation)
|
||||
// .ThenInclude(m => m.GRUPO1Navigation) // Incluye la navegación hacia GRUPO1
|
||||
// .Include(v => v.IDRPTDESNavigation)
|
||||
// .ThenInclude(m => m.CUERPO1Navigation) // Incluye la navegación hacia CUERPO1
|
||||
// .Include(v => v.IDRPTNavigation)
|
||||
// .ThenInclude(x => x.IDSITUACIONNavigation) // Incluye la navegación hacia IDSITUACION
|
||||
// .Include(v => v.IDOCUPACIONNavigation)
|
||||
// .AsNoTracking()
|
||||
// .ToListAsync();
|
||||
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("GetWithIncludes/{id}")]
|
||||
public async Task<IActionResult> GetWithIncludes(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Consulta con Includes necesarios
|
||||
var entity = await context.PUESTOS
|
||||
.Include(p => p.IDDOTACIONNavigation) // Carga Dotación
|
||||
.Include(p => p.IDPERSONALNavigation) // Carga Persona asociada
|
||||
.Include(p => p.IDOCUPACIONNavigation) // Carga Ocupación
|
||||
.Include(p => p.TITULARNavigation) // Carga Titular
|
||||
.AsNoTracking()
|
||||
.Where(p => p.IDRPTDES == id).ToListAsync(); // Filtra por IDPUESTO
|
||||
|
||||
// Verifica si la entidad no se encontró
|
||||
if (entity == null)
|
||||
return NotFound($"El puesto con ID {id} no fue encontrado.");
|
||||
|
||||
// Devuelve la entidad con las relaciones cargadas
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<PUESTOS>();
|
||||
var entity = context.PUESTOS
|
||||
.Include(v => v.IDRPTDESNavigation)
|
||||
.ThenInclude(m => m.IDNIVEL_RPTNavigation)
|
||||
.Include(v => v.IDRPTDESNavigation)
|
||||
.ThenInclude(m => m.IDRPTNavigation)
|
||||
.Include(v => v.IDRPTDESNavigation)
|
||||
.ThenInclude(m => m.GRUPO1Navigation)
|
||||
.Include(v => v.IDRPTDESNavigation)
|
||||
.ThenInclude(m => m.CUERPO1Navigation)
|
||||
.Include(v => v.IDRPTDESNavigation)
|
||||
.ThenInclude(r => r.IDUNIDADADMINISTRATIVANavigation)
|
||||
.Include(v => v.IDRPTNavigation)
|
||||
.ThenInclude(x => x.IDSITUACIONNavigation)
|
||||
.Include(v => v.IDOCUPACIONNavigation)
|
||||
.Include(v => v.IDDOTACIONNavigation)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDPUESTO == id);
|
||||
|
||||
if (entity == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
using SwaggerAntifraudeMYSQL.Controllers;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class PUESTOSTRABAJOController : GenericoController<PUESTOSTRABAJO, int>
|
||||
{
|
||||
public PUESTOSTRABAJOController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public override async Task<IActionResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var entities = await context.PUESTOSTRABAJO
|
||||
.Include(x => x.IDTIPOPUESTOTRABAJONavigation)
|
||||
.Include(x => x.CONCEPTOSPUESTOSDETRABAJO)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
//.Include(v => v.IDSERVICIOADSCRITONavigation)
|
||||
//.Include(v => v.IDUNIDADADMINISTRATIVANavigation)
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<VIDA_ADMINISTRATIVA>();
|
||||
var entities = context.PUESTOSTRABAJO
|
||||
.Include(x => x.IDTIPOPUESTOTRABAJONavigation)
|
||||
.Include(x => x.CONCEPTOSPUESTOSDETRABAJO)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDPUESTOSTRABAJO == id);
|
||||
|
||||
|
||||
|
||||
if (entities == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("filtrar")] // Cambié a POST ya que estás usando [FromBody]
|
||||
public override async Task<IActionResult> Filtrar([FromBody] ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<PUESTOSTRABAJO, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
var entities = await context.PUESTOSTRABAJO.Where(deserializedExpression)
|
||||
.Include(x => x.IDTIPOPUESTOTRABAJONavigation)
|
||||
.Include(x => x.CONCEPTOSPUESTOSDETRABAJO)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class REDUCCIONDEJORNADAController : GenericoController<REDUCCIONDEJORNADA, int>
|
||||
{
|
||||
public REDUCCIONDEJORNADAController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class RETENCIONJUDICIALController : GenericoController<RETENCIONJUDICIAL, int>
|
||||
{
|
||||
public RETENCIONJUDICIALController() : base() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class RETRIBUCIONBASICAController : GenericoController<RETRIBUCIONBASICA, int>
|
||||
{
|
||||
public RETRIBUCIONBASICAController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SwaggerAntifraudeMYSQL.Controllers;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class RPTController : GenericoController<RPT, int>
|
||||
{
|
||||
public RPTController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
public override async Task<IActionResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var rpts = context.RPT
|
||||
.Include(r => r.IDSITUACIONNavigation).ToList();
|
||||
|
||||
if (rpts == null)
|
||||
return NotFound("Sin registros.");
|
||||
|
||||
return Ok(rpts);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Diagnostics;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class RPT_DESCRIPController : GenericoController<RPT_DESCRIP, int>
|
||||
{
|
||||
public RPT_DESCRIPController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<VIDA_ADMINISTRATIVA>();
|
||||
var entities = context.RPT_DESCRIP
|
||||
.Include(rd => rd.IDRPTNavigation)
|
||||
.Include(rd => rd.GRUPO1Navigation)
|
||||
.Include(rd => rd.IDUNIDADADMINISTRATIVANavigation)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDRPTDES == id);
|
||||
|
||||
|
||||
|
||||
if (entities == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("GetWithIncludes/{id}")]
|
||||
public async Task<IActionResult> GetWithIncludes(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Consulta con Includes necesarios
|
||||
var entity = await context.RPT_DESCRIP
|
||||
.Include(p => p.IDRPTNavigation)
|
||||
.Include(p => p.IDUNIDADADMINISTRATIVANavigation)
|
||||
.Include(p => p.CUERPO1Navigation)
|
||||
.Include(p => p.GRUPO1Navigation)
|
||||
.Include(p => p.GRUPO2Navigation)
|
||||
.Include(p => p.IDDEPARTAMENTONavigation)
|
||||
.Include(p => p.ADSCRIPCIONNavigation)
|
||||
.Include(p => p.PROVISIONNavigation)
|
||||
.AsNoTracking()
|
||||
.Where(p => p.IDRPT == id).ToListAsync(); // Filtra por IDPUESTO
|
||||
|
||||
// Verifica si la entidad no se encontró
|
||||
if (entity == null)
|
||||
return NotFound($"El puesto con ID {id} no fue encontrado.");
|
||||
|
||||
// Devuelve la entidad con las relaciones cargadas
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("GetAtributo/{id}/{id2}")]
|
||||
public async Task<IActionResult> GetListRPTGrupo(int id, int id2)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Consulta con Includes necesarios
|
||||
var entity = await context.RPT_DESCRIP
|
||||
.Include(p => p.GRUPO1Navigation)
|
||||
.AsNoTracking()
|
||||
.Where(p => p.IDRPT == id && p.GRUPO1 == id2).Select(x => x.CODIGO).ToListAsync(); // Filtra por IDPUESTO
|
||||
|
||||
// Verifica si la entidad no se encontró
|
||||
if (entity == null)
|
||||
return NotFound($"El puesto con ID {id} no fue encontrado.");
|
||||
|
||||
// Devuelve la entidad con las relaciones cargadas
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using SwaggerAntifraudeMYSQL.Models;
|
||||
using DevExpress.CodeParser;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ResultadoIdentificacionController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Carga el perfil de identificación y las incidencias asociadas para el usuario especificado.
|
||||
/// Se asignan roles y se consultan incidencias según el origen (WEBINTRANET, GESTDELE o RPT).
|
||||
/// Además, se incluyen en el listado tanto el usuario consultante como sus subordinados,
|
||||
/// forzando que el usuario consultante se agregue a la lista (incluso si ya apareciera en el listado de subordinados).
|
||||
/// </summary>
|
||||
/// <param name="nif">NIF del usuario a identificar.</param>
|
||||
/// <param name="origen">Origen de la consulta (por ejemplo: "WEBINTRANET", "GESTDELE" o "RPT").</param>
|
||||
/// <returns>Objeto ResultadoIdentificacion con la lista de perfiles e incidencias.</returns>
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("nif/{nif}/origen/{origen}")]
|
||||
public IActionResult CargaPerfilIdentificacion(string nif, string origen)
|
||||
{
|
||||
var resultadoIdentificacion = new ResultadoIdentificacion
|
||||
{
|
||||
Personas = new List<Personal>()
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Se busca la persona por NIF
|
||||
var persona = context.PERSONAS
|
||||
.Include(p => p.IDDEPARTAMENTONavigation) // Para obtener la descripción del departamento
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(p => p.NIF.Trim().ToUpper() == nif.Trim().ToUpper());
|
||||
|
||||
if (persona == null)
|
||||
{
|
||||
resultadoIdentificacion.resultado = 1;
|
||||
resultadoIdentificacion.errores = $"No se encontró persona con NIF: {nif}";
|
||||
return Ok(resultadoIdentificacion);
|
||||
}
|
||||
|
||||
// Creamos el objeto Personal para el usuario consultante
|
||||
|
||||
var grup = context.USUARIOS.Include(x => x.IDGRUPONavigation).FirstOrDefault(x => x.USUARIO == persona.NIF).IDGRUPONavigation.DESCRIPCION;
|
||||
|
||||
|
||||
var usuarioActual = new Personal
|
||||
{
|
||||
Nombre = persona.APELLIDOS + ", " + persona.NOMBRE,
|
||||
Departamento = persona.IDDEPARTAMENTONavigation?.DESCRIPCION,
|
||||
Dni = persona.NIF,
|
||||
idPersona = persona.IDPERSONA,
|
||||
Roll = string.Empty,
|
||||
Grupo = grup.ToUpper() == "ACCESO WEB RET" ? "RET" : ""
|
||||
};
|
||||
|
||||
// Creamos la lista de personas y agregamos inmediatamente el usuario consultante
|
||||
var personas = new List<Personal>();
|
||||
personas.Add(usuarioActual);
|
||||
resultadoIdentificacion.Personas = personas;
|
||||
|
||||
// Lógica de asignación de roles según el origen
|
||||
if (origen == "WEBINTRANET" || origen == "GESTDELE")
|
||||
{
|
||||
if (persona.DELEGADO)
|
||||
usuarioActual.Roll = "DELEGADO";
|
||||
if (persona.SUPERVISORDEPARTAMENTO)
|
||||
usuarioActual.Roll = "SUPERVISOR";
|
||||
if (persona.SUPERVISORDETODO)
|
||||
usuarioActual.Roll = "SUPERVISORDETODO";
|
||||
if (persona.ADMINISTRADORCONTROLHORARIO)
|
||||
usuarioActual.Roll = "ADMINISTRADORCONTROLHORARIO";
|
||||
|
||||
// Consultar incidencias en la vista V_ASISTENCIAS_EXTENDIDA
|
||||
List<V_ASISTENCIAS_EXTENDIDA> asisYestados;
|
||||
if (usuarioActual.Roll == "ADMINISTRADORCONTROLHORARIO")
|
||||
{
|
||||
asisYestados = context.V_ASISTENCIAS_EXTENDIDA
|
||||
.Where(x => x.ULTIMOESTADO.Contains("VISTO BUENO") || x.ULTIMOESTADO == "SOLICITADA")
|
||||
.ToList();
|
||||
}
|
||||
else if (usuarioActual.Roll == "SUPERVISORDETODO")
|
||||
{
|
||||
asisYestados = context.V_ASISTENCIAS_EXTENDIDA
|
||||
.Where(x => x.ULTIMOESTADO.Contains("PROPUESTA") ||
|
||||
x.ULTIMOESTADO == "SOLICITADA" ||
|
||||
x.ULTIMOESTADO.Contains("VISTO BUENO"))
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
asisYestados = context.V_ASISTENCIAS_EXTENDIDA
|
||||
.Where(x => x.ULTIMOESTADO.Contains("PROPUESTA"))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
var asisBorrador = context.V_ASISTENCIAS_EXTENDIDA
|
||||
.Where(x => x.ULTIMOESTADO == "BORRADOR")
|
||||
.ToList();
|
||||
|
||||
if (!string.IsNullOrEmpty(usuarioActual.Roll))
|
||||
{
|
||||
if (usuarioActual.Roll != "ADMINISTRADORCONTROLHORARIO")
|
||||
{
|
||||
// Para SUPERVISOR o DELEGADO se filtra por departamento
|
||||
if (usuarioActual.Roll == "SUPERVISOR" || usuarioActual.Roll == "DELEGADO")
|
||||
{
|
||||
asisYestados = asisYestados
|
||||
.Where(x => x.IDDEPARTAMENTO == persona.IDDEPARTAMENTO)
|
||||
.ToList();
|
||||
}
|
||||
usuarioActual.NumeroInciPorAceptar = asisYestados.Count;
|
||||
usuarioActual.NumeroInciBorrador = asisBorrador
|
||||
.Where(x => x.IDPERSONA == usuarioActual.idPersona)
|
||||
.Count();
|
||||
|
||||
if (usuarioActual.NumeroInciPorAceptar > 0)
|
||||
{
|
||||
usuarioActual.FeIniInciPorAceptar = (DateTime)asisYestados
|
||||
.OrderBy(x => x.FECHAOCURRENCIA)
|
||||
.First().FECHAOCURRENCIA;
|
||||
usuarioActual.FeFinInciPorAceptar = (DateTime)asisYestados
|
||||
.OrderBy(x => x.FECHAOCURRENCIA)
|
||||
.Last().FECHAOCURRENCIA;
|
||||
}
|
||||
if (usuarioActual.NumeroInciBorrador > 0)
|
||||
{
|
||||
usuarioActual.FeIniInciBorrador = (DateTime)asisBorrador
|
||||
.Where(x => x.IDPERSONA == usuarioActual.idPersona)
|
||||
.OrderBy(x => x.FECHAOCURRENCIA)
|
||||
.First().FECHAOCURRENCIA;
|
||||
usuarioActual.FeFinInciBorrador = (DateTime)asisBorrador
|
||||
.Where(x => x.IDPERSONA == usuarioActual.idPersona)
|
||||
.OrderBy(x => x.FECHAOCURRENCIA)
|
||||
.Last().FECHAOCURRENCIA;
|
||||
}
|
||||
}
|
||||
else // Caso ADMINISTRADORCONTROLHORARIO
|
||||
{
|
||||
asisYestados = context.V_ASISTENCIAS_EXTENDIDA
|
||||
.Where(x => x.ULTIMOESTADO == "VISTO BUENO")
|
||||
.ToList();
|
||||
usuarioActual.NumeroInciPorAceptar = asisYestados.Count;
|
||||
usuarioActual.NumeroInciBorrador = asisBorrador.Count;
|
||||
if (usuarioActual.NumeroInciPorAceptar > 0)
|
||||
{
|
||||
usuarioActual.FeIniInciPorAceptar = (DateTime)asisYestados
|
||||
.OrderBy(x => x.FECHAOCURRENCIA)
|
||||
.First().FECHAOCURRENCIA;
|
||||
usuarioActual.FeFinInciPorAceptar = (DateTime)asisYestados
|
||||
.OrderBy(x => x.FECHAOCURRENCIA)
|
||||
.Last().FECHAOCURRENCIA;
|
||||
}
|
||||
if (usuarioActual.NumeroInciBorrador > 0)
|
||||
{
|
||||
usuarioActual.FeIniInciBorrador = (DateTime)asisBorrador
|
||||
.OrderBy(x => x.FECHAOCURRENCIA)
|
||||
.First().FECHAOCURRENCIA;
|
||||
usuarioActual.FeFinInciBorrador = (DateTime)asisBorrador
|
||||
.OrderBy(x => x.FECHAOCURRENCIA)
|
||||
.Last().FECHAOCURRENCIA;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cargar perfiles secundarios (subordinados)
|
||||
if (!string.IsNullOrEmpty(usuarioActual.Roll))
|
||||
{
|
||||
var lpdep = context.PERSONAS
|
||||
.Include(p => p.IDDEPARTAMENTONavigation)
|
||||
.Where(x => x.IDDEPARTAMENTO != null && x.FECHABAJA == null)
|
||||
.ToList();
|
||||
|
||||
if (usuarioActual.Roll == "SUPERVISOR" || usuarioActual.Roll == "DELEGADO")
|
||||
{
|
||||
lpdep = lpdep.Where(x => x.IDDEPARTAMENTO == persona.IDDEPARTAMENTO).ToList();
|
||||
}
|
||||
|
||||
foreach (var perDep in lpdep.OrderBy(x => x.IDDEPARTAMENTO))
|
||||
{
|
||||
if (perDep.NIF.Trim().ToUpper() != nif.Trim().ToUpper() &&
|
||||
(
|
||||
(!perDep.SUPERVISORDEPARTAMENTO && (usuarioActual.Roll == "SUPERVISOR" || usuarioActual.Roll == "DELEGADO"))
|
||||
|| (usuarioActual.Roll == "SUPERVISORDETODO")
|
||||
)
|
||||
)
|
||||
{
|
||||
var subordinate = new Personal
|
||||
{
|
||||
Nombre = perDep.APELLIDOS + ", " + perDep.NOMBRE,
|
||||
Dni = perDep.NIF,
|
||||
idPersona = perDep.IDPERSONA,
|
||||
Departamento = perDep.IDDEPARTAMENTONavigation?.DESCRIPCION,
|
||||
Roll = string.Empty
|
||||
};
|
||||
if (perDep.DELEGADO)
|
||||
subordinate.Roll = "DELEGADO";
|
||||
if (string.IsNullOrEmpty(subordinate.Roll) && perDep.SUPERVISORDEPARTAMENTO)
|
||||
subordinate.Roll = "SUPERVISOR";
|
||||
subordinate.NumeroInciPorAceptar = asisYestados.Where(x => x.IDPERSONA == perDep.IDPERSONA).Count();
|
||||
subordinate.NumeroInciBorrador = asisBorrador.Where(x => x.IDPERSONA == perDep.IDPERSONA).Count();
|
||||
|
||||
personas.Add(subordinate);
|
||||
}
|
||||
}
|
||||
|
||||
// Calcular fechas globales a partir de todos los perfiles (incluyendo el usuario consultante)
|
||||
DateTime fechaNula = new DateTime(1, 1, 1);
|
||||
if (personas.Any(x => x.FeIniInciPorAceptar > fechaNula))
|
||||
{
|
||||
resultadoIdentificacion.FeIniInciPorAceptar = personas
|
||||
.Where(x => x.FeIniInciPorAceptar > fechaNula)
|
||||
.OrderBy(x => x.FeIniInciPorAceptar)
|
||||
.First().FeIniInciPorAceptar;
|
||||
}
|
||||
if (personas.Any(x => x.FeFinInciPorAceptar > fechaNula))
|
||||
{
|
||||
resultadoIdentificacion.FeFinInciPorAceptar = personas
|
||||
.Where(x => x.FeFinInciPorAceptar > fechaNula)
|
||||
.OrderBy(x => x.FeFinInciPorAceptar)
|
||||
.Last().FeFinInciPorAceptar;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Caso "RPT"
|
||||
{
|
||||
if (origen == "RPT" && !persona.ADMINISTRARPTYREGISTRO)
|
||||
{
|
||||
resultadoIdentificacion.resultado = 1;
|
||||
resultadoIdentificacion.errores = "Identificación correcta pero no es Administrador de Rpt y de Registro de Personal";
|
||||
return Ok(resultadoIdentificacion);
|
||||
}
|
||||
}
|
||||
|
||||
resultadoIdentificacion.resultado = 0;
|
||||
resultadoIdentificacion.errores = string.Empty;
|
||||
return Ok(resultadoIdentificacion);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
resultadoIdentificacion.resultado = 3;
|
||||
resultadoIdentificacion.errores = ex.ToString();
|
||||
return Ok(resultadoIdentificacion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
//[ApiController]
|
||||
//[Route("api/[controller]")]
|
||||
//public class SERVICIOSController : GenericoController<SERVICIOS, int>
|
||||
//{
|
||||
// public SERVICIOSController()
|
||||
// : base()
|
||||
// {
|
||||
// }
|
||||
//}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class SITUACIONACTUALIRPFController : GenericoController<SITUACIONACTUALIRPF, int>
|
||||
{
|
||||
public SITUACIONACTUALIRPFController() : base() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class SITUACIONController : GenericoController<SITUACION, int>
|
||||
{
|
||||
public SITUACIONController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class TIPOAPTOSADMINISTRATIVOSController : GenericoController<TIPOAPTOSADMINISTRATIVOS, int>
|
||||
{
|
||||
public TIPOAPTOSADMINISTRATIVOSController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
using SwaggerAntifraudeMYSQL.Controllers;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class TIPOSPUESTOSTRABAJOController : GenericoController<TIPOSPUESTOSTRABAJO, int>
|
||||
{
|
||||
public TIPOSPUESTOSTRABAJOController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public override async Task<IActionResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var entities = await context.TIPOSPUESTOSTRABAJO
|
||||
.Include(x => x.IDTIPOPERSONANavigation)
|
||||
.Include(x=> x.CONCEPTOSTIPOSPUESTOSTRABAJO).ThenInclude(x=> x.IDCONCEPTOGENERALNavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<VIDA_ADMINISTRATIVA>();
|
||||
var entities = context.TIPOSPUESTOSTRABAJO
|
||||
.Include(x => x.IDTIPOPERSONANavigation)
|
||||
.Include(x => x.CONCEPTOSTIPOSPUESTOSTRABAJO).ThenInclude(x => x.IDCONCEPTOGENERALNavigation)
|
||||
//.ThenInclude(pr => pr.IDPERSONANavigation)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDTIPOPUESTO == id);
|
||||
|
||||
|
||||
|
||||
if (entities == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class TIPOSTRAMOSController : GenericoController<TIPOSTRAMOS, int>
|
||||
{
|
||||
public TIPOSTRAMOSController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public override async Task<IActionResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var entities = await context.TIPOSTRAMOS
|
||||
.Include(x => x.IDTIPOTRAMOFICHEROXMLNavigation)
|
||||
.Include(x => x.IDCODIGOTRAMOACUMULANavigation)
|
||||
.Include(x => x.IDREGIMENAPLICACIONNavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
//.Include(v => v.IDSERVICIOADSCRITONavigation)
|
||||
//.Include(v => v.IDUNIDADADMINISTRATIVANavigation)
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class TIPOS_PERSONALController : GenericoController<TIPOS_PERSONAL, int>
|
||||
{
|
||||
public TIPOS_PERSONALController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class TITULACIONESController : GenericoController<TITULACIONES, int>
|
||||
{
|
||||
public TITULACIONESController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("GetWithIncludes/{id}")]
|
||||
public async Task<IActionResult> GetWithIncludes(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Consulta con Includes necesarios
|
||||
var entity = await context.TITULACIONES
|
||||
.Include(p => p.IDPERSONANavigation)
|
||||
.AsNoTracking()
|
||||
.Where(p => p.IDPERSONA == id).ToListAsync();
|
||||
|
||||
// Verifica si la entidad no se encontró
|
||||
if (entity == null)
|
||||
return NotFound($"El puesto con ID {id} no fue encontrado.");
|
||||
|
||||
// Devuelve la entidad con las relaciones cargadas
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<PUESTOS>();
|
||||
var entity = context.TITULACIONES
|
||||
.Include(x=> x.IDPERSONANavigation)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDTITULACION == id);
|
||||
|
||||
if (entity == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class TRABAJADORTIEMPOPARCIALController : GenericoController<TRABAJADORTIEMPOPARCIAL, int>
|
||||
{
|
||||
public TRABAJADORTIEMPOPARCIALController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class TRIENIOSController : GenericoController<TRIENIOS, int>
|
||||
{
|
||||
public TRIENIOSController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("GetWithIncludes/{id}")]
|
||||
public async Task<IActionResult> GetWithIncludes(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Consulta con Includes necesarios
|
||||
var entity = await context.TRIENIOS
|
||||
.Include(p => p.IDGRUPONavigation)
|
||||
.AsNoTracking()
|
||||
.Where(p => p.IDPERSONAL == id).ToListAsync();
|
||||
|
||||
// Verifica si la entidad no se encontró
|
||||
if (entity == null)
|
||||
return NotFound($"El puesto con ID {id} no fue encontrado.");
|
||||
|
||||
// Devuelve la entidad con las relaciones cargadas
|
||||
return Ok(entity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class UNIDADADMINISTRATIVAController : GenericoController<UNIDADADMINISTRATIVA, int>
|
||||
{
|
||||
public UNIDADADMINISTRATIVAController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class VALORESNOMINAController : GenericoController<VALORESNOMINA, int>
|
||||
{
|
||||
public VALORESNOMINAController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class VEHICULOSController : GenericoController<VEHICULOS, int>
|
||||
{
|
||||
public VEHICULOSController()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class VIDA_ADMINISTRATIVAController : GenericoController<VIDA_ADMINISTRATIVA, int>
|
||||
{
|
||||
public VIDA_ADMINISTRATIVAController() : base() { }
|
||||
|
||||
[HttpGet]
|
||||
public override async Task<IActionResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var entities = await context.VIDA_ADMINISTRATIVA
|
||||
.Include(v => v.IDMOTIVONavigation)
|
||||
.ThenInclude(m => m.IDTIPOAPTOSNavigation)
|
||||
.Include(v => v.IDPUESTONavigation)
|
||||
.ThenInclude(x => x.IDRPTDESNavigation)
|
||||
.ThenInclude(y => y.IDDEPARTAMENTONavigation)
|
||||
.Include(v => v.IDTRAMOCARRERAHORIZONTALNavigation)
|
||||
.Include(v => v.IDTIPOPERSONALNavigation)
|
||||
.Include(v => v.NIVEL_OLDNavigation)
|
||||
.Include(v => v.NIVELCNavigation)
|
||||
.Include(v => v.GRUPOTNavigation)
|
||||
.Include(v => v.OCUPACION_OLDNavigation)
|
||||
.Include(v => v.IDPERSONALNavigation)
|
||||
.Include(v => v.IDPUESTONavigation)
|
||||
.ThenInclude(n => n.IDRPTDESNavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
//.Include(v => v.IDSERVICIOADSCRITONavigation)
|
||||
//.Include(v => v.IDUNIDADADMINISTRATIVANavigation)
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("{id}")]
|
||||
public override IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
//var dbSet = context.Set<VIDA_ADMINISTRATIVA>();
|
||||
var entities = context.VIDA_ADMINISTRATIVA
|
||||
.Include(v => v.IDMOTIVONavigation)
|
||||
.ThenInclude(m => m.IDTIPOAPTOSNavigation)
|
||||
.Include(v => v.IDPUESTONavigation)
|
||||
.Include(v => v.IDPERSONALNavigation)
|
||||
.ThenInclude(x => x.IDGRUPOFUNCIONARIONavigation)
|
||||
.Include(v => v.IDTRAMOCARRERAHORIZONTALNavigation)
|
||||
.Include(v => v.IDTIPOPERSONALNavigation)
|
||||
.Include(v => v.NIVEL_OLDNavigation)
|
||||
.Include(v => v.GRUPOTNavigation)
|
||||
.Include(v => v.IDPUESTONavigation)
|
||||
.ThenInclude(s => s.IDRPTDESNavigation)
|
||||
.ThenInclude(y => y.IDDEPARTAMENTONavigation)
|
||||
|
||||
//.Include(v => v.IDSERVICIOADSCRITONavigation)
|
||||
//.Include(v => v.IDUNIDADADMINISTRATIVANavigation)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault(v => v.IDVIDA == id);
|
||||
|
||||
|
||||
|
||||
if (entities == null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpPost("filtrar")] // Cambié a POST ya que estás usando [FromBody]
|
||||
public override async Task<IActionResult> Filtrar([FromBody] ExpressionWrapper request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<VIDA_ADMINISTRATIVA, bool>>;
|
||||
if (deserializedExpression == null)
|
||||
{
|
||||
return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
}
|
||||
var entities = await context.VIDA_ADMINISTRATIVA.Where(deserializedExpression)
|
||||
.Include(v => v.IDMOTIVONavigation)
|
||||
.ThenInclude(m => m.IDTIPOAPTOSNavigation)
|
||||
.Include(v => v.IDPUESTONavigation)
|
||||
.Include(v => v.IDTRAMOCARRERAHORIZONTALNavigation)
|
||||
.Include(v => v.IDTIPOPERSONALNavigation)
|
||||
.Include(v => v.NIVEL_OLDNavigation)
|
||||
//.Include(v => v.IDSERVICIOADSCRITONavigation)
|
||||
//.Include(v => v.IDUNIDADADMINISTRATIVANavigation)
|
||||
.Include(v => v.NIVELCNavigation)
|
||||
.Include(v => v.GRUPOTNavigation)
|
||||
.Include(v => v.OCUPACION_OLDNavigation)
|
||||
.Include(v => v.IDPERSONALNavigation)
|
||||
.Include(v => v.IDPUESTONavigation)
|
||||
.ThenInclude(n => n.IDRPTDESNavigation)
|
||||
.ThenInclude(gr => gr.GRUPO1Navigation)
|
||||
.Include(v => v.IDPUESTONavigation)
|
||||
.ThenInclude(n => n.IDRPTDESNavigation)
|
||||
.ThenInclude(x => x.IDDEPARTAMENTONavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("puestospersona/{idPersona}")]
|
||||
public async Task<IActionResult> PuestosPersona(int idPersona)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
var entities = bdAntifraudeMYSQL.Utilidades.ObtienePuestoPersona(context,idPersona);
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet("vidaspersona/{idPersona}")]
|
||||
public async Task<IActionResult> VidasPersona(int idPersona)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
{
|
||||
// Crear el deserializador
|
||||
var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer());
|
||||
|
||||
// Deserializar la expresión
|
||||
//var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression<Func<VIDA_ADMINISTRATIVA, bool>>;
|
||||
//if (deserializedExpression == null)
|
||||
//{
|
||||
// return BadRequest("La expresión deserializada es nula o incorrecta.");
|
||||
//}
|
||||
var entities = await context.VIDA_ADMINISTRATIVA.Where(x => x.IDPERSONAL == idPersona)
|
||||
.Include(v => v.IDMOTIVONavigation)
|
||||
.ThenInclude(m => m.IDTIPOAPTOSNavigation)
|
||||
.Include(v => v.IDPUESTONavigation)
|
||||
.Include(v => v.IDTRAMOCARRERAHORIZONTALNavigation)
|
||||
.Include(v => v.IDTIPOPERSONALNavigation)
|
||||
.Include(v => v.NIVEL_OLDNavigation)
|
||||
//.Include(v => v.IDSERVICIOADSCRITONavigation)
|
||||
//.Include(v => v.IDUNIDADADMINISTRATIVANavigation)
|
||||
.Include(v => v.NIVELCNavigation)
|
||||
.Include(v => v.GRUPOTNavigation)
|
||||
.Include(v => v.LINEASVIDAADMINISTRATIVA)
|
||||
.Include(v => v.OCUPACION_OLDNavigation)
|
||||
.Include(v => v.IDPERSONALNavigation)
|
||||
.Include(v => v.IDPUESTONavigation)
|
||||
.ThenInclude(n => n.IDRPTDESNavigation)
|
||||
.ThenInclude(x => x.IDDEPARTAMENTONavigation)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
|
||||
// Verificar si el resultado es vacío
|
||||
if (entities.Count == 0)
|
||||
{
|
||||
Console.WriteLine("La consulta no devolvió resultados.");
|
||||
}
|
||||
|
||||
return Ok(entities);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
private static readonly string[] Summaries = new[]
|
||||
{
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
};
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using SwaggerAntifraudeMYSQL.Controllers;
|
||||
using bdAntifraudeMYSQL.vistas;
|
||||
using System.ComponentModel;
|
||||
using Microsoft.AspNetCore.Authorization; // Asegúrate de importar el namespace correcto para VePersonas
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class VePersonasController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Obtiene una lista de VePersonas con un filtro opcional de activos.
|
||||
/// </summary>
|
||||
/// <param name="activos">Indica si solo se deben devolver las personas activas.</param>
|
||||
/// <returns>Lista de VePersonas.</returns>
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
[HttpGet]
|
||||
public IActionResult ObtenerVistaPersonas(bool activos = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: true))
|
||||
{
|
||||
// Llamar al método ObtenerVistaPersonas
|
||||
var personas = VePersonas.ObtenerVistaPersonas(context, activos);
|
||||
|
||||
|
||||
|
||||
return Ok(personas);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error interno del servidor: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace SwaggerAntifraudeMYSQL.DTOs
|
||||
{
|
||||
public class CertificateProxyLoginDto
|
||||
{
|
||||
public string Dni { get; set; } = string.Empty;
|
||||
public string? Origen { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
9
Antifraude.Net/SwaggerAntifraudeMYSQL/DTOs/LoginDto.cs
Normal file
9
Antifraude.Net/SwaggerAntifraudeMYSQL/DTOs/LoginDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace SwaggerAntifraudeMYSQL.DTOs
|
||||
{
|
||||
public class LoginDto
|
||||
{
|
||||
public string NombreUsuario { get; set; }
|
||||
public string Contraseña { get; set; }
|
||||
public string Origen { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Net;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Middlewares
|
||||
{
|
||||
public class ExceptionMiddleware
|
||||
{
|
||||
private readonly RequestDelegate _next;
|
||||
private readonly ILogger<ExceptionMiddleware> _logger;
|
||||
|
||||
public ExceptionMiddleware(RequestDelegate next, ILogger<ExceptionMiddleware> logger)
|
||||
{
|
||||
_next = next;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task InvokeAsync(HttpContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _next(context);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError($"Ocurrió un error: {ex}");
|
||||
|
||||
switch (ex)
|
||||
{
|
||||
case DbUpdateException dbEx:
|
||||
await HandleExceptionAsync(context, "Error al actualizar la base de datos.", HttpStatusCode.BadRequest);
|
||||
break;
|
||||
case KeyNotFoundException _:
|
||||
await HandleExceptionAsync(context, "Recurso no encontrado.", HttpStatusCode.NotFound);
|
||||
break;
|
||||
default:
|
||||
await HandleExceptionAsync(context, "Ocurrió un error inesperado. Por favor, inténtalo de nuevo más tarde.", HttpStatusCode.InternalServerError);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Task HandleExceptionAsync(HttpContext context, string message, HttpStatusCode statusCode)
|
||||
{
|
||||
context.Response.ContentType = "application/json";
|
||||
context.Response.StatusCode = (int)statusCode;
|
||||
|
||||
var response = new { message };
|
||||
var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
|
||||
|
||||
return context.Response.WriteAsync(JsonSerializer.Serialize(response, options));
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Antifraude.Net/SwaggerAntifraudeMYSQL/Models/Personal.cs
Normal file
19
Antifraude.Net/SwaggerAntifraudeMYSQL/Models/Personal.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace SwaggerAntifraudeMYSQL.Models
|
||||
{
|
||||
public class Personal
|
||||
{
|
||||
public string Nombre { get; set; }
|
||||
public string Dni { get; set; }
|
||||
public int idPersona { get; set; }
|
||||
public string Departamento { get; set; }
|
||||
public string Roll { get; set; }
|
||||
public string Grupo { get; set; }
|
||||
public int NumeroInciPorAceptar { get; set; }
|
||||
public int NumeroInciBorrador { get; set; }
|
||||
public DateTime FeIniInciPorAceptar { get; set; }
|
||||
public DateTime FeFinInciPorAceptar { get; set; }
|
||||
public DateTime FeIniInciBorrador { get; set; }
|
||||
public DateTime FeFinInciBorrador { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Models
|
||||
{
|
||||
public class ResultadoIdentificacion
|
||||
{
|
||||
public int resultado { get; set; }
|
||||
public List<Personal> Personas { get; set; }
|
||||
public DateTime FeIniInciPorAceptar { get; set; }
|
||||
public DateTime FeFinInciPorAceptar { get; set; }
|
||||
public string errores { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,159 @@
|
||||
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System.Text;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using System.Reflection;
|
||||
using System.Text.Json.Serialization;
|
||||
using SwaggerAntifraudeMYSQL.Middlewares;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
SwaggerAntifraudeMYSQL.ContextosMySql.Configurar(builder.Configuration["MySql:NombreConexion"]);
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
// 1. Configuración de Servicios
|
||||
|
||||
// a. Configurar servicios de controladores
|
||||
builder.Services.AddControllers()
|
||||
.ConfigureApiBehaviorOptions(options =>
|
||||
{
|
||||
options.SuppressModelStateInvalidFilter = true; // Desactiva la validación automática del estado del modelo
|
||||
})
|
||||
.AddJsonOptions(options =>
|
||||
{
|
||||
options.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles;
|
||||
});
|
||||
|
||||
// b. Configuración de JWT
|
||||
var jwtSettings = builder.Configuration.GetSection("Jwt");
|
||||
var keyString = jwtSettings["Key"];
|
||||
if (string.IsNullOrEmpty(keyString))
|
||||
{
|
||||
throw new ArgumentNullException("JWT Key is not configured.");
|
||||
}
|
||||
var key = Encoding.UTF8.GetBytes(keyString);
|
||||
|
||||
if (!double.TryParse(jwtSettings["ExpiresInMinutes"], out double expiresInMinutes))
|
||||
{
|
||||
expiresInMinutes = 60; // Valor por defecto
|
||||
}
|
||||
|
||||
builder.Services.AddAuthentication(options =>
|
||||
{
|
||||
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
})
|
||||
.AddJwtBearer(options =>
|
||||
{
|
||||
options.TokenValidationParameters = new TokenValidationParameters
|
||||
{
|
||||
ValidateIssuer = true,
|
||||
ValidateAudience = true,
|
||||
ValidateLifetime = true,
|
||||
ValidateIssuerSigningKey = true,
|
||||
ValidIssuer = jwtSettings["Issuer"],
|
||||
ValidAudience = jwtSettings["Audience"],
|
||||
IssuerSigningKey = new SymmetricSecurityKey(key)
|
||||
};
|
||||
});
|
||||
|
||||
builder.WebHost.ConfigureKestrel(options =>
|
||||
{
|
||||
options.ConfigureHttpsDefaults(httpsOptions =>
|
||||
{
|
||||
httpsOptions.ClientCertificateMode =
|
||||
Microsoft.AspNetCore.Server.Kestrel.Https.ClientCertificateMode.AllowCertificate;
|
||||
|
||||
// (Opcional, en pruebas)
|
||||
httpsOptions.AllowAnyClientCertificate();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// c. Definir Políticas de Autorización
|
||||
builder.Services.AddAuthorization(options =>
|
||||
{
|
||||
options.AddPolicy("SupervisorPolicy", policy => policy.RequireRole("Supervisor"));
|
||||
options.AddPolicy("LecturaPolicy", policy => policy.RequireRole("Lectura", "Supervisor"));
|
||||
});
|
||||
|
||||
// d. Configurar Swagger con soporte para JWT
|
||||
builder.Services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Swagger OAAF API MySQL", Version = "v1" });
|
||||
|
||||
// Definir el esquema de seguridad JWT
|
||||
var securityScheme = new OpenApiSecurityScheme
|
||||
{
|
||||
Name = "Authorization",
|
||||
Description = "Ingrese 'Bearer' seguido de su token en el campo de texto.\n\nEjemplo: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6...'",
|
||||
In = ParameterLocation.Header,
|
||||
Type = SecuritySchemeType.ApiKey,
|
||||
Scheme = "Bearer",
|
||||
BearerFormat = "JWT"
|
||||
};
|
||||
|
||||
c.AddSecurityDefinition("Bearer", securityScheme);
|
||||
|
||||
|
||||
var securityRequirement = new OpenApiSecurityRequirement
|
||||
{
|
||||
{
|
||||
new OpenApiSecurityScheme
|
||||
{
|
||||
Reference = new OpenApiReference
|
||||
{
|
||||
Type = ReferenceType.SecurityScheme,
|
||||
Id = "Bearer"
|
||||
}
|
||||
},
|
||||
new string[] {}
|
||||
}
|
||||
};
|
||||
|
||||
c.AddSecurityRequirement(securityRequirement);
|
||||
|
||||
// Incluir comentarios XML para Swagger
|
||||
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
||||
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
|
||||
if (File.Exists(xmlPath))
|
||||
{
|
||||
c.IncludeXmlComments(xmlPath);
|
||||
}
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
// 2. Configuración del Pipeline HTTP
|
||||
|
||||
// a. Middleware de Excepciones
|
||||
app.UseMiddleware<ExceptionMiddleware>();
|
||||
|
||||
// b. Habilitar Swagger solo en Desarrollo
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "SwaggerAntifraudeMYSQL API V1");
|
||||
c.RoutePrefix = string.Empty; // Swagger en la raíz
|
||||
});
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
//app.UseHttpsRedirection();
|
||||
|
||||
// c. Configurar CORS (Opcional)
|
||||
app.UseCors("AllowSpecificOrigin");
|
||||
|
||||
// d. Autenticación y Autorización
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
// e. Mapear Controladores
|
||||
app.MapControllers();
|
||||
|
||||
// f. Ejecutar la Aplicación
|
||||
app.Run();
|
||||
|
||||
23
Antifraude.Net/SwaggerAntifraudeMYSQL/README.md
Normal file
23
Antifraude.Net/SwaggerAntifraudeMYSQL/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# SwaggerAntifraudeMYSQL
|
||||
|
||||
Esta API reproduce las rutas de `SwaggerAntifraude` y utiliza `bdAntifraudeMYSQL`.
|
||||
|
||||
## Conexión MySQL
|
||||
|
||||
La cadena de conexión se resuelve en `bdAntifraudeMYSQL/dbcontext/conexion.cs`, mediante el método original `tsGestionAntifraude.NuevoContexto(NombreConexion: ...)`. No se necesitan las claves `ConnectionStrings:WriteConnection` ni `ConnectionStrings:ReadOnlyConnection`.
|
||||
|
||||
El nombre de la entrada se selecciona en `appsettings.json` de este proyecto:
|
||||
|
||||
```json
|
||||
"MySql": {
|
||||
"NombreConexion": "Producción"
|
||||
}
|
||||
```
|
||||
|
||||
`Producción` es el nombre de la entrada actualmente activa en `conexion.cs`; el nombre por sí solo no indica a qué servidor o base apunta. Comprueba que esa entrada corresponde a la nueva base MySQL antes de probar rutas que escriban datos. Para elegir otra entrada, cambia solo `MySql:NombreConexion` en esta API y asegúrate de que exista en `conexion.cs`.
|
||||
|
||||
## Ejecutar
|
||||
|
||||
El Swagger conserva la autenticación JWT de la API original. Su sección `Jwt` se ha copiado a `appsettings.json` de esta instancia para mantener compatibles los tokens al cambiar la URL de la API.
|
||||
|
||||
Desde esta carpeta, ejecuta `dotnet run --project SwaggerAntifraudeMYSQL.csproj --launch-profile http`. La interfaz Swagger aparece en la raíz de la URL indicada por el perfil `http` en Development. Las rutas `api/...` mantienen los nombres de los controladores originales.
|
||||
@@ -0,0 +1,292 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Renci.SshNet;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using SwaggerAntifraudeMYSQL.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using bdAntifraudeMYSQL.clases;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Servicios
|
||||
{
|
||||
|
||||
public class ServicioAlmacenamiento
|
||||
{
|
||||
private static IConfiguration Conf { get; set; }
|
||||
public ResultadoAlmacenaFicheroAtransmitir DevolverResultadoAlmacenaFicheroAtransmitir(int idRegistro, string tabla, string ficheroBase64)
|
||||
{
|
||||
var resultado = new ResultadoAlmacenaFicheroAtransmitir();
|
||||
|
||||
try
|
||||
{
|
||||
// Convertir el archivo Base64 a un flujo
|
||||
var stream = new MemoryStream(Convert.FromBase64String(ficheroBase64));
|
||||
|
||||
// Obtener el nombre de la base de datos utilizando el contexto
|
||||
string baseDeDatos;
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true))
|
||||
{
|
||||
baseDeDatos = context.Database.GetDbConnection().Database;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(baseDeDatos))
|
||||
{
|
||||
Conf = new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json")
|
||||
.Build();
|
||||
baseDeDatos = Conf.GetSection("BaseDatos").Value; ;
|
||||
}
|
||||
|
||||
// Conectar al servidor SFTP utilizando el contexto
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true))
|
||||
using (var clienteSftp = ConectarServidorSftp(context))
|
||||
{
|
||||
clienteSftp.Connect();
|
||||
|
||||
// Generar la ruta base
|
||||
string ruta = $"{baseDeDatos.ToLower()}/registrodepersonal";
|
||||
|
||||
switch (tabla.ToUpper())
|
||||
{
|
||||
case "LINEAVIDAADMINISTRATIVA":
|
||||
ruta += "/lineavidaadministrativa/";
|
||||
break;
|
||||
case "FORMACION":
|
||||
ruta += "/formacion/";
|
||||
break;
|
||||
case "TITULACION":
|
||||
ruta += "/titulacion/";
|
||||
break;
|
||||
case "DOCENCIA":
|
||||
ruta += "/docencia/";
|
||||
break;
|
||||
case "INCIDENCIA":
|
||||
ruta = $"{baseDeDatos.ToLower()}/control_horario/";
|
||||
break;
|
||||
default:
|
||||
resultado.Resultado = 1;
|
||||
resultado.Mensaje = "Tabla no contemplada entre las posibles para tener ficheros";
|
||||
return resultado;
|
||||
}
|
||||
|
||||
// Subir el archivo al servidor SFTP
|
||||
ruta += $"{idRegistro}.pdf";
|
||||
clienteSftp.UploadFile(stream, ruta);
|
||||
clienteSftp.Disconnect();
|
||||
|
||||
resultado.Resultado = 0;
|
||||
resultado.Mensaje = "Fichero almacenado";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
resultado.Resultado = 1;
|
||||
resultado.Mensaje = $"ERROR de generación: {ex.Message}";
|
||||
|
||||
if (ex.InnerException != null)
|
||||
{
|
||||
resultado.Mensaje += $" {ex.InnerException.Message}";
|
||||
}
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
public ResultadoObtenFicheroAtransmitir DevolverObtenFicheroAtransmitir(int idRegistro, string tabla, string nif)
|
||||
{
|
||||
var resultado = new ResultadoObtenFicheroAtransmitir();
|
||||
|
||||
try
|
||||
{
|
||||
// Obtener el nombre de la base de datos utilizando el contexto
|
||||
string baseDeDatos;
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true))
|
||||
{
|
||||
baseDeDatos = context.Database.GetDbConnection().Database;
|
||||
}
|
||||
|
||||
Conf = new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json")
|
||||
.Build();
|
||||
baseDeDatos = Conf.GetSection("BaseDatos").Value; ;
|
||||
|
||||
//if (string.IsNullOrEmpty(baseDeDatos))
|
||||
//{
|
||||
// baseDeDatos = "preproduccion";
|
||||
//}
|
||||
|
||||
// Generar la ruta base
|
||||
string ruta = $"{baseDeDatos.ToLower()}/registrodepersonal";
|
||||
|
||||
switch (tabla.ToUpper())
|
||||
{
|
||||
case "LINEAVIDAADMINISTRATIVA":
|
||||
ruta += "/lineavidaadministrativa/";
|
||||
break;
|
||||
case "FORMACION":
|
||||
ruta += "/formacion/";
|
||||
break;
|
||||
case "TITULACION":
|
||||
ruta += "/titulacion/";
|
||||
break;
|
||||
case "DOCENCIA":
|
||||
ruta += "/docencia/";
|
||||
break;
|
||||
case "INCIDENCIA":
|
||||
ruta = $"{baseDeDatos.ToLower()}/control_horario/";
|
||||
break;
|
||||
case "CSV":
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true))
|
||||
{
|
||||
//ruta += context.VALIDACIONDOCUMENTOS.First(x => x.CSV == nif).RUTAFICHERO;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
resultado.Resultado = 1;
|
||||
resultado.Mensaje = "Tabla no contemplada entre las posibles para tener ficheros";
|
||||
return resultado;
|
||||
}
|
||||
|
||||
if (tabla.ToUpper() != "CSV")
|
||||
{
|
||||
ruta += $"{idRegistro}.pdf";
|
||||
}
|
||||
|
||||
resultado.Mensaje = $"Ruta: {ruta}";
|
||||
|
||||
// Descargar el archivo desde el servidor SFTP
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true))
|
||||
using (var clienteSftp = ConectarServidorSftp(context))
|
||||
{
|
||||
clienteSftp.Connect();
|
||||
|
||||
using var memoryStream = new MemoryStream();
|
||||
clienteSftp.DownloadFile(ruta, memoryStream);
|
||||
clienteSftp.Disconnect();
|
||||
|
||||
resultado.Pdf = memoryStream.ToArray();
|
||||
}
|
||||
|
||||
resultado.Resultado = 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
resultado.Resultado = 1;
|
||||
resultado.Mensaje = $"ERROR de generación: {ex.Message}";
|
||||
|
||||
if (ex.InnerException != null)
|
||||
{
|
||||
resultado.Mensaje += $" {ex.InnerException.Message}";
|
||||
}
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
public ResultadoObtenFicheroAtransmitir EliminarFicheroAtransmitir(int idRegistro, string tabla, string nif)
|
||||
{
|
||||
var resultado = new ResultadoObtenFicheroAtransmitir();
|
||||
|
||||
try
|
||||
{
|
||||
// Obtener el nombre de la base de datos utilizando el contexto
|
||||
string baseDeDatos;
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true))
|
||||
{
|
||||
baseDeDatos = context.Database.GetDbConnection().Database;
|
||||
}
|
||||
|
||||
Conf = new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json")
|
||||
.Build();
|
||||
baseDeDatos = Conf.GetSection("BaseDatos").Value; ;
|
||||
|
||||
//if (string.IsNullOrEmpty(baseDeDatos))
|
||||
//{
|
||||
// baseDeDatos = "preproduccion";
|
||||
//}
|
||||
|
||||
// Generar la ruta base
|
||||
string ruta = $"{baseDeDatos.ToLower()}/registrodepersonal";
|
||||
|
||||
switch (tabla.ToUpper())
|
||||
{
|
||||
case "LINEAVIDAADMINISTRATIVA":
|
||||
ruta += "/lineavidaadministrativa/";
|
||||
break;
|
||||
case "FORMACION":
|
||||
ruta += "/formacion/";
|
||||
break;
|
||||
case "TITULACION":
|
||||
ruta += "/titulacion/";
|
||||
break;
|
||||
case "DOCENCIA":
|
||||
ruta += "/docencia/";
|
||||
break;
|
||||
case "INCIDENCIA":
|
||||
ruta = $"{baseDeDatos.ToLower()}/control_horario/";
|
||||
break;
|
||||
case "CSV":
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true))
|
||||
{
|
||||
//ruta += context.VALIDACIONDOCUMENTOS.First(x => x.CSV == nif).RUTAFICHERO;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
resultado.Resultado = 1;
|
||||
resultado.Mensaje = "Tabla no contemplada entre las posibles para tener ficheros";
|
||||
return resultado;
|
||||
}
|
||||
|
||||
if (tabla.ToUpper() != "CSV")
|
||||
{
|
||||
ruta += $"{idRegistro}.pdf";
|
||||
}
|
||||
|
||||
resultado.Mensaje = $"Ruta: {ruta}";
|
||||
|
||||
// Descargar el archivo desde el servidor SFTP
|
||||
using (var context = ContextosMySql.NuevoContexto(SoloLectura: true))
|
||||
using (var clienteSftp = ConectarServidorSftp(context))
|
||||
{
|
||||
clienteSftp.Connect();
|
||||
|
||||
//using var memoryStream = new MemoryStream();
|
||||
clienteSftp.DeleteFile(ruta);
|
||||
clienteSftp.Disconnect();
|
||||
|
||||
//resultado.Pdf = memoryStream.ToArray();
|
||||
}
|
||||
|
||||
resultado.Resultado = 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
resultado.Resultado = 1;
|
||||
resultado.Mensaje = $"ERROR de generación: {ex.Message}";
|
||||
|
||||
if (ex.InnerException != null)
|
||||
{
|
||||
resultado.Mensaje += $" {ex.InnerException.Message}";
|
||||
}
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
private SftpClient ConectarServidorSftp(tsGestionAntifraude context)
|
||||
{
|
||||
var configuraciones = context.ENUMERACIONES
|
||||
.Where(x => x.IDGRUPOENUMERACIONNavigation.GRUPO == "SERVIDORSFTP")
|
||||
.ToList();
|
||||
|
||||
var servidor = configuraciones.First(n => n.CODIGO == "SERVIDORSFTP.SERVIDOR").VALORALFABETICO1;
|
||||
var puerto = int.Parse(configuraciones.First(n => n.CODIGO == "SERVIDORSFTP.PUERTO").VALORALFABETICO1);
|
||||
var usuario = configuraciones.First(n => n.CODIGO == "SERVIDORSFTP.USUARIO").VALORALFABETICO1;
|
||||
var clave = tsUtilidades.crypt.FEncS(
|
||||
configuraciones.First(n => n.CODIGO == "SERVIDORSFTP.CLAVE").VALORALFABETICO1,
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/\\-*",
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/\\-*",
|
||||
-875421649);
|
||||
|
||||
return new SftpClient(servidor, puerto, usuario, clave);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,820 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL.dbcontext;
|
||||
using bdAntifraudeMYSQL.DatRecTri;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Servicios
|
||||
{
|
||||
public class ServicioFormularios
|
||||
{
|
||||
// public byte[] GenerarFormulario(
|
||||
// string claveFormulario,
|
||||
// string idPersona,
|
||||
// string Motivo,
|
||||
// string texto1,
|
||||
// string texto2,
|
||||
// string FechaEfecto,
|
||||
// string Organo,
|
||||
// string FechaEmision,
|
||||
// string Extra)
|
||||
// {
|
||||
// switch (claveFormulario)
|
||||
// {
|
||||
// case "TomPos":
|
||||
// return DevuelveTomaPosesion(idPersona, Motivo, texto1, FechaEfecto, Organo, FechaEmision);
|
||||
// case "CumTri":
|
||||
// return DevuelveCumplimientoTrienios(idPersona, Motivo, texto1, FechaEfecto, Organo, FechaEmision, "RECTRI");
|
||||
// case "SolTri":
|
||||
// return DevuelveCumplimientoTrienios(idPersona, Motivo, texto1, FechaEfecto, Organo, FechaEmision, "SOLTRI");
|
||||
// case "ComInt":
|
||||
// return DevuelveComunicacionInterna(idPersona, texto1, texto2, FechaEmision);
|
||||
// case "AcuJub":
|
||||
// return DevuelveAcuerdoJubilacion(idPersona, Motivo, texto1, FechaEfecto, Organo, FechaEmision, Extra);
|
||||
// case "AcuBaj":
|
||||
// return DevuelveAcuerdoBaja(idPersona, Motivo, texto1, FechaEfecto, Organo, FechaEmision);
|
||||
// case "AcuCes":
|
||||
// return DevuelveAcuerdoCese(idPersona, Motivo, texto1, FechaEfecto, Organo, FechaEmision);
|
||||
// case "ConGra":
|
||||
// return DevuelveConsolidacionGrado(idPersona, Motivo, texto1, texto2, FechaEfecto, Organo, FechaEmision);
|
||||
// default:
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
// private byte[] DevuelveTomaPosesion(
|
||||
//string idPersona,
|
||||
//string motivo,
|
||||
//string texto1,
|
||||
//string fechaEfecto,
|
||||
//string organo,
|
||||
//string fechaEmision)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
// {
|
||||
// PERSONAS per = new PERSONAS();
|
||||
// var LisTomPos = new List<bdAntifraudeMYSQL.DatRecTri.RecTri>();
|
||||
// var ForTomPos = new bdAntifraudeMYSQL.DatRecTri.RecTri();
|
||||
|
||||
// if (!string.IsNullOrEmpty(idPersona))
|
||||
// {
|
||||
// int iDPer = Convert.ToInt32(idPersona);
|
||||
// per = context.PERSONAS.First(x => x.IDPERSONA == iDPer);
|
||||
|
||||
// ForTomPos.Nif = per.NIF;
|
||||
// ForTomPos.Apellidos = per.APELLIDOS;
|
||||
// ForTomPos.Nombre = per.NOMBRE;
|
||||
// ForTomPos.Adscripcion = per.IDADSCRIPCIONRPTNavigation.DESCRIPCION;
|
||||
// ForTomPos.NRP = per.NRP;
|
||||
|
||||
// if (per.IDSITUACIONADMINISTRATIVARPT != null)
|
||||
// ForTomPos.SitAdm = per.IDSITUACIONADMINISTRATIVARPTNavigation.LITERAL_SITUACION;
|
||||
|
||||
// if (per.IDCUERPORPT != null)
|
||||
// ForTomPos.Cuerpo = per.IDCUERPORPTNavigation.DESCRIPCION;
|
||||
|
||||
// ForTomPos.Grupo = per.GRUPOFUNCIONARIODESCRIPCION;
|
||||
|
||||
// PUESTOS PuestoTrabajo = null;
|
||||
|
||||
// var puestosPersona = context.PUESTOS.Where(x => x.IDPERSONAL == per.IDPERSONA);
|
||||
// if (puestosPersona.Any())
|
||||
// {
|
||||
// PuestoTrabajo = puestosPersona
|
||||
// .OrderByDescending(x => x.IDRPTNavigation.F_PARLAMENTO.Value)
|
||||
// .First();
|
||||
|
||||
// ForTomPos.DesPuesTrab = PuestoTrabajo.IDRPTDESNavigation.DENOMINACION;
|
||||
// }
|
||||
|
||||
// if (per.DEPARTAMENTOACTUAL != null)
|
||||
// ForTomPos.Departamento = per.IDDEPARTAMENTONavigation.DESCRIPCION;
|
||||
|
||||
// if (PuestoTrabajo != null)
|
||||
// {
|
||||
// ForTomPos.CuerpoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.CUERPO1Navigation.DESCRIPCION;
|
||||
|
||||
// double Especifico = double.Parse(PuestoTrabajo.IDRPTDESNavigation.ESPECIFICO.ToString());
|
||||
// ForTomPos.ComEsp = Especifico.ToString("##,##0.00") + "€";
|
||||
|
||||
// ForTomPos.GrupoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.GRUPO1Navigation.GRUPO1;
|
||||
// ForTomPos.NivelPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.IDNIVEL_RPTNavigation.NIVEL1;
|
||||
// ForTomPos.CarOcu = PuestoTrabajo.IDOCUPACIONNavigation.DESCRIPCION;
|
||||
// }
|
||||
|
||||
// ForTomPos.MotivoTomaPosesion = motivo;
|
||||
// ForTomPos.texto1 = texto1;
|
||||
// ForTomPos.FechaEfectoTomaPosesion = fechaEfecto;
|
||||
// ForTomPos.OrganoCompetente = organo;
|
||||
// ForTomPos.FechaEmision = fechaEmision;
|
||||
// }
|
||||
|
||||
// LisTomPos.Add(ForTomPos);
|
||||
|
||||
// var pl = context.PLANTILLAS.First(x => x.CODIGO == "TOMPOS");
|
||||
// var idPlantilla = pl.IDPLANTILLA;
|
||||
|
||||
// var sFicherohtmlTmp = tsUtilidades.Utilidades.ObtieneFicheroAleatorio("pdf");
|
||||
|
||||
// //return tsXtraReport.ExportarAPDF(pl.IDFICHERONavigation.FICHERO, LisTomPos).ToArray();
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// private byte[] DevuelveCumplimientoTrienios(
|
||||
// string idPersona,
|
||||
// string motivo,
|
||||
// string texto1,
|
||||
// string fechaEfecto,
|
||||
// string organo,
|
||||
// string fechaEmision,
|
||||
// string Tipo)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
// {
|
||||
// PERSONAS per=null;
|
||||
// var LisCumTri = new List<bdAntifraudeMYSQL.DatRecTri.RecTri>();
|
||||
// var ForCumTri = new bdAntifraudeMYSQL.DatRecTri.RecTri();
|
||||
|
||||
// if (!string.IsNullOrEmpty(idPersona))
|
||||
// {
|
||||
// int iDPer = Convert.ToInt32(idPersona);
|
||||
// per = context.PERSONAS.First(x => x.IDPERSONA == iDPer);
|
||||
|
||||
// ForCumTri.Nif = per.NIF;
|
||||
// ForCumTri.Apellidos = per.APELLIDOS;
|
||||
// ForCumTri.Nombre = per.NOMBRE;
|
||||
// ForCumTri.Adscripcion = per.IDADSCRIPCIONRPTNavigation.DESCRIPCION;
|
||||
// ForCumTri.NRP = per.NRP;
|
||||
|
||||
// if (per.IDSITUACIONADMINISTRATIVARPT != null)
|
||||
// ForCumTri.SitAdm = per.IDSITUACIONADMINISTRATIVARPTNavigation.LITERAL_SITUACION;
|
||||
|
||||
// if (per.IDCUERPORPT != null)
|
||||
// ForCumTri.Cuerpo = per.IDCUERPORPTNavigation.DESCRIPCION;
|
||||
|
||||
// ForCumTri.Grupo = per.GRUPOFUNCIONARIODESCRIPCION;
|
||||
// ForCumTri.Localidad = per.NombrePoblacion;
|
||||
// ForCumTri.Provincia = per.NombreProvincia;
|
||||
|
||||
// PUESTOS PuestoTrabajo = null;
|
||||
// var iDSitRptAct = context.ENUMERACIONES.First(x => x.CODIGO == "SITRPTMAESTRO.ACT").IDENUMERACION;
|
||||
|
||||
// var puestosActivos = context.PUESTOS
|
||||
// .Where(x => x.IDPERSONAL == per.IDPERSONA && x.IDRPTNavigation.IDSITUACION == iDSitRptAct);
|
||||
|
||||
// if (puestosActivos.Any())
|
||||
// {
|
||||
// PuestoTrabajo = puestosActivos.First();
|
||||
// ForCumTri.DesPuesTrab = PuestoTrabajo.IDRPTDESNavigation.DENOMINACION;
|
||||
// }
|
||||
|
||||
// if (per.FECHACUMPLIMIENTOPROXTRIENIO.HasValue)
|
||||
// {
|
||||
// //Truncamos la fecha a los primeros 10 caracteres
|
||||
// var fechaProx = per.FECHACUMPLIMIENTOPROXTRIENIO.Value;
|
||||
// ForCumTri.FecVenTri = fechaProx.ToString("yyyy-MM-dd").Substring(0, 10);
|
||||
|
||||
// if (fechaProx.Day == 1)
|
||||
// {
|
||||
// ForCumTri.FechaEfeEco = fechaProx.ToString("yyyy-MM-dd").Substring(0, 10);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var Fechaefe = fechaProx.AddMonths(1);
|
||||
// var primerDiaMesSiguiente = new DateTime(Fechaefe.Year, Fechaefe.Month, 1);
|
||||
// ForCumTri.FechaEfeEco = primerDiaMesSiguiente.ToString("yyyy-MM-dd").Substring(0, 10);
|
||||
// }
|
||||
|
||||
// ForCumTri.FecCumProTri = fechaProx.AddYears(3).ToString("yyyy-MM-dd").Substring(0, 10);
|
||||
// }
|
||||
|
||||
// //Calcular trienios
|
||||
// if (per.TRIENIOS.Any())
|
||||
// {
|
||||
// foreach (var trienio in per.TRIENIOS.ToList())
|
||||
// {
|
||||
// var grupoTrim = trienio.GRUPO.Trim();
|
||||
// switch (grupoTrim)
|
||||
// {
|
||||
// case "A1":
|
||||
// case "I":
|
||||
// ForCumTri.TriA1 = trienio.TC;
|
||||
// if (per.GRUPOFUNCIONARIODESCRIPCION == "A1")
|
||||
// ForCumTri.TriA1 = (int)(trienio.TC + trienio.TOA + 1);
|
||||
// break;
|
||||
// case "A2":
|
||||
// case "II":
|
||||
// ForCumTri.TriA2 = trienio.TC;
|
||||
// if (per.GRUPOFUNCIONARIODESCRIPCION == "A2")
|
||||
// ForCumTri.TriA2 = trienio.TC + trienio.TOA + 1;
|
||||
// break;
|
||||
// case "C1":
|
||||
// case "III":
|
||||
// ForCumTri.TriC1 = trienio.TC;
|
||||
// if (per.GRUPOFUNCIONARIODESCRIPCION == "C1")
|
||||
// ForCumTri.TriC1 = trienio.TC + trienio.TOA + 1;
|
||||
// break;
|
||||
// case "C2":
|
||||
// case "IV":
|
||||
// ForCumTri.TriC2 = trienio.TC;
|
||||
// if (per.GRUPOFUNCIONARIODESCRIPCION == "C2")
|
||||
// ForCumTri.TriC2 = trienio.TC + trienio.TOA + 1;
|
||||
// break;
|
||||
// case "E":
|
||||
// case "V":
|
||||
// ForCumTri.TriE = trienio.TC;
|
||||
// if (per.GRUPOFUNCIONARIODESCRIPCION == "E")
|
||||
// ForCumTri.TriE = trienio.TC + trienio.TOA + 1;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //No hay trienios, se asigna 1 según el grupo
|
||||
// if (!string.IsNullOrWhiteSpace(per.GRUPOFUNCIONARIODESCRIPCION))
|
||||
// {
|
||||
// switch (per.GRUPOFUNCIONARIODESCRIPCION.Trim())
|
||||
// {
|
||||
// case "A1":
|
||||
// ForCumTri.TriA1 = 1;
|
||||
// break;
|
||||
// case "A2":
|
||||
// ForCumTri.TriA2 = 1;
|
||||
// break;
|
||||
// case "C1":
|
||||
// ForCumTri.TriC1 = 1;
|
||||
// break;
|
||||
// case "C2":
|
||||
// ForCumTri.TriC2 = 1;
|
||||
// break;
|
||||
// case "E":
|
||||
// ForCumTri.TriE = 1;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// else if (PuestoTrabajo != null)
|
||||
// {
|
||||
// //Si no hay grupo en persona, se toma del puesto de trabajo
|
||||
// var grupoPT = PuestoTrabajo.IDRPTDESNavigation.GRUPO1Navigation.GRUPO1.Trim();
|
||||
// switch (grupoPT)
|
||||
// {
|
||||
// case "A1":
|
||||
// ForCumTri.TriA1 = 1;
|
||||
// break;
|
||||
// case "A2":
|
||||
// ForCumTri.TriA2 = 1;
|
||||
// break;
|
||||
// case "C1":
|
||||
// ForCumTri.TriC1 = 1;
|
||||
// break;
|
||||
// case "C2":
|
||||
// ForCumTri.TriC2 = 1;
|
||||
// break;
|
||||
// case "E":
|
||||
// ForCumTri.TriE = 1;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// //Departamento y otros datos del puesto
|
||||
// if (PuestoTrabajo != null)
|
||||
// {
|
||||
// ForCumTri.Departamento = PuestoTrabajo.IDRPTDESNavigation.DEPARTAMENTO;
|
||||
// ForCumTri.CuerpoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.CUERPO1Navigation.DESCRIPCION;
|
||||
|
||||
// double Especifico = double.Parse(PuestoTrabajo.IDRPTDESNavigation.ESPECIFICO.ToString());
|
||||
// ForCumTri.ComEsp = Especifico.ToString("##,##0.00") + "€";
|
||||
|
||||
// ForCumTri.GrupoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.GRUPO1Navigation.GRUPO1;
|
||||
// ForCumTri.NivelPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.IDNIVEL_RPTNavigation.NIVEL1;
|
||||
|
||||
// if (per.NIVEL != null)
|
||||
// ForCumTri.Nivel = per.IDNIVELRPTNavigation.NIVEL1;
|
||||
|
||||
// ForCumTri.CarOcu = PuestoTrabajo.IDOCUPACIONNavigation.DESCRIPCION;
|
||||
// }
|
||||
|
||||
// ForCumTri.MotivoTomaPosesion = motivo;
|
||||
// ForCumTri.texto1 = texto1;
|
||||
|
||||
// if (!string.IsNullOrEmpty(fechaEfecto) && fechaEfecto.Length >= 10)
|
||||
// ForCumTri.FechaEfectoTomaPosesion = fechaEfecto.Substring(0, 10);
|
||||
|
||||
// ForCumTri.OrganoCompetente = organo;
|
||||
// ForCumTri.FechaEmision = fechaEmision;
|
||||
|
||||
// ForCumTri.TolTri = per.TRIENIOS.Sum(x => x.TC) + per.TRIENIOS.Sum(x => x.TOA);
|
||||
// ForCumTri.texto1 = (ForCumTri.TolTri + 1).ToString();
|
||||
|
||||
// if (per.FECHACUMPLIMIENTOPROXTRIENIO.HasValue)
|
||||
// {
|
||||
// var fechaProx = per.FECHACUMPLIMIENTOPROXTRIENIO.Value;
|
||||
// ForCumTri.texto2 = fechaProx.Day.ToString().PadLeft(2, '0') + " de " +
|
||||
// tsUtilidades.Extensiones.DateTimeExtensions.MesCastellano(fechaProx) + " de " +
|
||||
// fechaProx.Year.ToString();
|
||||
// }
|
||||
// }
|
||||
|
||||
// LisCumTri.Add(ForCumTri);
|
||||
|
||||
// if (per != null && per.IDADSCRIPCIONRPTNavigation.DESCRIPCION == "LABORAL")
|
||||
// {
|
||||
// switch (ForCumTri.Grupo)
|
||||
// {
|
||||
// case "A1":
|
||||
// ForCumTri.Grupo = "I";
|
||||
// break;
|
||||
// case "A2":
|
||||
// ForCumTri.Grupo = "II";
|
||||
// break;
|
||||
// case "C1":
|
||||
// ForCumTri.Grupo = "III";
|
||||
// break;
|
||||
// case "C2":
|
||||
// ForCumTri.Grupo = "IV";
|
||||
// break;
|
||||
// case "E":
|
||||
// ForCumTri.Grupo = "V";
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// PLANTILLAS pl;
|
||||
|
||||
// if (Tipo == "RECTRI")
|
||||
// {
|
||||
// pl = context.PLANTILLAS.First(x => x.CODIGO == "RECTRI");
|
||||
// if (per.IDADSCRIPCIONRPTNavigation.DESCRIPCION == "LABORAL")
|
||||
// pl = context.PLANTILLAS.First(x => x.CODIGO == "RECTRIL");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// pl = context.PLANTILLAS.First(x => x.CODIGO == "RECTRI4");
|
||||
// if (per.IDADSCRIPCIONRPTNavigation.DESCRIPCION == "LABORAL")
|
||||
// pl = context.PLANTILLAS.First(x => x.CODIGO == "RECTRI4L");
|
||||
// }
|
||||
|
||||
// var idPlantilla = pl.IDPLANTILLA;
|
||||
// var sFicherohtmlTmp = tsUtilidades.Utilidades.ObtieneFicheroAleatorio("pdf");
|
||||
|
||||
// //return tsXtraReport.ExportarAPDF(pl.IDFICHERONavigation.FICHERO, LisCumTri).ToArray();
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// private byte[] DevuelveComunicacionInterna(
|
||||
// string idPersona,
|
||||
// string texto1,
|
||||
// string texto2,
|
||||
// string fechaEmision)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
// {
|
||||
// PERSONAS per;
|
||||
// var LisCumTri = new List<bdAntifraudeMYSQL.DatRecTri.RecTri>();
|
||||
// var ForCumTri = new bdAntifraudeMYSQL.DatRecTri.RecTri();
|
||||
|
||||
// if (!string.IsNullOrEmpty(idPersona))
|
||||
// {
|
||||
// int iDPer = Convert.ToInt32(idPersona);
|
||||
// per = context.PERSONAS.First(x => x.IDPERSONA == iDPer);
|
||||
|
||||
// ForCumTri.Nif = per.NIF;
|
||||
// ForCumTri.Apellidos = per.APELLIDOS;
|
||||
// ForCumTri.Nombre = per.NOMBRE;
|
||||
// ForCumTri.Adscripcion = per.IDADSCRIPCIONRPTNavigation.DESCRIPCION;
|
||||
// ForCumTri.NRP = per.NRP;
|
||||
|
||||
// if (per.IDSITUACIONADMINISTRATIVARPT != null)
|
||||
// ForCumTri.SitAdm = per.IDSITUACIONADMINISTRATIVARPTNavigation.LITERAL_SITUACION;
|
||||
|
||||
// if (per.IDCUERPORPT != null)
|
||||
// ForCumTri.Cuerpo = per.IDCUERPORPTNavigation.DESCRIPCION;
|
||||
|
||||
// ForCumTri.Grupo = per.GRUPOFUNCIONARIODESCRIPCION;
|
||||
// ForCumTri.Localidad = per.NombrePoblacion;
|
||||
// ForCumTri.Provincia = per.NombreProvincia;
|
||||
|
||||
// if (per.IDDEPARTAMENTO != null)
|
||||
// ForCumTri.Departamento = per.IDDEPARTAMENTONavigation.DESCRIPCION;
|
||||
|
||||
// ForCumTri.FechaEmision = fechaEmision;
|
||||
// ForCumTri.texto1 = texto1;
|
||||
// ForCumTri.texto2 = texto2;
|
||||
// }
|
||||
|
||||
// LisCumTri.Add(ForCumTri);
|
||||
|
||||
// var pl = context.PLANTILLAS.First(x => x.CODIGO == "COMUNI");
|
||||
// var idPlantilla = pl.IDPLANTILLA;
|
||||
|
||||
// var sFicherohtmlTmp = tsUtilidades.Utilidades.ObtieneFicheroAleatorio("pdf");
|
||||
|
||||
// //return tsXtraReport.ExportarAPDF(pl.IDFICHERONavigation.FICHERO, LisCumTri).ToArray();
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// private byte[] DevuelveAcuerdoJubilacion(
|
||||
//string idPersona,
|
||||
//string motivo,
|
||||
//string texto1,
|
||||
//string fechaEfecto,
|
||||
//string organo,
|
||||
//string fechaEmision,
|
||||
//string fechaEfe)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
// {
|
||||
// var LisAcuJub = new List<RecTri>();
|
||||
// var ForAcuJub = new RecTri();
|
||||
|
||||
// if (!string.IsNullOrEmpty(idPersona))
|
||||
// {
|
||||
// int iDPer = Convert.ToInt32(idPersona);
|
||||
// var per = context.PERSONAS.First(x => x.IDPERSONA == iDPer);
|
||||
|
||||
// int Años = 0;
|
||||
// if (per.TRIENIOS.Any())
|
||||
// {
|
||||
// Años = (int)per.TRIENIOS.Sum(x => x.TC + x.TOA) * 3;
|
||||
// }
|
||||
|
||||
// var Fechafin = tsUtilidades.Extensiones.DateTimeExtensions.FechaHoraStringADate(fechaEfe);
|
||||
|
||||
// if (per.FECHACUMPLIMIENTOPROXTRIENIO.HasValue && Fechafin.HasValue)
|
||||
// {
|
||||
// var TiemSer = bdAntifraudeMYSQL.Utilidades.AnosMesesDias(per.FECHACUMPLIMIENTOPROXTRIENIO.Value.AddYears(-3), Fechafin.Value);
|
||||
|
||||
// if (TiemSer != null)
|
||||
// {
|
||||
// TiemSer.Anos += Años;
|
||||
|
||||
// //Construcción del texto1 según años, meses, días
|
||||
// string tiempo = "";
|
||||
// if (TiemSer.Anos == 1) tiempo += TiemSer.Anos.ToString() + " AÑO ";
|
||||
// else if (TiemSer.Anos > 1) tiempo += TiemSer.Anos.ToString() + " AÑOS ";
|
||||
|
||||
// if (TiemSer.Meses == 1) tiempo += TiemSer.Meses.ToString() + " MES ";
|
||||
// else if (TiemSer.Meses > 1) tiempo += TiemSer.Meses.ToString() + " MESES ";
|
||||
|
||||
// if (TiemSer.Dias == 1) tiempo += TiemSer.Dias.ToString() + " DIA ";
|
||||
// else if (TiemSer.Dias > 1) tiempo += TiemSer.Dias.ToString() + " DIAS ";
|
||||
|
||||
// ForAcuJub.texto1 = tiempo.Trim();
|
||||
// }
|
||||
// }
|
||||
|
||||
// ForAcuJub.Nif = per.NIF;
|
||||
// ForAcuJub.Apellidos = per.APELLIDOS;
|
||||
// ForAcuJub.Nombre = per.NOMBRE;
|
||||
// ForAcuJub.Adscripcion = per.IDADSCRIPCIONRPTNavigation.DESCRIPCION;
|
||||
// ForAcuJub.NRP = per.NRP;
|
||||
|
||||
// if (per.IDSITUACIONADMINISTRATIVARPT != null)
|
||||
// ForAcuJub.SitAdm = per.IDSITUACIONADMINISTRATIVARPTNavigation.LITERAL_SITUACION;
|
||||
|
||||
// if (per.IDCUERPORPT != null)
|
||||
// ForAcuJub.Cuerpo = per.IDCUERPORPTNavigation.DESCRIPCION;
|
||||
|
||||
// ForAcuJub.Grupo = per.GRUPOFUNCIONARIODESCRIPCION;
|
||||
|
||||
// var puestosPersona = context.PUESTOS.Where(x => x.IDPERSONAL == per.IDPERSONA);
|
||||
// PUESTOS PuestoTrabajo = null;
|
||||
|
||||
// if (puestosPersona.Any())
|
||||
// {
|
||||
// PuestoTrabajo = puestosPersona
|
||||
// .OrderByDescending(x => x.IDRPTNavigation.F_PARLAMENTO.Value)
|
||||
// .First();
|
||||
// ForAcuJub.DesPuesTrab = PuestoTrabajo.IDRPTDESNavigation.DENOMINACION;
|
||||
// }
|
||||
|
||||
// if (per.IDDEPARTAMENTO != null)
|
||||
// ForAcuJub.Departamento = per.IDDEPARTAMENTONavigation.DESCRIPCION;
|
||||
|
||||
// if (PuestoTrabajo != null)
|
||||
// {
|
||||
// ForAcuJub.CuerpoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.CUERPO1Navigation.DESCRIPCION;
|
||||
|
||||
// double Especifico = double.Parse(PuestoTrabajo.IDRPTDESNavigation.ESPECIFICO.ToString());
|
||||
// ForAcuJub.ComEsp = Especifico.ToString("##,##0.00") + "€";
|
||||
|
||||
// ForAcuJub.GrupoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.GRUPO1Navigation.GRUPO1;
|
||||
// ForAcuJub.NivelPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.IDNIVEL_RPTNavigation.NIVEL1;
|
||||
// ForAcuJub.CarOcu = PuestoTrabajo.IDOCUPACIONNavigation.DESCRIPCION;
|
||||
// }
|
||||
|
||||
// ForAcuJub.MotivoTomaPosesion = motivo;
|
||||
// ForAcuJub.texto3 = motivo;
|
||||
|
||||
// if (per.FECHANACIMIENTO.HasValue)
|
||||
// {
|
||||
// var fechaNac = per.FECHANACIMIENTO.Value;
|
||||
// string dia = fechaNac.Day.ToString().PadLeft(2, '0');
|
||||
// string mes = tsUtilidades.Extensiones.DateTimeExtensions.MesCastellano(fechaNac);
|
||||
// string anio = fechaNac.Year.ToString();
|
||||
// ForAcuJub.FecVenTri = $"{dia} de {mes} de {anio}";
|
||||
// }
|
||||
|
||||
// ForAcuJub.FechaEfeEco = fechaEfecto;
|
||||
// ForAcuJub.OrganoCompetente = organo;
|
||||
// }
|
||||
|
||||
// LisAcuJub.Add(ForAcuJub);
|
||||
|
||||
// var pl = context.PLANTILLAS.First(x => x.CODIGO == "ACUJUBI");
|
||||
// var idPlantilla = pl.IDPLANTILLA;
|
||||
|
||||
// var sFicherohtmlTmp = tsUtilidades.Utilidades.ObtieneFicheroAleatorio("pdf");
|
||||
|
||||
// //return tsXtraReport.ExportarAPDF(pl.IDFICHERONavigation.FICHERO, LisAcuJub).ToArray();
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// private byte[] DevuelveAcuerdoBaja(
|
||||
// string idPersona,
|
||||
// string motivo,
|
||||
// string texto1,
|
||||
// string fechaEfecto,
|
||||
// string organo,
|
||||
// string fechaEmision)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
// {
|
||||
// PERSONAS per;
|
||||
// var LisAcuJub = new List<RecTri>();
|
||||
// var ForAcuJub = new RecTri();
|
||||
|
||||
// if (!string.IsNullOrEmpty(idPersona))
|
||||
// {
|
||||
// int iDPer = Convert.ToInt32(idPersona);
|
||||
// per = context.PERSONAS.First(x => x.IDPERSONA == iDPer);
|
||||
|
||||
// ForAcuJub.Nif = per.NIF;
|
||||
// ForAcuJub.Apellidos = per.APELLIDOS;
|
||||
// ForAcuJub.Nombre = per.NOMBRE;
|
||||
// ForAcuJub.Adscripcion = per.IDADSCRIPCIONRPTNavigation.DESCRIPCION;
|
||||
// ForAcuJub.NRP = per.NRP;
|
||||
|
||||
// if (per.IDSITUACIONADMINISTRATIVARPT != null)
|
||||
// ForAcuJub.SitAdm = per.IDSITUACIONADMINISTRATIVARPTNavigation.LITERAL_SITUACION;
|
||||
|
||||
// if (per.IDCUERPORPT != null)
|
||||
// ForAcuJub.Cuerpo = per.IDCUERPORPTNavigation.DESCRIPCION;
|
||||
|
||||
// ForAcuJub.Grupo = per.GRUPOFUNCIONARIODESCRIPCION;
|
||||
|
||||
// PUESTOS PuestoTrabajo = null;
|
||||
// var puestosPersona = context.PUESTOS.Where(x => x.IDPERSONAL == per.IDPERSONA);
|
||||
// if (puestosPersona.Any())
|
||||
// {
|
||||
// PuestoTrabajo = puestosPersona
|
||||
// .OrderByDescending(x => x.IDRPTNavigation.F_PARLAMENTO.Value)
|
||||
// .First();
|
||||
// ForAcuJub.DesPuesTrab = PuestoTrabajo.IDRPTDESNavigation.DENOMINACION;
|
||||
|
||||
// if (per.IDDEPARTAMENTO != null)
|
||||
// ForAcuJub.Departamento = per.IDDEPARTAMENTONavigation.DESCRIPCION;
|
||||
|
||||
// ForAcuJub.CuerpoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.CUERPO1Navigation.DESCRIPCION;
|
||||
|
||||
// double Especifico = double.Parse(PuestoTrabajo.IDRPTDESNavigation.ESPECIFICO.ToString());
|
||||
// ForAcuJub.ComEsp = Especifico.ToString("##,##0.00") + "€";
|
||||
|
||||
// ForAcuJub.GrupoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.GRUPO1Navigation.GRUPO1;
|
||||
// ForAcuJub.NivelPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.IDNIVEL_RPTNavigation.NIVEL1;
|
||||
// ForAcuJub.CarOcu = PuestoTrabajo.IDOCUPACIONNavigation.DESCRIPCION;
|
||||
// }
|
||||
|
||||
// ForAcuJub.MotivoTomaPosesion = motivo;
|
||||
// ForAcuJub.texto1 = texto1;
|
||||
// ForAcuJub.FechaEfectoTomaPosesion = fechaEfecto;
|
||||
// ForAcuJub.FechaEfeEco = fechaEfecto;
|
||||
// ForAcuJub.OrganoCompetente = organo;
|
||||
// ForAcuJub.FecVenTri = fechaEmision;
|
||||
// }
|
||||
|
||||
// LisAcuJub.Add(ForAcuJub);
|
||||
|
||||
// var pl = context.PLANTILLAS.First(x => x.CODIGO == "ACUBAJA");
|
||||
// var idPlantilla = pl.IDPLANTILLA;
|
||||
|
||||
// var sFicherohtmlTmp = tsUtilidades.Utilidades.ObtieneFicheroAleatorio("pdf");
|
||||
|
||||
// return tsXtraReport.ExportarAPDF(pl.IDFICHERONavigation.FICHERO, LisAcuJub).ToArray();
|
||||
// }
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// private byte[] DevuelveAcuerdoCese(
|
||||
// string idPersona,
|
||||
// string motivo,
|
||||
// string texto1,
|
||||
// string fechaEfecto,
|
||||
// string organo,
|
||||
// string fechaEmision)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
// {
|
||||
// PERSONAS per;
|
||||
// var LisAcuJub = new List<RecTri>();
|
||||
// var ForAcuJub = new RecTri();
|
||||
|
||||
// if (!string.IsNullOrEmpty(idPersona))
|
||||
// {
|
||||
// int iDPer = Convert.ToInt32(idPersona);
|
||||
// per = context.PERSONAS.First(x => x.IDPERSONA == iDPer);
|
||||
|
||||
// ForAcuJub.Nif = per.NIF;
|
||||
// ForAcuJub.Apellidos = per.APELLIDOS;
|
||||
// ForAcuJub.Nombre = per.NOMBRE;
|
||||
// ForAcuJub.Adscripcion = per.IDADSCRIPCIONRPTNavigation.DESCRIPCION;
|
||||
// ForAcuJub.NRP = per.NRP;
|
||||
|
||||
// if (per.IDSITUACIONADMINISTRATIVARPT != null)
|
||||
// ForAcuJub.SitAdm = per.IDSITUACIONADMINISTRATIVARPTNavigation.LITERAL_SITUACION;
|
||||
|
||||
// if (per.IDCUERPORPT != null)
|
||||
// ForAcuJub.Cuerpo = per.IDCUERPORPTNavigation.DESCRIPCION;
|
||||
|
||||
// ForAcuJub.Grupo = per.GRUPOFUNCIONARIODESCRIPCION;
|
||||
|
||||
// PUESTOS PuestoTrabajo = null;
|
||||
// var puestosPersona = context.PUESTOS.Where(x => x.IDPERSONAL == per.IDPERSONA);
|
||||
// if (puestosPersona.Any())
|
||||
// {
|
||||
// PuestoTrabajo = puestosPersona
|
||||
// .OrderByDescending(x => x.IDRPTNavigation.F_PARLAMENTO.Value)
|
||||
// .First();
|
||||
|
||||
// ForAcuJub.DesPuesTrab = PuestoTrabajo.IDRPTDESNavigation.DENOMINACION;
|
||||
// }
|
||||
|
||||
// if (per.IDDEPARTAMENTO != null)
|
||||
// ForAcuJub.Departamento = per.IDDEPARTAMENTONavigation.DESCRIPCION;
|
||||
|
||||
// if (PuestoTrabajo != null)
|
||||
// {
|
||||
// ForAcuJub.CuerpoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.CUERPO1Navigation.DESCRIPCION;
|
||||
|
||||
// double Especifico = double.Parse(PuestoTrabajo.IDRPTDESNavigation.ESPECIFICO.ToString());
|
||||
// ForAcuJub.ComEsp = Especifico.ToString("##,##0.00") + "€";
|
||||
|
||||
// ForAcuJub.GrupoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.GRUPO1Navigation.GRUPO1;
|
||||
// ForAcuJub.NivelPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.IDNIVEL_RPTNavigation.NIVEL1;
|
||||
// ForAcuJub.CarOcu = PuestoTrabajo.IDOCUPACIONNavigation.DESCRIPCION;
|
||||
// }
|
||||
|
||||
// ForAcuJub.MotivoTomaPosesion = motivo;
|
||||
// ForAcuJub.texto1 = texto1;
|
||||
// ForAcuJub.FechaEfectoTomaPosesion = fechaEfecto;
|
||||
// ForAcuJub.FechaEfeEco = fechaEfecto;
|
||||
// ForAcuJub.OrganoCompetente = organo;
|
||||
// ForAcuJub.FecVenTri = fechaEmision;
|
||||
// }
|
||||
|
||||
// LisAcuJub.Add(ForAcuJub);
|
||||
|
||||
// var pl = context.PLANTILLAS.First(x => x.CODIGO == "ACUCESE");
|
||||
// var sFicherohtmlTmp = tsUtilidades.Utilidades.ObtieneFicheroAleatorio("pdf");
|
||||
|
||||
// return tsXtraReport.ExportarAPDF(pl.IDFICHERONavigation.FICHERO, LisAcuJub).ToArray();
|
||||
|
||||
// }
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// private byte[] DevuelveConsolidacionGrado(
|
||||
// string idPersona,
|
||||
// string motivo,
|
||||
// string texto1,
|
||||
// string texto2,
|
||||
// string fechaEfecto,
|
||||
// string organo,
|
||||
// string fechaEmision)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// using (var context = ContextosMySql.NuevoContexto(SoloLectura: true, Lazy: false))
|
||||
// {
|
||||
// PERSONAS per;
|
||||
// var LisCumTri = new List<RecTri>();
|
||||
// var ForCumTri = new RecTri();
|
||||
|
||||
// if (!string.IsNullOrEmpty(idPersona))
|
||||
// {
|
||||
// int iDPer = Convert.ToInt32(idPersona);
|
||||
// per = context.PERSONAS.First(x => x.IDPERSONA == iDPer);
|
||||
|
||||
// ForCumTri.Nif = per.NIF;
|
||||
// ForCumTri.Apellidos = per.APELLIDOS;
|
||||
// ForCumTri.Nombre = per.NOMBRE;
|
||||
// ForCumTri.Adscripcion = per.IDADSCRIPCIONRPTNavigation.DESCRIPCION;
|
||||
// ForCumTri.NRP = per.NRP;
|
||||
|
||||
// if (per.IDSITUACIONADMINISTRATIVARPT != null)
|
||||
// ForCumTri.SitAdm = per.IDSITUACIONADMINISTRATIVARPTNavigation.LITERAL_SITUACION;
|
||||
|
||||
// if (per.IDCUERPORPT != null)
|
||||
// ForCumTri.Cuerpo = per.IDCUERPORPTNavigation.DESCRIPCION;
|
||||
|
||||
// ForCumTri.Grupo = per.GRUPOFUNCIONARIODESCRIPCION;
|
||||
// ForCumTri.Localidad = per.NombrePoblacion;
|
||||
// ForCumTri.Provincia = per.NombreProvincia;
|
||||
|
||||
// var iDSitRptAct = context.ENUMERACIONES.First(x => x.CODIGO == "SITRPTMAESTRO.ACT").IDENUMERACION;
|
||||
// PUESTOS PuestoTrabajo = null;
|
||||
|
||||
// var puestoActivo = context.PUESTOS
|
||||
// .Where(x => x.IDPERSONAL == per.IDPERSONA && x.IDRPTNavigation.IDSITUACION == iDSitRptAct);
|
||||
|
||||
// if (puestoActivo.Any())
|
||||
// {
|
||||
// PuestoTrabajo = puestoActivo.First();
|
||||
// ForCumTri.DesPuesTrab = PuestoTrabajo.IDRPTDESNavigation.DENOMINACION;
|
||||
// }
|
||||
|
||||
// ForCumTri.FechaEfeEco = fechaEfecto;
|
||||
|
||||
// if (PuestoTrabajo != null)
|
||||
// {
|
||||
// ForCumTri.CuerpoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.CUERPO1Navigation.DESCRIPCION;
|
||||
|
||||
// double Especifico = double.Parse(PuestoTrabajo.IDRPTDESNavigation.ESPECIFICO.ToString());
|
||||
// ForCumTri.ComEsp = Especifico.ToString("##,##0.00") + "€";
|
||||
|
||||
// ForCumTri.GrupoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.GRUPO1Navigation.GRUPO1;
|
||||
// ForCumTri.NivelPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.IDNIVEL_RPTNavigation.NIVEL1;
|
||||
// ForCumTri.CarOcu = PuestoTrabajo.IDOCUPACIONNavigation.DESCRIPCION;
|
||||
// }
|
||||
|
||||
// ForCumTri.texto1 = texto1;
|
||||
// ForCumTri.texto2 = texto2;
|
||||
// ForCumTri.texto3 = motivo;
|
||||
// }
|
||||
|
||||
// LisCumTri.Add(ForCumTri);
|
||||
|
||||
// var pl = context.PLANTILLAS.First(x => x.CODIGO == "CONGRA");
|
||||
// var idPlantilla = pl.IDPLANTILLA;
|
||||
|
||||
// var sFicherohtmlTmp = tsUtilidades.Utilidades.ObtieneFicheroAleatorio("pdf");
|
||||
|
||||
// return tsXtraReport.ExportarAPDF(pl.IDFICHERONavigation.FICHERO, LisCumTri).ToArray();
|
||||
// }
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using bdAntifraudeMYSQL;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Renci.SshNet;
|
||||
using System.Diagnostics;
|
||||
using System.Security.Cryptography;
|
||||
using tsUtilidades.Enumeraciones;
|
||||
using tsUtilidades;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Servicios
|
||||
{
|
||||
public class ServiciosGestion
|
||||
{
|
||||
|
||||
private static void GuardandoCambiosNomina(object sender, EventArgs e)
|
||||
{
|
||||
//OAEntities bd = (OAEntities)sender;
|
||||
|
||||
////
|
||||
//// ELIMINACION DE NOMINAS
|
||||
////
|
||||
//var NominasEliminadas = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Deleted).Where(x => x.EntitySet.Name == "NOMINATRABAJADORCABECERA").ToList();
|
||||
//if (NominasEliminadas.Count > 0)
|
||||
//{
|
||||
// SftpClient sftp;
|
||||
// sftp = ConectaServidorSftp(bd);
|
||||
// sftp.Connect();
|
||||
// foreach (var n in NominasEliminadas)
|
||||
// {
|
||||
// int idTr = n.OriginalValues("IDPERSONA");
|
||||
// int Año = n.OriginalValues("AÑONOMINA");
|
||||
// int Mes = n.OriginalValues("MESNOMINA");
|
||||
// bool EsDieta = n.OriginalValues("ESLIQUIDACIONDIPUTADO").ToString();
|
||||
// string Fichero;
|
||||
// if (EsDieta)
|
||||
// {
|
||||
// Fichero = "nominas/dietas/" + Año.ToString() + "/" + Mes.ToString().PadLeft(2, '0') + "/" + Año.ToString() + Mes.ToString().PadLeft(2, '0') + "-" + idTr.ToString() + ".pdf";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Fichero = "ordinarias/" + Año.ToString() + "/" + Mes.ToString().PadLeft(2, '0') + "/" + Año.ToString() + Mes.ToString().PadLeft(2, '0') + "-" + idTr.ToString() + ".pdf";
|
||||
// }
|
||||
// if (sftp.Exists(Fichero))
|
||||
// sftp.DeleteFile(Fichero);
|
||||
// }
|
||||
// sftp.Disconnect();
|
||||
//}
|
||||
//if (bd.NivelLog != NivelLogs.SIN_LOGS)
|
||||
//{
|
||||
// IEnumerable<ObjectStateEntry> om;
|
||||
// om = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Added);
|
||||
// foreach (var o in om)
|
||||
// {
|
||||
// if (o.Entity.GetType().GetProperties.Any(X => X.Name == "IDUSUARIOALTA"))
|
||||
// {
|
||||
// var c = o.Entity.GetType().GetProperty("IDUSUARIOALTA");
|
||||
// c.SetValue(o.Entity, dsc.idUsuario);
|
||||
// }
|
||||
|
||||
// if (o.Entity.GetType().GetProperties.Any(X => Operators.ConditionalCompareObjectEqual(X.Name, "FECHAREGISTRONUEVO", false)))
|
||||
// {
|
||||
// var c = o.Entity.GetType().GetProperty("FECHAREGISTRONUEVO");
|
||||
// c.SetValue(o.Entity, Utilidades.AhoraOracle(bd));
|
||||
// }
|
||||
// }
|
||||
// om = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified);
|
||||
// foreach (var o in om)
|
||||
// {
|
||||
// if (o.Entity.GetType().GetProperties.Any(X => Operators.ConditionalCompareObjectEqual(X.Name, "IDUSUARIOMODIFICA", false)))
|
||||
// {
|
||||
// var c = o.Entity.GetType().GetProperty("IDUSUARIOMODIFICA");
|
||||
// c.SetValue(o.Entity, dsc.idUsuario);
|
||||
// }
|
||||
|
||||
// if (o.Entity.GetType().GetProperties.Any(X => Operators.ConditionalCompareObjectEqual(X.Name, "FECHAREGISTROMODIFICADO", false)))
|
||||
// {
|
||||
// var c = o.Entity.GetType().GetProperty("FECHAREGISTROMODIFICADO");
|
||||
// c.SetValue(o.Entity, Utilidades.AhoraOracle(bd));
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (bd.NivelLog == NivelLogs.MODIFICACIONES_Y_ELIMINACIONES)
|
||||
// {
|
||||
// om = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified + EntityState.Deleted);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// om = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified + EntityState.Added + EntityState.Deleted);
|
||||
// }
|
||||
// // End If
|
||||
|
||||
// foreach (var o in om)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// string CampoTimeStamp = o.Entity.GetType().GetProperties.Any(X => Operators.ConditionalCompareObjectEqual(X.Name, "IDTIMESPAN", false)) ? "IDTIMESPAN" : "";
|
||||
// var nl = new LOGS();
|
||||
// if (!EntidadesExcluidas.Contains(o.EntitySet.Name.ToLower))
|
||||
// {
|
||||
// nl.TABLA = o.EntitySet.Name;
|
||||
// try
|
||||
// {
|
||||
// nl.ID = (long)o.EntityKey.EntityKeyValues.First.Value;
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// }
|
||||
// var lpm = new List<string>();
|
||||
// switch (o.State)
|
||||
// {
|
||||
// case var @case when @case == EntityState.Added:
|
||||
// {
|
||||
// nl.IDTIPO = TipoLog.ALTA;
|
||||
// lpm = o.CurrentValues.DataRecordInfo.FieldMetadata.Select(x => x.FieldType.ToString).ToList;
|
||||
// if (o.Entity.GetType().GetProperties.Any(X => Operators.ConditionalCompareObjectEqual(X.Name, "IDTIMESPAN", false)))
|
||||
// {
|
||||
// var cts = o.Entity.GetType().GetProperty("IDTIMESPAN");
|
||||
// double ticks = DateTime.Now.Ticks;
|
||||
// cts.SetValue(o.Entity, ticks);
|
||||
// nl.IDTIMESTAMP = ticks;
|
||||
// }
|
||||
|
||||
// break;
|
||||
// }
|
||||
// case var case1 when case1 == EntityState.Deleted:
|
||||
// {
|
||||
// nl.IDTIPO = TipoLog.ELIMINACION;
|
||||
// break;
|
||||
// }
|
||||
// case var case2 when case2 == EntityState.Modified:
|
||||
// {
|
||||
// nl.IDTIPO = TipoLog.MODIFICACION;
|
||||
// lpm = o.GetModifiedProperties.ToList;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// nl.USUARIO = Usuario;
|
||||
// nl.FECHAHORA = AhoraOracle(bd);
|
||||
// nl.IP = bd.ip;
|
||||
// nl.APLICACION = bd.Aplicacion;
|
||||
// nl.IDCONEXION = bd.idConexion;
|
||||
// var rl = new RegistroLog();
|
||||
// if (o.State == EntityState.Deleted)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// for (int i = 0, loopTo = o.OriginalValues.FieldCount - 1; i <= loopTo; i++)
|
||||
// {
|
||||
// var ol = new CampoLog();
|
||||
// ol.NombreCampo = o.OriginalValues.GetName(i);
|
||||
// ol.ValorAnterior = nl.ID.ToString;
|
||||
// rl.CamposLog.Add(ol);
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Debug.Write(ex.Message);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// foreach (var p in lpm)
|
||||
// {
|
||||
// var tipo = o.Entity.GetType().GetProperty(p).PropertyType;
|
||||
// // Dim stipo = tipo.ToString
|
||||
// // Dim sTipoBase = tipo.BaseType.ToString
|
||||
// try
|
||||
// {
|
||||
// var ol = new CampoLog();
|
||||
// ol.NombreCampo = p;
|
||||
// // If Not (tipo Is GetType(Byte()) Or p.ToLower = "entitykey" Or stipo.ToLower.Contains("entitycollection") Or stipo.ToLower.Contains("entityreference") Or sTipoBase.ToLower.Contains("entityobject")) Then
|
||||
// if (!object.ReferenceEquals(tipo, typeof(byte[])))
|
||||
// {
|
||||
// switch (o.State)
|
||||
// {
|
||||
// case var case3 when case3 == EntityState.Added:
|
||||
// {
|
||||
// if (o.CurrentValues(p) is not null)
|
||||
// ol.ValorNuevo = o.CurrentValues(p).ToString;
|
||||
// break;
|
||||
// }
|
||||
|
||||
// default:
|
||||
// {
|
||||
// if (o.OriginalValues(p) is not null)
|
||||
// ol.ValorAnterior = o.OriginalValues(p).ToString;
|
||||
// if (o.CurrentValues(p) is not null)
|
||||
// ol.ValorNuevo = o.CurrentValues(p).ToString;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// rl.CamposLog.Add(ol);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Debug.Write(ex.Message);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// nl.LOG = tsl5.Utilidades.Serializar(rl);
|
||||
// bd.AddToLOGS(nl);
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Debug.Write(ex.Message);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
//public static bool CompruebaFicheroNomina(NOMINATRABAJADORCABECERA N)
|
||||
//{
|
||||
//var bd = bdAntifraudeMYSQL.Utilidades.NuevaConexion(bdAntifraudeMYSQL.Utilidades.ObtieneCBD());
|
||||
//SftpClient sftp = ConectarServidorSftp(bd);
|
||||
//sftp.Connect();
|
||||
//string Fichero = "";
|
||||
//if (N.ESLIQUIDACIONDIPUTADO == true)
|
||||
//{
|
||||
// Fichero = "nominas/dietas/" + N.IDNOMINANavigation?.AÑO.ToString() + "/" + N.IDNOMINANavigation?.DESCRIPCION + "/" + N.IDNOMINANavigation?.AÑO.ToString() + N.IDNOMINANavigation?.MES.ToString().PadLeft(2, '0') + "-" + N.IDPERSONA.ToString() + ".pdf";
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Fichero = "ordinarias/" + N.IDNOMINANavigation?.AÑO.ToString() + "/" + N.IDNOMINANavigation?.DESCRIPCION + "/" + N.IDNOMINANavigation?.AÑO.ToString() + N.IDNOMINANavigation?.MES.ToString().PadLeft(2, '0') + "-" + N.IDPERSONA.ToString() + ".pdf";
|
||||
//}
|
||||
//bool result = sftp.Exists(Fichero);
|
||||
//sftp.Disconnect();
|
||||
//return result;
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using DevExpress.Data.Extensions;
|
||||
using DevExpress.DataProcessing.InMemoryDataProcessor;
|
||||
using System.Linq;
|
||||
using DevExpress.XtraReports.Parameters;
|
||||
namespace SwaggerAntifraudeMYSQL.Servicios
|
||||
{
|
||||
public class tsXtraReport
|
||||
{
|
||||
public static void ExportarAPDF(byte[] Plantilla, object Datos, string FicheroPDF)
|
||||
{
|
||||
DevExpress.XtraReports.UI.XtraReport xr;
|
||||
string s = System.Text.Encoding.UTF8.GetString(Plantilla);
|
||||
using (StreamWriter sw = new StreamWriter(new MemoryStream()))
|
||||
{
|
||||
sw.Write(s);
|
||||
sw.Flush();
|
||||
|
||||
xr = DevExpress.XtraReports.UI.XtraReport.FromStream(sw.BaseStream, true);
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
var pr = xr.Parameters.Cast<DevExpress.XtraReports.Parameters.Parameter>()
|
||||
.FirstOrDefault(p => p.Name == "Fecha");
|
||||
|
||||
|
||||
pr.Value = DateTime.Now;
|
||||
pr.Visible = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
xr.DataSource = Datos;
|
||||
xr.CreateDocument();
|
||||
xr.ExportToPdf(FicheroPDF);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
@@ -7,7 +7,29 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DevExpress.Document.Processor.es" Version="23.2.3" />
|
||||
<PackageReference Include="DevExpress.Printing.Core.es" Version="23.2.3" />
|
||||
<PackageReference Include="DevExpress.Reporting.Core" Version="23.2.3" />
|
||||
<PackageReference Include="DevExpress.Reporting.Core.es" Version="23.2.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.10" />
|
||||
<PackageReference Include="Serialize.Linq" Version="3.1.160" />
|
||||
<PackageReference Include="SSH.NET" Version="2026.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.3.1" />
|
||||
<PackageReference Include="System.Linq" Version="4.3.0" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.6" />
|
||||
<PackageReference Include="System.Linq.Expressions" Version="4.3.0" />
|
||||
<PackageReference Include="System.Linq.Queryable" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\bdAntifraudeMYSQL\bdAntifraudeMYSQL.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="tsUtilidades">
|
||||
<HintPath>..\..\..\..\Comun\tsUtilidades\bin\Debug\net8.0\tsUtilidades.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@SwaggerAntifraudeMYSQL_HostAddress = http://localhost:5274
|
||||
|
||||
GET {{SwaggerAntifraudeMYSQL_HostAddress}}/weatherforecast/
|
||||
GET {{SwaggerAntifraudeMYSQL_HostAddress}}/swagger/v1/swagger.json
|
||||
Accept: application/json
|
||||
|
||||
###
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace SwaggerAntifraudeMYSQL
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -5,5 +5,14 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"MySql": {
|
||||
"NombreConexion": "Producción"
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"Jwt": {
|
||||
"Key": "TuClaveSecretaMuySegura_1234567890",
|
||||
"Issuer": "TuDominio.com",
|
||||
"Audience": "TuDominio.com",
|
||||
"ExpiresInMinutes": 60
|
||||
}
|
||||
}
|
||||
|
||||
43
Antifraude.Net/bdAntifraudeMYSQL/RecTri.cs
Normal file
43
Antifraude.Net/bdAntifraudeMYSQL/RecTri.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
namespace bdAntifraudeMYSQL.DatRecTri
|
||||
{
|
||||
public class RecTri
|
||||
{
|
||||
public string Apellidos { get; set; } = "";
|
||||
public string Nombre { get; set; } = "";
|
||||
public string Nif { get; set; } = "";
|
||||
public string Adscripcion { get; set; } = "";
|
||||
public string Cuerpo { get; set; } = "";
|
||||
public string NRP { get; set; } = "";
|
||||
public string Grupo { get; set; } = "";
|
||||
public string SitAdm { get; set; } = "";
|
||||
public string DesPuesTrab { get; set; } = "";
|
||||
public string CarOcu { get; set; } = "";
|
||||
public string CenOrg { get; set; } = "";
|
||||
public string Localidad { get; set; } = "";
|
||||
public string Provincia { get; set; } = "";
|
||||
public string FechaRecTri { get; set; } = "";
|
||||
public string FechaEfeEco { get; set; } = "";
|
||||
public string Departamento { get; set; } = "";
|
||||
public int? TriA1 { get; set; }
|
||||
public int? TriA2 { get; set; }
|
||||
public int? TriC1 { get; set; }
|
||||
public int? TriC2 { get; set; }
|
||||
public int? TriE { get; set; }
|
||||
public int? TolTri { get; set; }
|
||||
public string ComEsp { get; set; } = "";
|
||||
public string Nivel { get; set; } = "";
|
||||
public string FecCumProTri { get; set; } = "";
|
||||
public string FecVenTri { get; set; } = "";
|
||||
public string CuerpoPuestoTrabajo { get; set; } = "";
|
||||
public double ComplementoEspecifico { get; set; }
|
||||
public string GrupoPuestoTrabajo { get; set; } = "";
|
||||
public string NivelPuestoTrabajo { get; set; } = "";
|
||||
public string FechaEfectoTomaPosesion { get; set; } = "";
|
||||
public string OrganoCompetente { get; set; } = "";
|
||||
public string MotivoTomaPosesion { get; set; } = "";
|
||||
public string texto1 { get; set; } = "";
|
||||
public string texto2 { get; set; } = "";
|
||||
public string texto3 { get; set; } = "";
|
||||
public string FechaEmision { get; set; } = "";
|
||||
}
|
||||
}
|
||||
317
Antifraude.Net/bdAntifraudeMYSQL/Utilidades.cs
Normal file
317
Antifraude.Net/bdAntifraudeMYSQL/Utilidades.cs
Normal file
@@ -0,0 +1,317 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using bdAntifraudeMYSQL.clases;
|
||||
using bdAntifraudeMYSQL.db;
|
||||
|
||||
namespace bdAntifraudeMYSQL;
|
||||
|
||||
public enum NivelLogs
|
||||
{
|
||||
SIN_LOGS,
|
||||
TODOS_LOGS,
|
||||
MODIFICACIONES_Y_ELIMINACIONES
|
||||
}
|
||||
|
||||
public static class Utilidades
|
||||
{
|
||||
public static List<PuestoPersona> ObtienePuestoPersona(bdAntifraudeMYSQL.dbcontext.antifraudeContext bd, int idPersona)
|
||||
{
|
||||
List<TIPOS_PERSONAL> listaTP = bd.TIPOS_PERSONAL.ToList();
|
||||
|
||||
List<PuestoPersona> puestosnuevos = new List<PuestoPersona>();
|
||||
try
|
||||
{
|
||||
|
||||
List<VIDA_ADMINISTRATIVA> listaVA = bd.VIDA_ADMINISTRATIVA.Where(x => x.IDPERSONAL == idPersona && x.IDMOTIVO != null)
|
||||
.Include(v => v.IDMOTIVONavigation)
|
||||
.ThenInclude(r => r.IDTIPOAPTOSNavigation)
|
||||
.Include(v => v.NIVEL_OLDNavigation)
|
||||
.Include(v => v.NIVELCNavigation)
|
||||
.Include(v => v.GRUPOTNavigation)
|
||||
.Include(v => v.OCUPACION_OLDNavigation)
|
||||
.Include(v => v.IDPERSONALNavigation)
|
||||
.Include(v => v.IDPUESTONavigation)
|
||||
.ThenInclude(i => i.IDRPTDESNavigation)
|
||||
.ThenInclude(r => r.IDDEPARTAMENTONavigation)
|
||||
.Include(i => i.GRUPOTNavigation)
|
||||
.Include(v => v.IDPUESTONavigation)
|
||||
.ThenInclude(n => n.IDRPTDESNavigation)
|
||||
.ThenInclude(gr => gr.GRUPO1Navigation)
|
||||
.Include(v => v.IDPUESTONavigation)
|
||||
.ThenInclude(n => n.IDRPTDESNavigation)
|
||||
.ThenInclude(grr => grr.GRUPO2Navigation)
|
||||
.Include(v => v.IDPUESTONavigation)
|
||||
.ThenInclude(n => n.IDRPTDESNavigation)
|
||||
.ThenInclude(nv => nv.IDNIVEL_RPTNavigation)
|
||||
.OrderBy(x => x.FECHA).ThenBy(x => x.NUM_REG)
|
||||
.AsNoTracking().ToList();
|
||||
//.Include(v => v.IDSERVICIOADSCRITONavigation)
|
||||
//.Include(v => v.IDUNIDADADMINISTRATIVANavigation)
|
||||
if (listaVA.Count > 0)
|
||||
{
|
||||
|
||||
List<VIDA_ADMINISTRATIVA> ToPoyCese = listaVA
|
||||
.Where(x => x.MotivoTipo.Contains("TOMA POSESIÓN") ||
|
||||
x.MotivoTipo.Contains("TOMA POSESION") ||
|
||||
x.MotivoTipo.Contains("CESE") ||
|
||||
x.MotivoTipo.Contains("BAJA")).ToList();
|
||||
|
||||
if (ToPoyCese.Count > 0)
|
||||
{
|
||||
int NumActo = ToPoyCese.Count;
|
||||
for (int np = 0, loopTo = NumActo - 1; np <= loopTo; np += 2)
|
||||
{
|
||||
PuestoPersona pues = new PuestoPersona();
|
||||
puestosnuevos.Add(pues);
|
||||
|
||||
VIDA_ADMINISTRATIVA vidaAdmin = ToPoyCese[np];
|
||||
if (vidaAdmin?.IDMOTIVONavigation?.DESCRIPCION == "ACTIVO")
|
||||
{
|
||||
np = np + 1;
|
||||
vidaAdmin = ToPoyCese[np];
|
||||
}
|
||||
//pues.Puesto = vidaAdmin.DENOMINACION_OLD;
|
||||
pues.Puesto = vidaAdmin.IDPUESTONavigation.DESPUESCOM;
|
||||
if (vidaAdmin?.IDPUESTO != null)
|
||||
{
|
||||
pues.Puesto = pues.Puesto + "*";
|
||||
}
|
||||
//pues.Nivel = vidaAdmin.DescripcionNivel;
|
||||
pues.Nivel = vidaAdmin.IDPUESTONavigation.IDRPTDESNavigation.IDNIVEL_RPTNavigation.NIVEL1;
|
||||
pues.Adscripcion = vidaAdmin.DescripcionAdscripcion(listaTP);
|
||||
//pues.servicioAdscrito = vidaAdmin.IDSERVICIOADSCRITO != null ? bd.SERVICIOS.First(x => x.IDSERVICIO == vidaAdmin.IDSERVICIOADSCRITONavigation.IDSERVICIO).DESCRIPCION : "";
|
||||
//pues.unidadAdministrativa = vidaAdmin.IDUNIDADADMINISTRATIVA != null ? bd.UNIDADADMINISTRATIVA.First(y => y.IDUNIDADADMINISTRATIVA == vidaAdmin.IDUNIDADADMINISTRATIVANavigation.IDUNIDADADMINISTRATIVA).LITERAL_DEPARTAMENTO : "";
|
||||
pues.Grupo = vidaAdmin.IDPUESTONavigation.IDRPTDESNavigation.GRUPO1Navigation?.GRUPO1; //vidaAdmin.DescripcionGrupo1;
|
||||
if (vidaAdmin.IDPUESTONavigation.IDRPTDESNavigation.GRUPO2Navigation?.GRUPO1 != null)
|
||||
{
|
||||
pues.Grupo = pues.Grupo.Trim() + "/" + vidaAdmin.IDPUESTONavigation.IDRPTDESNavigation.GRUPO2Navigation.GRUPO1;
|
||||
}
|
||||
if (pues.Grupo.Trim() == "")
|
||||
{
|
||||
pues.Grupo = vidaAdmin.GRUPOTNavigation.GRUPO1;
|
||||
}
|
||||
if (pues.Adscripcion.Trim() == "")
|
||||
{
|
||||
if ("|I|II|III|IV|V|".Trim().Contains("|" + pues.Grupo.Trim() + "|"))
|
||||
{
|
||||
pues.Adscripcion = "Laboral temporal";
|
||||
}
|
||||
else
|
||||
{
|
||||
pues.Adscripcion = "Funcionario";
|
||||
}
|
||||
}
|
||||
if (vidaAdmin.FECHA.HasValue)
|
||||
{
|
||||
pues.FechaToPo = (DateTime)vidaAdmin.FECHA;
|
||||
}
|
||||
pues.MotivoToPo = vidaAdmin.IDMOTIVONavigation.DESCRIPCION;
|
||||
if (vidaAdmin.OCUPACION_OLD != null)
|
||||
{
|
||||
pues.CaracterOcu = vidaAdmin.OCUPACION_OLDNavigation.DESCRIPCION;
|
||||
}
|
||||
|
||||
Anos_Meses_Dias TiemSer = new Anos_Meses_Dias();
|
||||
if (np + 2 <= NumActo)
|
||||
{
|
||||
VIDA_ADMINISTRATIVA vidaAdmin2 = ToPoyCese[np + 1];
|
||||
if (!vidaAdmin2.IDMOTIVONavigation.TIPMOT.Trim().Contains("CESE") && vidaAdmin2.IDMOTIVONavigation.TIPMOT.Trim().Contains("BAJA"))
|
||||
{
|
||||
if (vidaAdmin2.FECHA > vidaAdmin.FECHA)
|
||||
{
|
||||
string motDes = vidaAdmin2.IDMOTIVONavigation.DESCRIPCION;
|
||||
if (motDes == "ACTIVO" || motDes == "NOMBRAMIENTO" || motDes.Contains("REINGRESO PLAZA") || motDes.Contains("SERVICIOS ESPECIALES") || motDes.Contains("EXCEDENCIA"))
|
||||
{
|
||||
pues.FechaCese = (DateTime)vidaAdmin2.FECHA;
|
||||
pues.MotivoCese = vidaAdmin2.IDMOTIVONavigation.DESCRIPCION;
|
||||
|
||||
if (motDes.Contains("REINGRESO PLAZA") || motDes.Contains("ACTIVO") || motDes.Contains("SERVICIOS ESPECIALES"))
|
||||
{
|
||||
for (int npn = np - 1; npn >= 0; npn -= 1)
|
||||
{
|
||||
if (ToPoyCese[npn].IDMOTIVONavigation.DESCRIPCION != "SERVICIOS ESPECIALES")
|
||||
{
|
||||
pues.MotivoCese = ToPoyCese[npn].IDMOTIVONavigation.DESCRIPCION;
|
||||
pues.Puesto = "********";
|
||||
pues.Nivel = "***";
|
||||
pues.Grupo = "***";
|
||||
pues.Adscripcion = "***";
|
||||
if ((npn + 2) <= (NumActo - 1) && ToPoyCese[npn + 2].FECHA == pues.FechaCese)
|
||||
{
|
||||
pues.FechaCese = pues.FechaCese.AddDays(-1);
|
||||
}
|
||||
npn = 0;
|
||||
PuestoPersona ppll = puestosnuevos[puestosnuevos.Count - 2];
|
||||
if (ppll.FechaCese == pues.FechaToPo && ppll.MotivoCese != "CAMBIO DE SITUACIÓN ADMINISTRATIVA (CON RESERVA DE PUESTO)" && ppll.MotivoCese != "SERVICIOS ESPECIALES")
|
||||
{
|
||||
pues.FechaToPo = pues.FechaToPo.AddDays(+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pues.FechaCese = vidaAdmin2.FECHA.Value.AddDays(-1);
|
||||
pues.MotivoCese = "SUPUESTO CESE NO EXISTE EN VIDAADMINISTRATIVA";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vidaAdmin2.FECHA.HasValue)
|
||||
{
|
||||
pues.FechaCese = vidaAdmin2.FECHA.Value;
|
||||
}
|
||||
pues.MotivoCese = vidaAdmin2.IDMOTIVONavigation?.DESCRIPCION;
|
||||
}
|
||||
PuestoPersona ppl = puestosnuevos[puestosnuevos.Count - 2];
|
||||
if (puestosnuevos.Count - 2 >= 0 && ppl.FechaCese == pues.FechaToPo)
|
||||
{
|
||||
if (pues.MotivoToPo == "SERVICIOS ESPECIALES" && !(ppl.FechaCese == pues.FechaToPo && ppl.FechaToPo == pues.FechaToPo))
|
||||
{
|
||||
pues.FechaToPo = pues.FechaToPo.AddDays(+1);
|
||||
pues.Puesto = "********";
|
||||
pues.Nivel = "***";
|
||||
pues.Grupo = "***";
|
||||
pues.Adscripcion = "***";
|
||||
}
|
||||
}
|
||||
|
||||
TiemSer = AnosMesesDias(pues.FechaToPo, pues.FechaCese);
|
||||
pues.AnosSer = TiemSer.Anos;
|
||||
pues.MesesSer = TiemSer.Meses;
|
||||
pues.DiasSer = TiemSer.Dias;
|
||||
}
|
||||
else
|
||||
{
|
||||
pues.FechaCese = (DateTime)vidaAdmin2.FECHA;
|
||||
pues.MotivoCese = vidaAdmin2.IDMOTIVONavigation.DESCRIPCION;
|
||||
if (pues.FechaToPo == pues.FechaCese && pues.MotivoCese.Contains("COMISIÓN DE SERVICIOS") && np + 2 <= NumActo)
|
||||
{
|
||||
pues.MotivoToPo = vidaAdmin2.IDMOTIVONavigation.DESCRIPCION;
|
||||
pues.MotivoCese = ToPoyCese[np + 2].IDMOTIVONavigation.DESCRIPCION;
|
||||
pues.FechaCese = ToPoyCese[np + 2].FECHA.Value.AddDays(-1);
|
||||
pues.Puesto = "********";
|
||||
pues.Nivel = "***";
|
||||
pues.Grupo = "***";
|
||||
pues.Adscripcion = "***";
|
||||
}
|
||||
if (((np + 2) < (NumActo - 1)) && pues.FechaCese == ToPoyCese[np + 2].FECHA && pues.FechaToPo != pues.FechaCese && ToPoyCese[np + 2].IDMOTIVONavigation.DESCRIPCION != "SERVICIOS ESPECIALES")
|
||||
{
|
||||
pues.FechaCese = pues.FechaCese.AddDays(-1);
|
||||
}
|
||||
if (puestosnuevos.Count >= 2 && pues.FechaToPo == puestosnuevos[puestosnuevos.Count - 2].FechaCese)
|
||||
{
|
||||
var puestoant = puestosnuevos[puestosnuevos.Count - 2];
|
||||
if (pues.MotivoToPo == "NOMBRAMIENTO")
|
||||
{
|
||||
puestoant.FechaCese = puestoant.FechaCese.AddDays(-1);
|
||||
TiemSer = AnosMesesDias(puestoant.FechaToPo, puestoant.FechaCese);
|
||||
puestoant.AnosSer = TiemSer.Anos;
|
||||
puestoant.MesesSer = TiemSer.Meses;
|
||||
puestoant.DiasSer = TiemSer.Dias;
|
||||
}
|
||||
if (pues.MotivoToPo == "SERVICIOS ESPECIALES")
|
||||
{
|
||||
pues.FechaToPo = pues.FechaToPo.AddDays(1);
|
||||
}
|
||||
}
|
||||
TiemSer = AnosMesesDias(pues.FechaToPo, pues.FechaCese);
|
||||
pues.AnosSer = TiemSer.Anos;
|
||||
pues.MesesSer = TiemSer.Meses;
|
||||
pues.DiasSer = TiemSer.Dias;
|
||||
if (pues.MotivoToPo == "SERVICIOS ESPECIALES" && (pues.MotivoCese == "REVOCACIÓN O CESE" || pues.MotivoCese == "CAMBIO DE SITUACIÓN ADMINISTRATIVA (CON RESERVA DE PUESTO)"))
|
||||
{
|
||||
pues.Puesto = "********";
|
||||
pues.Nivel = "***";
|
||||
pues.Grupo = "***";
|
||||
pues.Adscripcion = "***";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TiemSer = AnosMesesDias(pues.FechaToPo, DateTime.Now);
|
||||
pues.AnosSer = TiemSer.Anos;
|
||||
pues.MesesSer = TiemSer.Meses;
|
||||
pues.DiasSer = TiemSer.Dias;
|
||||
if (pues.MotivoToPo.Contains("SERVICIOS ESPECIALES") && pues.MotivoCese == null)
|
||||
{
|
||||
pues.Puesto = "********";
|
||||
pues.Nivel = "***";
|
||||
pues.Grupo = "***";
|
||||
pues.Adscripcion = "***";
|
||||
}
|
||||
np = NumActo;
|
||||
}
|
||||
|
||||
if ((np + 2) <= (NumActo - 1) && ToPoyCese[np + 2].FECHA.Value.Subtract(pues.FechaCese).Days > 1 && ToPoyCese[np + 2].IDMOTIVONavigation.DESCRIPCION == "SERVICIOS ESPECIALES")
|
||||
{
|
||||
var puesnue = new PuestoPersona();
|
||||
puestosnuevos.Add(puesnue);
|
||||
puesnue.MotivoToPo = pues.MotivoCese;
|
||||
puesnue.MotivoCese = pues.MotivoCese;
|
||||
puesnue.FechaToPo = pues.FechaCese.AddDays(1);
|
||||
puesnue.FechaCese = ToPoyCese[np + 2].FECHA.Value.AddDays(-1);
|
||||
puesnue.Puesto = "********";
|
||||
puesnue.Nivel = "***";
|
||||
puesnue.Grupo = "***";
|
||||
puesnue.Adscripcion = "***";
|
||||
TiemSer = AnosMesesDias(puesnue.FechaToPo, puesnue.FechaCese);
|
||||
puesnue.AnosSer = TiemSer.Anos;
|
||||
puesnue.MesesSer = TiemSer.Meses;
|
||||
puesnue.DiasSer = TiemSer.Dias;
|
||||
}
|
||||
if ((np + 2) <= (NumActo - 1) && ToPoyCese[np + 2].FECHA == pues.FechaCese && ToPoyCese[np + 2].IDMOTIVONavigation.DESCRIPCION != "SERVICIOS ESPECIALES" && ToPoyCese[np + 2].IDMOTIVONavigation.DESCRIPCION != "ACTIVO" && pues.FechaToPo != pues.FechaCese)
|
||||
{
|
||||
pues.FechaCese = pues.FechaCese.AddDays(-1);
|
||||
TiemSer = AnosMesesDias(pues.FechaToPo, pues.FechaCese);
|
||||
pues.AnosSer = TiemSer.Anos;
|
||||
pues.MesesSer = TiemSer.Meses;
|
||||
pues.DiasSer = TiemSer.Dias;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var a = 1;
|
||||
}
|
||||
return puestosnuevos.OrderByDescending(x => x.FechaToPo).ToList();
|
||||
}
|
||||
|
||||
public static Anos_Meses_Dias AnosMesesDias(DateTime fechaInicio, DateTime fechaFin)
|
||||
{
|
||||
//DateTime fechaFinAjustada = (fechaFin.Date == DateTime.Today)
|
||||
// ? fechaFin.AddDays(1)
|
||||
// : fechaFin;
|
||||
|
||||
if (fechaFin < fechaInicio)
|
||||
throw new ArgumentException("La fecha final debe ser mayor o igual que la fecha de inicio.");
|
||||
|
||||
int anos = fechaFin.Year - fechaInicio.Year;
|
||||
int meses = fechaFin.Month - fechaInicio.Month;
|
||||
int dias = fechaFin.Day - fechaInicio.Day;
|
||||
|
||||
// Ajustar cuando la diferencia en días es negativa (no se completó el mes)
|
||||
if (dias < 0)
|
||||
{
|
||||
meses--;
|
||||
int diasMesAnterior = DateTime.DaysInMonth(
|
||||
fechaFin.Month == 1 ? fechaFin.Year - 1 : fechaFin.Year,
|
||||
fechaFin.Month == 1 ? 12 : fechaFin.Month - 1);
|
||||
dias += diasMesAnterior;
|
||||
}
|
||||
|
||||
// Ajustar cuando la diferencia en meses es negativa (no se completó el año)
|
||||
if (meses < 0)
|
||||
{
|
||||
anos--;
|
||||
meses += 12;
|
||||
}
|
||||
|
||||
return new Anos_Meses_Dias { Anos = anos, Meses = meses, Dias = dias };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace bdAntifraudeMYSQL.clases
|
||||
{
|
||||
public class AlmacenaFicheroAtransmitir
|
||||
{
|
||||
public int IdRegistro { get; set; }
|
||||
public string Tabla { get; set; } = "";
|
||||
public string Fichero { get; set; } = "";
|
||||
|
||||
public AlmacenaFicheroAtransmitir() { }
|
||||
|
||||
public AlmacenaFicheroAtransmitir(int idRegistro, string tabla, string fichero)
|
||||
{
|
||||
IdRegistro = idRegistro;
|
||||
Tabla = tabla;
|
||||
Fichero = fichero;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Antifraude.Net/bdAntifraudeMYSQL/clases/Anos_Meses_Dias.cs
Normal file
15
Antifraude.Net/bdAntifraudeMYSQL/clases/Anos_Meses_Dias.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bdAntifraudeMYSQL.clases
|
||||
{
|
||||
public class Anos_Meses_Dias
|
||||
{
|
||||
public int Anos { get; set; }
|
||||
public int Meses { get; set; }
|
||||
public int Dias { get; set; }
|
||||
}
|
||||
}
|
||||
18
Antifraude.Net/bdAntifraudeMYSQL/clases/Formacion.cs
Normal file
18
Antifraude.Net/bdAntifraudeMYSQL/clases/Formacion.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bdAntifraudeMYSQL.clases
|
||||
{
|
||||
public class Formacion
|
||||
{
|
||||
public string NumReg { get; set; } = "";
|
||||
public string Descripcion { get; set; } = "";
|
||||
public string Centro { get; set; } = "";
|
||||
public string FExpedicion { get; set; } = "";
|
||||
public string NumHoras { get; set; } = "";
|
||||
public string Aprovechamiento { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using bdAntifraudeMYSQL.db;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Security.Claims;
|
||||
using bdAntifraudeMYSQL.clases;
|
||||
|
||||
namespace SwaggerAntifraudeMYSQL.Models
|
||||
{
|
||||
public class HojaAcreditacionDatos
|
||||
{
|
||||
public string Nif { get; set; } = "";
|
||||
public string ApellidosNombre { get; set; } = "";
|
||||
public string Cuerpo { get; set; } = "";
|
||||
public string Especialidad { get; set; } = "";
|
||||
public string Grado { get; set; } = "";
|
||||
public string Antiguedad { get; set; } = "";
|
||||
public string FechaRecGra { get; set; } = "";
|
||||
public string FechaProTri { get; set; } = "";
|
||||
|
||||
public List<PuestoPersona> Puestos { get; set; } = new List<PuestoPersona>();
|
||||
public List<PuestoPersona> Titulaciones { get; set; } = new List<PuestoPersona>();
|
||||
public List<PuestoPersona> Cursos { get; set; } = new List<PuestoPersona>();
|
||||
}
|
||||
|
||||
}
|
||||
31
Antifraude.Net/bdAntifraudeMYSQL/clases/ParFicExcel.cs
Normal file
31
Antifraude.Net/bdAntifraudeMYSQL/clases/ParFicExcel.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bdAntifraudeMYSQL.clases
|
||||
{
|
||||
public class ParFicExcel
|
||||
{
|
||||
public string ClaveExcel { get; set; } = "";
|
||||
public string texto1 { get; set; } = "";
|
||||
public string texto2 { get; set; } = "";
|
||||
public string Fecha { get; set; } = "";
|
||||
}
|
||||
public class NifPersona
|
||||
{
|
||||
public string Nif { get; set; } = "";
|
||||
}
|
||||
public class ResultadoObtenerHAD
|
||||
{
|
||||
public int Resultado { get; set; }
|
||||
public string Mensaje { get; set; }
|
||||
public string HAD { get; set; }
|
||||
}
|
||||
public class DatGenNom
|
||||
{
|
||||
public List<int> Personas { get; set; } = new List<int>();
|
||||
public int Idnomina { get; set; }
|
||||
}
|
||||
}
|
||||
25
Antifraude.Net/bdAntifraudeMYSQL/clases/PeticionFichero.cs
Normal file
25
Antifraude.Net/bdAntifraudeMYSQL/clases/PeticionFichero.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bdAntifraudeMYSQL.clases
|
||||
{
|
||||
public class PeticionFichero
|
||||
{
|
||||
public int IdRegistro { get; set; }
|
||||
public string Tabla { get; set; } = "";
|
||||
public string Nif { get; set; } = "";
|
||||
|
||||
|
||||
public PeticionFichero() { }
|
||||
|
||||
public PeticionFichero(int idRegistro, string tabla, string nif)
|
||||
{
|
||||
IdRegistro = idRegistro;
|
||||
Tabla = tabla;
|
||||
Nif = nif;
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Antifraude.Net/bdAntifraudeMYSQL/clases/PuestoPersona.cs
Normal file
26
Antifraude.Net/bdAntifraudeMYSQL/clases/PuestoPersona.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bdAntifraudeMYSQL.clases
|
||||
{
|
||||
public class PuestoPersona
|
||||
{
|
||||
public string Puesto { get; set; } = "";
|
||||
public string Nivel { get; set; } = "";
|
||||
public string Adscripcion { get; set; } = "";
|
||||
public string Grupo { get; set; } = "";
|
||||
public DateTime FechaToPo { get; set; }
|
||||
public string MotivoToPo { get; set; } = "";
|
||||
public string CaracterOcu { get; set; } = "";
|
||||
public DateTime FechaCese { get; set; }
|
||||
public string MotivoCese { get; set; } = "";
|
||||
public int AnosSer { get; set; }
|
||||
public int MesesSer { get; set; }
|
||||
public int DiasSer { get; set; }
|
||||
public string unidadAdministrativa { get; set; } = "";
|
||||
public string servicioAdscrito { get; set; } = "";
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user