예제 #1
0
        public PageGestionnaireViewModel(Window window, int idGestionnaire)
        {
            this._window = window;
            DBContext    = new DatabaseContext.GestionRelationClient_DBContext();

            this.Gestionnaire      = DBContext.Utilisateurs.Where(u => (u.Id.Equals(idGestionnaire))).FirstOrDefault();
            this.LoginGestionnaire = Gestionnaire.Login;


            // Navigation
            GoToAccueilCommand = new RelayCommand(
                o => true,
                o => OpenAccueil()
                );
            GoToPageGestionnaire = new RelayCommand(
                o => true,
                o => OpenPageGestionnaire()
                );
            GoToAjoutServiceCommand = new RelayCommand(
                o => true,
                o => OpenPageAjoutService()
                );
            GoToAjoutProduitCommand = new RelayCommand(
                o => true,
                o => OpenPageAjoutProduit()
                );
            GoToListeArticleGestionnaire = new RelayCommand(
                o => true,
                o => OpenListeArticleGestionnaire()
                );
        }
        public ClientViewModel(Window window)
        {
            _window   = window;
            DBContext = new DatabaseContext.GestionRelationClient_DBContext();

            _clients     = new ObservableCollection <Models.Client>();
            _addedClient = new Models.Client();

            _connectingClient = new Models.Client();

            // Inscription
            InscriptionClientCommand = new RelayCommand(
                o => _isValid_addedClient,
                o => AddClient()
                );

            //Connexion
            ConnexionClientCommand = new RelayCommand(
                o => _isValid_connectingClient,
                o => ConnectClient()
                );


            // Navigation
            GoToClientInscription = new RelayCommand(
                o => true,
                o => OpenClientInscription()
                );
            GoToClientConnexion = new RelayCommand(
                o => true,
                o => OpenClientConnexion()
                );
        }
        public ListeArticleGestionnaireViewModel(Window window, int idGestionnaire)
        {
            this._window = window;
            DBContext    = new DatabaseContext.GestionRelationClient_DBContext();

            this.idGestionnaire = idGestionnaire;


            this.Articles = Models.Utilitaire.ToObservableCollection(DBContext.Articles);



            // Navigation
            GoToAccueilCommand = new RelayCommand(
                o => true,
                o => OpenAccueil()
                );
            SelectionnerArticle = new RelayCommand(
                o => true,
                o => OpenDetailsArticles()
                );
            GoToListeArticlesCommand = new RelayCommand(
                o => true,
                o => OpenListeArticle()
                );
            GoToPageGestionnaireCommand = new RelayCommand(
                o => true,
                o => OpenPageGestionnaire()
                );
        }
        public ListeArticleGestionnaireDetailViewModel(Window window, int idGestionnaire, int idArticle)
        {
            this._window = window;
            DBContext    = new DatabaseContext.GestionRelationClient_DBContext();

            this.idGestionnaire = idGestionnaire;
            this.Article        = DBContext.Articles.Where(a => (a.Id.Equals(idArticle))).FirstOrDefault();

            this.NomArticle         = this.Article.Nom;
            this.ImageArticle       = this.Article.Image;
            this.TypeArticle        = this.Article.Type;
            this.PrixArticle        = this.Article.Prix + " $";
            this.DescriptionArticle = this.Article.GetArticleDetails();
            this.ManuelArticle      = this.ManuelArticle;



            // Navigation
            GoToAccueilCommand = new RelayCommand(
                o => true,
                o => OpenAccueil()
                );
            GoToListeArticlesCommand = new RelayCommand(
                o => true,
                o => OpenListeArticle()
                );
            GoToPageGestionnaireCommand = new RelayCommand(
                o => true,
                o => OpenPageGestionnaire()
                );
        }
예제 #5
0
        public ListeComptesViewModel(Window window, Models.Utilisateur client)
        {
            this._window = window;
            DBContext    = new DatabaseContext.GestionRelationClient_DBContext();

            this.Client    = client;
            this.nomClient = this.Client.Login;

            this._addedCompte = new Models.Compte();



            // Initialisation du compte
            ObservableCollection <Models.Compte> comptesATrouver = Models.Utilitaire.ToObservableCollection <Models.Compte>(DBContext.Comptes.Where(c => c.ClientId.Equals(Client.Id)));

            if (comptesATrouver == null)
            {
                this.Comptes = new ObservableCollection <Models.Compte>();
            }
            else
            {
                this.Comptes = comptesATrouver;
            }



            // Inscription
            AjoutCompteCommand = new RelayCommand(
                o => _isValid_addedCompte,
                o => AddCompte()
                );

            // Sélection compte
            SelectionnerCompteCommand = new RelayCommand(
                o => (p_SelectedItem != null),
                o => SelectionnerCompte()
                );

            // Navigation
            GoToAccueilCommand = new RelayCommand(
                o => true,
                o => OpenAccueil()
                );
            GoToModificationClientCommand = new RelayCommand(
                o => true,
                o => OpenModificationClient()
                );
            GoToListeCompteClientCommand = new RelayCommand(
                o => true,
                o => OpenListeCompteClient(this.Client)
                );
        }
예제 #6
0
        public AchatArticleDetailViewModel(Window window, int idCompte, int idArticle)
        {
            this._window = window;
            DBContext    = new DatabaseContext.GestionRelationClient_DBContext();



            this.IdCompte = idCompte;
            this.Article  = DBContext.Articles.Where(a => (a.Id.Equals(idArticle))).FirstOrDefault();

            this.NomArticle         = this.Article.Nom;
            this.ImageArticle       = this.Article.Image;
            this.TypeArticle        = this.Article.Type;
            this.PrixArticle        = this.Article.Prix + " $";
            this.DescriptionArticle = this.Article.GetArticleDetails();
            this.ManuelArticle      = this.ManuelArticle;



            // Navigation
            GoToAccueilCommand = new RelayCommand(
                o => true,
                o => OpenAccueil()
                );
            GoToModificationCompteCommand = new RelayCommand(
                o => true,
                o => OpenModificationCompte()
                );
            GoToPageCompteCommand = new RelayCommand(
                o => true,
                o => OpenPageClient()
                );
            GoToListeCompteClientCommand = new RelayCommand(
                o => true,
                o => OpenListeCompteClient()
                );
            GoToListeArticles = new RelayCommand(
                o => true,
                o => OpenListeArticles()
                );
            GoToPanier = new RelayCommand(
                o => true,
                o => OpenPanier()
                );
            AjouterArticlePanierCommand = new RelayCommand(
                o => true,
                o => AjouterArticlePanier()
                );
        }
예제 #7
0
        public GestionnaireViewModel(Window window)
        {
            _window   = window;
            DBContext = new DatabaseContext.GestionRelationClient_DBContext();

            _gestionnaires = new ObservableCollection <Models.Gestionnaire>();


            _addedGestionnaire      = new Models.Gestionnaire();
            _connectingGestionnaire = new Models.Gestionnaire();

            Roles = Models.Utilitaire.ToObservableCollection(DBContext.Roles);

            // On initialise le rôle sinon ça bug lors du test
            _addedGestionnaire.Role = new Models.Role()
            {
                Title = "Role bidon"
            };

            // Inscription
            InscriptionGestionnaireCommand = new RelayCommand(
                o => _isValid_addedGestionnaire,
                o => AddGestionnaire()
                );

            // Connexion
            ConnexionGestionnaireCommand = new RelayCommand(
                o => _isValid_connectingGestionnaire,
                o => Connectgestionnaire()
                );

            // Ajout rôle
            AjoutRoleCommand = new RelayCommand(
                o => (NouveauRole != null),
                o => AjoutRole()
                );


            // Navigation
            GoToGestionnaireInscription = new RelayCommand(
                o => true,
                o => OpenGestionnaireInscription()
                );
            GoToGestionnaireConnexion = new RelayCommand(
                o => true,
                o => OpenGestionnaireConnexion()
                );
        }
예제 #8
0
        public PageCompteClientViewModel(Window window, int idCompte)
        {
            this._window = window;
            DBContext    = new DatabaseContext.GestionRelationClient_DBContext();


            this.Compte = DBContext.Comptes.Where(c => (c.CompteId.Equals(idCompte))).FirstOrDefault();

            this.Client = DBContext.Utilisateurs.Where(c => (c.Id.Equals(this.Compte.ClientId))).FirstOrDefault();


            this.NomClient = this.Client.Login;
            this.NomCompte = this.Compte.NomCompte;



            // Modification nom Compte
            ModificationNomCompteCommand = new RelayCommand(
                o => InformationsModificationNomCompteValides(),
                o => ModifieNomClient(LoginModificationCompte, MotDePasseModificationCompte, NouveauNomModificationCompte)
                );

            // Navigation
            GoToAccueilCommand = new RelayCommand(
                o => true,
                o => OpenAccueil()
                );
            GoToModificationCompteCommand = new RelayCommand(
                o => true,
                o => OpenModificationCompte()
                );
            GoToListeCompteClientCommand = new RelayCommand(
                o => true,
                o => OpenListeCompteClient()
                );
            GoToListArticleCommand = new RelayCommand(
                o => true,
                o => OpenListeArticle()
                );
            GoToPanierCommand = new RelayCommand(
                o => true,
                o => OpenPanier()
                );
        }
        public AchatArticleViewModel(Window window, int idCompte)
        {
            this._window = window;
            DBContext    = new DatabaseContext.GestionRelationClient_DBContext();

            this.Compte = DBContext.Comptes.Where(c => (c.CompteId.Equals(idCompte))).FirstOrDefault();

            // Pour l'instant, on ne s'embète pas à ne pas afficher les article qu'à déjà l'utilisateur


            this.Articles = Models.Utilitaire.ToObservableCollection(DBContext.Articles);



            // Navigation
            GoToAccueilCommand = new RelayCommand(
                o => true,
                o => OpenAccueil()
                );
            GoToModificationCompteCommand = new RelayCommand(
                o => true,
                o => OpenModificationCompte()
                );
            GoToListeComptesClientCommand = new RelayCommand(
                o => true,
                o => OpenListeCompteClient()
                );
            SelectionnerCompteCommand = new RelayCommand(
                o => true,
                o => OpenDetailsArticle()
                );
            GoToPageCompteCommand = new RelayCommand(
                o => true,
                o => OpenPageClient()
                );
            GoToPanierCommand = new RelayCommand(
                o => true,
                o => OpenPanier()
                );
        }
예제 #10
0
        public AjoutArticleViewModel(Window window, int idGestionnaire)
        {
            this._window = window;
            DBContext    = new DatabaseContext.GestionRelationClient_DBContext();

            this.Gestionnaire = DBContext.Utilisateurs.Where(u => (u.Id.Equals(idGestionnaire))).FirstOrDefault();


            // Service à ajouter, on ne gère pas encore les abonnements donc on lui affecte celui par défaut ; on lui affecte aussi un panier bidon
            this._addedService = new Models.Service()
            {
                AbonnementId = 1,
                PanierId     = 1
            };
            // Produit à ajouter, on ne gère pas encore les abonnements donc on lui affecte celui par défaut ; on lui affecte aussi un panier bidon
            this._addedProduit = new Models.Produit()
            {
                AbonnementId = 1,
                PanierId     = 1,
                //StockId = // On ne peut pas récupérer le stock Id puisque il n'est que dans la table Gestionnaire, hors nous n'avons accès qu'à la table Utilisateur
            };

            // Navigation
            GoToAccueilCommand = new RelayCommand(
                o => true,
                o => OpenAccueil()
                );
            GoToPageGestionnaireCommand = new RelayCommand(
                o => true,
                o => OpenPageGestionnaire()
                );
            AjouterServiceCommand = new RelayCommand(
                o => _isValid_addedService,
                o => AddService()
                );
            AjouterProduitCommand = new RelayCommand(
                o => _isValid_addedProduit,
                o => AddProduit()
                );
        }
        public PanierViewModels(Window window, int idCompte)
        {
            this._window = window;
            DBContext    = new DatabaseContext.GestionRelationClient_DBContext();

            this.Panier = DBContext.Paniers.Where(p => (p.CompteId.Equals(idCompte))).FirstOrDefault();

            this.Articles = Models.Utilitaire.ToObservableCollection(DBContext.Articles.Where(a => (a.PanierId.Equals(this.Panier.PanierId))));

            this.ValeurTotale = "Valeur totale : " + this.Panier.getPrixTotal() + " $";



            // Navigation
            GoToAccueilCommand = new RelayCommand(
                o => true,
                o => OpenAccueil()
                );
            GoToModificationCompteCommand = new RelayCommand(
                o => true,
                o => OpenModificationCompte()
                );
            GoToPageCompteCommand = new RelayCommand(
                o => true,
                o => OpenPageClient()
                );
            GoToListeComptesClient = new RelayCommand(
                o => true,
                o => OpenListeCompteClient()
                );
            GoToListeArticle = new RelayCommand(
                o => true,
                o => OpenListeArticle()
                );
            SelectionnerArticleCommand = new RelayCommand(
                o => true,
                o => OpenDetailsArticle()
                );
        }