Exemplo n.º 1
0
        /* 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()
                );
        }
        /* 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)
                );
        }
Exemplo n.º 5
0
        /* 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 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()
                );
        }