diff --git a/BLL/EnvioDGA.cs b/BLL/EnvioDGA.cs index 608df5d..8f8ec69 100644 --- a/BLL/EnvioDGA.cs +++ b/BLL/EnvioDGA.cs @@ -7,24 +7,13 @@ namespace BLL { public class EnvioDGA { - private readonly IConfiguration _configuration; private readonly MedicionScadaRepository _dGAMedicionScadaRepository; private readonly RegistrarMedicion _registrarMedicion; - private static string? password; - private static string? rutEmpresa; - private static string? rutUsuario; - public EnvioDGA(IConfiguration configuration, MedicionScadaRepository dGAMedicionScadaRepository, RegistrarMedicion registrarMedicion) + public EnvioDGA(MedicionScadaRepository dGAMedicionScadaRepository, RegistrarMedicion registrarMedicion) { - _configuration = configuration ?? new ConfigurationBuilder() - .SetBasePath(AppContext.BaseDirectory) - .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) - .Build(); _dGAMedicionScadaRepository = dGAMedicionScadaRepository; _registrarMedicion = registrarMedicion; - rutUsuario = _configuration["Credenciales:rutEmpresa"] ?? ""; - rutEmpresa = _configuration["Credenciales:rutUsuario"] ?? "" ?? ""; - password = _configuration["Credenciales:password"] ?? ""; } public async Task> ObtenerMedicionesAsync() @@ -39,9 +28,9 @@ namespace BLL { Autenticacion = new Autenticacion { - Password = password, - RutEmpresa = rutEmpresa, - RutUsuario = rutUsuario + Password = string.Empty, + RutEmpresa = string.Empty, + RutUsuario = string.Empty }, MedicionSubterranea = new Medicion { diff --git a/DAS/RegistrarMedicion.cs b/DAS/RegistrarMedicion.cs index b669259..5ed4372 100644 --- a/DAS/RegistrarMedicion.cs +++ b/DAS/RegistrarMedicion.cs @@ -9,15 +9,26 @@ namespace DAS { private readonly HttpClient _httpClient; private readonly IConfiguration _configuration; + private static string? password; + private static string? rutEmpresa; + private static string? rutUsuario; public RegistrarMedicion(HttpClient httpClient, IConfiguration configuration) { _httpClient = httpClient; _configuration = configuration; + rutUsuario = _configuration["Credenciales:rutEmpresa"] ?? ""; + rutEmpresa = _configuration["Credenciales:rutUsuario"] ?? "" ?? ""; + password = _configuration["Credenciales:password"] ?? ""; } public async Task EnviarMedicionAsync(string codigoObra, MedicionSubterraneaRequest request) { + + request.Autenticacion.Password = password; + request.Autenticacion.RutEmpresa = rutEmpresa; + request.Autenticacion.RutUsuario = rutUsuario; + var baseUrl = _configuration["ApiSubterranea:BaseUrl"]; var endpoint = _configuration["ApiSubterranea:Endpoint"]; var url = $"{baseUrl}{endpoint}"; diff --git a/Integracion_DGA.sln b/Integracion_DGA.sln index 5d3ffbc..4eeba9a 100644 --- a/Integracion_DGA.sln +++ b/Integracion_DGA.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DAS", "DAS\DAS.csproj", "{E EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "SHARED\Shared.csproj", "{6F270A26-F9CB-4F15-A2F7-EA72DB31F2CA}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Recuperacion_DGA", "Recuperacion_DGA\Recuperacion_DGA.csproj", "{768016E4-ED7F-4F3D-A174-84C8AB26D9F4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +41,10 @@ Global {6F270A26-F9CB-4F15-A2F7-EA72DB31F2CA}.Debug|Any CPU.Build.0 = Debug|Any CPU {6F270A26-F9CB-4F15-A2F7-EA72DB31F2CA}.Release|Any CPU.ActiveCfg = Release|Any CPU {6F270A26-F9CB-4F15-A2F7-EA72DB31F2CA}.Release|Any CPU.Build.0 = Release|Any CPU + {768016E4-ED7F-4F3D-A174-84C8AB26D9F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {768016E4-ED7F-4F3D-A174-84C8AB26D9F4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {768016E4-ED7F-4F3D-A174-84C8AB26D9F4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {768016E4-ED7F-4F3D-A174-84C8AB26D9F4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Recuperacion_DGA/Program.cs b/Recuperacion_DGA/Program.cs new file mode 100644 index 0000000..3751555 --- /dev/null +++ b/Recuperacion_DGA/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/Recuperacion_DGA/Recuperacion_DGA.csproj b/Recuperacion_DGA/Recuperacion_DGA.csproj new file mode 100644 index 0000000..2150e37 --- /dev/null +++ b/Recuperacion_DGA/Recuperacion_DGA.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + +