//Dodawanie nowego skladnika do listy
    private void AddIngredient()
    {
        var ingredient = new Ingredient();

        ingredient.Name = IngredientNameTxt;
        if (IngredientNameTxt == null || IngredientNameTxt == "")
        {
            MessageBox.Show("Uzupełnij nazwę składnika");
            return;
        }
        try
        {
            ingredient.Quantity = double.Parse(IngredientQuantityTxt);
        }
        catch (Exception)
        {
            return;
        }

        using (var contex = new CookingBookEntities1())
        {
            ingredient.TypeID = contex.QuantityTypes.Where(x => x.Name == SelectedQuantityCB).First().ID;
        }

        IngredientList.Add(ingredient);
        IngredientNameTxt     = null;
        IngredientQuantityTxt = null;
    }
        async Task ExecuteLoadIngredientCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                IngredientList.Clear();
                var items = await DataStore.GetItemAsync(Item.Id);

                foreach (var ingredient in items.IngredientList)
                {
                    IngredientList.Add(ingredient);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
 public void PopulateBindingLists()
 {
     IngredientList.Clear();
     IngredientQuantities.Clear();
     foreach (var kvp in PantryContents)
     {
         IngredientList.Add(kvp.Key);
         IngredientQuantities.Add(kvp.Value);
     }
 }
Exemple #4
0
        //functions
        public static void addIngredient(string name, double cost, int stock)
        {
            var ingredient = new Ingredient();

            ingredient.setName(name);
            ingredient.setCost(cost);
            ingredient.setStock(stock);

            IngredientList.Add(ingredient);
        }
        public void PopulateIngredientList()
        {
            IngredientList.Clear();
            MealPlan mealPlan = new MealPlan();

            foreach (Ingredient i in mealPlan.Ingredients)
            {
                IngredientModel item = new IngredientModel(i.IngredientName, i.IngredientID, i.PricePerPack, i.NumberInPack);
                IngredientList.Add(item);
            }
        }
Exemple #6
0
 /// <summary>
 /// This method invokes method for selecting ingredient.
 /// </summary>
 public void AddIngredientExecute()
 {
     if (String.IsNullOrEmpty(IngredientName))
     {
         MessageBox.Show("Please fill name.", "Notification");
     }
     else
     {
         IngredientList.Add(IngredientName);
         MessageBox.Show("Ingredient has been selected.");
         IngredientName = null;
     }
 }
Exemple #7
0
 private void AddIngredientExecute()
 {
     if (Ingredient == null || String.IsNullOrEmpty(Ingredient))
     {
         MessageBox.Show("Please enter name of ingredient.", "Notification");
     }
     else if (IngredientList != null && IngredientList.Contains(Ingredient))
     {
         MessageBox.Show("You already added this ingredient.", "Notification");
     }
     else
     {
         IngredientList.Add(Ingredient);
     }
 }
Exemple #8
0
        public void PopulateIngredientList(MealModel m)
        {
            IngredientList.Clear();
            if (m != default(MealModel))
            {
                MealPlan           mealPlan   = new MealPlan();
                IEnumerable <Meal> chosenMeal = from meal in mealPlan.Meals
                                                where meal.MealName == m.Name
                                                select meal;

                foreach (var meal in chosenMeal)
                {
                    ICollection <Ingredient> chosenIngredients = meal.Ingredients;
                    foreach (var ci in chosenIngredients)
                    {
                        IngredientModel im = new IngredientModel(ci.IngredientName, ci.IngredientID, ci.PricePerPack, ci.NumberInPack);
                        IngredientList.Add(im);
                    }
                }
            }
        }
Exemple #9
0
        private async Task GetConfig()
        {
            Configuration conf = await _configurationService.GetConfig();

            IngredientList.Add(new Ingredient {
                Name = conf.IngredientPump1
            });
            IngredientList.Add(new Ingredient {
                Name = conf.IngredientPump2
            });
            IngredientList.Add(new Ingredient {
                Name = conf.IngredientPump3
            });
            IngredientList.Add(new Ingredient {
                Name = conf.IngredientPump4
            });
            IngredientList.Add(new Ingredient {
                Name = conf.IngredientPump5
            });
            IngredientList.Add(new Ingredient {
                Name = conf.IngredientPump6
            });
        }
Exemple #10
0
        public void AddIngredient(float quantity, string unit, string title)
        {
            IngredientLine l = new IngredientLine(quantity, unit, title);

            IngredientList.Add(l);
        }