más cambios ahora funciona el tema de las facturas pero no el emailer

This commit is contained in:
fedpo
2024-10-01 02:48:17 +01:00
parent 37ff7022cf
commit 76d9b597d6
30 changed files with 156 additions and 6617 deletions

View File

@@ -12,16 +12,10 @@ namespace Controladora
repositorioFacturas = new(new Context());
}
private bool ExistePorId(int id)
{
var fac = repositorioFacturas.ObtenerPorId(id);
return (fac.Id == id);
}
public string Añadir(Factura t)
{
if (t == null) return "La Factura es nula, fallo la carga";
if (ExistePorId(t.Id)) return $"La Factura con el ID {t.Id} ya existe";
if (t.Cliente == null || t.Cliente.Cuit == 0) return "Debe seleccionar un cliente antes de agregar la factura";
string checkstock = "";
@@ -41,7 +35,8 @@ namespace Controladora
{
repositorioFacturas.Add(t);
bool resultado = repositorioFacturas.Guardar();
string resultadolote = ControladoraLotes.Instance.DisminuirStock(t.MostrarDetalles());
t = ObtenerPorId(t);
string resultadolote = ControladoraLotes.Instance.DisminuirStock(t);
// Convierte ReadOnlyCollection a List
var detallesList = new List<DetalleFactura>(t.MostrarDetalles());
@@ -78,6 +73,11 @@ namespace Controladora
.AsReadOnly();
}
public Factura ObtenerPorId(Factura fac)
{
return repositorioFacturas.ObtenerPorId(fac);
}
public ReadOnlyCollection<DetalleFactura> ListarDetallesFactura(Factura factura)
{
Factura facturaalistar = ControladoraFacturas.Instance.Listar().First(x => x.Id == factura.Id);