/// <summary> /// Opens the Add ingredient amount to shopping basket window /// </summary> /// <param name="addIngrediwntOpen">Window that we open</param> /// <param name="ingredientEdit">ingredient that we are showing</param> public AddIngredientToBasketViewModel(AddIngredientAmountToRecipe addIngredientAmountOpen, tblIngredient ingredientEdit) { ItemAmount = new tblShoppingBasket(); addIngredientAmountToShoppingBasket = addIngredientAmountOpen; IngredientList = ingrediantsData.GetAllIngredients().ToList(); Ingredient = ingredientEdit; }
/// <summary> /// Opens the Add ingredient amount to recipe window /// </summary> /// <param name="addIngrediwntOpen">Window that we open</param> /// <param name="ingredientEdit">ingredient that we are showing</param> /// <param name="recipeIDEdit">recipe that we are showing</param> public AddIngredientToRecipeViewModel(AddIngredientAmountToRecipe addIngredientAmountOpen, tblIngredient ingredientEdit, int recipeIDEdit) { ItemAmount = new tblIngredientAmount(); addIngredientAmountToRecipe = addIngredientAmountOpen; IngredientList = ingrediantsData.GetAllIngredients().ToList(); Ingredient = ingredientEdit; RecipeID = recipeIDEdit; IngrediantAmountList = recipeData.GetAllSelectedRecipeIngrediantAmount(recipeIDEdit).ToList(); }
/// <summary> /// Executes the add shopping basket command /// </summary> private void AddItemExecute() { try { AddIngredientAmountToRecipe addIngredientWindow = new AddIngredientAmountToRecipe(Ingredient); addIngredientWindow.ShowDialog(); // Refresh the list IngrediantAmountList = shoppingData.GetAllSelectedShoppingBasketItems(LoggedGuest.ID); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Executes the add ingredient amount command /// </summary> private void AddItemExecute() { try { AddIngredientAmountToRecipe addIngredientWindow = new AddIngredientAmountToRecipe(Ingredient, recipeID); addIngredientWindow.ShowDialog(); // Refresh the list IngrediantAmountList = recipeData.GetAllSelectedRecipeIngrediantAmount(RecipeID); IngrediantAmountListCount = IngrediantAmountList.Count(); if (IngrediantAmountList.Count > 0) { addIngredientToRecipe.gridIngredientItem.Visibility = Visibility.Visible; addIngredientToRecipe.msgNoItems.Visibility = Visibility.Collapsed; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }