/* constructor and initialization */ public InterfaceAdministrateurViewModel(Window window, int IdAdministrateur, string Token) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); Clients = new ObservableCollection <Client>(_restApiQueries.GetClients("Client")); Gestionnaires = new ObservableCollection <Gestionnaire>(_restApiQueries.GetGestionnaires("Gestionnaire")); this.IdAdministrateur = IdAdministrateur; this.Token = Token; Administrateur administrateur = _restApiQueries.GetSpecificAdministrateur("Administrateur/" + IdAdministrateur); LoginAdministrateur = administrateur.Login; GoToInterfaceAdministrateur = new RelayCommand( o => true, o => _router.GoToInterfaceAdministrateur(_window, IdAdministrateur, Token) ); GoToAjoutClient = new RelayCommand( o => true, o => _router.GoToAjoutClient(_window, IdAdministrateur, Token) ); GoToAjoutGestionnaire = new RelayCommand( o => true, o => _router.GoToAjoutGestionnaire(_window, IdAdministrateur, Token) ); GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); ModifierClient = new RelayCommand( o => (SelectedClient != null), o => _router.GoToModificationClient(_window, IdAdministrateur, Token, SelectedClient) ); SupprimerClient = new RelayCommand( o => (SelectedClient != null), o => RemoveClient() ); ModifierGestionnaire = new RelayCommand( o => (SelectedGestionnaire != null), o => _router.GoToModificationGestionnaire(_window, IdAdministrateur, Token, SelectedGestionnaire) ); SupprimerGestionnaire = new RelayCommand( o => (SelectedGestionnaire != null), o => RemoveGestionnaire() ); }
/* constructor and initialization */ public ConnexionViewModel(Window window) { _window = window; _restApiQueries = new RestApiQueries(null); _router = new Router(); _clients = new ObservableCollection <Client>(_restApiQueries.GetClients("Client")); /* Routing */ GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); GoToClientInscription = new RelayCommand( o => true, o => _router.GoToInscription(_window) ); /* Action */ ConnexionClientCommand = new RelayCommand( o => is_identififantsValides(), o => Connexion() ); }
/* 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 ListeTicketsClientViewModel(Window window, int IdCompte, string Token) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); string path = "Support/Compte/" + IdCompte; Supports = new ObservableCollection <Support>(_restApiQueries.GetSupports(path)); this.IdCompte = IdCompte; this.Token = Token; MessageResolution = "Résolu par le client"; /* Routing */ GoToInterfaceClient = new RelayCommand( o => true, o => _router.GoToInterfaceClient(_window, IdCompte, Token) ); GoToListeFactures = new RelayCommand( o => true, o => _router.GoToListeFactures(_window, IdCompte, Token) ); GoToListeTicketsClient = new RelayCommand( o => true, o => _router.GoToListeTicketsClient(_window, IdCompte, Token) ); GoToSolde = new RelayCommand( o => true, o => _router.GoToSoldeClient(_window, IdCompte, Token) ); GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); /* Actions */ FermerTicketCommand = new RelayCommand( o => (SelectedTicket != null && SelectedTicket.Status != "Resolu"), o => FermerTicket() ); AfficherDescriptionCommand = new RelayCommand( o => (SelectedTicket != null), o => AfficherDescription() ); }
/* constructor and initialization */ public AjoutSoldeViewModel(Window window, int IdCompte, string Token) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); string path = "Compte/" + IdCompte; Compte = _restApiQueries.GetSpecificCompte(path); // Initialisation des listes (%20 = " ") path = "Client/Solde/" + Compte.CompteId; Solde = _restApiQueries.GetClientSolde(path); this.IdCompte = IdCompte; this.Token = Token; /* Routing */ GoToInterfaceClient = new RelayCommand( o => true, o => _router.GoToInterfaceClient(_window, IdCompte, Token) ); GoToListeFactures = new RelayCommand( o => true, o => _router.GoToListeFactures(_window, IdCompte, Token) ); GoToListeTicketsClient = new RelayCommand( o => true, o => _router.GoToListeTicketsClient(_window, IdCompte, Token) ); GoToSolde = new RelayCommand( o => true, o => _router.GoToSoldeClient(_window, IdCompte, Token) ); GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); /* Action */ AjoutSoldeCommand = new RelayCommand( o => (Montant != 0), o => AjoutSolde() ); }
/* constructor and initialization */ public ModifierGestionnaireViewModel(Window window, int IdAdministrateur, string Token, Gestionnaire gestionnaire) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); this.IdAdministrateur = IdAdministrateur; this.Token = Token; this.Gestionnaire = gestionnaire; LoginModification = gestionnaire.Login; MailModification = gestionnaire.Email; NomModification = gestionnaire.NomGestionnaire; RoleModification = gestionnaire.Role; Roles = new ObservableCollection <Role>(_restApiQueries.GetRoles("Role")); GoToInterfaceAdministrateur = new RelayCommand( o => true, o => _router.GoToInterfaceAdministrateur(_window, IdAdministrateur, Token) ); GoToAjoutClient = new RelayCommand( o => true, o => _router.GoToAjoutClient(_window, IdAdministrateur, Token) ); GoToAjoutGestionnaire = new RelayCommand( o => true, o => _router.GoToAjoutGestionnaire(_window, IdAdministrateur, Token) ); GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); ModifierGestionnaire = new RelayCommand( o => isValidModificationGestionnaire(), o => ModificationGestionnaire() ); AjouterRoleCommand = new RelayCommand( o => (!string.IsNullOrEmpty(NouveauRole)), o => AjoutRole() ); }
/* constructor and initialization */ public ModifierClientViewModel(Window window, int IdAdministrateur, string Token, Client client) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); this.IdAdministrateur = IdAdministrateur; this.Token = Token; Debug.WriteLine("FLAG C : " + client.UtilisateurId); this.client = client; LoginModification = client.Login; MailModification = client.Mail; NomModification = client.Nom; PrenomModification = client.Prenom; TelephoneModification = client.Telephone; AgeModification = client.Age.ToString(); GoToInterfaceAdministrateur = new RelayCommand( o => true, o => _router.GoToInterfaceAdministrateur(_window, IdAdministrateur, Token) ); GoToAjoutClient = new RelayCommand( o => true, o => _router.GoToAjoutClient(_window, IdAdministrateur, Token) ); GoToAjoutGestionnaire = new RelayCommand( o => true, o => _router.GoToAjoutGestionnaire(_window, IdAdministrateur, Token) ); GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); ModifierClient = new RelayCommand( o => isValidModificationClient(), o => ModificationClient() ); }
/* constructor and initialization */ public OuvertureTicketSupportViewModel(Window window, int IdCompte, string Token, int IdArticle) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); this.IdCompte = IdCompte; this.Token = Token; this.IdArticle = IdArticle; Description = "Expliquez de manière concise votre problème"; Debug.WriteLine("Demande d'ouverture d'un ticket pour l'article " + this.IdArticle); /* Routing */ GoToInterfaceClient = new RelayCommand( o => true, o => _router.GoToInterfaceClient(_window, IdCompte, Token) ); GoToListeFactures = new RelayCommand( o => true, o => _router.GoToListeFactures(_window, IdCompte, Token) ); GoToListeTicketsClient = new RelayCommand( o => true, o => _router.GoToListeTicketsClient(_window, IdCompte, Token) ); GoToSolde = new RelayCommand( o => true, o => _router.GoToSoldeClient(_window, IdCompte, Token) ); GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); /* Action */ OuvrirTicketCommand = new RelayCommand( o => isValid_addedSupport(), o => OuvrirTicket() ); }
/* constructor and initialization */ public ListeFacturesViewModel(Window window, int IdCompte, string Token) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); // Liste des factures string path = "Facture/" + IdCompte; Factures = new ObservableCollection <Facture>(_restApiQueries.GetFactures(path)); this.IdCompte = IdCompte; this.Token = Token; /* Routing */ GoToInterfaceClient = new RelayCommand( o => true, o => _router.GoToInterfaceClient(_window, IdCompte, Token) ); GoToListeFactures = new RelayCommand( o => true, o => _router.GoToListeFactures(_window, IdCompte, Token) ); GoToListeTicketsClient = new RelayCommand( o => true, o => _router.GoToListeTicketsClient(_window, IdCompte, Token) ); GoToSolde = new RelayCommand( o => true, o => _router.GoToSoldeClient(_window, IdCompte, Token) ); GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); }
/* constructor and initialization */ public ListeComptesClientViewModel(Window window, int IdClient, string Token) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); this.IdClient = IdClient; this.Token = Token; string path = "Client/" + IdClient; Client client = _restApiQueries.GetSpecificClient(path); LoginClient = client.Login; // Liste des comptes path = "Compte/Client/" + IdClient; Comptes = new ObservableCollection <Compte>(_restApiQueries.GetComptes(path)); /* Commandes de routing */ GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); /* Boutons */ AjouterCompteCommand = new RelayCommand( o => (NomNouveauCompte != null), o => AjoutCompte() ); SelectionCompteCommand = new RelayCommand( o => (SelectedCompte != null), o => _router.GoToInterfaceClient(_window, SelectedCompte.CompteId, Token) ); }
/* constructor and initialization */ public InscriptionViewModel(Window window) { _window = window; _restApiQueries = new RestApiQueries("DefaultToken"); _router = new Router(); /* Routing */ GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); /* Action */ AjouterClient = new RelayCommand( o => isValidAjoutClient(), o => AjoutClient() ); }
/* constructor and initialization */ public AjoutClientViewModel(Window window, int IdAdministrateur, string Token) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); this.IdAdministrateur = IdAdministrateur; this.Token = Token; GoToInterfaceAdministrateur = new RelayCommand( o => true, o => _router.GoToInterfaceAdministrateur(_window, IdAdministrateur, Token) ); GoToAjoutClient = new RelayCommand( o => true, o => _router.GoToAjoutClient(_window, IdAdministrateur, Token) ); GoToAjoutGestionnaire = new RelayCommand( o => true, o => _router.GoToAjoutGestionnaire(_window, IdAdministrateur, Token) ); GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); AjouterClient = new RelayCommand( o => isValidAjoutClient(), o => AjoutClient() ); }
/* 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 InterfaceClientViewModel(Window window, int IdCompte, string Token) { _window = window; _restApiQueries = new RestApiQueries(Token); _router = new Router(); string path = "Compte/" + IdCompte; Compte = _restApiQueries.GetSpecificCompte(path); // Initialisation des listes (%20 = " ") path = "Article/Panier/" + Compte.CompteId + "/%20"; ArticlesPanier = new ObservableCollection <Article>(_restApiQueries.GetArticle(path)); path = "Article/Disponibles/%20"; ArticlesDisponibles = new ObservableCollection <Article>(_restApiQueries.GetArticle(path)); SynchroniserTotalPanier(); this.IdCompte = IdCompte; this.Token = Token; NomCompte = Compte.NomCompte; /* Routing */ GoToInterfaceClient = new RelayCommand( o => true, o => _router.GoToInterfaceClient(_window, IdCompte, Token) ); GoToListeFactures = new RelayCommand( o => true, o => _router.GoToListeFactures(_window, IdCompte, Token) ); GoToListeTicketsClient = new RelayCommand( o => true, o => _router.GoToListeTicketsClient(_window, IdCompte, Token) ); GoToSolde = new RelayCommand( o => true, o => _router.GoToSoldeClient(_window, IdCompte, Token) ); GoToConnexion = new RelayCommand( o => true, o => _router.GoToConnexion(_window) ); /* Action */ RechercheCommand = new RelayCommand( o => !string.IsNullOrEmpty(StringRecherchee), o => Recherche(StringRecherchee) ); OuvrirTicket = new RelayCommand( o => (SelectedArticlePanier != null), o => _router.GoToOuvertureTicketSupport(_window, IdCompte, Token, SelectedArticlePanier.ArticleId) ); RetirerArticle = new RelayCommand( o => (SelectedArticlePanier != null), o => EnlevementArticlePanier() ); AjouterArticle = new RelayCommand( o => (SelectedArticleDisponible != null), o => AjoutArticlePanier() ); GenererFacture = new RelayCommand( o => true, o => GenerationFacture() ); }
/* 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 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 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() ); }