Compare commits
3 commits
dcc8d17f56
...
3bcb94a5a1
Author | SHA1 | Date | |
---|---|---|---|
3bcb94a5a1 | |||
|
45f5ec5f84 | ||
|
ff88af6835 |
5 changed files with 33 additions and 15 deletions
|
@ -7,24 +7,13 @@ 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(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;
|
_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()
|
||||||
|
@ -39,9 +28,9 @@ namespace BLL
|
||||||
{
|
{
|
||||||
Autenticacion = new Autenticacion
|
Autenticacion = new Autenticacion
|
||||||
{
|
{
|
||||||
Password = password,
|
Password = string.Empty,
|
||||||
RutEmpresa = rutEmpresa,
|
RutEmpresa = string.Empty,
|
||||||
RutUsuario = rutUsuario
|
RutUsuario = string.Empty
|
||||||
},
|
},
|
||||||
MedicionSubterranea = new Medicion
|
MedicionSubterranea = new Medicion
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,15 +9,26 @@ 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,6 +13,8 @@ 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
|
||||||
|
@ -39,6 +41,10 @@ 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
|
||||||
|
|
2
Recuperacion_DGA/Program.cs
Normal file
2
Recuperacion_DGA/Program.cs
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
// See https://aka.ms/new-console-template for more information
|
||||||
|
Console.WriteLine("Hello, World!");
|
10
Recuperacion_DGA/Recuperacion_DGA.csproj
Normal file
10
Recuperacion_DGA/Recuperacion_DGA.csproj
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<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