36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using System.Data;
|
|
using Dapper;
|
|
using Microsoft.Data.SqlClient;
|
|
using Shared.DTO.Envios_DGA;
|
|
using Shared.DTO.VariablesEntorno;
|
|
|
|
namespace DAL
|
|
{
|
|
public class MedicionScadaRepository
|
|
{
|
|
public async Task<List<MedicionScada>> ObtenerMedicionesAsync()
|
|
{
|
|
await using var connection = new SqlConnection(BdConexion.StringConnection);
|
|
|
|
var result = await connection.QueryAsync<MedicionScada>(
|
|
"SP_OBTENER_MEDICION_SMARTSCADA_OPERACION",
|
|
commandType: CommandType.StoredProcedure);
|
|
|
|
return result.ToList();
|
|
}
|
|
|
|
public static async Task<bool> ActualizarMedicionesAsync(string medicionesJson)
|
|
{
|
|
try
|
|
{
|
|
await using var connection = new SqlConnection(BdConexion.StringConnection);
|
|
await connection.ExecuteAsync("SP_ACTUALIZAR_MEDICION_SMARTSCADA_OPERACION", new { JsonMediciones = medicionesJson }, commandType: CommandType.StoredProcedure);
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception($"Error: {ex.Message}");
|
|
}
|
|
}
|
|
}
|
|
}
|