cosas que faltaban

This commit is contained in:
2024-08-03 21:09:08 +01:00
parent aa3a281092
commit c493033009
83 changed files with 2217 additions and 39603 deletions

View File

@@ -7,22 +7,31 @@ namespace Modelo
{
override public bool Add(Factura t)
{
bool ret = false;
if (ExistePorId(t.Id))
{
throw new InvalidOperationException($"La Factura con el ID {t.Id} ya existe.");
}
if (t.Cliente == null || t.Cliente.Cuit == 0)
{
throw new InvalidOperationException("Debe seleccionar un cliente antes de agregar la factura.");
}
try
{
almacen.Add(t);
ret = true;
return true;
}
catch (Exception)
catch (Exception ex)
{
throw;
// Mejor manejo de excepciones, podrías registrar el error
throw new Exception("Error al agregar la factura.", ex);
}
return ret;
}
override public bool Mod(Factura t)
public bool ExistePorId(int id)
{
return almacen.Any(f => f.Id == id);
}
override public bool Mod(Factura t)
{
bool ret = false;