Beispiel #1
0
        //public static void DisplayOwnerMenu()
        //{
        //    while (true)
        //    {

        //        Console.WriteLine("Welcome to Marvelous Magic (Owner)");
        //        Console.WriteLine("==========================");
        //        Console.WriteLine("1. Display ALl Stock Requests");
        //        Console.WriteLine("2. Display Owner Inventory");
        //        Console.WriteLine("3. Reset Inventory Item Stock");
        //        Console.WriteLine("4. Return to Main Menu");
        //        Console.WriteLine("Enter an option:");

        //        var input = Console.ReadLine();

        //        check if the input valid
        //        if (!int.TryParse(input, out var option) || option < 1 || option > 3)
        //        {
        //            Console.WriteLine("Invalid input.");
        //            Console.WriteLine();
        //            continue;
        //        }

        //        switch (input)
        //        {
        //            case "1":
        //                DisplayAllStock();
        //                break;
        //            case "2":
        //                DisplayOwnerInventory();
        //                break;
        //            case "3":
        //                ResetInventoryItemStock();
        //                break;
        //            case "4":
        //                return;
        //            default:
        //                Console.WriteLine("Invalid Choice");
        //                break;
        //        }
        //    }
        //}

        //private static void ResetInventoryItemStock()
        //{
        //    throw new NotImplementedException();
        //}

        //private static void DisplayOwnerInventory()
        //{
        //    throw new NotImplementedException();
        //}

        //private static void DisplayAllStock()
        //{
        //    throw new NotImplementedException();
        //}

        //2. Franchisee Menu
        //Retrieves Store List for user to locate, takes in user input
        //3 Franchise Holder Options: Display Inventory, Stock Request (Threshold), Add New Inventory Item
        public static void DisplayFranchiseMenu()
        {
            var f = new FranchiseHolder();
            var s = new Store();

            s.GetStoreList();

            Console.WriteLine("Enter your store to use: ");
            var storeID = Int32.Parse(Console.ReadLine());

            Store.StoreFranchise storeLocation = (Store.StoreFranchise)storeID;

            while (true)
            {
                Console.WriteLine($"\nWelcome to Marvelous Magic (Retail - {storeLocation})");
                Console.WriteLine("==========================");
                Console.WriteLine("1. Display Inventory");
                Console.WriteLine("2. Stock Request (Threshold)");
                Console.WriteLine("3. Add New Inventory Item");
                Console.WriteLine("4. Return to Main Menu\n");
                Console.WriteLine("Enter an option:\n");

                var input = Console.ReadLine();

                switch (input)
                {
                case "1":
                    f.checkStoreInventory(storeID);
                    break;

                case "2":
                    //OPTION 2 - STEP 1: View Stock Request Threshold - requires user input for threshold amount
                    Console.WriteLine("\nEnter threshold for re-stocking: ");
                    var v = Int32.Parse(Console.ReadLine());
                    f.getStockThreshold(v, storeID);
                    break;

                case "3":
                    f.checkOwnerItem(storeID);
                    break;

                case "4":
                    return;

                default:
                    Console.WriteLine("Invalid Choice \n");
                    break;
                }
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            /*
             * var dm = DataManager.GetDataManager();
             *
             * string ConnServer = dm.ConnectionString;
             *
             * var table = dm.fetchData("select * from store;", ConnServer);
             *
             *
             * foreach (DataRow row in table.Rows)
             * {
             *  Console.WriteLine("{0}\n{1}\n",
             *                    row["StoreID"],
             *                    row["Name"]);
             * }*/



            var admin = new FranchiseHolder();

            Console.WriteLine("Please input the store id: ");

            var storeId = Console.ReadLine();

            Console.WriteLine("Display the storeInventory list");
            //admin.checkOwnerItem(Int32.Parse(storeId)); //Exception: Column 'Name' does not belong to table .
            admin.checkStoreInventory(Int32.Parse(storeId));

            Console.WriteLine("Please input the product you want to increase: ");

            var productID = Console.ReadLine();

            admin.addStockRequest(Int32.Parse(productID), 10, Int32.Parse(storeId));

            Console.WriteLine("\nOwner: I would like to see my Inventory.\n");

            Owner.checkOwnerInventory();

            Console.WriteLine("\nOwner: I would like to see all the stock request.\n");

            Owner.getStockRequestTable();
            Owner.displayOwnerRequest();

            Console.WriteLine("Please input the reqeust id you want to process: ");

            var rId = Console.ReadLine();

            Owner.processRequest(Int32.Parse(rId));
            Owner.deleteRequest(Int32.Parse(rId));

            /*
             * foreach (Owner.OwnerRequest temp in Owner.displayedRequest)
             * {
             *  Console.WriteLine("{0} {1} {2} {3} {4} {5}\n",
             *                            temp.request.requestID,
             *                            temp.request.storeID,
             *                            temp.productName,
             *                            temp.request.requestQuantity,
             *                            temp.currentOwnerStock,
             *                            temp.availability);
             *
             * }*/
            //Exception: Column 'StockRequesetID' does not belong to table Table.
            //Owner.getStockRequestTable();

            /* test the fetchData() work well
             * string query = "select * from StockRequest;";
             *
             *
             * string Connection = DataManager.GetDataManager().ConnectionString;
             *
             * var table = DataManager.GetDataManager().fetchData(query, Connection);
             *
             * foreach (DataRow row in table.Rows)
             * {
             *  Console.WriteLine("{0} {1} {2} {3}\n",
             *                    row["StockRequestID"],
             *                    row["StoreID"],
             *                    row["ProductID"],
             *                    row["Quantity"]);
             * } */

            /*
             * Console.WriteLine("Please input the store id: ");
             *
             * var id2 = Console.ReadLine();
             * Console.WriteLine("2- East Melbourne");
             *
             * admin.checkStoreInventory(Int32.Parse(id2)); */

            /*
             * Owner.checkOwnerInventory();
             *
             * Console.WriteLine("Please enter the productID:"); */
            /*
             * var productID = Console.ReadLine();
             * Owner.resetTo20(Int32.Parse(productID)); */
        }