public UserControlCaisserViewModel()
        {
            _openAddPlatViewCommand    = new RelayCommand(() => AddPlat(), o => true);
            _deleteSelectedChoosenPlat = new RelayCommand(() => DeletePlat(), o => true);
            _cardPayCommand            = new RelayCommand(() => GoToTicketEdition(), o => true);

            _platBusiness = new PlatBusiness();
            _menuBusiness = new MenuBusiness();

            try
            {
                _menusDuJour = _menuBusiness.GetMenusDuJour();
            }
            catch (Exception ex)
            {
                DialogService.ShowErrorWindow(ex.Message);
            }

            _displayPlatCommand    = new RelayCommand(() => Plats(), o => true);
            _displayEntreeCommand  = new RelayCommand(() => Entree(), o => true);
            _displayDessertCommand = new RelayCommand(() => Dessert(), o => true);
            _displaySnackCommand   = new RelayCommand(() => Snack(), o => true);
            _displayAutreCommand   = new RelayCommand(() => Autre(), o => true);

            _validateCommand = new RelayCommand(() => GetPlats(_selectedPlat), o => true);
        }
 private void UpdateMenuDuJour()
 {
     try
     {
         _menuBusiness.GetMenusDuJour().ForEach(m => _collectionMenuDuJour.Add(m));
     }
     catch (Exception ex)
     {
         DialogService.ShowErrorWindow(ex.Message);
     }
 }
        public UserControlCafeteriaViewModel()
        {
            _platBusiness    = new PlatBusiness();
            _menuBusiness    = new MenuBusiness();
            _produitBusiness = new ProduitBusiness();

            _openDeletingMenuWindow    = new RelayCommand(() => DialogService.ShowYesNoWindow("Etes-vous sûr de vouloir supprimer ce menu ?", new Action(DeleteMenu)), o => true);
            _openDeletingPlatWindow    = new RelayCommand(() => DialogService.ShowYesNoWindow("Etes-vous sûr de vouloir supprimer ce plat ?", new Action(DeletePlat)), o => true);
            _openDeletingProduitWindow = new RelayCommand(() => DialogService.ShowYesNoWindow("Etes-vous sûr de vouloir supprimer ce produit ?", new Action(DeleteProduit)), o => true);

            _openAddingPlatWindow    = new RelayCommand(() => DialogGerant.ShowAjoutMenuView(), o => true);
            _openAddingMenuWindow    = new RelayCommand(() => DialogGerant.ShowAjoutPlatView(), o => true);
            _openAddingProduitWindow = new RelayCommand(() => DialogGerant.ShowAjoutProduitView(), o => true);

            _openModifyingMenuWindow    = new RelayCommand(() => DialogGerant.ShowModifMenuView(), o => true);
            _openModifyingPlatWindow    = new RelayCommand(() => DialogGerant.ShowModifPlatView(), o => true);
            _openModifyingProduitWindow = new RelayCommand(() => DialogGerant.ShowModifProduitView(), o => true);

            _duplicateMenuCommand = new RelayCommand(() => DialogService.ShowYesNoWindow("Etes-vous sûr de vouloir dupliquer ce menu ?", new Action(DuplicateMenu)), o => true);

            _addToMenusDuJour = new RelayCommand(() => AddToMenuDuJour(), o => true);

            Messenger.Default.Register <string>(this, (msg) => HandleMessage(msg));

            try
            {
                foreach (Plat plat in _platBusiness.GetAllPlat())
                {
                    _collectionPlat.Add(plat);
                }

                foreach (Menu menu in _menuBusiness.GetAllMenus())
                {
                    _collectionMenu.Add(menu);
                }

                foreach (Produit produit in _produitBusiness.GetAllProduits())
                {
                    _collectionProduit.Add(produit);
                }

                foreach (Menu menu in _menuBusiness.GetMenusDuJour())
                {
                    _collectionMenuDuJour.Add(menu);
                }
            }
            catch (Exception ex)
            {
                DialogService.ShowErrorWindow(ex.Message);
            }
        }
Ejemplo n.º 4
0
        public CuisinierMainViewModel()
        {
            _menuBusiness    = new MenuBusiness();
            _platBusiness    = new PlatBusiness();
            _produitBusiness = new ProduitBusiness();

            _logOut = new RelayCommand(() => Quit(), o => true);

            _openDeletePlatWindow = new RelayCommand(() => DialogService.ShowYesNoWindow("Etes-vous sûr de vouloir supprimer ce plat du menu ?", new Action(DeletePlat)), o => true);
            _openAddObsWindow     = new RelayCommand(() => DialogService.ShowYesNoWindow("Etes-vous sûr de vouloir ajouter une observation à ce produit ?", new Action(AddObs)), o => true);

            try
            {
                foreach (Menu menu in _menuBusiness.GetMenusDuJour())
                {
                    _collectionMenu.Add(menu);
                }
            }
            catch (Exception ex)
            {
                DialogService.ShowErrorWindow(ex.Message);
            }
        }