/* 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 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() ); }
public void OuvrirTicket() { Support support = new Support() { CompteId = IdCompte, Objet = Objet, Description = Description }; // La date de création est générée coté API string path = "Support/Ouvrir/" + IdArticle; _restApiQueries.AddSupport(path, support); _router.GoToListeTicketsClient(_window, IdCompte, Token); }
/* 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 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() ); }