Compare commits

..

No commits in common. "6f64273cddd30533c494dae2a1d9c95bb55c93a3" and "45f5ec5f847e2f9274a6f2671ba79fb1d5c5c93b" have entirely different histories.

92 changed files with 19 additions and 2676 deletions

View file

@ -6,10 +6,6 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DAL\DAL.csproj" /> <ProjectReference Include="..\DAL\DAL.csproj" />
<ProjectReference Include="..\DAS\DAS.csproj" /> <ProjectReference Include="..\DAS\DAS.csproj" />

View file

@ -2,9 +2,8 @@
using Shared.DTO; using Shared.DTO;
using DAL; using DAL;
using DAS; using DAS;
using Shared.DTO.Envios_DGA;
namespace BLL.Recuperacion_DGA namespace BLL
{ {
public class EnvioDGA public class EnvioDGA
{ {

View file

@ -1,111 +0,0 @@
using System.Text.Json;
using System.Text;
using Azure.Core;
using System;
using Newtonsoft.Json;
namespace BLL.Integracion_DGA
{
public class ApiService
{
private readonly HttpClient _httpClient;
public ApiService(HttpClient httpClient)
{
_httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
}
public async Task<string> GetApiResponseAsync(string apiUrl, Dictionary<string, string> headers = null)
{
using (var httpClient = new HttpClient())
{
// Configura la URL base
httpClient.BaseAddress = new Uri(apiUrl);
var request = new HttpRequestMessage(HttpMethod.Get, apiUrl);
// Configura los encabezados personalizados si se proporcionan
if (headers != null)
{
foreach (var header in headers)
{
request.Headers.Add(header.Key, header.Value);
}
}
// Realiza la solicitud con la solicitud personalizada
try
{
var response = await httpClient.SendAsync(request);
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync();
}
else
{
// Maneja errores aquí según sea necesario.
Console.WriteLine($"Error en la solicitud: {response.StatusCode}");
throw new HttpRequestException($"Error en la solicitud HTTP. Código de estado: {response.StatusCode}");
}
}catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
throw new Exception($"Error en la solicitud HTTP: {ex.Message}");
// Maneja la excepción según sea necesario
}
}
}
public async Task<string> PostApiResponseAsync(string apiUrl, Dictionary<string, string> headers = null, object data = null)
{
using (var httpClient = new HttpClient())
{
try
{
httpClient.BaseAddress = new Uri(apiUrl);
var request = new HttpRequestMessage(HttpMethod.Post, apiUrl);
// Serializa el objeto data a JSON
//string jsonData = JsonSerializer.Serialize(data);
string jsonData = JsonConvert.SerializeObject(data);
// Crea el contenido de la solicitud HTTP con el cuerpo JSON
HttpContent contenido = new StringContent(jsonData, Encoding.UTF8, "application/json");
request.Content = contenido;
// Configura los encabezados personalizados si se proporcionan
if (headers != null)
{
foreach (var header in headers)
{
request.Headers.Add(header.Key, header.Value);
}
}
// Realiza la solicitud POST
HttpResponseMessage response = await httpClient.SendAsync(request);
// Verifica si la solicitud fue exitosa
if (response.IsSuccessStatusCode)
{
// Lee la respuesta como una cadena
return await response.Content.ReadAsStringAsync();
}
else
{
// La solicitud no fue exitosa, maneja el error según sea necesario
Console.WriteLine($"Error en la solicitud HTTP. Código de estado: {response.StatusCode}");
throw new HttpRequestException($"Error en la solicitud HTTP. Código de estado: {response.StatusCode}");
}
}
catch (Exception ex)
{
// Maneja excepciones si ocurren
Console.WriteLine($"Error en la solicitud HTTP: {ex.Message}");
throw new Exception($"Error en la solicitud HTTP: {ex.Message}");
}
}
}
}
}

View file

@ -1,228 +0,0 @@
using Azure;
using DAL;
using Microsoft.Extensions.Configuration;
using Shared.DTO;
using Shared.DTO.Integracion_DGA;
using Shared.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
namespace BLL.Integracion_DGA
{
public class BusinessLogic
{
private readonly IConfiguration _configuration;
private readonly ApiService _apiService;
private readonly JobsDgaRepository _jobs;
private readonly JobsDgaVilosRepository _jobsVilos;
private readonly JobsDgaSupFlujRepository _jobsSupFluj;
private readonly FileLoggerHelper _fileLoggerHelper;
public BusinessLogic(IConfiguration configuration, ApiService apiService, JobsDgaRepository jobs, JobsDgaVilosRepository jobsVilos, JobsDgaSupFlujRepository jobsSupFluj) {
_configuration = configuration;
_apiService = apiService;
_jobs = jobs;
_jobsVilos = jobsVilos;
_jobsSupFluj = jobsSupFluj;
FileLoggerHelper.ConfigureLogger(_configuration);
}
public async Task Run()
{
DateTimeOffset dateEnd = DateTimeOffset.Now;
DateTimeOffset dateStart = dateEnd.AddHours(-1);
JsonSerializerOptions options = new JsonSerializerOptions() { PropertyNameCaseInsensitive = true };
//FileLoggerHelper.ConfigureLogger(_configuration);
WriteLineAndLog($"Inicia Proceso DGA");
try
{
string apiUrlBase = _configuration["ApiSettings:ApiUrl"];
Dictionary<string, string> headers = new Dictionary<string, string>
{
{ "nexustoken", _configuration["ApiSettings:ApiKey"] },
{ "nexusapiversion", _configuration["ApiSettings:Version"] },
{ "accept", "application/json" }
};
WriteLineAndLog($"Obteniendo Documentos");
string apiUrlDocuments = apiUrlBase + "/api/Documents";
// Utiliza el servicio para realizar la solicitud a la API con URL y encabezados personalizados
string responseData = await _apiService.GetApiResponseAsync(apiUrlDocuments, headers);
var documento = JsonSerializer.Deserialize<List<DocumentResponse>>(responseData, options);
foreach (DocumentResponse item in documento)
{
WriteLineAndLog($"Obteniendo Tagviews");
string apiUrlTagViews = $"{apiUrlBase}/api/Documents/tagviews/{item.uid}";
responseData = await _apiService.GetApiResponseAsync(apiUrlTagViews, headers);
TagviewsResponse tagviews = JsonSerializer.Deserialize<TagviewsResponse>(responseData, options);
List<string> listTagsID = new List<string>();
foreach (Column tag in tagviews.Columns)
{
listTagsID.Add(tag.Uid);
}
HistoricRequest historicRequest = new HistoricRequest();
historicRequest.DataSource = _configuration["ApiSettings:DataSource"];
historicRequest.Resolution = _configuration["ApiSettings:Resolution"];
historicRequest.Uids = listTagsID;
historicRequest.StartTs = dateStart.ToUnixTimeSeconds();
historicRequest.EndTs = dateEnd.ToUnixTimeSeconds();
WriteLineAndLog($"Obteniendo Tagviews Historic");
string apiUrlHistoric = $"{apiUrlBase}/api/Documents/tagviews/{item.uid}/historic";
responseData = await _apiService.PostApiResponseAsync(apiUrlHistoric, headers, historicRequest);
List<HistoricResponse> historicResponse = JsonSerializer.Deserialize<List<HistoricResponse>>(responseData, options);
List<DgaMacroResultado> listDgaMacroResultados = new List<DgaMacroResultado>();
foreach (Column tag in tagviews.Columns)
{
IEnumerable<HistoricResponse> filter = historicResponse.Where(h => h.Uid == tag.Uid);
foreach (HistoricResponse historic in filter)
{
TimeZoneInfo zonaHorariaChile = TimeZoneInfo.FindSystemTimeZoneById("Pacific SA Standard Time");
DateTime now = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(historic.TimeStamp);
DateTime fechaHoraChile = TimeZoneInfo.ConvertTimeFromUtc(now, zonaHorariaChile);
DgaMacroResultado dgaMacroResultado = new DgaMacroResultado();
dgaMacroResultado.TagName = $"SCADA001.{tag.Name}.F_CV";
dgaMacroResultado.Value = historic.Value;
//dgaMacroResultado.TimeStamp = new DateTime(historic.TimeStamp);
dgaMacroResultado.TimeStamp = fechaHoraChile;
listDgaMacroResultados.Add(dgaMacroResultado);
}
}
/**************/
WriteLineAndLog($"Inicia Envio DGA", ConsoleColor.Green);
WriteLineAndLog($"\t Descargar datos historian: Insertar DgaMacroResultado");
var resultMacro = await _jobs.InsertarDgaMacroResultado(listDgaMacroResultados);
WriteLineAndLog($"\t Descargar datos historian: Insertar DgaSensorResultado");
List<DgaSensorResultado> listDgaSensorResultado = listDgaMacroResultados.Select(item => new DgaSensorResultado
{
TagName = item.TagName,
TimeStamp = item.TimeStamp,
Value = item.Value,
Quality = item.Quality
}).ToList();
var resultSensor = await _jobs.InsertarDgaSensorResultado(listDgaSensorResultado);
WriteLineAndLog($"\t Calculo DGA");
var resultCalculo = await _jobs.SpCalculoDga();
WriteLineAndLog($"\t descargar datos suma reversibilidad : Insertar DgaMacroResultadoSupFlujSuma");
List<DgaMacroResultadoSupFlujSuma> listDgaMacroResultadoSupFlujSuma = listDgaMacroResultados.Select(item => new DgaMacroResultadoSupFlujSuma
{
TagName = item.TagName,
TimeStamp = item.TimeStamp,
Value = item.Value,
Quality = item.Quality
}).ToList();
var resultSupFlujSuma = await _jobs.InsertarDgaMacroResultadoSupFlujSuma(listDgaMacroResultadoSupFlujSuma);
WriteLineAndLog($"\t Calculo Suma");
var resultCalculoDgaSup = await _jobs.SpCalculoDgaSupFlujSumaSnreversibilidad();
WriteLineAndLog($"\t Traspaso datos achird");
var result = await _jobs.SpTraspasoDatosAchird();
WriteLineAndLog($"Fin Envio DGA", ConsoleColor.Green);
/**************/
/**************/
WriteLineAndLog($"Inicio Envio DGA Vilos", ConsoleColor.Green);
WriteLineAndLog($"\t Descargar datos historian: Insertar InsertarDgaMacroResultadoVilos");
List<DgaMacroResultadoVilos> listDgaMacroResultadoVilos = listDgaMacroResultados.Select(item => new DgaMacroResultadoVilos
{
TagName = item.TagName,
TimeStamp = item.TimeStamp,
Value = item.Value,
Quality = item.Quality
}).ToList();
var resultVilos = await _jobsVilos.InsertarDgaMacroResultadoVilos(listDgaMacroResultadoVilos);
WriteLineAndLog($"\t Descargar datos historian: Insertar InsertarDgaSensorResultadoVilos");
List<DgaSensorResultadoVilos> listDgaSensorResultadoVilos = listDgaMacroResultados.Select(item => new DgaSensorResultadoVilos
{
TagName = item.TagName,
TimeStamp = item.TimeStamp,
Value = item.Value,
Quality = item.Quality
}).ToList();
var resultSensorVilos = await _jobsVilos.InsertarDgaSensorResultadoVilos(listDgaSensorResultadoVilos);
WriteLineAndLog($"\t Calculo Suma");
var resultCalculoVilos = await _jobsVilos.SpCalculoDgaVilos();
WriteLineAndLog($"\t Traspaso datos achird");
var resultAchirdVilos = await _jobsVilos.SpTraspasoDatosAchirdVilos();
WriteLineAndLog($"Fin Envio DGA Vilos", ConsoleColor.Green);
/**************/
/**************/
WriteLineAndLog($"Inicio Envio DGA Sup Fluj", ConsoleColor.Green);
WriteLineAndLog($"\t Descargar datos historian: Insertar InsertarDgaMacroResultadoSupFluj");
List<DgaMacroResultadoSupFluj> listDgaMacroResultadoSupFluj = listDgaMacroResultados.Select(item => new DgaMacroResultadoSupFluj
{
TagName = item.TagName,
TimeStamp = item.TimeStamp,
Value = item.Value,
Quality = item.Quality
}).ToList();
var resultSensorSup = await _jobsSupFluj.InsertarDgaMacroResultadoSupFluj(listDgaMacroResultadoSupFluj);
WriteLineAndLog($"\t Calculo Suma");
var resultCalculoSup = await _jobsSupFluj.SpCalculoDgaSupFluj();
WriteLineAndLog($"\t Traspaso datos achird");
var resultAchirdSup = await _jobsSupFluj.SpTraspasoDatosAchirdSupFluj();
WriteLineAndLog($"Fin Envio DGA Sup Fluj", ConsoleColor.Green);
/**************/
/**************/
}
WriteLineAndLog($"FIN Proceso DGA");
}
catch (Exception ex)
{
FileLoggerHelper.LogError($"{ex.Message}", ex);
WriteLineAndLog($"{ex.Message}", ConsoleColor.Red);
}
}
static void WriteLineAndLog(string msj, ConsoleColor? color = null)
{
if (color.HasValue && Enum.IsDefined(typeof(ConsoleColor), color.Value))
{
Console.ForegroundColor = (ConsoleColor)color;
Console.WriteLine(msj);
Console.ResetColor();
}
else
{
Console.WriteLine($"{msj}");
}
FileLoggerHelper.LogInformation($"{msj}");
}
}
}

View file

@ -1,58 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace DAL
{
public static class Encriptador
{
private static readonly byte[] key = Encoding.ASCII.GetBytes("1234567891234567");
private static readonly byte[] iv = Encoding.ASCII.GetBytes("Devjoker7.37hAES");
public static string Encripta(string Cadena)
{
using Aes aesAlg = Aes.Create();
aesAlg.Key = key;
aesAlg.IV = iv;
ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
using (MemoryStream msEncrypt = new MemoryStream())
{
using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
{
using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
{
swEncrypt.Write(Cadena);
}
}
return Convert.ToBase64String(msEncrypt.ToArray());
}
}
public static string Desencripta(string Cadena)
{
using Aes aesAlg = Aes.Create();
aesAlg.Key = key;
aesAlg.IV = iv;
ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
using (MemoryStream msDecrypt = new MemoryStream(Convert.FromBase64String(Cadena)))
{
using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
{
using (StreamReader srDecrypt = new StreamReader(csDecrypt))
{
return srDecrypt.ReadToEnd();
}
}
}
}
}
}

View file

@ -1,159 +0,0 @@
using Microsoft.Data.SqlClient;
using Microsoft.Win32;
using Shared.DTO.Integracion_DGA;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dapper;
using Microsoft.Extensions.Configuration;
namespace DAL
{
public class JobsDgaRepository
{
private static string connectionString = string.Empty;
private readonly IConfiguration _configuration;
public JobsDgaRepository(IConfiguration configuration)
{
_configuration = configuration;
connectionString = _configuration.GetConnectionString("DefaultConnection") ?? "";
}
public async Task<bool> InsertarDgaMacroResultado(List<DgaMacroResultado> dgaMacroResultados)
{
try
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
await connection.OpenAsync();
// 1. Truncar la tabla antes de insertar
await connection.ExecuteAsync("TRUNCATE TABLE DGA_MACRO_RESULTADO");
// 2. Insertar la lista de registros
string sql = "INSERT INTO DGA_MACRO_RESULTADO (TagName, TimeStamp, Value, Quality) VALUES (@TagName, @TimeStamp, @Value, @Quality)";
// Esto inserta todos los elementos de la lista en la tabla
await connection.ExecuteAsync(sql, dgaMacroResultados);
return true;
}
}
catch (Exception ex)
{
throw new Exception($"Error: {ex.Message}");
}
}
public async Task<bool> InsertarDgaSensorResultado(List<DgaSensorResultado> dgaSensorResultado)
{
try
{
using (var connection = new SqlConnection(connectionString))
{
await connection.OpenAsync();
// 1. Truncar la tabla DGA_SENSOR_RESULTADO
await connection.ExecuteAsync("TRUNCATE TABLE DGA_SENSOR_RESULTADO");
// 2. Llamar al stored procedure SP_CALCULO_DGA
await connection.ExecuteAsync("SP_CALCULO_DGA", commandType: System.Data.CommandType.StoredProcedure);
// 3. Insertar todos los registros de la lista con Dapper
string sql = "INSERT INTO DGA_SENSOR_RESULTADO (TagName, TimeStamp, Value, Quality) VALUES (@TagName, @TimeStamp, @Value, @Quality)";
await connection.ExecuteAsync(sql, dgaSensorResultado);
return true;
}
}
catch (Exception ex)
{
throw new Exception($"Error: {ex.Message}");
}
}
public async Task<bool> InsertarDgaMacroResultadoSupFlujSuma(List<DgaMacroResultadoSupFlujSuma> dgaMacroResultadoSupFlujSuma)
{
try
{
// Configurar la conexión a la base de datos
using (SqlConnection connection = new SqlConnection(connectionString))
{
await connection.OpenAsync();
// Truncar la tabla antes de insertar
await connection.ExecuteAsync("TRUNCATE TABLE DGA_MACRO_RESULTADO_SUP_FLUJ_SUMA");
// Crear un adaptador de datos
SqlDataAdapter adapter = new SqlDataAdapter();
// Configurar el comando de inserción
string sql = "INSERT INTO DGA_MACRO_RESULTADO_SUP_FLUJ_SUMA (TagName, TimeStamp, Value, Quality) VALUES (@TagName, @TimeStamp, @Value, @Quality)";
await connection.ExecuteAsync(sql, dgaMacroResultadoSupFlujSuma);
return true; // Éxito
}
}catch (Exception ex)
{
throw new Exception($"Error: {ex.Message}");
}
}
public async Task<bool> SpCalculoDga()
{
try
{
using (var connection = new SqlConnection(connectionString))
{
await connection.OpenAsync();
// Ejecuta el stored procedure sin parámetros
await connection.ExecuteAsync("SP_CALCULO_DGA", commandType: CommandType.StoredProcedure);
}
return true; // Éxito
}
catch (Exception ex)
{
throw new Exception($"Error: {ex.Message}");
}
}
public async Task<bool> SpCalculoDgaSupFlujSumaSnreversibilidad()
{
try
{
using (var connection = new SqlConnection(connectionString))
{
await connection.OpenAsync();
await connection.ExecuteAsync(
"SP_CALCULO_DGA_SUP_FLUJ_SUMA_SNREVERSIBILIDAD",
commandType: CommandType.StoredProcedure
);
}
return true; // Éxito
}
catch (Exception ex)
{
throw new Exception($"Error: {ex.Message}");
}
}
public async Task<bool> SpTraspasoDatosAchird()
{
try
{
using (var connection = new SqlConnection(connectionString))
{
await connection.OpenAsync();
await connection.ExecuteAsync(
"SP_TRASPASO_DATOS_ACHIRD",
commandType: CommandType.StoredProcedure
);
}
return true; // Éxito
}
catch (Exception ex)
{
throw new Exception($"Error: {ex.Message}");
}
}
}
}

View file

@ -1,88 +0,0 @@
using Dapper;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using Shared.DTO.Integracion_DGA;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DAL
{
public class JobsDgaSupFlujRepository
{
private static string connectionString = string.Empty;
private readonly IConfiguration _configuration;
public JobsDgaSupFlujRepository(IConfiguration configuration)
{
_configuration = configuration;
connectionString = _configuration.GetConnectionString("DefaultConnection") ?? "";
}
public async Task<bool> InsertarDgaMacroResultadoSupFluj(List<DgaMacroResultadoSupFluj> dgaMacroResultadoSupFluj)
{
try
{
// Configurar la conexión a la base de datos
using (SqlConnection connection = new SqlConnection(connectionString))
{
await connection.OpenAsync();
await connection.ExecuteAsync("TRUNCATE TABLE DGA_MACRO_RESULTADO_SUP_FLUJ");
await SpCalculoDgaSupFluj();
string sql = "INSERT INTO DGA_MACRO_RESULTADO_SUP_FLUJ (TagName, TimeStamp, Value, Quality) VALUES (@TagName, @TimeStamp, @Value, @Quality)";
await connection.ExecuteAsync(sql, dgaMacroResultadoSupFluj);
return true;
}
}
catch (Exception ex)
{
throw new Exception($"Error: {ex.Message}");
}
}
public async Task<bool> SpCalculoDgaSupFluj()
{
try
{
using (var connection = new SqlConnection(connectionString))
{
await connection.OpenAsync();
await connection.ExecuteAsync(
"SP_CALCULO_DGA_SUP_FLUJ",
commandType: CommandType.StoredProcedure
);
}
return true; // Éxito
}
catch (Exception ex)
{
throw new Exception($"Error: {ex.Message}");
}
}
public async Task<bool> SpTraspasoDatosAchirdSupFluj()
{
try
{
using (var connection = new SqlConnection(connectionString))
{
await connection.OpenAsync();
await connection.ExecuteAsync(
"SP_TRASPASO_DATOS_ACHIRD_SUP_FLUJ",
commandType: CommandType.StoredProcedure
);
}
return true; // Éxito
}
catch (Exception ex)
{
throw new Exception($"Error: {ex.Message}");
}
}
}
}

View file

@ -1,116 +0,0 @@
using Dapper;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using Shared.DTO.Integracion_DGA;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DAL
{
public class JobsDgaVilosRepository
{
private IConfiguration _configuration;
private static string connectionString = string.Empty;
public JobsDgaVilosRepository(IConfiguration configuration)
{
_configuration = configuration;
connectionString = _configuration.GetConnectionString("DefaultConnection") ?? "";
}
public async Task<bool> InsertarDgaMacroResultadoVilos(List<DgaMacroResultadoVilos> dgaMacroResultadoVilos)
{
try
{
using (var connection = new SqlConnection(connectionString))
{
await connection.OpenAsync();
// 1. Truncar la tabla antes de insertar
await connection.ExecuteAsync("TRUNCATE TABLE DGA_MACRO_RESULTADO_VILOS");
// 2. Llamar al stored procedure
await connection.ExecuteAsync("SP_CALCULO_DGA_VILOS", commandType: System.Data.CommandType.StoredProcedure);
// 3. Insertar todos los datos de la lista usando Dapper
string sql = "INSERT INTO DGA_MACRO_RESULTADO_VILOS (TagName, TimeStamp, Value, Quality) VALUES (@TagName, @TimeStamp, @Value, @Quality)";
await connection.ExecuteAsync(sql, dgaMacroResultadoVilos);
return true; // Éxito
}
}
catch (Exception ex)
{
throw new Exception($"Error: {ex.Message}");
}
}
public async Task<bool> InsertarDgaSensorResultadoVilos(List<DgaSensorResultadoVilos> dgaSensorResultadoVilos)
{
try
{
using (var connection = new SqlConnection(connectionString))
{
await connection.OpenAsync();
// 1. Truncar la tabla antes de insertar
await connection.ExecuteAsync("TRUNCATE TABLE DGA_SENSOR_RESULTADO_VILOS");
// 2. Insertar todos los datos de la lista usando Dapper
string sql = "INSERT INTO DGA_SENSOR_RESULTADO_VILOS (TagName, TimeStamp, Value, Quality) VALUES (@TagName, @TimeStamp, @Value, @Quality)";
await connection.ExecuteAsync(sql, dgaSensorResultadoVilos);
return true; // Éxito
}
}
catch (Exception ex)
{
throw new Exception($"Error: {ex.Message}");
}
}
public async Task<bool> SpCalculoDgaVilos()
{
try
{
using (var connection = new SqlConnection(connectionString))
{
await connection.OpenAsync();
await connection.ExecuteAsync(
"SP_CALCULO_DGA_VILOS",
commandType: CommandType.StoredProcedure
);
}
return true; // Éxito
}
catch (Exception ex)
{
throw new Exception($"Error: {ex.Message}");
}
}
public async Task<bool> SpTraspasoDatosAchirdVilos()
{
try
{
using (var connection = new SqlConnection(connectionString))
{
await connection.OpenAsync();
await connection.ExecuteAsync(
"SP_TRASPASO_DATOS_ACHIRD_VILOS",
commandType: CommandType.StoredProcedure
);
}
return true; // Éxito
}
catch (Exception ex)
{
throw new Exception($"Error: {ex.Message}");
}
}
}
}

View file

@ -1,7 +1,7 @@
using Dapper; using Dapper;
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Shared.DTO.Envios_DGA; using Shared.DTO;
using System.Data; using System.Data;
namespace DAL namespace DAL

View file

@ -1,5 +1,5 @@
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Shared.DTO.Envios_DGA; using Shared.DTO;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;

View file

@ -1,10 +1,9 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using BLL;
using DAL; using DAL;
using DAS; using DAS;
using BLL.Recuperacion_DGA;
using BLL.Integracion_DGA;
namespace Integracion_DGA namespace Integracion_DGA
{ {
@ -21,18 +20,10 @@ namespace Integracion_DGA
services.AddScoped<MedicionScadaRepository>(); services.AddScoped<MedicionScadaRepository>();
services.AddScoped<EnvioDGA>(); services.AddScoped<EnvioDGA>();
services.AddHttpClient<RegistrarMedicion>(); services.AddHttpClient<RegistrarMedicion>();
//Estos dos servicios son los que migre del otro proyecto
services.AddScoped<JobsDgaRepository>();
services.AddScoped<JobsDgaVilosRepository>();
services.AddScoped<JobsDgaSupFlujRepository>();
services.AddScoped<ApiService>();
services.AddScoped<BusinessLogic>();
}) })
.Build(); .Build();
var envioDGA = host.Services.GetRequiredService<EnvioDGA>(); var envioDGA = host.Services.GetRequiredService<EnvioDGA>();
var BussinessLogic = host.Services.GetRequiredService<BusinessLogic>();
var ApiService = host.Services.GetRequiredService<ApiService>();
var mediciones = await envioDGA.ObtenerMedicionesAsync(); var mediciones = await envioDGA.ObtenerMedicionesAsync();
Console.WriteLine($"Se obtuvieron {mediciones.Count} registros."); Console.WriteLine($"Se obtuvieron {mediciones.Count} registros.");

View file

@ -1,19 +1,14 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"DefaultConnection": "Server=10.224.7.53,1433;Initial Catalog=ENVIO_DGA;Persist Security Info=False;User ID=enviodga;Password=esval++2022;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=true;Connection Timeout=30;" "DefaultConnection": "Server=10.224.7.53,1433;Initial Catalog=ENVIO_DGA;Persist Security Info=False;User ID=enviodga;Password=esval++2022;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=true;Connection Timeout=30;"
}, },
"ApiSubterranea": { "ApiSubterranea": {
"BaseUrl": "https://apimee.mop.gob.cl", "BaseUrl": "https://apimee.mop.gob.cl",
"Endpoint": "/api/v1/mediciones/subterraneas" "Endpoint": "/api/v1/mediciones/subterraneas"
}, },
"Credenciales": { "Credenciales": {
"rutEmpresa": "9A4PUqd1t4", "rutEmpresa": "9A4PUqd1t4",
"rutUsuario": "77555666-7", "rutUsuario": "77555666-7",
"password": "20999888-7" "password": "20999888-7"
}, }
"Logging": { }
"LogFile": {
"Path": "logs/log.txt"
}
}
}

View file

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shared.DTO
{
public class DocumentResponse
{
public string owner { get; set; }
public string type { get; set; }
public string uid { get; set; }
public string name { get; set; }
}
}

View file

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shared.DTO
{
public class HistoricRequest
{
public string DataSource { get; set; }
public string Resolution { get; set; }
public List<string> Uids { get; set; }
public long StartTs { get; set; }
public long EndTs { get; set; }
}
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shared.DTO
{
public class HistoricResponse
{
public string Uid { get; set; }
public double? Value { get; set; }
public long TimeStamp { get; set; }
}
}

View file

@ -1,47 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class BitacoraPiloto
{
public string IdProceso { get; set; } = null!;
public DateTime? FechaInicial { get; set; }
public DateTime? FechaFinal { get; set; }
public string? AnoMes { get; set; }
public int? Ano { get; set; }
public int? Mes { get; set; }
public int? Sector { get; set; }
public string? Frecuencia { get; set; }
public string? Procesado { get; set; }
public DateTime? FechaMedicion { get; set; }
public string? Estructura { get; set; }
public string? Variante { get; set; }
public string? Campo { get; set; }
public float? ValorOra { get; set; }
public float? ValorSql { get; set; }
public string? Naturaleza { get; set; }
public string? CampoCondicion1 { get; set; }
public string? CampoCondicion2 { get; set; }
public int Cor { get; set; }
public int? Diferencia { get; set; }
}

View file

@ -1,9 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabApoyoProceso
{
public string IdSensor { get; set; } = null!;
}

View file

@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabBaseMonitoreoConsumo
{
public string? EmpresaPiloto { get; set; }
public double? IdCliente { get; set; }
public string? IdDma { get; set; }
public string? FechaLectura { get; set; }
public double? ConsumoAcumulado { get; set; }
public string? CodigoLectura { get; set; }
public DateTime? FechaFacturacion { get; set; }
}

View file

@ -1,11 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabClientesDma
{
public int? IdCliente { get; set; }
public string? IdDma { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabIncrementoValoresSenale
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabIncrementoValoresSenalesBaseform
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabIncrementoValoresSenalesNe
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabIncrementoValoresSenalesWt
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabIncrementoValoresSenalesWtPrueba
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabMaxFecha
{
public string IdSensor { get; set; } = null!;
public string? FrecuenciaRegistro { get; set; }
public DateTime? MaxFecha { get; set; }
}

View file

@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabMonitoreoConsumo
{
public string? EmpresaPiloto { get; set; }
public double? IdCliente { get; set; }
public string? IdDma { get; set; }
public string? FechaLectura { get; set; }
public double? ConsumoAcumulado { get; set; }
public string? CodigoLectura { get; set; }
public DateTime? FechaFacturacion { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabResultadoCargaHistorico
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabResultadoCargaHistoricoPwbi
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSalidaValoresSenale
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSalidaValoresSenalesBaseform
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSalidaValoresSenalesNe
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSalidaValoresSenalesWt
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSenalesSensoresBorrada
{
public string TagName { get; set; } = null!;
public DateTime? FechaDesde { get; set; }
public string? FechaHasta { get; set; }
}

View file

@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSensore
{
public string? EmpresaPiloto { get; set; }
public string IdSensor { get; set; } = null!;
public string? Descripcion { get; set; }
public string? Tipo { get; set; }
public string? Unidad { get; set; }
public string? FrecuenciaRegistro { get; set; }
public string? IdMedicion { get; set; }
public string? OrigenSenal { get; set; }
public int? CodMedicion { get; set; }
public byte? FrecuenciaEnvio { get; set; }
public int? CantidadData { get; set; }
}

View file

@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSensoresAgregar
{
public string? EmpresaPiloto { get; set; }
public string IdSensor { get; set; } = null!;
public string? Descripcion { get; set; }
public string? Tipo { get; set; }
public string? Unidad { get; set; }
public string? FrecuenciaRegistro { get; set; }
public string? IdMedicion { get; set; }
public string? OrigenSenal { get; set; }
public int? CodMedicion { get; set; }
public byte? FrecuenciaEnvio { get; set; }
public int? CantidadData { get; set; }
}

View file

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSensoresBaseform
{
public int Id { get; set; }
public string? EmpresaPiloto { get; set; }
public string IdSensor { get; set; } = null!;
public string? Descripcion { get; set; }
public string? Tipo { get; set; }
public string? Unidad { get; set; }
public string? FrecuenciaRegistro { get; set; }
public string? IdMedicion { get; set; }
public string? OrigenSenal { get; set; }
public int? CodMedicion { get; set; }
public byte? FrecuenciaEnvio { get; set; }
public int? CantidadData { get; set; }
public short EstadoSensor { get; set; }
}

View file

@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSensoresEliminado
{
public DateTime? FechaEliminacion { get; set; }
public string? EmpresaPiloto { get; set; }
public string IdSensor { get; set; } = null!;
public string? Descripcion { get; set; }
public string? Tipo { get; set; }
public string? Unidad { get; set; }
public string? FrecuenciaRegistro { get; set; }
public string? IdMedicion { get; set; }
public string? OrigenSenal { get; set; }
public int? CodMedicion { get; set; }
public byte? FrecuenciaEnvio { get; set; }
public int? CantidadData { get; set; }
}

View file

@ -1,9 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSensoresEliminar
{
public string? IdSensor { get; set; }
}

View file

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSensoresHistorico
{
public int Id { get; set; }
public string? EmpresaPiloto { get; set; }
public string IdSensor { get; set; } = null!;
public string? Descripcion { get; set; }
public string? Tipo { get; set; }
public string? Unidad { get; set; }
public string? FrecuenciaRegistro { get; set; }
public string? IdMedicion { get; set; }
public string? OrigenSenal { get; set; }
public int? CodMedicion { get; set; }
public byte? FrecuenciaEnvio { get; set; }
public int? CantidadData { get; set; }
public short EstadoSensor { get; set; }
}

View file

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSensoresNe
{
public int Id { get; set; }
public string? EmpresaPiloto { get; set; }
public string IdSensor { get; set; } = null!;
public string? Descripcion { get; set; }
public string? Tipo { get; set; }
public string? Unidad { get; set; }
public string? FrecuenciaRegistro { get; set; }
public string? IdMedicion { get; set; }
public string? OrigenSenal { get; set; }
public int? CodMedicion { get; set; }
public byte? FrecuenciaEnvio { get; set; }
public int? CantidadData { get; set; }
public short EstadoSensor { get; set; }
}

View file

@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSensoresRevisar
{
public string? EmpresaPiloto { get; set; }
public string IdSensor { get; set; } = null!;
public string? Descripcion { get; set; }
public string? Tipo { get; set; }
public string? Unidad { get; set; }
public string? FrecuenciaRegistro { get; set; }
public string? IdMedicion { get; set; }
public string? OrigenSenal { get; set; }
public int? CodMedicion { get; set; }
public byte? FrecuenciaEnvio { get; set; }
public int? CantidadData { get; set; }
}

View file

@ -1,35 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSensoresValidar
{
public int Id { get; set; }
public string? EmpresaPiloto { get; set; }
public string IdSensor { get; set; } = null!;
public string? Descripcion { get; set; }
public string? Tipo { get; set; }
public string? Unidad { get; set; }
public string? FrecuenciaRegistro { get; set; }
public string? IdMedicion { get; set; }
public string? OrigenSenal { get; set; }
public int? CodMedicion { get; set; }
public byte? FrecuenciaEnvio { get; set; }
public int? CantidadData { get; set; }
public short EstadoSensor { get; set; }
public int CodEmpresa { get; set; }
}

View file

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSensoresWt
{
public int Id { get; set; }
public string? EmpresaPiloto { get; set; }
public string IdSensor { get; set; } = null!;
public string? Descripcion { get; set; }
public string? Tipo { get; set; }
public string? Unidad { get; set; }
public string? FrecuenciaRegistro { get; set; }
public string? IdMedicion { get; set; }
public string? OrigenSenal { get; set; }
public int? CodMedicion { get; set; }
public byte? FrecuenciaEnvio { get; set; }
public int? CantidadData { get; set; }
public short EstadoSensor { get; set; }
}

View file

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabSensoresWtPrueba
{
public int Id { get; set; }
public string? EmpresaPiloto { get; set; }
public string IdSensor { get; set; } = null!;
public string? Descripcion { get; set; }
public string? Tipo { get; set; }
public string? Unidad { get; set; }
public string? FrecuenciaRegistro { get; set; }
public string? IdMedicion { get; set; }
public string? OrigenSenal { get; set; }
public int? CodMedicion { get; set; }
public byte? FrecuenciaEnvio { get; set; }
public int? CantidadData { get; set; }
public short EstadoSensor { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabUltimoEnvio
{
public string? EmpresaPiloto { get; set; }
public string IdSensor { get; set; } = null!;
public string? OrigenSenal { get; set; }
public string? MaxFecha { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabValoresSenale
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabValoresSenalesAgregar
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabValoresSenalesBaseform
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabValoresSenalesHistorico
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabValoresSenalesNe
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class CabValoresSenalesWt
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public string? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,43 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaBorrado
{
public int Id { get; set; }
public string? Zonal { get; set; }
public string? Comuna { get; set; }
public string? NombreCaptacion { get; set; }
public string? Fuente { get; set; }
public string? CodigoNbi { get; set; }
public string? CodigoDga { get; set; }
public string? InfraEstandarDga { get; set; }
public string? Macro { get; set; }
public string? Sensor { get; set; }
public decimal? UbicacionSensor { get; set; }
public string? MacroTag { get; set; }
public string? SensorTag { get; set; }
public int? TipoObra { get; set; }
public int? IdSensor { get; set; }
public long? Totalizador { get; set; }
public string? MarcaUbicacion { get; set; }
public DateTime? FechaBorrado { get; set; }
}

View file

@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaMacro
{
public int Id { get; set; }
public string? Zonal { get; set; }
public string? Comuna { get; set; }
public string? NombreCaptacion { get; set; }
public string? Fuente { get; set; }
public string? CodigoNbi { get; set; }
public string? CodigoDga { get; set; }
public string? InfraEstandarDga { get; set; }
public string? Macro { get; set; }
public string? Sensor { get; set; }
public decimal? UbicacionSensor { get; set; }
public string? MacroTag { get; set; }
public string? SensorTag { get; set; }
public int? TipoObra { get; set; }
public int? IdSensor { get; set; }
public long? Totalizador { get; set; }
public string? MarcaUbicacion { get; set; }
}

View file

@ -1,45 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaMacroA
{
public int Id { get; set; }
public string? Zonal { get; set; }
public int? IdLocalidad { get; set; }
public string Localidad { get; set; } = null!;
public string? Comuna { get; set; }
public string? NombreCaptacion { get; set; }
public string? Fuente { get; set; }
public string? CodigoNbi { get; set; }
public string? CodigoDga { get; set; }
public string? InfraEstandarDga { get; set; }
public string? Macro { get; set; }
public string? Sensor { get; set; }
public decimal? UbicacionSensor { get; set; }
public string? MacroTag { get; set; }
public string? SensorTag { get; set; }
public int? TipoObra { get; set; }
public int? IdSensor { get; set; }
public long? Totalizador { get; set; }
public string? MarcaUbicacion { get; set; }
}

View file

@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaMacroQa
{
public int Id { get; set; }
public string? Zonal { get; set; }
public string? Comuna { get; set; }
public string? NombreCaptacion { get; set; }
public string? Fuente { get; set; }
public string? CodigoNbi { get; set; }
public string? CodigoDga { get; set; }
public string? InfraEstandarDga { get; set; }
public string? Macro { get; set; }
public string? Sensor { get; set; }
public decimal? UbicacionSensor { get; set; }
public string? MacroTag { get; set; }
public string? SensorTag { get; set; }
public int? TipoObra { get; set; }
public int? IdSensor { get; set; }
public long? Totalizador { get; set; }
public string? MarcaUbicacion { get; set; }
}

View file

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaMacroResultado
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public double? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaMacroResultadoQa
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public double? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaMacroResultadoSup
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public double? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaMacroResultadoSupFluj
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public double? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaMacroResultadoSupFlujSuma
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public double? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaMacroResultadoVilos
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public double? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaMacroSup
{
public int Id { get; set; }
public string? Zonal { get; set; }
public string? Comuna { get; set; }
public string? NombreCaptacion { get; set; }
public string? Fuente { get; set; }
public string? CodigoNbi { get; set; }
public string? CodigoDga { get; set; }
public string? InfraEstandarDga { get; set; }
public string? Macro { get; set; }
public string? Sensor { get; set; }
public decimal? UbicacionSensor { get; set; }
public string? MacroTag { get; set; }
public string? SensorTag { get; set; }
public int? TipoObra { get; set; }
public int? IdSensor { get; set; }
public long? Totalizador { get; set; }
public string? MarcaUbicacion { get; set; }
}

View file

@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaMacroSupFluj
{
public int Id { get; set; }
public string? Zonal { get; set; }
public string? Comuna { get; set; }
public string? NombreCaptacion { get; set; }
public string? Fuente { get; set; }
public string? CodigoNbi { get; set; }
public string? CodigoDga { get; set; }
public string? InfraEstandarDga { get; set; }
public string? Macro { get; set; }
public string? Sensor { get; set; }
public decimal? UbicacionSensor { get; set; }
public string? MacroTag { get; set; }
public string? SensorTag { get; set; }
public int? TipoObra { get; set; }
public int? IdSensor { get; set; }
public decimal? Totalizador { get; set; }
}

View file

@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaMacroSupFlujSuma
{
public int Id { get; set; }
public string? Zonal { get; set; }
public string? Comuna { get; set; }
public string? NombreCaptacion { get; set; }
public string? Fuente { get; set; }
public string? CodigoNbi { get; set; }
public string? CodigoDga { get; set; }
public string? InfraEstandarDga { get; set; }
public string? Macro { get; set; }
public string? Sensor { get; set; }
public decimal? UbicacionSensor { get; set; }
public string? MacroTag { get; set; }
public string? SensorTag { get; set; }
public int? TipoObra { get; set; }
public int? IdSensor { get; set; }
public decimal? Totalizador { get; set; }
}

View file

@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaMacroSuperficial
{
public int Id { get; set; }
public string? Zonal { get; set; }
public string? Comuna { get; set; }
public string? NombreCaptacion { get; set; }
public string? Fuente { get; set; }
public string? CodigoNbi { get; set; }
public string? CodigoDga { get; set; }
public string? InfraEstandarDga { get; set; }
public string? Macro { get; set; }
public string? Sensor { get; set; }
public decimal? UbicacionSensor { get; set; }
public string? MacroTag { get; set; }
public string? SensorTag { get; set; }
public int? TipoObra { get; set; }
public int? IdSensor { get; set; }
public long? Totalizador { get; set; }
public string? MarcaUbicacion { get; set; }
}

View file

@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaMacroVilo
{
public int Id { get; set; }
public string? Zonal { get; set; }
public string? Comuna { get; set; }
public string? NombreCaptacion { get; set; }
public string? Fuente { get; set; }
public string? CodigoNbi { get; set; }
public string? CodigoDga { get; set; }
public string? InfraEstandarDga { get; set; }
public string? Macro { get; set; }
public string? Sensor { get; set; }
public decimal? UbicacionSensor { get; set; }
public string? MacroTag { get; set; }
public string? SensorTag { get; set; }
public int? TipoObra { get; set; }
public int? IdSensor { get; set; }
public long? Totalizador { get; set; }
public string? MarcaUbicacion { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaSensorResultado
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public double? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaSensorResultadoQa
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public double? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DgaSensorResultadoVilos
{
public string TagName { get; set; } = null!;
public DateTime TimeStamp { get; set; }
public double? Value { get; set; }
public string? Quality { get; set; }
}

View file

@ -1,61 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class DiccionarioCalidad
{
public string? Empresa { get; set; }
public string? SubgerenciaZonal { get; set; }
public string? ZonaRedes { get; set; }
public string? Localidad { get; set; }
public string? Codigo1 { get; set; }
public string? Descripcion1 { get; set; }
public string? Relacion { get; set; }
public string? Codigo2 { get; set; }
public string? CodigoIdunicoSensor { get; set; }
public string? Descripcion2 { get; set; }
public string? TipoVariable { get; set; }
public string? TipoSensor { get; set; }
public string? UnidadesIhistorian { get; set; }
public string? UnidadesTaKaDu { get; set; }
public string? FuentePresion { get; set; }
public double? FrecuenciaTransmision { get; set; }
public string? FuenteDatos { get; set; }
public string? Manufactura { get; set; }
public string? Modelo { get; set; }
public string? TipoActivo { get; set; }
public string? ActivoAsociado { get; set; }
public double? CodigoIdgis { get; set; }
public double? Latitud { get; set; }
public double? Longitud { get; set; }
public string? Plcscada { get; set; }
public string? PantallaScada { get; set; }
public string? EstadoSensor { get; set; }
}

View file

@ -1,177 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class EstructuraRedEsvalScadaNbi
{
public string? Empresa { get; set; }
public string? SubgerenciaZonal { get; set; }
public string? ZonaRedes { get; set; }
public string? Localidad { get; set; }
public string? Código2 { get; set; }
public string? Descripción2 { get; set; }
public string? Relación { get; set; }
public string? Código { get; set; }
public string? CódigoIdÚnicoSensor { get; set; }
public string? Descripción { get; set; }
public string? TipoDeVariable { get; set; }
public string? TipoDeSensor { get; set; }
public string? UnidadesIhistorian { get; set; }
public string? UnidadesEnTaKaDu { get; set; }
public string? FuenteDePresión { get; set; }
public string? FrecuenciaDeTransmisión { get; set; }
public string? FuenteDeDatos { get; set; }
public string? Manufactura { get; set; }
public string? Modelo { get; set; }
public string? TipoDeActivo { get; set; }
public string? ActivoAsociado { get; set; }
public string? CódigoIdGis { get; set; }
public string? Latitud { get; set; }
public string? Longitud { get; set; }
public string? PlcScada { get; set; }
public string? PantallaScada { get; set; }
public string? Empresa2 { get; set; }
public string? Column27 { get; set; }
public string? Column28 { get; set; }
public string? Column29 { get; set; }
public string? Column30 { get; set; }
public string? Column31 { get; set; }
public string? Column32 { get; set; }
public string? Column33 { get; set; }
public string? Column34 { get; set; }
public string? Column35 { get; set; }
public string? Column36 { get; set; }
public string? Column37 { get; set; }
public string? Column38 { get; set; }
public string? Column39 { get; set; }
public string? Column40 { get; set; }
public string? Column41 { get; set; }
public string? Column42 { get; set; }
public string? Column43 { get; set; }
public string? Column44 { get; set; }
public string? Column45 { get; set; }
public string? Column46 { get; set; }
public string? Column47 { get; set; }
public string? Column48 { get; set; }
public string? Column49 { get; set; }
public string? Column50 { get; set; }
public string? Column51 { get; set; }
public string? Column52 { get; set; }
public string? Column53 { get; set; }
public string? Column54 { get; set; }
public string? Column55 { get; set; }
public string? Column56 { get; set; }
public string? Column57 { get; set; }
public string? Column58 { get; set; }
public string? Column59 { get; set; }
public string? Column60 { get; set; }
public string? Column61 { get; set; }
public string? Column62 { get; set; }
public string? Column63 { get; set; }
public string? Column64 { get; set; }
public string? Column65 { get; set; }
public string? Column66 { get; set; }
public string? Column67 { get; set; }
public string? Column68 { get; set; }
public string? Column69 { get; set; }
public string? Column70 { get; set; }
public string? Column71 { get; set; }
public string? Column72 { get; set; }
public string? Column73 { get; set; }
public string? Column74 { get; set; }
public string? Column75 { get; set; }
public string? Column76 { get; set; }
public string? Column77 { get; set; }
public string? Column78 { get; set; }
public string? Column79 { get; set; }
public string? Column80 { get; set; }
public string? Column81 { get; set; }
public string? Column82 { get; set; }
public string? Column83 { get; set; }
public string? Column84 { get; set; }
}

View file

@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class IoAsParamMaxcap
{
public string? IdScada { get; set; }
public string? FiltroWhereN0 { get; set; }
public string? FiltroWhereFrec { get; set; }
public int? MaxBomb { get; set; }
public string? Localidad { get; set; }
public string? Sgz { get; set; }
public string? NombrePlanta { get; set; }
}

View file

@ -1,25 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class MedicionDga
{
public string? Code { get; set; }
public DateTime? DateOrigen { get; set; }
public DateTime? DateMedicionSup { get; set; }
public decimal? Caudal { get; set; }
public decimal? Altura { get; set; }
public DateTime? DateMedicionSub { get; set; }
public decimal? Totalizador { get; set; }
public decimal? Caudalsub { get; set; }
public decimal? Nivel { get; set; }
}

View file

@ -1,25 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class MedicionDgaQa
{
public string? Code { get; set; }
public DateTime? DateOrigen { get; set; }
public DateTime? DateMedicionSup { get; set; }
public decimal? Caudal { get; set; }
public decimal? Altura { get; set; }
public DateTime? DateMedicionSub { get; set; }
public decimal? Totalizador { get; set; }
public decimal? Caudalsub { get; set; }
public decimal? Nivel { get; set; }
}

View file

@ -1,25 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class MedicionDgaSupFluj
{
public string? Code { get; set; }
public DateTime? DateOrigen { get; set; }
public DateTime? DateMedicionSup { get; set; }
public decimal? Caudal { get; set; }
public decimal? Altura { get; set; }
public DateTime? DateMedicionSub { get; set; }
public decimal? Totalizador { get; set; }
public decimal? Caudalsub { get; set; }
public decimal? Nivel { get; set; }
}

View file

@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class MedicionDgaSupFlujSuma
{
public string? Code { get; set; }
public DateTime? DateOrigen { get; set; }
public DateTime? DateMedicionSup { get; set; }
public decimal? Caudal { get; set; }
public decimal? Altura { get; set; }
public DateTime? DateMedicionSub { get; set; }
public decimal? Totalizador { get; set; }
public decimal? Caudalsub { get; set; }
public decimal? Nivel { get; set; }
public decimal? Suma1 { get; set; }
public decimal? Suma2 { get; set; }
public decimal? Total { get; set; }
}

View file

@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class MedicionDgaSupFlujSumaQa
{
public string? Code { get; set; }
public DateTime? DateOrigen { get; set; }
public DateTime? DateMedicionSup { get; set; }
public decimal? Caudal { get; set; }
public decimal? Altura { get; set; }
public DateTime? DateMedicionSub { get; set; }
public decimal? Totalizador { get; set; }
public decimal? Caudalsub { get; set; }
public decimal? Nivel { get; set; }
public decimal? Suma1 { get; set; }
public decimal? Suma2 { get; set; }
public decimal? Total { get; set; }
}

View file

@ -1,25 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class MedicionDgaVilos
{
public string? Code { get; set; }
public DateTime? DateOrigen { get; set; }
public DateTime? DateMedicionSup { get; set; }
public decimal? Caudal { get; set; }
public decimal? Altura { get; set; }
public DateTime? DateMedicionSub { get; set; }
public decimal? Totalizador { get; set; }
public decimal? Caudalsub { get; set; }
public decimal? Nivel { get; set; }
}

View file

@ -1,11 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class ResponseDga
{
public string? Code { get; set; }
public DateTime? Date { get; set; }
}

View file

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class SenalesNueva
{
public string TagName { get; set; } = null!;
public string Data { get; set; } = null!;
public string? Hora { get; set; }
public string? Valor { get; set; }
}

View file

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class SenalesNuevasBunt
{
public string TagName { get; set; } = null!;
public string Data { get; set; } = null!;
public string? Hora { get; set; }
public string? Valor { get; set; }
public DateTime? Fecha { get; set; }
}

View file

@ -1,9 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class Sensore
{
public string IdSensor { get; set; } = null!;
}

View file

@ -1,9 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class SensoresBunt
{
public string IdSensor { get; set; } = null!;
}

View file

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class SensoresConsolidado
{
public string EmpresaPiloto { get; set; } = null!;
public string IdSensor { get; set; } = null!;
public string? OrigenSenal { get; set; }
}

View file

@ -1,9 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class Sensoresold
{
public string IdSensor { get; set; } = null!;
}

View file

@ -1,9 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class VwSensoresAgregarExistente
{
public string IdSensor { get; set; } = null!;
}

View file

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
namespace Shared.DTO.Integracion_DGA;
public partial class VwSensoresAgregarExistentesRango
{
public string TagName { get; set; } = null!;
public DateTime? MaxFecRegistro { get; set; }
public DateTime? MinFecRegistro { get; set; }
}

View file

@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Shared.DTO.Envios_DGA namespace Shared.DTO
{ {
public class MedicionScada public class MedicionScada
{ {

View file

@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Shared.DTO.Envios_DGA namespace Shared.DTO
{ {
public class MedicionSubterraneaRequest public class MedicionSubterraneaRequest
{ {

View file

@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shared.DTO
{
public class TagviewsResponse
{
public List<Column> Columns { get; set; }
}
public class Column
{
public string Statistic { get; set; }
public Details Details { get; set; }
public string Name { get; set; }
public string Uid { get; set; }
}
public class Details
{
public string Type { get; set; }
public string Installation { get; set; }
public string Name { get; set; }
public string Uid { get; set; }
}
}

View file

@ -1,29 +0,0 @@
using Microsoft.Extensions.Configuration;
using Serilog;
namespace Shared.Helper
{
public class FileLoggerHelper
{
public static void ConfigureLogger(IConfiguration configuration)
{
var logFilePath = configuration.GetSection("Logging:LogFile:Path").Value;
var logFileFullPath = Path.Combine(Directory.GetCurrentDirectory(), logFilePath);
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.WriteTo.File(logFileFullPath, rollingInterval: RollingInterval.Day)
.CreateLogger();
}
public static void LogInformation(string message)
{
Log.Information($"{message}");
}
public static void LogError(string message, Exception ex)
{
Log.Error(ex, message);
}
}
}

View file

@ -6,10 +6,4 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.6" />
<PackageReference Include="Serilog.Settings.Configuration" Version="9.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
</ItemGroup>
</Project> </Project>