diff --git a/APIFicheros/APIFicheros.csproj b/APIFicheros/APIFicheros.csproj new file mode 100644 index 0000000..505c4bc --- /dev/null +++ b/APIFicheros/APIFicheros.csproj @@ -0,0 +1,17 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + diff --git a/APIFicheros/APIFicheros.http b/APIFicheros/APIFicheros.http new file mode 100644 index 0000000..ee91da2 --- /dev/null +++ b/APIFicheros/APIFicheros.http @@ -0,0 +1,6 @@ +@APIFicheros_HostAddress = http://localhost:5219 + +GET {{APIFicheros_HostAddress}}/weatherforecast/ +Accept: application/json + +### 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/Controllers/WeatherForecastController.cs b/APIFicheros/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..9216ce9 --- /dev/null +++ b/APIFicheros/Controllers/WeatherForecastController.cs @@ -0,0 +1,32 @@ +using Microsoft.AspNetCore.Mvc; + +namespace APIFicheros.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 _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable 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(); + } +} 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 new file mode 100644 index 0000000..7bded67 --- /dev/null +++ b/APIFicheros/Program.cs @@ -0,0 +1,32 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +// 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. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/APIFicheros/Properties/launchSettings.json b/APIFicheros/Properties/launchSettings.json new file mode 100644 index 0000000..8f79618 --- /dev/null +++ b/APIFicheros/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:3277", + "sslPort": 44319 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5219", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7224;http://localhost:5219", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/APIFicheros/WeatherForecast.cs b/APIFicheros/WeatherForecast.cs new file mode 100644 index 0000000..4d1de37 --- /dev/null +++ b/APIFicheros/WeatherForecast.cs @@ -0,0 +1,12 @@ +namespace APIFicheros; + +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; } +} diff --git a/APIFicheros/appsettings.Development.json b/APIFicheros/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/APIFicheros/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/APIFicheros/appsettings.json b/APIFicheros/appsettings.json new file mode 100644 index 0000000..48353fb --- /dev/null +++ b/APIFicheros/appsettings.json @@ -0,0 +1,15 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + + "Configuracion": { + "SegundosMinimosEntreProcesos": "60", + "HoraProcesosDiarios": "06:30", + "NombreConexionBD": "Producción Remoto" + }, + "AllowedHosts": "*" +} diff --git a/Asegasa.sln b/Asegasa.sln index 626e5c4..a90479f 100644 --- a/Asegasa.sln +++ b/Asegasa.sln @@ -7,10 +7,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WSAsegasa", "WSAsegasa\WSAs EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bdAsegasa", "bdAsegasa\bdAsegasa.csproj", "{E42D668E-CB26-498B-89AF-8A205528C4EF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tsVeriFactu", "..\..\Comunes\tsVeriFactu\tsVeriFactu.csproj", "{DDFE8F31-9ED8-5C11-4E72-6CE96526C459}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bdfactu", "..\Tecnosis\tsFactu\bdFactu\bdfactu.csproj", "{56D9C47A-1D6F-0C5B-2DB0-72EB359C1093}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tsVeriFactu", "..\Tecnosis\tsVeriFactu\tsVeriFactu.csproj", "{947E1B2F-7877-66E7-8DF0-282429B770F0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "APIFicheros", "APIFicheros\APIFicheros.csproj", "{729F814F-BBAF-A079-B0A1-D5890DA11543}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -25,14 +27,18 @@ Global {E42D668E-CB26-498B-89AF-8A205528C4EF}.Debug|Any CPU.Build.0 = Debug|Any CPU {E42D668E-CB26-498B-89AF-8A205528C4EF}.Release|Any CPU.ActiveCfg = Release|Any CPU {E42D668E-CB26-498B-89AF-8A205528C4EF}.Release|Any CPU.Build.0 = Release|Any CPU - {DDFE8F31-9ED8-5C11-4E72-6CE96526C459}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DDFE8F31-9ED8-5C11-4E72-6CE96526C459}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DDFE8F31-9ED8-5C11-4E72-6CE96526C459}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DDFE8F31-9ED8-5C11-4E72-6CE96526C459}.Release|Any CPU.Build.0 = Release|Any CPU {56D9C47A-1D6F-0C5B-2DB0-72EB359C1093}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {56D9C47A-1D6F-0C5B-2DB0-72EB359C1093}.Debug|Any CPU.Build.0 = Debug|Any CPU {56D9C47A-1D6F-0C5B-2DB0-72EB359C1093}.Release|Any CPU.ActiveCfg = Release|Any CPU {56D9C47A-1D6F-0C5B-2DB0-72EB359C1093}.Release|Any CPU.Build.0 = Release|Any CPU + {947E1B2F-7877-66E7-8DF0-282429B770F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {947E1B2F-7877-66E7-8DF0-282429B770F0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {947E1B2F-7877-66E7-8DF0-282429B770F0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {947E1B2F-7877-66E7-8DF0-282429B770F0}.Release|Any CPU.Build.0 = Release|Any CPU + {729F814F-BBAF-A079-B0A1-D5890DA11543}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {729F814F-BBAF-A079-B0A1-D5890DA11543}.Debug|Any CPU.Build.0 = Debug|Any CPU + {729F814F-BBAF-A079-B0A1-D5890DA11543}.Release|Any CPU.ActiveCfg = Release|Any CPU + {729F814F-BBAF-A079-B0A1-D5890DA11543}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE 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 @@ +