fix: ahora envia emails

This commit is contained in:
fedpo
2024-10-01 03:01:17 +01:00
parent 76d9b597d6
commit 431da19be6
3 changed files with 12 additions and 7 deletions

View File

@@ -37,14 +37,13 @@ namespace Controladora
bool resultado = repositorioFacturas.Guardar();
t = ObtenerPorId(t);
string resultadolote = ControladoraLotes.Instance.DisminuirStock(t);
// Convierte ReadOnlyCollection a List
var detallesList = new List<DetalleFactura>(t.MostrarDetalles());
var detallesList = t.Detalles;
if (resultado && resultadolote == "Se Descontaron los productos")
{
if (ControladoraInformes.Instance.Informa) {
// Envía el correo electrónico si la factura se cargó correctamente y el stock se decrementó
string emailResult = ControladoraInformes.Instance.EnviarEmail(
"Factura Cargada",
detallesList // Pasa la lista convertida

View File

@@ -19,7 +19,7 @@ namespace Controladora
{
string json = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(configpath, json);
InformeEmail.Instance.Informar = config.Informar;
}
catch (IOException) { throw; }
}
@@ -35,7 +35,8 @@ namespace Controladora
{
get
{
return InformeEmail.Instance.Informar;
string jsonString = File.ReadAllText(configpath);
return JsonSerializer.Deserialize<ConfigEmail>(jsonString).Informar;
}
}
public ConfigEmail RecuperarConfig()