public void AddProductToSoldProducts(Product soldProduct) { this.soldProductsList.Add(soldProduct); this.OnlineShopProfit += soldProduct.Price; if (this.OnSoldProduct != null) { this.OnSoldProduct(this, EventArgs.Empty); } }
/// <summary> /// Removes the product. /// </summary> /// <param name="productInStock">The product in stock.</param> public void RemoveProduct(Product productInStock) { if (this.productList.Count == 0) { if (this.OnEmpthyShop != null) { this.OnEmpthyShop(this, EventArgs.Empty ); } } else if (this.productList.Contains(productInStock)) { this.productList.Remove(productInStock); this.OnlineShopSoldProducts.AddProductToSoldProducts(productInStock); } else { throw new PopayeShopException("Wrong data entered or the product isnt in stock"); } }
/// <summary> /// Adding products to the list. Here we can have many of the same product /// </summary> /// <param name="addedProduct"></param> public void AddProduct(Product addedProduct) { this.productList.Add(addedProduct); }