public static bool GetList(Expression <Func <Factura, bool> > criterio, bool relaciones) { using (var db = new Repositorio <Factura>()) { if ((facturaReturnedList = db.GetList(criterio)) != null) { if (relaciones) { foreach (var factura in facturaReturnedList) { ClientesBLL.Buscar(x => x.ClienteId == factura.ClienteId, false); FormasDePagosBLL.Buscar(x => x.FormaDePagoId == factura.FormaDePagoId); factura.FormaDePago = FormasDePagosBLL.formaDePagoReturned; factura.Cliente = ClientesBLL.clienteReturned; factura.Productos.Count(); facturaReturned.Pagos.Count(); foreach (var producto in factura.Productos) { int id = producto.ProductoId; ProductosBLL.Buscar(x => x.ProductoId == id, true); producto.Producto = ProductosBLL.productoReturned; } } } return(true); } return(false); } }
public static bool Buscar(Expression <Func <ProductoFactura, bool> > criterio, bool relaciones) { using (var db = new Repositorio <ProductoFactura>()) { if ((productoFacturaReturned = db.Buscar(criterio)) != null) { FacturasBLL.Buscar(x => x.FacturaId == productoFacturaReturned.FacturaId, true); productoFacturaReturned.Factura = FacturasBLL.facturaReturned; ProductosBLL.Buscar(x => x.ProductoId == productoFacturaReturned.ProductoId, true); productoFacturaReturned.Producto = ProductosFacturasBLL.productoFacturaReturned.Producto; return(true); } return(false); } }
public static bool GetList(Expression <Func <ProductoFactura, bool> > criterio, bool relaciones) { using (var db = new Repositorio <ProductoFactura>()) { if ((productoFacturaReturnedList = db.GetList(criterio)) != null) { if (relaciones) { foreach (var productoFactura in productoFacturaReturnedList) { FacturasBLL.Buscar(x => x.FacturaId == productoFactura.FacturaId, true); productoFactura.Factura = FacturasBLL.facturaReturned; ProductosBLL.Buscar(x => x.ProductoId == productoFactura.ProductoId, true); productoFactura.Producto = ProductosBLL.productoReturned; } } return(true); } return(false); } }