public Meal Create() { Meal meal = new Meal(); meal.Add(new Bone()); meal.Add(new ButcherLeftovers()); return(meal); }
public Meal Create() { Meal meal = new Meal(); meal.Add(new Kibble()); meal.Add(new MeatChunks()); return(meal); }
public void Fun1() { Meal meal = new Meal(); meal.Add(new HongShaoPaiGu()); meal.Add(new BanLiShaoJi()); meal.Add(new YuXiangRouSi()); meal.Show(); }
public Meal MakeBreakfast() { var meal = new Meal(); meal.Name = "Breakfast"; meal.Add(new Toast()); meal.Add(new OrangeJuice()); return(meal); }
public Meal MakeLunch() { var meal = new Meal(); meal.Name = "Lunch"; meal.Add(new Sandwich()); meal.Add(new Water()); return(meal); }
public Meal Create() { var meal = new Meal(); meal.Name = "Breakfast"; var cereal = new BranFlakes(); meal.Add(cereal); meal.Add(new OrangeJuice()); return(meal); }
public override Meal MakeLunch() { var meal = new Meal(); meal.Name = "Lunch"; var sandwich = new Sandwich(); sandwich.Type = "Tuna Melt"; meal.Add(sandwich); meal.Add(new Water()); return(meal); }
public Meal Create() { var meal = new Meal(); meal.Name = "Breakfast"; var toast = new Toast(); toast.Type = "Dry"; meal.Add(toast); var coffee = new Coffee(); coffee.Type = "Quick"; meal.Add(coffee); return(meal); }
public Meal Create() { var meal = new Meal(); meal.Name = "Breakfast"; var toast = new Toast(); toast.Type = "Jam on"; meal.Add(toast); var juice = new OrangeJuice(); juice.Type = "Concentrate"; meal.Add(juice); return(meal); }
public override Meal MakeBreakfast() { var meal = new Meal(); meal.Name = "Breakfast"; var toast = new Toast(); toast.Type = "Lightly Buttered"; meal.Add(toast); var juice = new OrangeJuice(); juice.Type = "Fresh"; meal.Add(juice); return(meal); }
public override Meal MakeLunch() { var meal = new Meal(); meal.Name = "Lunch"; var sandwich = new Sandwich(); sandwich.Type = "BLT"; meal.Add(sandwich); var beer = new Beer(); beer.Type = "Non Alcoholic"; meal.Add(beer); return(meal); }
void Start() { Person person = new Person { Name = "Bob" }; var morningMeal = new Meal { Type = "Breakfast" }; morningMeal.Add(new Toast()); morningMeal.Add(new OrangeJuice()); person.Eat(morningMeal); var eveningMeal = new Meal { Type = "Lunch" }; eveningMeal.Add(new Sandwich()); eveningMeal.Add(new Water()); person.Eat(eveningMeal); }
public Meal CreateMeal(string name, string[] mealData) { Meal requestedMeal; if (!availableMeals.ContainsKey(name)) { requestedMeal = new Meal(name, (MealType)int.Parse(mealData[1])); //add ingredients; for (int i = 2; i < mealData.Length; i += 2) { requestedMeal.Add(ProductFlyweightFactory.Factory.MakeProduct(mealData[i], mealData), int.Parse(mealData[i + 1])); } availableMeals.Add(name, requestedMeal); } else { requestedMeal = availableMeals[name]; } return requestedMeal; }
private void btnSave_Click(object sender, EventArgs e) { try { //the is a max of 4 menus options for each booking if (comboMenu1.Text != "None") { FoodMenu menu1 = (FoodMenu)comboMenu1.SelectedItem; int quantity = (int)numMenu1Count.Value; if ((string)comboMenu1.Tag == "None") { if (!Meal.Add(new Meal(m_SelectedBooking, menu1, quantity))) { pushErrorMessage("Error adding a new menu."); return; } comboMenu1.Tag = ""; goto MENU_2; } if (!Meal.Update(new Meal(m_SelectedBooking, ((FoodMenu)comboMenu1.SelectedItem), 0), menu1.ID, quantity)) { pushErrorMessage(string.Format("Error submitting menu \"{0}.\" Check you aren't passing two of the same menus!", menu1.ToString())); return; } } MENU_2: if (comboMenu2.Text != "None") { FoodMenu menu2 = (FoodMenu)comboMenu2.SelectedItem; int quantity = (int)numMenu2Count.Value; if ((string)comboMenu2.Tag == "None") { if (!Meal.Add(new Meal(m_SelectedBooking, menu2, quantity))) { pushErrorMessage("Error adding a new menu."); return; } comboMenu2.Tag = ""; goto MENU_3; } if (!Meal.Update(new Meal(m_SelectedBooking, ((FoodMenu)comboMenu2.SelectedItem), 0), menu2.ID, quantity)) { pushErrorMessage(string.Format("Error submitting menu \"{0}.\" Check you aren't passing two of the same menus!", menu2.ToString())); return; } } MENU_3: if (comboMenu3.Text != "None") { FoodMenu menu3 = (FoodMenu)comboMenu3.SelectedItem; int quantity = (int)numMenu3Count.Value; if ((string)comboMenu3.Tag == "None") { if (!Meal.Add(new Meal(m_SelectedBooking, menu3, quantity))) { pushErrorMessage("Error adding a new menu."); return; } comboMenu3.Tag = ""; goto MENU_4; } if (!Meal.Update(new Meal(m_SelectedBooking, ((FoodMenu)comboMenu3.SelectedItem), 0), menu3.ID, quantity)) { pushErrorMessage(string.Format("Error submitting menu \"{0}.\" Check you aren't passing two of the same menus!", menu3.ToString())); return; } } MENU_4: if (comboMenu4.Text != "None") { FoodMenu menu4 = (FoodMenu)comboMenu4.SelectedItem; int quantity = (int)numMenu4Count.Value; if ((string)comboMenu4.Tag == "None") { if (!Meal.Add(new Meal(m_SelectedBooking, menu4, quantity))) { pushErrorMessage("Error adding a new menu."); return; } comboMenu4.Tag = ""; goto MENU_ADD_UPDATE_END; } if (!Meal.Update(new Meal(m_SelectedBooking, ((FoodMenu)comboMenu4.SelectedItem), 0), menu4.ID, quantity)) { pushErrorMessage(string.Format("Error submitting menu \"{0}.\" Check you aren't passing two of the same menus!", menu4.ToString())); return; } } MENU_ADD_UPDATE_END: MessageBox.Show("Menus Added / Updated Successfully!"); this.Close(); } catch (Exception ex) { //debugging menu addition var st = new StackTrace(ex, true); var frame = st.GetFrame(0); var line = frame.GetFileLineNumber(); //debugging end Console.WriteLine("ERROR : {0} {1}", ex.Message, line); } }
private void btnAddBooking_Click(object sender, EventArgs e) { if (numMenu1Count.Value + numMenu2Count.Value + numMenu3Count.Value + numMenu4Count.Value > numPeopleUpDown.Value) { MessageBox.Show("You cannot specify more menus than there are number of people!", "Error:", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); return; } try { //take the customer and their details and add to the database Customer customer = Customer.RetrieveById(customerId); Booking inserted_Booking = Booking.Add(new Booking((int)numPeopleUpDown.Value, datePickerPlaced.Value, datePickerEvent.Value, bool.Parse(comboConfirmed.SelectedItem.ToString()), bool.Parse(comboPaid.SelectedItem.ToString()), customerId, ApplicationManagement.ApplicationManager.LoggedInEmployee)); //add the choosen menus and quantities to the meals table if (inserted_Booking != null) { try{ //the is a max of 4 menus options for each booking if (comboMenu1.Text != "None") { FoodMenu menu1 = (FoodMenu)comboMenu1.SelectedItem; int quantity = (int)numMenu1Count.Value; Meal.Add(new Meal(inserted_Booking, menu1, quantity)); } if (comboMenu2.Text != "None") { FoodMenu menu2 = (FoodMenu)comboMenu2.SelectedItem; int quantity = (int)numMenu2Count.Value; Meal.Add(new Meal(inserted_Booking, menu2, quantity)); } if (comboMenu3.Text != "None") { FoodMenu menu3 = (FoodMenu)comboMenu3.SelectedItem; int quantity = (int)numMenu3Count.Value; Meal.Add(new Meal(inserted_Booking, menu3, quantity)); } if (comboMenu4.Text != "None") { FoodMenu menu4 = (FoodMenu)comboMenu4.SelectedItem; int quantity = (int)numMenu4Count.Value; Meal.Add(new Meal(inserted_Booking, menu4, quantity)); } MessageBox.Show("Booking & Food Menu(s) Successfully Added!"); this.Close(); } catch (Exception ex) { Console.WriteLine(ex.Message); } } } catch (Exception ex) { Console.WriteLine("{0}", ex.Message); MessageBox.Show("Failed to add booking Check Your Input!"); } }
public void AddFood(IFoodItem item) { _meal.Add(item); }