/* constructor and initialization */ public AjoutProduitViewModel(Window window, int IdGestionnaire, string Token) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); this.IdGestionnaire = IdGestionnaire; this.Token = Token; /* Commandes de routing */ GoToInterfaceCommercial = new RelayCommand( o => true, o => _router.GoToInterfaceCommercial(_window, IdGestionnaire, Token) ); GoToAssociationClient = new RelayCommand( o => true, o => _router.GoToAssociationClient(_window, IdGestionnaire, Token) ); GoToAjoutProduit = new RelayCommand( o => true, o => _router.GoToAjoutProduit(_window, IdGestionnaire, Token) ); GoToAjoutService = new RelayCommand( o => true, o => _router.GoToAjoutService(_window, IdGestionnaire, Token) ); GoToAjoutAbonnement = new RelayCommand( o => true, o => _router.GoToAjoutAbonnement(_window, IdGestionnaire, Token) ); GoToListeTickets = new RelayCommand( o => true, o => _router.GoToListeTicketsGestionnaire(_window, IdGestionnaire, Token) ); GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); /* Boutons */ AjouterProduitCommand = new RelayCommand( o => isValid_addedProduit(), o => AjoutProduit() ); }
/* constructor and initialization */ public AjoutClientAssocieViewModel(Window window, int IdGestionnaire, string Token) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); this.IdGestionnaire = IdGestionnaire; this.Token = Token; // Liste des clients dispo string path = "Client/GestionnaireAssocie/0"; Clients = new ObservableCollection <Client>(_restApiQueries.GetClients(path)); /* Commandes de routing */ GoToInterfaceCommercial = new RelayCommand( o => true, o => _router.GoToInterfaceCommercial(_window, IdGestionnaire, Token) ); GoToAssociationClient = new RelayCommand( o => true, o => _router.GoToAssociationClient(_window, IdGestionnaire, Token) ); GoToAjoutProduit = new RelayCommand( o => true, o => _router.GoToAjoutProduit(_window, IdGestionnaire, Token) ); GoToAjoutService = new RelayCommand( o => true, o => _router.GoToAjoutService(_window, IdGestionnaire, Token) ); GoToAjoutAbonnement = new RelayCommand( o => true, o => _router.GoToAjoutAbonnement(_window, IdGestionnaire, Token) ); GoToListeTickets = new RelayCommand( o => true, o => _router.GoToListeTicketsGestionnaire(_window, IdGestionnaire, Token) ); GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); /* Boutons */ AssocierClientCommand = new RelayCommand( o => (SelectedClient != null), o => AssociationClient() ); }
/* constructor and initialization */ public ListeTicketsGestionnaireViewModel(Window window, int IdGestionnaire, string Token) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); string path = "Support/Commercial/Ouvert/" + IdGestionnaire; Supports = new ObservableCollection <Support>(_restApiQueries.GetSupports(path)); this.IdGestionnaire = IdGestionnaire; this.Token = Token; /* Commandes de routing */ GoToInterfaceCommercial = new RelayCommand( o => true, o => _router.GoToInterfaceCommercial(_window, IdGestionnaire, Token) ); GoToAssociationClient = new RelayCommand( o => true, o => _router.GoToAssociationClient(_window, IdGestionnaire, Token) ); GoToAjoutProduit = new RelayCommand( o => true, o => _router.GoToAjoutProduit(_window, IdGestionnaire, Token) ); GoToAjoutService = new RelayCommand( o => true, o => _router.GoToAjoutService(_window, IdGestionnaire, Token) ); GoToAjoutAbonnement = new RelayCommand( o => true, o => _router.GoToAjoutAbonnement(_window, IdGestionnaire, Token) ); GoToListeTickets = new RelayCommand( o => true, o => _router.GoToListeTicketsGestionnaire(_window, IdGestionnaire, Token) ); GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); /* Actions */ FermerTicketCommand = new RelayCommand( o => (SelectedTicket != null), o => FermerTicket() ); AfficherDescriptionCommand = new RelayCommand( o => (SelectedTicket != null), o => AfficherDescription() ); }
/* constructor and initialization */ public ModifierServiceViewModel(Window window, int IdGestionnaire, string Token, Service service) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); this.IdGestionnaire = IdGestionnaire; this.Token = Token; // Liste des abonnements string path = "Abonnement"; Abonnements = new ObservableCollection <Abonnement>(_restApiQueries.GetAbonnements(path)); /* Initilisation des valeurs de base du service */ IdService = service.ArticleId; NomService = service.Nom; DescriptionService = service.Description; PrixService = service.Prix; ImageService = service.Image; TypeService = service.Type; ManuelService = service.Manuel; ConditionsService = service.Conditions; AbonnementService = service.Abonnement; /* Commandes de routing */ GoToInterfaceCommercial = new RelayCommand( o => true, o => _router.GoToInterfaceCommercial(_window, IdGestionnaire, Token) ); GoToAssociationClient = new RelayCommand( o => true, o => _router.GoToAssociationClient(_window, IdGestionnaire, Token) ); GoToAjoutProduit = new RelayCommand( o => true, o => _router.GoToAjoutProduit(_window, IdGestionnaire, Token) ); GoToAjoutService = new RelayCommand( o => true, o => _router.GoToAjoutService(_window, IdGestionnaire, Token) ); GoToAjoutAbonnement = new RelayCommand( o => true, o => _router.GoToAjoutAbonnement(_window, IdGestionnaire, Token) ); GoToListeTickets = new RelayCommand( o => true, o => _router.GoToListeTicketsGestionnaire(_window, IdGestionnaire, Token) ); GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); /* Boutons */ ModifierServiceCommand = new RelayCommand( o => isValid_service(), o => ModificationService() ); }
/* constructor and initialization */ public ModifierProduitViewModel(Window window, int IdGestionnaire, string Token, Produit produit) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); this.IdGestionnaire = IdGestionnaire; this.Token = Token; /* Initilisation des valeurs de base du produit */ IdProduit = produit.ArticleId; NomProduit = produit.Nom; DescriptionProduit = produit.Description; PrixProduit = produit.Prix; ImageProduit = produit.Image; TypeProduit = produit.Type; ManuelProduit = produit.Manuel; FabricantProduit = produit.Fabricant; QuantiteProduit = produit.Quantite; CapaciteProduit = produit.Capacite; /* Commandes de routing */ GoToInterfaceCommercial = new RelayCommand( o => true, o => _router.GoToInterfaceCommercial(_window, IdGestionnaire, Token) ); GoToAssociationClient = new RelayCommand( o => true, o => _router.GoToAssociationClient(_window, IdGestionnaire, Token) ); GoToAjoutProduit = new RelayCommand( o => true, o => _router.GoToAjoutProduit(_window, IdGestionnaire, Token) ); GoToAjoutService = new RelayCommand( o => true, o => _router.GoToAjoutService(_window, IdGestionnaire, Token) ); GoToAjoutAbonnement = new RelayCommand( o => true, o => _router.GoToAjoutAbonnement(_window, IdGestionnaire, Token) ); GoToListeTickets = new RelayCommand( o => true, o => _router.GoToListeTicketsGestionnaire(_window, IdGestionnaire, Token) ); GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); /* Boutons */ ModifierProduitCommand = new RelayCommand( o => isValid_produit(), o => ModifierProduit() ); }
/* constructor and initialization */ public InterfaceCommercialViewModel(Window window, int IdGestionnaire, string Token) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); this.IdGestionnaire = IdGestionnaire; string path; path = "Gestionnaire/" + IdGestionnaire; Debug.WriteLine("Path Login : "******"Gestionnaire/" + IdGestionnaire); Debug.WriteLine("GestionnaireLogin : "******"Client/GestionnaireAssocie/" + IdGestionnaire; ClientsLiés = new ObservableCollection <Client>(_restApiQueries.GetClients(path)); // Liste des produits associés au gestionnaire path = "Produit/GestionnaireAssocie/" + IdGestionnaire; ProduitsLiés = new ObservableCollection <Produit>(_restApiQueries.GetProduit(path)); path = "Service"; Services = new ObservableCollection <Service>(_restApiQueries.GetService(path)); this.Token = Token; /* Commandes de routing */ GoToInterfaceCommercial = new RelayCommand( o => true, o => _router.GoToInterfaceCommercial(_window, IdGestionnaire, Token) ); GoToAssociationClient = new RelayCommand( o => true, o => _router.GoToAssociationClient(_window, IdGestionnaire, Token) ); GoToAjoutProduit = new RelayCommand( o => true, o => _router.GoToAjoutProduit(_window, IdGestionnaire, Token) ); GoToAjoutService = new RelayCommand( o => true, o => _router.GoToAjoutService(_window, IdGestionnaire, Token) ); GoToAjoutAbonnement = new RelayCommand( o => true, o => _router.GoToAjoutAbonnement(_window, IdGestionnaire, Token) ); GoToListeTickets = new RelayCommand( o => true, o => _router.GoToListeTicketsGestionnaire(_window, IdGestionnaire, Token) ); GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); /* Commandes d'action */ RetirerClient = new RelayCommand( o => (SelectedClient != null), o => DesassociationClient() ); ModifierProduit = new RelayCommand( o => (SelectedProduit != null), o => _router.GoToModificationProduit(_window, IdGestionnaire, Token, SelectedProduit) ); SupprimerProduit = new RelayCommand( o => (SelectedProduit != null), o => RetirerUnProduit() ); ModifierService = new RelayCommand( o => (SelectedService != null), o => _router.GoToModificationService(_window, IdGestionnaire, Token, SelectedService) ); SupprimerService = new RelayCommand( o => (SelectedService != null), o => RemoveService() ); }