Ejemplo n.º 1
0
        internal void Run()
        {
            // String permettant de choisir le sous-menu ou de quitter
            string userEntry;

            // Affichage message d'accueil
            Display.Welcome();

            do
            {
                Display.MainMenu();
                userEntry = UserEntry.GetAnswerString().ToUpper();
                switch (userEntry)
                {
                case "CLI":
                    ClientMenu clientMenu = new ClientMenu();
                    clientMenu.Run();
                    break;

                case "CMD":
                    CommandMenu commandMenu = new CommandMenu();
                    commandMenu.Run();
                    break;

                case "PRD":
                    ProductMenu productMenu = new ProductMenu();
                    productMenu.Run();
                    break;

                case "STK":
                    StockMenu stockMenu = new StockMenu();
                    stockMenu.Run();
                    break;

                case "QUIT":
                    break;

                default:
                    Display.NoEntry();
                    break;
                }
            } while (userEntry != "QUIT");

            Display.Byebye();
        }
Ejemplo n.º 2
0
        private void AddClient()
        {
            Console.WriteLine("Entrez un nom de client");
            string clientName = UserEntry.GetAnswerString();

            Console.WriteLine("Entrez un email");
            string clientEmail = UserEntry.GetAnswerString();

            if (String.IsNullOrEmpty(clientName.Trim()) || String.IsNullOrEmpty(clientEmail.Trim()))
            {
                Console.WriteLine("Entrées invalides");
            }
            else
            {
                SQLRequestsClients.AddClient(new Client {
                    ClientName = clientName, ClientEmail = clientEmail
                });
            }
        }
Ejemplo n.º 3
0
        private void AddCommand()
        {
            listClients = SQLRequestsClients.ListClients();
            Display.DisplayListClients(listClients);
            listStock = SQLRequestsStock.ListStock();
            Display.DisplayListStock(listStock);

            Console.WriteLine("\tCréation d'une commande\t");
            Console.WriteLine("Vous allez créer une commande");
            Console.Write("ID Client : ");
            int clientID = UserEntry.GetAnswerInt();

            Console.Write("ID Produit : ");
            int productID = UserEntry.GetAnswerInt();

            Console.Write("Quantité Produit : ");
            int productQuantity = UserEntry.GetAnswerInt();

            Console.Write("Adresse commande : ");
            string commandAddress = UserEntry.GetAnswerString();
        }
Ejemplo n.º 4
0
        private void ModifyClient()
        {
            ListClient();
            Console.WriteLine("Quel utilisateur voulez-vous modifier (ID) ?");
            int userID = UserEntry.GetAnswerInt();

            Console.WriteLine("Entrez un nouveau nom de client");
            string clientName = UserEntry.GetAnswerString();

            Console.WriteLine("Entrez un nouvel email");
            string clientEmail = UserEntry.GetAnswerString();

            if (String.IsNullOrEmpty(clientName.Trim()) || String.IsNullOrEmpty(clientEmail.Trim()))
            {
                Console.WriteLine("Entrées invalides");
            }
            else
            {
                SQLRequestsClients.ModifyClient(userID, clientName, clientEmail);
            }
        }
Ejemplo n.º 5
0
        private void ModQuantity()
        {
            listStock = SQLRequestsStock.ListStock();
            Display.DisplayListStock(listStock);
            Console.WriteLine("Entrez l'ID du produit dont vous voulez modifier la quantité");
            int productID = UserEntry.GetAnswerInt();

            Stock stock = SQLRequestsStock.GetStock(productID);

            if (stock != null)
            {
                Console.WriteLine("Entrez la modification sur la quantité");
                Console.WriteLine("!!!\tSi vous dépassez le zéro, la quantité sera mise à zéro\t!!!");
                int quantity     = UserEntry.GetAnswerInt();
                int new_quantity = stock.ProductQuantity + quantity;
                new_quantity = (new_quantity < 0) ? 0 : new_quantity;

                SQLRequestsStock.ChangeStock(productID, new_quantity);
            }
            else
            {
                Console.WriteLine("Ce stock n'existe pas.");
            }
        }