Ejemplo n.º 1
0
        //function to display the inventory of the store
        private void DisplayItems()
        {
            //if the store does not have any item, the operation will not be continued in order to prevent crash
            if (!FranchiseHolderManager.Items.Any())
            {
                Console.WriteLine("No items present at selected store.\n");
                return;
            }
            Console.WriteLine("Inventory\n");

            //using the shared function from customutilities class to display the item list
            CustomUtilities.DisplayItems(FranchiseHolderManager.Items);
        }
Ejemplo n.º 2
0
        //function to display owner's inventory
        private void DisplayAllItems()
        {
            Console.WriteLine("Owner Inventory\n");

            //if items from inventory cannot be fetched, the operation will not continue in order to prevent crash
            if (!OwnerManager.Items.Any())
            {
                Console.WriteLine("No items present.\n");
                return;
            }

            //using the shared function from customutilities class to display the item list
            CustomUtilities.DisplayItems(OwnerManager.Items);
        }
Ejemplo n.º 3
0
        //function to display all the store
        private void DisplayStores()
        {
            //if store list is empty, function will not preceed further
            if (!FranchiseHolderManager.Stores.Any())
            {
                Console.WriteLine("No stores present.\n");
                return;
            }
            Console.WriteLine("Stores\n");

            //using the shared function from customutilities class to display the store list
            CustomUtilities.DisplayStores(FranchiseHolderManager.Stores);
            Console.Write("Enter the store to use: ");
        }
Ejemplo n.º 4
0
        //function to display all stores
        private void DisplayStores()
        {
            //if store from inventory cannot be fetched/ empty, the operation will not be continued in order to prevent crash
            if (!FranchiseHolderManager.Stores.Any())
            {
                Console.WriteLine("No stores present.\n");
                return;
            }
            Console.WriteLine("Stores\n");

            //using the shared function from customutilities class to display the store list
            CustomUtilities.DisplayStores(FranchiseHolderManager.Stores);
            Console.Write("Enter the store to use: ");
        }
Ejemplo n.º 5
0
        //function to restock item for owner
        private void ResetStock()
        {
            Console.WriteLine("Reset Stock\nProduct stock will be reset to 20.\n");

            //if items from inventory cannot be fetched, the operation will not continue in order to prevent crash
            if (!OwnerManager.Items.Any())
            {
                Console.WriteLine("No items present.\n");
                return;
            }

            //using the shared function from customutilities class to display the item list
            CustomUtilities.DisplayItems(OwnerManager.Items);

            while (true)
            {
                Console.Write("Enter item ID to reset: ");
                var input = Console.ReadLine();
                Console.WriteLine();

                //if the user give a null input, then no request will be processed and the menu will go back to owner sub menu
                if (string.IsNullOrEmpty(input))
                {
                    break;
                }

                //if user entered a non-number a new input will be requested
                if (!int.TryParse(input, out var id))
                {
                    Console.WriteLine("Invalid input.\n");
                    continue;
                }

                //if user entered an id that is not on the current list and new input will be requested
                var item = OwnerManager.GetItem(id);
                if (item == null)
                {
                    Console.WriteLine("No such item.\n");
                    continue;
                }

                //input passed all conditions above and restock function will be called
                ResetStock(item);
                break;
            }
        }