Compare commits
No commits in common. "3bcb94a5a18a659bda4cb5c50e5165ecd3ceedf8" and "dcc8d17f56fd329dc4039d7815dbe59797b45f35" have entirely different histories.
3bcb94a5a1
...
dcc8d17f56
5 changed files with 15 additions and 33 deletions
|
@ -7,13 +7,24 @@ namespace BLL
|
||||||
{
|
{
|
||||||
public class EnvioDGA
|
public class EnvioDGA
|
||||||
{
|
{
|
||||||
|
private readonly IConfiguration _configuration;
|
||||||
private readonly MedicionScadaRepository _dGAMedicionScadaRepository;
|
private readonly MedicionScadaRepository _dGAMedicionScadaRepository;
|
||||||
private readonly RegistrarMedicion _registrarMedicion;
|
private readonly RegistrarMedicion _registrarMedicion;
|
||||||
|
private static string? password;
|
||||||
|
private static string? rutEmpresa;
|
||||||
|
private static string? rutUsuario;
|
||||||
|
|
||||||
public EnvioDGA(MedicionScadaRepository dGAMedicionScadaRepository, RegistrarMedicion registrarMedicion)
|
public EnvioDGA(IConfiguration configuration, MedicionScadaRepository dGAMedicionScadaRepository, RegistrarMedicion registrarMedicion)
|
||||||
{
|
{
|
||||||
|
_configuration = configuration ?? new ConfigurationBuilder()
|
||||||
|
.SetBasePath(AppContext.BaseDirectory)
|
||||||
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||||
|
.Build();
|
||||||
_dGAMedicionScadaRepository = dGAMedicionScadaRepository;
|
_dGAMedicionScadaRepository = dGAMedicionScadaRepository;
|
||||||
_registrarMedicion = registrarMedicion;
|
_registrarMedicion = registrarMedicion;
|
||||||
|
rutUsuario = _configuration["Credenciales:rutEmpresa"] ?? "";
|
||||||
|
rutEmpresa = _configuration["Credenciales:rutUsuario"] ?? "" ?? "";
|
||||||
|
password = _configuration["Credenciales:password"] ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<MedicionScada>> ObtenerMedicionesAsync()
|
public async Task<List<MedicionScada>> ObtenerMedicionesAsync()
|
||||||
|
@ -28,9 +39,9 @@ namespace BLL
|
||||||
{
|
{
|
||||||
Autenticacion = new Autenticacion
|
Autenticacion = new Autenticacion
|
||||||
{
|
{
|
||||||
Password = string.Empty,
|
Password = password,
|
||||||
RutEmpresa = string.Empty,
|
RutEmpresa = rutEmpresa,
|
||||||
RutUsuario = string.Empty
|
RutUsuario = rutUsuario
|
||||||
},
|
},
|
||||||
MedicionSubterranea = new Medicion
|
MedicionSubterranea = new Medicion
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,26 +9,15 @@ namespace DAS
|
||||||
{
|
{
|
||||||
private readonly HttpClient _httpClient;
|
private readonly HttpClient _httpClient;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
private static string? password;
|
|
||||||
private static string? rutEmpresa;
|
|
||||||
private static string? rutUsuario;
|
|
||||||
|
|
||||||
public RegistrarMedicion(HttpClient httpClient, IConfiguration configuration)
|
public RegistrarMedicion(HttpClient httpClient, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
rutUsuario = _configuration["Credenciales:rutEmpresa"] ?? "";
|
|
||||||
rutEmpresa = _configuration["Credenciales:rutUsuario"] ?? "" ?? "";
|
|
||||||
password = _configuration["Credenciales:password"] ?? "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> EnviarMedicionAsync(string codigoObra, MedicionSubterraneaRequest request)
|
public async Task<bool> EnviarMedicionAsync(string codigoObra, MedicionSubterraneaRequest request)
|
||||||
{
|
{
|
||||||
|
|
||||||
request.Autenticacion.Password = password;
|
|
||||||
request.Autenticacion.RutEmpresa = rutEmpresa;
|
|
||||||
request.Autenticacion.RutUsuario = rutUsuario;
|
|
||||||
|
|
||||||
var baseUrl = _configuration["ApiSubterranea:BaseUrl"];
|
var baseUrl = _configuration["ApiSubterranea:BaseUrl"];
|
||||||
var endpoint = _configuration["ApiSubterranea:Endpoint"];
|
var endpoint = _configuration["ApiSubterranea:Endpoint"];
|
||||||
var url = $"{baseUrl}{endpoint}";
|
var url = $"{baseUrl}{endpoint}";
|
||||||
|
|
|
@ -13,8 +13,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DAS", "DAS\DAS.csproj", "{E
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "SHARED\Shared.csproj", "{6F270A26-F9CB-4F15-A2F7-EA72DB31F2CA}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "SHARED\Shared.csproj", "{6F270A26-F9CB-4F15-A2F7-EA72DB31F2CA}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Recuperacion_DGA", "Recuperacion_DGA\Recuperacion_DGA.csproj", "{768016E4-ED7F-4F3D-A174-84C8AB26D9F4}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -41,10 +39,6 @@ Global
|
||||||
{6F270A26-F9CB-4F15-A2F7-EA72DB31F2CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{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.ActiveCfg = Release|Any CPU
|
||||||
{6F270A26-F9CB-4F15-A2F7-EA72DB31F2CA}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
// See https://aka.ms/new-console-template for more information
|
|
||||||
Console.WriteLine("Hello, World!");
|
|
|
@ -1,10 +0,0 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
Loading…
Add table
Reference in a new issue