/// <summary> /// Metoda obsluguje logike po wcisnieciu przycisku AddMeal. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tnAdd_Click(object sender, EventArgs e) { if (cBoxMeal.Text != string.Empty) { var meal = this._menuMeals.Where(m => m.Name == cBoxMeal.Text).FirstOrDefault(); if (meal != null) { var index = dGridViewListOfMeals.Rows.Add(); dGridViewListOfMeals.Rows[index].Cells["ID"].Value = meal.Id; dGridViewListOfMeals.Rows[index].Cells["Name"].Value = meal.Name; dGridViewListOfMeals.Rows[index].Cells["Price"].Value = meal.Price.ToString("C2"); this._menuMealsTmp.Add(meal); this._mealAbstract = new MealDecorator <Model.Menu>(this._mealAbstract, meal); txtBoxCost.Text = this._mealAbstract.CalculateCost().ToString("C2"); this._mealAbstract.GetOrderDescription(); PopulateAdditions(); } } }
/// <summary> /// Metoda tworzy domyślne instancje zmiennych /// </summary> private void PopulateDefaultVariables() { this._unit = new ApplicationUnitOfWork(); this._menuMeals = new List <Model.Menu>(); this._menuMealsOrder = new List <Model.Menu>(); this._menuMealsTmp = new List <Model.Menu>(); this._menuItemsRepository = this._unit.Menus.GetAll(); this._firstLoad = true; this._mealAbstract = new BaseMeal(); }
private void ClearMealSection() { PopulateControlsStatusAfterClean(); this._menuMealsTmp.Clear(); this._mealAbstract = null; this._mealAbstract = new BaseMeal(); FillCombobox(new TypeOfMeal(), ref cBoxMealCategory, false); }
public MealDecorator(MealAbstract mealAbstract, TEntity menuItem) { this._mealAbstract = mealAbstract; this._menuItem = menuItem; }