Example #1
0
        /// <summary>
        /// Method for adding the selected item from the list
        /// </summary>
        public void AddShoppingItemExecute()
        {
            try
            {
                List <tblShoppingBasket>    tempShoppingList            = shoppingData.GetAllSelectedShoppingBasketItems(LoggedGuest.ID).ToList();
                AddIngredientToRecipe       addIngredientToBasket       = new AddIngredientToRecipe();
                AddIngredientToRecipeWindow addIngredientToRecipeWindow = new AddIngredientToRecipeWindow();
                addIngredientToRecipeWindow.ShowDialog();
                // addIngredientToBasket.ShowDialog();

                // Return the list to the initial state
                if (isShoppingListNotUpdated == true)
                {
                    for (int i = 0; i < tempShoppingList.Count; i++)
                    {
                        tempShoppingList[i].ShoppingBasketID = 0;
                        tempShoppingList[i].UserID           = LoggedGuest.ID;
                        shoppingData.AddShoppingList(tempShoppingList[i]);
                    }
                    isShoppingListNotUpdated = false;
                }

                ShoppingBasketList = shoppingData.GetAllSelectedShoppingBasketItems(LoggedGuest.ID).ToList();
            }
            catch (Exception)
            {
                MessageBoxResult dialog = Xceed.Wpf.Toolkit.MessageBox.Show("Trenutno je nemoguce dodati sastojak...", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
 public AddIngredientToRecipeWindowViewModel(AddIngredientToRecipeWindow addIngredientToRecipeWindow)
 {
     this.addIngredientToRecipeWindow = addIngredientToRecipeWindow;
     ingredient           = new tblIngredient();
     ItemAmount           = new tblShoppingBasket();
     IngredientList       = ingrediantsData.GetAllIngredients().ToList();
     IngrediantAmountList = shoppingData.GetAllSelectedShoppingBasketItems(LoggedGuest.ID).ToList();
 }
        /// <summary>
        /// Checks if the users want to finish creating the recipe
        /// </summary>
        private void AddToRecipeExecute()
        {
            MessageBoxResult dialog = Xceed.Wpf.Toolkit.MessageBox.Show("Da li želite da dodate proizvode u korpu?", "Zavrsetak", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (dialog == MessageBoxResult.Yes)
            {
                AddIngredientToRecipeWindow addIngredientToRecipeWindow1 = new AddIngredientToRecipeWindow();
                addIngredientToRecipeWindow.Close();
            }
            //else
            //{
            //    shoppingData.DeleteShoppingBasket(ItemAmount.ShoppingBasketID);
            //}
        }