Example #1
0
        virtual public bool DeleteProductFromyYard(ProductQuantity pq)
        {
            bool        canDelete = false;
            ProductYard py        = ProdYard.Select(p => p).Where(p => p.Product == pq.Product).FirstOrDefault();

            if (py != null && py.Product == pq.Product &&
                py.Quantity >= pq.Quantity)
            {
                canDelete    = true;
                py.Quantity -= pq.Quantity;
                return(canDelete);
            }
            return(canDelete);
        }
Example #2
0
        virtual public void AddProductInYard(ProductQuantity pq, Supply supply)
        {
            ProductYard py = ProdYard.Select(p => p).Where(p => p.Product == pq.Product).FirstOrDefault();

            if (py != null)
            {
                py.Quantity += pq.Quantity;
                py.Supply    = supply;
            }
            else
            {
                ProdYard.Add(new ProductYard {
                    Product = pq.Product, Quantity = pq.Quantity, Supply = supply, Yard = this
                });
            }
        }
Example #3
0
 public bool FillProducts(List <ProductYard> products)
 {
     if (products.Count > Rows * Columns)
     {
         return(false);
     }
     for (int i = 0; i < products.Count; i++)
     {
         ProductQuantity pq = products[i].Supply.Products
                              .Single(p => p.Product == products[i].Product);
         Products.Add(new MachineProduct {
             NameProd = pq.Product.ProductName,
             Cost     = pq.Cost
         });
     }
     return(true);
 }