Feat: Baja Lógica de Distribuidores (Selectores Dropdown)
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 8m32s

This commit is contained in:
2026-03-23 14:09:26 -03:00
parent 9201d7222b
commit 5212e31a03
17 changed files with 289 additions and 53 deletions

View File

@@ -22,13 +22,16 @@ namespace GestionIntegral.Api.Services.Anomalia
public async Task<IEnumerable<AlertaGenericaDto>> ObtenerAlertasNoLeidasAsync()
{
// Apunta a la nueva tabla genérica 'Sistema_Alertas'
var query = "SELECT * FROM Sistema_Alertas WHERE Leida = 0 ORDER BY FechaDeteccion DESC";
//var query = "SELECT * FROM Sistema_Alertas WHERE Leida = 0 ORDER BY FechaDeteccion DESC";
try
{
using (var connection = _dbConnectionFactory.CreateConnection())
{
/*
var alertas = await connection.QueryAsync<AlertaGenericaDto>(query);
return alertas ?? Enumerable.Empty<AlertaGenericaDto>();
return alertas ?? Enumerable.Empty<AlertaGenericaDto>();
*/
return Enumerable.Empty<AlertaGenericaDto>();
}
}
catch (System.Exception ex)
@@ -40,17 +43,20 @@ namespace GestionIntegral.Api.Services.Anomalia
public async Task<(bool Exito, string? Error)> MarcarComoLeidaAsync(int idAlerta)
{
var query = "UPDATE Sistema_Alertas SET Leida = 1 WHERE IdAlerta = @IdAlerta";
//var query = "UPDATE Sistema_Alertas SET Leida = 1 WHERE IdAlerta = @IdAlerta";
try
{
using (var connection = _dbConnectionFactory.CreateConnection())
{
/*
var result = await connection.ExecuteAsync(query, new { IdAlerta = idAlerta });
if (result > 0)
{
return (true, null);
}
return (false, "La alerta no fue encontrada o ya estaba marcada.");
*/
return (true, null); // Retornar éxito silencioso por ahora
}
}
catch (System.Exception ex)
@@ -62,15 +68,18 @@ namespace GestionIntegral.Api.Services.Anomalia
public async Task<(bool Exito, string? Error)> MarcarGrupoComoLeidoAsync(string tipoAlerta, int idEntidad)
{
var query = "UPDATE Sistema_Alertas SET Leida = 1 WHERE TipoAlerta = @TipoAlerta AND IdEntidad = @IdEntidad AND Leida = 0";
//var query = "UPDATE Sistema_Alertas SET Leida = 1 WHERE TipoAlerta = @TipoAlerta AND IdEntidad = @IdEntidad AND Leida = 0";
try
{
using (var connection = _dbConnectionFactory.CreateConnection())
{
/*
var result = await connection.ExecuteAsync(query, new { TipoAlerta = tipoAlerta, IdEntidad = idEntidad });
// No es un error si no se actualizan filas (puede que no hubiera ninguna para ese grupo)
_logger.LogInformation("Marcadas como leídas {Count} alertas para Tipo: {Tipo}, EntidadID: {IdEntidad}", result, tipoAlerta, idEntidad);
return (true, null);
*/
return (true, null);
}
}
catch (System.Exception ex)