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); }
public AjoutPlatViewModel() { _platBusiness = new PlatBusiness(); _availableCategories = _platBusiness.GetAllCategories(); DateEffet = DateTime.Now; _createPlatCommand = new RelayCommand(() => { CreateNewPlat(); Messenger.Default.Send <string>("UpdatePlat"); Close(); }, o => true); }
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); } }
public UserControlFactureViewModel() { _commandeBusiness = new CommandeBusiness(); _platBusiness = new PlatBusiness(); _deleteCommand = new RelayCommand(() => DeletePlatFromCommande(), o => true); try { foreach (Commande c in _commandeBusiness.GetAllCommandes()) { _collectionCommande.Add(c); } } catch (Exception ex) { DialogService.ShowErrorWindow(ex.Message); } }
public ModifPlatViewModel() { Messenger.Default.Register <Plat>(this, (plat) => HandleMessage(plat)); Messenger.Default.Send <string>("RequestSelectedPlat"); _platBusiness = new PlatBusiness(); _produitBusiness = new ProduitBusiness(); _deleteProduit = new RelayCommand(() => { DeleteProduitFromPlat(); }, o => true); _addProduit = new RelayCommand(() => { AddMewProduitToPlat(); }, o => true); _apply = new RelayCommand(() => { Modify(); Messenger.Default.Send <string>("UpdatePlat"); Close(); }, o => true); Nom = ModifyedPlat.Nom; DateEffet = ModifyedPlat.DateEffet; DateFin = ModifyedPlat.DateFin; Tarif = ModifyedPlat.Prix; try { _availableCategories = _platBusiness.GetAllCategories(); foreach (Produit p in ModifyedPlat.ListProduits) { _collectionSelectedProduit.Add(p); } List <Produit> list = new List <Produit>(); list.AddRange(_produitBusiness.GetAllProduits().Except(ModifyedPlat.ListProduits)); foreach (Produit p in list) { _collectionAvalaibleProduit.Add(p); } } catch (Exception ex) { DialogService.ShowErrorWindow(ex.Message); } }
public ModifMenuViewModel() { Messenger.Default.Register <Menu>(this, (menu) => HandleMessage(menu)); Messenger.Default.Send <string>("RequestSelectedMenu"); Nom = ModifyedMenu.Nom; DateElaboration = ModifyedMenu.DateElaboration; Observation = ModifyedMenu.Observation; _menuBusiness = new MenuBusiness(); _utilisateurBusiness = new UtilisateurBusiness(); _platBusiness = new PlatBusiness(); _addPlat = new RelayCommand(() => AddNewPlatToMenu(), o => true); _removePlat = new RelayCommand(() => DeletePlatFromMenu(), o => true); _apply = new RelayCommand(() => { Modify(); Close(); }, o => true); try { foreach (Plat p in ModifyedMenu.ListPLats) { _collectionSelectedPat.Add(p); } List <Plat> list = new List <Plat>(); list.AddRange(_platBusiness.GetAllPlat().Except(ModifyedMenu.ListPLats)); foreach (Plat p in list) { _collectionAvalaiblePat.Add(p); } _availableCategories = _menuBusiness.GetAllCategories(); _avalaibleGerant = _utilisateurBusiness.GetUtilisateursByFonction("Gérant"); } catch (Exception ex) { DialogService.ShowErrorWindow(ex.Message); } }
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); } }