public void ClearSelected() { EFData ed = new EFData(); foreach (var item in ed.ReadCrust()) { item.Selected = false; } }
public string FindSelectedCurst() { EFData ed = new EFData(); foreach (var item in ed.ReadCrust()) { if (item.Selected) { return(item.Name); } } throw new ArgumentNullException("No Crust Selected"); }
public double GetCrustCost(string itemName) { EFData ed = new EFData(); foreach (var item in ed.ReadCrust()) { if (item.Name == itemName) { return(double.Parse(item.Price.ToString())); } } throw new ArgumentNullException("No Size Added"); }
public string FindCrustByName(string itemName) { EFData ed = new EFData(); foreach (var item in ed.ReadCrust()) { if (item.Name == itemName) { item.Selected = true; return(item.Name); } } throw new ArgumentNullException("No Crust Selected"); }
public int FindIndexOfSelected() { EFData ed = new EFData(); int i = 1; foreach (var item in ed.ReadCrust()) { if (item.Selected) { return(i); } i++; } throw new ArgumentNullException("Couldn't find record"); }
public bool CheckIfStockLeft() { EFData ef = new EFData(); foreach (var item in ef.ReadPizzaOrder()) { if (item.Order == ef.ReadOrder().Count() + 1) { foreach (var item2 in ef.ReadPizza()) { if (item2.PizzaId == item.Pizza) { foreach (var item3 in ef.ReadCrust()) { if (item2.Crust == item3.Name) { if (item3.Dough > decimal.Parse(Dough.ToString())) { throw new Exception("Dough Out of Stock"); } } } foreach (var item3 in ef.ReadSize()) { if (item2.Size == item3.Name) { if (item3.Dough > decimal.Parse(Dough.ToString())) { throw new Exception("Dough Out of Stock"); } } } foreach (var item3 in ef.ReadSauce()) { if (item2.Crust == item3.Name) { if (item3.Stock < decimal.Parse(5.1.ToString()) && item3.Name != "No Sauce") { throw new Exception("Sauce Out of Stock"); } } } foreach (var item3 in ef.ReadCheese()) { if (item2.FirstCheese == item3.Name) { if (item3.Stock < decimal.Parse(2.3.ToString()) && item3.Name != "No Cheese") { throw new Exception("Cheese Out of Stock"); } } if (item2.SecondCheese == item3.Name && item3.Name != "No Cheese") { if (item3.Stock < decimal.Parse(2.3.ToString())) { throw new Exception("Cheese Out of Stock"); } } } foreach (var item3 in ef.ReadPizzaTopping()) { if (item3.Pizza == item2.PizzaId) { foreach (var item4 in ef.ReadTopping()) { if (item3.Topping == item4.ToppingId) { if (item4.Stock < decimal.Parse(1.21.ToString())) { throw new Exception("Toppings Out of Stock"); } } } } } } } } } return(true); }