private void SaveSandwhich() {// uses the current details to make a new object, // apply the details to it and then add the object // to the temp sandwhichs list in the OrderProcess class // set saved to cart to enable duplicate adding checks Sandwich newSandwhich = new Sandwich(); newSandwhich.Bread = Program.ProcessOrder.ChosenBread; newSandwhich.Spread = Program.ProcessOrder.ChosenSpread; newSandwhich.Sauce = Program.ProcessOrder.ChosenSauce; newSandwhich.Fillings = Program.ProcessOrder.ChosenFilling; newSandwhich.SaladItems = Program.ProcessOrder.ChosenSalad; newSandwhich.Price = price; Program.ProcessOrder.ChosenSandwhiches.Add(newSandwhich); addedToCart = true; MessageBox.Show("Sandwhich Saved, please now press checkout", "Saved Confirmed"); }
private void FetchSandwhichDetails() { // retrieves the saved sandwhich details // makes a new sandwhich object ready to save to the sandwhiches list and sets the price for the sandwhich price = Program.ProcessOrder.ChosenBread.Price + Program.ProcessOrder.ChosenSpread.Price + Program.ProcessOrder.ChosenSauce.Price + Program.ProcessOrder.ChosenFilling.Price + Program.ProcessOrder.ChosenSalad.Price; //adds the compoents together to make a price for the sandwich Sandwich sandwhich = new Sandwich(); //create new sandwhich object and set the details sandwhich.Bread = Program.ProcessOrder.ChosenBread; sandwhich.Spread = Program.ProcessOrder.ChosenSpread; sandwhich.Sauce = Program.ProcessOrder.ChosenSauce; sandwhich.Fillings = Program.ProcessOrder.ChosenFilling; sandwhich.SaladItems = Program.ProcessOrder.ChosenSalad; sandwhich.Price = price; //price is the price calulate above }