/* 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()
                );
        }
        private void AjoutService()
        {
            Service service = new Service()
            {
                Nom          = NomService,
                Image        = ImageService,
                Type         = TypeService,
                Prix         = PrixService,
                Description  = DescriptionService,
                Manuel       = ManuelService,
                Conditions   = ConditionsService,
                AbonnementId = AbonnementService.AbonnementId
            };

            string path = "Service";

            _restApiQueries.AddService(path, service);
            _router.GoToInterfaceCommercial(_window, IdGestionnaire, Token);
        }
Beispiel #3
0
        private void Connexion()
        {
            string path = "Utilisateur/" + LoginConnexion + "," + MotDePasseConnexion;

            Debug.WriteLine("Chemin : " + path);

            RestApiQueries.ResultConnexion resultsConnexion = _restApiQueries.GetUtilisateurPourConnexion(path);

            if (resultsConnexion != null)
            {
                // TODO update statut connexion

                Debug.WriteLine("Type : " + resultsConnexion.Type);
                //GestionClientWPF.Models.Utilisateur

                switch (resultsConnexion.Type)
                {
                case "Client":

                    _router.GoToListeCompteClient(_window, resultsConnexion.Id, resultsConnexion.Token);
                    break;

                case "Gestionnaire":

                    _router.GoToInterfaceCommercial(_window, resultsConnexion.Id, resultsConnexion.Token);
                    break;

                case "Administrateur":

                    _router.GoToInterfaceAdministrateur(_window, resultsConnexion.Id, resultsConnexion.Token);
                    break;

                default:
                    ErreurConnexion();
                    break;
                }
            }
            else
            {
                ErreurConnexion();
            }
        }
Beispiel #4
0
        private void ModifierProduit()
        {
            Produit produit = new Produit()
            {
                Nom         = NomProduit,
                Image       = ImageProduit,
                Fabricant   = FabricantProduit,
                Type        = TypeProduit,
                Prix        = PrixProduit,
                Quantite    = QuantiteProduit,
                Capacite    = CapaciteProduit,
                Description = DescriptionProduit,
                Manuel      = ManuelProduit,
            };

            string path = "Produit/" + IdProduit;

            _restApiQueries.ModifierProduit(path, produit);
            _router.GoToInterfaceCommercial(_window, IdGestionnaire, Token);
        }
        private void AjoutProduit()
        {
            Produit produit = new Produit()
            {
                Nom         = NomProduit,
                Image       = ImageProduit,
                Fabricant   = FabricantProduit,
                Type        = TypeProduit,
                Prix        = PrixProduit,
                Quantite    = QuantiteProduit,
                Capacite    = CapaciteProduit,
                Description = DescriptionProduit,
                Manuel      = ManuelProduit,
            };

            // On passe l'IdGestionnaire dans l'url pour pouvoir récupérer l'id de son stock coté API
            string path = "Produit/" + IdGestionnaire;

            _restApiQueries.AddProduit(path, produit);
            _router.GoToInterfaceCommercial(_window, IdGestionnaire, Token);
        }
Beispiel #6
0
        /* 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()
                );
        }
Beispiel #9
0
        /* 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()
                );
        }