del: Se elimina todo rastro de los vilos ya que no son necesarias.

This commit is contained in:
Leonel Toro 2025-07-03 09:44:11 -04:00
parent 36bd2ff4f3
commit bd44537c93
8 changed files with 2 additions and 266 deletions

View file

@ -1,103 +0,0 @@
using System.Data;
using Dapper;
using Microsoft.Data.SqlClient;
using Shared.DTO.Integracion_DGA;
using Shared.DTO.VariablesEntorno;
namespace DAL
{
public class JobsDgaVilosRepository
{
public async Task<bool> InsertarDgaMacroResultadoVilos(List<DgaMacroResultadoVilos> dgaMacroResultadoVilos)
{
try
{
using (var connection = new SqlConnection(BdConexion.StringConnection))
{
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(BdConexion.StringConnection))
{
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(BdConexion.StringConnection))
{
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(BdConexion.StringConnection))
{
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,22 +0,0 @@
using System.Data;
using Dapper;
using Microsoft.Data.SqlClient;
using Shared.DTO.Envios_DGA;
using Shared.DTO.VariablesEntorno;
namespace DAL
{
public class MedicionScadaVilosRepository
{
public async Task<List<MedicionScada>> ObtenerMedicionesVilosAsync()
{
await using var connection = new SqlConnection(BdConexion.StringConnection);
var result = await connection.QueryAsync<MedicionScada>(
"SP_OBTENER_MEDICION_SMARTSCADA_OPERACION_VILOS",
commandType: CommandType.StoredProcedure);
return result.ToList();
}
}
}