using Dapper; using Microsoft.Data.SqlClient; using Shared.DTO.Envios_DGA; using Shared.DTO.VariablesEntorno; namespace DAL { public class LogEnvioRepository { public async Task 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}"); } } } }