Creada api y primer verbo buscar ficheros faltantes
This commit is contained in:
@@ -10,4 +10,8 @@
|
|||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\bdAsegasa\bdAsegasa.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
67
APIFicheros/Controllers/ObtenerFicherosController.cs
Normal file
67
APIFicheros/Controllers/ObtenerFicherosController.cs
Normal file
@@ -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<bdAsegasa.db.documentospolizassg> listadoDocumentos = new List<bdAsegasa.db.documentospolizassg>();
|
||||||
|
List<PolizasFaltantes> listadoFicherosFaltantes = new List<PolizasFaltantes>();
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
APIFicheros/DTOs/PolizasFaltantes.cs
Normal file
9
APIFicheros/DTOs/PolizasFaltantes.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace APIFicheros.DTOs
|
||||||
|
{
|
||||||
|
public class PolizasFaltantes
|
||||||
|
{
|
||||||
|
public int idDocumento { get; set; }
|
||||||
|
public string descripcion { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -2,11 +2,18 @@ var builder = WebApplication.CreateBuilder(args);
|
|||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen();
|
builder.Services.AddSwaggerGen();
|
||||||
|
|
||||||
|
|
||||||
|
builder.Services.AddControllers()
|
||||||
|
.AddJsonOptions(options =>
|
||||||
|
{
|
||||||
|
options.JsonSerializerOptions.ReferenceHandler =
|
||||||
|
System.Text.Json.Serialization.ReferenceHandler.IgnoreCycles;
|
||||||
|
});
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
|
|||||||
@@ -5,5 +5,11 @@
|
|||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"Configuracion": {
|
||||||
|
"SegundosMinimosEntreProcesos": "60",
|
||||||
|
"HoraProcesosDiarios": "06:30",
|
||||||
|
"NombreConexionBD": "Producción Remoto"
|
||||||
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\..\Comunes\tsVeriFactu\tsVeriFactu.csproj" />
|
<ProjectReference Include="..\..\..\Comunes\tsVeriFactu\tsVeriFactu.csproj" />
|
||||||
<ProjectReference Include="..\..\Tecnosis\tsFactu\bdFactu\bdfactu.csproj" />
|
<ProjectReference Include="..\..\Tecnosis\tsFactu\bdFactu\bdfactu.csproj" />
|
||||||
|
<ProjectReference Include="..\..\Tecnosis\tsVeriFactu\tsVeriFactu.csproj" />
|
||||||
<ProjectReference Include="..\bdAsegasa\bdAsegasa.csproj" />
|
<ProjectReference Include="..\bdAsegasa\bdAsegasa.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user