diff --git a/Contracts/Operaciones/IOpViajesRepository.cs b/Contracts/Operaciones/IOpViajesRepository.cs new file mode 100644 index 0000000..d82061b --- /dev/null +++ b/Contracts/Operaciones/IOpViajesRepository.cs @@ -0,0 +1,11 @@ +using AOLBackend.DTO.Operaciones; + +namespace AOLBackend.Contracts.Operaciones +{ + public interface IOpViajesRepository + { + public Task Append(DTOOpViajes data); + public Task> GetAll(); + public Task Delete(int id); + } +} \ No newline at end of file diff --git a/Controllers/Operaciones/OpViajesController.cs b/Controllers/Operaciones/OpViajesController.cs new file mode 100644 index 0000000..d792c5f --- /dev/null +++ b/Controllers/Operaciones/OpViajesController.cs @@ -0,0 +1,42 @@ +using AOLBackend.Contracts.Operaciones; +using AOLBackend.DTO.Operaciones; +using Microsoft.AspNetCore.Mvc; + +namespace AOLBackend.Controllers.Operaciones +{ + [ApiController] + [Route("api/Operaciones/[controller]")] + public class OpViajesController : ControllerBase + { + private readonly IOpViajesRepository _Repo; + + public OpViajesController(IOpViajesRepository Repo) + { + _Repo = Repo; + } + + [HttpPost] + [Route("Append")] + public async Task Append([FromBody] DTOOpViajes data) + { + var entrada = await _Repo.Append(data); + return entrada; + } + + [HttpGet] + [Route("Get")] + public async Task> GetAll() + { + var entrada = await _Repo.GetAll(); + return entrada; + } + + [HttpDelete("Delete/{id}")] + public async Task Delete(int id) + { + await _Repo.Delete(id); + return new OkObjectResult(new { respuesta = "Se elimino el registro" }); + } + + } +} \ No newline at end of file diff --git a/DTO/Operaciones/DTOOpViajes.cs b/DTO/Operaciones/DTOOpViajes.cs new file mode 100644 index 0000000..d8163a3 --- /dev/null +++ b/DTO/Operaciones/DTOOpViajes.cs @@ -0,0 +1,26 @@ +namespace AOLBackend.DTO.Operaciones +{ + public class DTOOpViajes + { + public int id { get; set; } = 0; + public string FAlta { get; set; } = null!; + public int Usuario { get; set; } = 0; + public string FCruce { get; set; } = null!; + public string RefAgenciaAduanal { get; set; } = null!; + public int Cliente { get; set; } = 0; + public string? sCliente { get; set; } = null!; + public int Proveedor { get; set; } = 0; + public string? sProveedor { get; set; } = null!; + public byte Hazmat { get; set; } = 0; + public int Servicio { get; set; } = 0; + public string? sServicio { get; set; } = null!; + public byte TipoUnidad { get; set; } = 0; + public string? sTipoUnidad { get; set; } = null!; + public string NoCaja { get; set; } = null!; + public string PickUpNumber { get; set; } = null!; + public int Origen { get; set; } = 0; + public string? sOrigen { get; set; } = null!; + public int Destino { get; set; } = 0; + public string? sDestino { get; set; } = null!; + } +} \ No newline at end of file diff --git a/Models/Operaciones/IOpViajes.cs b/Models/Operaciones/IOpViajes.cs new file mode 100644 index 0000000..4fbfab5 --- /dev/null +++ b/Models/Operaciones/IOpViajes.cs @@ -0,0 +1,29 @@ +namespace AOLBackend.Models.Operaciones +{ + public class IOpViajes + { + public int id { get; set; } = 0; + public string FAlta { get; set; } = null!; + public int Usuario { get; set; } = 0; + public string FCruce { get; set; } = null!; + public string RefAgenciaAduanal { get; set; } = null!; + public int Cliente { get; set; } = 0; + public int Proveedor { get; set; } = 0; + public byte Hazmat { get; set; } = 0; + public byte TipoUnidad { get; set; } = 0; + public string NoCaja { get; set; } = null!; + public string PickUpNumber { get; set; } = null!; + public int Origen { get; set; } = 0; + public int Destino { get; set; } = 0; + public string FacturaProveedor { get; set; } = null!; + public string FacturaAlphaOmega { get; set; } = null!; + public string FPagoFactura { get; set; } = null!; + public byte MetodoPago { get; set; } = 0; + public string FPagoProveedor { get; set; } = null!; + public int NoChequeAOL { get; set; } = 0; + public int FacturarA { get; set; } = 0; + public string FEntrega { get; set; } = null!; + public int Status { get; set; } = 0; + public int Activo { get; set; } = 0; + } +} \ No newline at end of file diff --git a/Program.cs b/Program.cs index 6a2ee24..a24346e 100644 --- a/Program.cs +++ b/Program.cs @@ -1,8 +1,10 @@ using AOLBackend.Context; using AOLBackend.Contracts; using AOLBackend.Contracts.Catalogos; +using AOLBackend.Contracts.Operaciones; using AOLBackend.Repository; using AOLBackend.Repository.Catalogos; +using AOLBackend.Repository.Operaciones; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.IdentityModel.Tokens; using System.Text; @@ -20,6 +22,9 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +//Operaciones +builder.Services.AddScoped(); + builder.Services.AddControllers(); builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options => { diff --git a/Repository/Operaciones/OpViajesRepository.cs b/Repository/Operaciones/OpViajesRepository.cs new file mode 100644 index 0000000..1bca2ff --- /dev/null +++ b/Repository/Operaciones/OpViajesRepository.cs @@ -0,0 +1,57 @@ +using AOLBackend.Context; +using AOLBackend.Contracts.Operaciones; +using AOLBackend.DTO.Operaciones; +using Dapper; +using System.Data; + +namespace AOLBackend.Repository.Operaciones +{ + public class OpViajesRepository : IOpViajesRepository + { + private readonly DapperContext _context; + private readonly IConfiguration _config; + public OpViajesRepository(DapperContext context, IConfiguration config) + { + _context = context; + _config = config; + } + + public async Task Append(DTOOpViajes data) + { + var query = "[Operaciones.Viajes.Append]"; + using var connection = _context.CreateConnection(); + var entrada = await connection.QueryAsync(query, new + { + @id = data.id, + @Usuario = data.Usuario, + @FCruce = data.FCruce, + @RefAgenciaAduanal = data.RefAgenciaAduanal, + @Cliente = data.Cliente, + @Proveedor = data.Proveedor, + @HazMat = data.Hazmat, + @Servicio = data.Servicio, + @TipoUnidad = data.TipoUnidad, + @NoCaja = data.NoCaja, + @PickUpNumber = data.PickUpNumber, + @Origen = data.Origen, + @Destino = data.Destino + }, commandType: CommandType.StoredProcedure); + return entrada.First(); + } + public async Task> GetAll() + { + var query = "[Operaciones.Viajes.Get]"; + using var connection = _context.CreateConnection(); + var entrada = await connection.QueryAsync(query, new { }, commandType: CommandType.StoredProcedure); + return entrada; + } + + public async Task Delete(int id) + { + var query = "[Operaciones.Viajes.Delete]"; + using var connection = _context.CreateConnection(); + var entrada = await connection.QueryAsync(query, new { @id }, commandType: CommandType.StoredProcedure); + return true; + } + } +} \ No newline at end of file diff --git a/bin/Debug/net6.0/AOLBackend.dll b/bin/Debug/net6.0/AOLBackend.dll index f977019..e67d91c 100644 Binary files a/bin/Debug/net6.0/AOLBackend.dll and b/bin/Debug/net6.0/AOLBackend.dll differ diff --git a/bin/Debug/net6.0/AOLBackend.pdb b/bin/Debug/net6.0/AOLBackend.pdb index ca6a2dd..efcfa81 100644 Binary files a/bin/Debug/net6.0/AOLBackend.pdb and b/bin/Debug/net6.0/AOLBackend.pdb differ diff --git a/obj/Debug/net6.0/AOLBackend.GeneratedMSBuildEditorConfig.editorconfig b/obj/Debug/net6.0/AOLBackend.GeneratedMSBuildEditorConfig.editorconfig index fc61964..aa0a97e 100644 --- a/obj/Debug/net6.0/AOLBackend.GeneratedMSBuildEditorConfig.editorconfig +++ b/obj/Debug/net6.0/AOLBackend.GeneratedMSBuildEditorConfig.editorconfig @@ -8,9 +8,9 @@ build_property.PlatformNeutralAssembly = build_property._SupportedPlatformList = Linux,macOS,Windows build_property.RootNamespace = AOLBackend build_property.RootNamespace = AOLBackend -build_property.ProjectDir = c:\projects\staging\AOLBackend\ +build_property.ProjectDir = C:\projects\staging\AOLBackend\ build_property.RazorLangVersion = 6.0 build_property.SupportLocalizedComponentNames = build_property.GenerateRazorMetadataSourceChecksumAttributes = -build_property.MSBuildProjectDirectory = c:\projects\staging\AOLBackend +build_property.MSBuildProjectDirectory = C:\projects\staging\AOLBackend build_property._RazorSourceGeneratorDebug = diff --git a/obj/Debug/net6.0/AOLBackend.assets.cache b/obj/Debug/net6.0/AOLBackend.assets.cache index 1389778..20a4db6 100644 Binary files a/obj/Debug/net6.0/AOLBackend.assets.cache and b/obj/Debug/net6.0/AOLBackend.assets.cache differ diff --git a/obj/Debug/net6.0/AOLBackend.csproj.CoreCompileInputs.cache b/obj/Debug/net6.0/AOLBackend.csproj.CoreCompileInputs.cache index d2efcf1..636d313 100644 --- a/obj/Debug/net6.0/AOLBackend.csproj.CoreCompileInputs.cache +++ b/obj/Debug/net6.0/AOLBackend.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -2042434c554652c90861df655d8b5f920355c627 +ed603f94136a48ae0a4b114ef696f13d8ba5c20a diff --git a/obj/Debug/net6.0/AOLBackend.dll b/obj/Debug/net6.0/AOLBackend.dll index f977019..e67d91c 100644 Binary files a/obj/Debug/net6.0/AOLBackend.dll and b/obj/Debug/net6.0/AOLBackend.dll differ diff --git a/obj/Debug/net6.0/AOLBackend.pdb b/obj/Debug/net6.0/AOLBackend.pdb index ca6a2dd..efcfa81 100644 Binary files a/obj/Debug/net6.0/AOLBackend.pdb and b/obj/Debug/net6.0/AOLBackend.pdb differ diff --git a/obj/Debug/net6.0/ref/AOLBackend.dll b/obj/Debug/net6.0/ref/AOLBackend.dll index 19d1441..72846f9 100644 Binary files a/obj/Debug/net6.0/ref/AOLBackend.dll and b/obj/Debug/net6.0/ref/AOLBackend.dll differ diff --git a/obj/Debug/net6.0/refint/AOLBackend.dll b/obj/Debug/net6.0/refint/AOLBackend.dll index 19d1441..72846f9 100644 Binary files a/obj/Debug/net6.0/refint/AOLBackend.dll and b/obj/Debug/net6.0/refint/AOLBackend.dll differ diff --git a/obj/staticwebassets.pack.sentinel b/obj/staticwebassets.pack.sentinel index 72d7281..16bd282 100644 --- a/obj/staticwebassets.pack.sentinel +++ b/obj/staticwebassets.pack.sentinel @@ -77,3 +77,14 @@ 2.0 2.0 2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0