Example #1
0
        public void Loaded()
        {
            Sales       = new ObservableCollection <WaiterSale>();
            Occupancies = new ObservableCollection <Data.Occupancy>(_occupanciesRepo.GetOccupancies());
            Console.WriteLine("test");
            foreach (Data.Occupancy occupancy in Occupancies)
            {
                foreach (Data.Sale sale in occupancy.Sales)
                {
                    if ((sale.Delivered == 0 && _categoryRepo.GetBySubCategory(sale.Product.SubCategory).Name == "Eten" && sale.Cooked == 1) || (sale.Delivered == 0 && _categoryRepo.GetBySubCategory(sale.Product.SubCategory).Name == "Drank"))
                    {
                        Sales.Add(new WaiterSale(sale, occupancy));
                    }
                }
            }

            //Sales = new ObservableCollection<Sale>(occupancy.Sales.Where(sale => sale.Cooked == 1 && sale.Delivered == 0));
        }
Example #2
0
        /// <summary>
        /// Constructor to edit a product.
        /// Initializes the commands, sets the repositories.
        /// </summary>
        /// <param name="categoryRepo"><inheritdoc cref="_categoryRepo"/></param>
        /// <param name="recipeRepo"><inheritdoc cref="_recipeRepo"/></param>
        /// <param name="ingredientRepo"><inheritdoc cref="_ingredientRepo"/></param>
        /// <param name="product">The product that has to be edited.</param>
        public StockAddOrEditProductViewModel(ICategoryRepo categoryRepo, IRecipeRepo recipeRepo, IIngredientRepo ingredientRepo, Product product)
        {
            ActionToTake    = "edit";
            _categoryRepo   = categoryRepo;
            _recipeRepo     = recipeRepo;
            _ingredientRepo = ingredientRepo;
            IsProductNotSet = true;

            SelectedRecipeItem         = new RecipeItem();
            SelectedRecipeItem.Product = product;
            SelectedCategory           = categoryRepo.GetBySubCategory(product.SubCategory);
            DeleteRecipeItemCommand    = new RelayCommand <RecipeItem>(DeleteRecipeItem, (r) => r != null);
            BackToStockCommand         = new RelayCommand(BackToStock);
            AddProductCommand          = new RelayCommand(AddProduct);
            AddRecipeItemCommand       = new RelayCommand <RecipeItem>(AddRecipeItem, (_) =>
            {
                if (RecipeItemCanBeAdded())
                {
                    return(true);
                }
                return(false);
            });
        }
Example #3
0
 public void Loaded()
 {
     Sales = new ObservableCollection <Data.Sale>(_saleRepo.GetSales().Where(sale => sale.Cooked == 0 && _categoryRepo.GetBySubCategory(sale.Product.SubCategory).Name == "Eten"));
 }