feat: añadidos mostrar faltantantes

This commit is contained in:
2024-03-16 13:05:25 -03:00
parent ebe118536d
commit 3fdab465f1
4 changed files with 20 additions and 14 deletions

View File

@@ -10,24 +10,24 @@ namespace Entidades
public class OrdenDeCompra public class OrdenDeCompra
{ {
public int Id { get; set; } public int Id { get; set; }
private List<DetalleOrdenDeCompra> productos = new List<DetalleOrdenDeCompra>(); private List<DetalleOrdenDeCompra> detalles = new List<DetalleOrdenDeCompra>();
public Proveedor Proveedor { get; set; } public Proveedor Proveedor { get; set; }
public void AñadirDetalle(DetalleOrdenDeCompra detalle) public void AñadirDetalle(DetalleOrdenDeCompra detalle)
{ {
productos.Add(detalle); detalles.Add(detalle);
} }
public bool EliminarDetalle(DetalleOrdenDeCompra detalle) public bool EliminarDetalle(DetalleOrdenDeCompra detalle)
{ {
var aeliminar = productos.Find(x => x.Id == detalle.Id); var aeliminar = detalles.Find(x => x.Id == detalle.Id);
if (aeliminar == null) return false; if (aeliminar == null) return false;
return productos.Remove(aeliminar); return detalles.Remove(aeliminar);
} }
public ReadOnlyCollection<DetalleOrdenDeCompra> MostrarDetalles() public ReadOnlyCollection<DetalleOrdenDeCompra> MostrarDetalles()
{ {
return productos.AsReadOnly(); return detalles.AsReadOnly();
} }
} }
} }

View File

@@ -20,10 +20,15 @@ namespace Entidades
detalles.Add(det); detalles.Add(det);
} }
public bool EliminarCategoria(DetallePresupuesto det) { public bool EliminarDetalle(DetallePresupuesto det) {
var dAEliminar = detalles.FirstOrDefault(x => x.Id == det.Id); var dAEliminar = detalles.FirstOrDefault(x => x.Id == det.Id);
if (dAEliminar == null) return false; if (dAEliminar == null) return false;
return detalles.Remove(dAEliminar); return detalles.Remove(dAEliminar);
} }
public ReadOnlyCollection<DetallePresupuesto> MostrarDetalles()
{
return detalles.AsReadOnly();
}
} }
} }

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -13,7 +14,7 @@ namespace Entidades
public double Precio { get; set; } public double Precio { get; set; }
public bool Habilitado { get; set; } public bool Habilitado { get; set; }
private List<Categoria> categorias = new List<Categoria>(); private List<Categoria> categorias = new List<Categoria>();
public void AñadirCategoria(Categoria cat) { public void AñadirCategoria(Categoria cat) {
categorias.Add(cat); categorias.Add(cat);
} }
@@ -24,5 +25,8 @@ namespace Entidades
return categorias.Remove(cAEliminar); return categorias.Remove(cAEliminar);
} }
public ReadOnlyCollection<Categoria> MostrarCategorias(){
return categorias.AsReadOnly();
}
} }
} }

View File

@@ -11,26 +11,23 @@ namespace Entidades
public class Remito public class Remito
{ {
public int Id { get; set; } public int Id { get; set; }
private List<Lote> LotesDeProductosEntregados { get; set; } private List<Lote> lotesDeProductosEntregados = new List<Lote>();
public Proveedor Proveedor { get; set; } public Proveedor Proveedor { get; set; }
public ReadOnlyCollection<Lote> MostrarLotes() public ReadOnlyCollection<Lote> MostrarLotes()
{ {
return LotesDeProductosEntregados.AsReadOnly(); return lotesDeProductosEntregados.AsReadOnly();
} }
public bool AñadirLote(Lote lote) public void AñadirLote(Lote lote)
{ {
bool ret = false;
try try
{ {
LotesDeProductosEntregados.Add(lote); lotesDeProductosEntregados.Add(lote);
ret= true;
} }
catch (Exception) catch (Exception)
{ {
throw; throw;
} }
return ret;
} }
} }
} }