Exemplo n.º 1
0
        public static void MainAddNewProduct()
        {
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("Please follow the next instructions to add a new record to Shop's Database.\n");
            ConnectDB conection_DB = new ConnectDB();

            PrintAvailableTables(conection_DB.GetTableNamesFromDb());

            string table_name1 = CMSmenuView.GetTableName();

            List <string> newEntryData = CMSmenuView.GetEntryToDbInput(table_name1, new List <string>()
            {
                "name",
                "division",
                "brigade",
                "battalion",
                "quantity",
                "unit",
                "status",
                "price"
            });

            Product productToBeAdded = new Product(newEntryData[0],
                                                   newEntryData[1],
                                                   newEntryData[2],
                                                   newEntryData[3],
                                                   Int16.Parse(newEntryData[4]),
                                                   newEntryData[5],
                                                   newEntryData[6].ToUpper(),
                                                   float.Parse(newEntryData[7]));

            conection_DB.AddProduct(table_name1, productToBeAdded);
            Console.ReadKey();
        }
Exemplo n.º 2
0
        public static void PreviewAllItemsInStock()
        {
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("Please follow the next instructions to add a new record to Shop's Database.\n");
            ConnectDB conection_DB_100 = new ConnectDB();

            PrintAvailableTables(conection_DB_100.GetTableNamesFromDb());
            string        tableName      = CMSmenuView.GetTableName();
            List <string> columnsToQuery = conection_DB_100.GetColumnNamesFromTable(tableName);

            conection_DB_100.ReadTable(tableName, new List <string>()
            {
                "name", "division", "status"
            });
            Console.ReadKey();
        }
Exemplo n.º 3
0
        public static void SearchInStock()
        {
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("Display specific tables, columns or products\n");
            ConnectDB conection_DB5 = new ConnectDB();

            PrintAvailableTables(conection_DB5.GetTableNamesFromDb());
            string table_name5 = CMSmenuView.GetTableName();

            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.Write("\nEnter a letter or word: ");
            Console.ResetColor();
            string frag_cond = Console.ReadLine();

            conection_DB5.SearchInTable(table_name5, frag_cond);
            Console.ReadKey();
        }