Exemplo n.º 1
0
 private void _tableAddSaleSubViewModel_ToTableAddSaleProductViewRequested(Data.SubCategory subCategory)
 {
     _tableAddSaleProductViewModel = new TableAddSaleProductViewModel(_tableOccupancyViewModel.CurrentOccupancy, subCategory, _recipeRepo, _ingredientRepo, _productRepo, _occupancyRepo, _suggestedProducts);
     _tableAddSaleProductViewModel.ViewBackRequested += ViewBackRequested;
     CurrentViewModel = _tableAddSaleProductViewModel;
     ViewModelHistory.Add(_tableAddSaleProductViewModel);
 }
Exemplo n.º 2
0
        public FakeProductsRepo()
        {
            Data.Address address = new Data.Address()
            {
                Country = "Belgium",
                Id      = 1,
                Number  = 77,
                Street  = "Ter Platen",
                Zipcode = "9000"
            };

            Data.Company company = new Data.Company()
            {
                Address     = address,
                Name        = "My Company",
                Id          = 1,
                PhoneNumber = 0483663598,
                VAT         = "BE12345678",
                Website     = "MyCompany.com"
            };

            Data.Category category = new Data.Category()
            {
                Company = company,
                Id      = 1,
                Name    = "Drank"
            };

            Data.SubCategory subCategory = new Data.SubCategory()
            {
                Category = category,
                Id       = 1,
                Name     = "Bier"
            };

            _products = new List <Data.Product>();
            _products.Add(new Data.Product()
            {
                SubCategory = subCategory,
                Id          = 1,
                Name        = "Westmalle",
                Price       = 4.5
            });
            _products.Add(new Data.Product()
            {
                SubCategory = subCategory,
                Id          = 2,
                Name        = "Westvleteren",
                Price       = 10
            });
            _products.Add(new Data.Product()
            {
                SubCategory = subCategory,
                Id          = 3,
                Name        = "Jupiler",
                Price       = 2
            });
        }
Exemplo n.º 3
0
 public void DeleteSubCategory(Data.SubCategory subCategory)
 {
     if (!_context.SubCategories.Local.Any(i => i.ID == subCategory.ID))
     {
         _context.SubCategories.Attach(subCategory);
     }
     _context.SubCategories.Remove(subCategory);
     _context.SaveChanges();
 }
Exemplo n.º 4
0
 public Data.SubCategory UpdateSubCategory(Data.SubCategory subCategory)
 {
     if (!_context.SubCategories.Local.Any(c => c.ID == subCategory.ID))
     {
         _context.SubCategories.Attach(subCategory);
     }
     _context.Entry(subCategory).State = EntityState.Modified;
     _context.SaveChanges();
     return(subCategory);
 }
Exemplo n.º 5
0
        public TableAddSaleProductViewModel(Data.Occupancy occupancy, Data.SubCategory subCategory, IRecipeRepo recipeRepo, IIngredientRepo ingredientRepo, IProductRepo productRepo, IOccupanciesRepo iOccupanciesRepo, ObservableCollection <SuggestedProducts> suggestedProducts)
        {
            _suggestedProducts        = suggestedProducts;
            _occupancy                = occupancy;
            _iOccupanciesRepo         = iOccupanciesRepo;
            _iRecipeRepo              = recipeRepo;
            _iIngredientRepo          = ingredientRepo;
            _iProductRepo             = productRepo;
            SubCategory               = subCategory;
            MinusAmountCommand        = new RelayCommand(MinusAmount);
            PlusAmountCommand         = new RelayCommand(PlusAmount);
            SetSelectedProductCommand = new RelayCommand <Business.Product>(SetSelectedProduct);

            AddSaleCommand  = new RelayCommand(AddSale, CanAddSale);
            ViewBackCommand = new RelayCommand(ViewBack);
        }
Exemplo n.º 6
0
        public Data.Category GetBySubCategory(Data.SubCategory subCategory)
        {
            if (_context.SubCategories != null)
            {
                foreach (Data.Category category in GetCategories())
                {
                    foreach (Data.SubCategory subC in category.SubCategories)
                    {
                        if (subC.ID == subCategory.ID)
                        {
                            return(category);
                        }
                    }
                }
            }

            return(null);
        }
Exemplo n.º 7
0
 public void ToTableAddSaleProductView(Data.SubCategory subCategory)
 {
     ToTableAddSaleProductViewRequested?.Invoke(subCategory);
 }
Exemplo n.º 8
0
 public Data.SubCategory AddSubCategory(Data.SubCategory subCategory)
 {
     _context.SubCategories.Add(subCategory);
     _context.SaveChanges();
     return(subCategory);
 }