integración nueva tabla
This commit is contained in:
parent
5db07294f9
commit
657fd50ac9
22 changed files with 203 additions and 447 deletions
34
DAL/LogEnvioRepository.cs
Normal file
34
DAL/LogEnvioRepository.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using Dapper;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Shared.DTO.Envios_DGA;
|
||||
using Shared.DTO.VariablesEntorno;
|
||||
|
||||
namespace DAL
|
||||
{
|
||||
public class LogEnvioRepository
|
||||
{
|
||||
public async Task<bool> InsertarLogEnvioAsync(LogMedicionEnvio logMedicionScada)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var connection = new SqlConnection(BdConexion.StringConnection))
|
||||
{
|
||||
await connection.OpenAsync();
|
||||
// Insertar todos los datos de la lista usando Dapper
|
||||
var sql = @"INSERT INTO dbo.DGA_LOGS_OPERACION
|
||||
(estado_envio, json_enviado, json_recibido, comprobante, fecha_envio, id_medicion_smartscada_operacion)
|
||||
VALUES
|
||||
(@EstadoEnvio, @JsonEnviado, @JsonRecibido, @Comprobante, @FechaEnvio, @IdMedicionSmartscadaOperacion)";
|
||||
await connection.ExecuteAsync(sql, logMedicionScada);
|
||||
|
||||
return true; // Éxito
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception($"Error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue