From 3094a563334f093368b31ba96069df214abab6d9 Mon Sep 17 00:00:00 2001 From: Felix Morales Date: Wed, 2 Aug 2023 16:54:34 -0500 Subject: [PATCH] crear catalogo TiposMercancias --- .../Catalogos/ITiposMercanciaRepository.cs | 8 ++++++ .../Catalogos/TiposMercanciaController.cs | 25 +++++++++++++++++++ Models/Catalogos/CatTiposMercancia.cs | 9 +++++++ Models/Clientes.cs | 1 + Models/Corresponsales/ITrafico.cs | 1 + Program.cs | 1 + .../Catalogos/TiposMercanciaRepository.cs | 23 +++++++++++++++++ .../CorresponsaliasTraficosRepository.cs | 3 ++- web.config | 20 +++++++++++++++ 9 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 Contracts/Catalogos/ITiposMercanciaRepository.cs create mode 100644 Controllers/Catalogos/TiposMercanciaController.cs create mode 100644 Models/Catalogos/CatTiposMercancia.cs create mode 100644 Repository/Catalogos/TiposMercanciaRepository.cs create mode 100644 web.config diff --git a/Contracts/Catalogos/ITiposMercanciaRepository.cs b/Contracts/Catalogos/ITiposMercanciaRepository.cs new file mode 100644 index 0000000..781ddd7 --- /dev/null +++ b/Contracts/Catalogos/ITiposMercanciaRepository.cs @@ -0,0 +1,8 @@ +using CORRESPONSALBackend.Models.Catalogos; + +namespace CORRESPONSALBackend.Contracts.Catalogos +{ + public interface ITiposMercanciaRepository{ + public Task> GetAll(); + } +} \ No newline at end of file diff --git a/Controllers/Catalogos/TiposMercanciaController.cs b/Controllers/Catalogos/TiposMercanciaController.cs new file mode 100644 index 0000000..5482c0d --- /dev/null +++ b/Controllers/Catalogos/TiposMercanciaController.cs @@ -0,0 +1,25 @@ +using CORRESPONSALBackend.Models.Catalogos; +using CORRESPONSALBackend.Contracts.Catalogos; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; + +namespace CORRESPONSALBackend.Controllers.Catalogos +{ + [Authorize] + [Route("api/Catalogos/[controller]")] + public class TiposMercanciaController : ControllerBase + { + private readonly IConfiguration _config; + private readonly ITiposMercanciaRepository _repo; + public TiposMercanciaController(IConfiguration config, ITiposMercanciaRepository repo){ + _config = config; + _repo = repo; + } + + [HttpGet] + public async Task> GetAll(){ + var tipos = await _repo.GetAll(); + return tipos; + } + } +} \ No newline at end of file diff --git a/Models/Catalogos/CatTiposMercancia.cs b/Models/Catalogos/CatTiposMercancia.cs new file mode 100644 index 0000000..92b871f --- /dev/null +++ b/Models/Catalogos/CatTiposMercancia.cs @@ -0,0 +1,9 @@ +namespace CORRESPONSALBackend.Models.Catalogos +{ + public class CatTiposMercancia + { + public int id { set; get; } = 0; + public string Clave { set; get; } = null!; + public string Descripcion { set; get; } = null!; + } +} \ No newline at end of file diff --git a/Models/Clientes.cs b/Models/Clientes.cs index 1bc5117..e08e781 100644 --- a/Models/Clientes.cs +++ b/Models/Clientes.cs @@ -5,6 +5,7 @@ namespace CORRESPONSALBackend.Models public int sClave { set; get; } public byte Agrupado { set; get; } public string sRazonSocial { set; get; } = null!; + public string sRFC {get;set;}=null!; } } \ No newline at end of file diff --git a/Models/Corresponsales/ITrafico.cs b/Models/Corresponsales/ITrafico.cs index c2e79e4..b5f7e76 100644 --- a/Models/Corresponsales/ITrafico.cs +++ b/Models/Corresponsales/ITrafico.cs @@ -41,5 +41,6 @@ public int NoRecti { get; set; } = 0; public double EstatusCode { get; set; } = 0; public byte? Activo { get; set; } = 0; + public int idTipoMercancia {get;set;} = 0; } } diff --git a/Program.cs b/Program.cs index 75767c4..80f8c31 100644 --- a/Program.cs +++ b/Program.cs @@ -68,6 +68,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); //Utilerias builder.Services.AddScoped(); diff --git a/Repository/Catalogos/TiposMercanciaRepository.cs b/Repository/Catalogos/TiposMercanciaRepository.cs new file mode 100644 index 0000000..c5d068c --- /dev/null +++ b/Repository/Catalogos/TiposMercanciaRepository.cs @@ -0,0 +1,23 @@ +using Dapper; +using CORRESPONSALBackend.Context; +using CORRESPONSALBackend.Models.Catalogos; +using CORRESPONSALBackend.Contracts.Catalogos; +using System.Data; + +namespace CORRESPONSALBackend.Repository.Catalogos +{ + public class TiposMercanciaRepository : ITiposMercanciaRepository + { + private readonly DapperContext _context; + + public TiposMercanciaRepository(DapperContext context) { _context = context; } + public async Task> GetAll() + { + var query = "[Catalogo.CatTiposMercancia.Get]"; + using var connection = _context.CreateConnection(); + var entrada = await connection.QueryAsync(query); + return entrada.ToList(); + + } + } +} \ No newline at end of file diff --git a/Repository/Corresponsalias/CorresponsaliasTraficosRepository.cs b/Repository/Corresponsalias/CorresponsaliasTraficosRepository.cs index febee4c..3f08f39 100644 --- a/Repository/Corresponsalias/CorresponsaliasTraficosRepository.cs +++ b/Repository/Corresponsalias/CorresponsaliasTraficosRepository.cs @@ -99,7 +99,8 @@ namespace CORRESPONSALBackend.Repository.Corresponsalias @FechaCuenta = data.FechaCuenta, @TipoMercancia = data.TipoMercancia, @Activo = true, - @IdTabulador = data.IdTabulador + @IdTabulador = data.IdTabulador, + @IdTipoMercancia = data.idTipoMercancia }, commandType: CommandType.StoredProcedure); return entrada.First(); diff --git a/web.config b/web.config new file mode 100644 index 0000000..472c4ae --- /dev/null +++ b/web.config @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file