diff --git a/APIFicheros/APIFicheros.csproj b/APIFicheros/APIFicheros.csproj index 5419ef0..505c4bc 100644 --- a/APIFicheros/APIFicheros.csproj +++ b/APIFicheros/APIFicheros.csproj @@ -10,4 +10,8 @@ + + + + diff --git a/APIFicheros/Controllers/ObtenerFicherosController.cs b/APIFicheros/Controllers/ObtenerFicherosController.cs new file mode 100644 index 0000000..a483c83 --- /dev/null +++ b/APIFicheros/Controllers/ObtenerFicherosController.cs @@ -0,0 +1,67 @@ +using APIFicheros.DTOs; +using bdAsegasa; +using bdAsegasa.db; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.SignalR; +using static Org.BouncyCastle.Math.EC.ECCurve; + +namespace APIFicheros.Controllers +{ + [ApiController] + [Route("[controller]")] + public class ObtenerFicherosController : Controller + { + private readonly IConfiguration _configuration; + private bdAsegasa.tscgestionasegasa bd; + public ObtenerFicherosController(IConfiguration configuration) + { + + _configuration = configuration; + + var nombreConexion = _configuration["Configuracion:NombreConexionBD"]; + + bd = tscgestionasegasa.NuevoContexto(nombreConexion, true, false, true, "ObtenerFicheros"); + + } + + + [HttpPost("ObtenerFicherosFaltantes")] + public ActionResult PostNombreBD([FromBody] string numeroPoliza) + { + + try + { + + int idPoliza = bd.polizassg.First(x => x.NumeroPoliza!.Contains(numeroPoliza)).idPoliza; + + + List listadoDocumentos = new List(); + List listadoFicherosFaltantes = new List(); + + listadoDocumentos = bd.documentospolizassg.Where(x => x.idPoliza == idPoliza && x.idFichero == null).ToList(); + + + foreach (documentospolizassg documentoFaltante in listadoDocumentos) + { + listadoFicherosFaltantes.Add(new PolizasFaltantes + { + idDocumento = documentoFaltante.idDocumento, + descripcion = documentoFaltante.idDocumentoASolicitarNavigation!.idTipoNavigation!.Descripcion + }); + } + + return Ok(listadoFicherosFaltantes); + + } + catch (Exception ex) { + + return BadRequest("Ha ocurrido un error. Mensaje de error: " + ex.Message); + } + + + + + } + } +} diff --git a/APIFicheros/DTOs/PolizasFaltantes.cs b/APIFicheros/DTOs/PolizasFaltantes.cs new file mode 100644 index 0000000..f25e796 --- /dev/null +++ b/APIFicheros/DTOs/PolizasFaltantes.cs @@ -0,0 +1,9 @@ +namespace APIFicheros.DTOs +{ + public class PolizasFaltantes + { + public int idDocumento { get; set; } + public string descripcion { get; set; } + } +} + \ No newline at end of file diff --git a/APIFicheros/Program.cs b/APIFicheros/Program.cs index 48863a6..7bded67 100644 --- a/APIFicheros/Program.cs +++ b/APIFicheros/Program.cs @@ -2,11 +2,18 @@ var builder = WebApplication.CreateBuilder(args); // 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(); + +builder.Services.AddControllers() + .AddJsonOptions(options => + { + options.JsonSerializerOptions.ReferenceHandler = + System.Text.Json.Serialization.ReferenceHandler.IgnoreCycles; + }); + var app = builder.Build(); // Configure the HTTP request pipeline. diff --git a/APIFicheros/appsettings.json b/APIFicheros/appsettings.json index 10f68b8..48353fb 100644 --- a/APIFicheros/appsettings.json +++ b/APIFicheros/appsettings.json @@ -5,5 +5,11 @@ "Microsoft.AspNetCore": "Warning" } }, + + "Configuracion": { + "SegundosMinimosEntreProcesos": "60", + "HoraProcesosDiarios": "06:30", + "NombreConexionBD": "Producción Remoto" + }, "AllowedHosts": "*" } diff --git a/WSAsegasa/WSAsegasa.csproj b/WSAsegasa/WSAsegasa.csproj index d9a6da2..74b0d6e 100644 --- a/WSAsegasa/WSAsegasa.csproj +++ b/WSAsegasa/WSAsegasa.csproj @@ -23,6 +23,7 @@ +