示例#1
0
        public void Menu() //initializes all the classes and handles menu option input
        {
            bool         close      = false;
            Data         data       = new Data();
            FileReader   reader     = new FileReader(data);
            FileWriter   writer     = new FileWriter(data);
            ItemCheckOut checkout   = new ItemCheckOut(data);
            ItemReturn   returnItem = new ItemReturn(data);
            Dictionary <string, bool>           resources        = data.Resources;
            Dictionary <string, List <string> > studentCheckOuts = data.StudentCheckOuts;
            AdminMenu admin = new AdminMenu(data);

            while (close == false)
            {
                Console.Clear();
                PrintMenu();

                int    choice;
                string menuChoice = Console.ReadLine();
                Console.WriteLine();

                bool quitter = data.MenuQuitter(menuChoice);
                if (quitter == true)
                {
                    return;
                }

                bool result = int.TryParse(menuChoice, out choice);

                switch (choice)
                {
                case 1:
                    reader.ViewStudentList();
                    break;

                case 2:
                    reader.PrintAvailableResources();
                    break;

                case 3:
                    reader.PrintCheckedOutResources();
                    break;

                case 4:
                    reader.ViewStudentAccount();
                    break;

                case 5:
                    checkout.CheckOut();
                    break;

                case 6:
                    returnItem.ReturnItem();
                    break;

                case 7:
                    ClosingImage();
                    close = true;
                    break;

                /*
                 * case 8:
                 * admin.RunAdminMenu();
                 * break; */
                default:
                    continue;
                }
            }
        }
示例#2
0
        //initializes all the classes and handles menu option input
        public void Menu()
        {
            bool close = false;
            Data data = new Data();
            FileReader reader = new FileReader(data);
            FileWriter writer = new FileWriter(data);
            ItemCheckOut checkout = new ItemCheckOut(data);
            ItemReturn returnItem = new ItemReturn(data);
            Dictionary<string, bool> resources = data.Resources;
            Dictionary<string, List<string>> studentCheckOuts = data.StudentCheckOuts;
            AdminMenu admin = new AdminMenu(data);

            while (close == false)
            {
                Console.Clear();
                PrintMenu();

                int choice;
                string menuChoice = Console.ReadLine();
                Console.WriteLine();

                bool quitter = data.MenuQuitter(menuChoice);
                if (quitter == true)
                {
                    return;
                }

                bool result = int.TryParse(menuChoice, out choice);

                switch (choice)
                {
                    case 1:
                        reader.ViewStudentList();
                        break;
                    case 2:
                        reader.PrintAvailableResources();
                        break;
                    case 3:
                        reader.PrintCheckedOutResources();
                        break;
                    case 4:
                        reader.ViewStudentAccount();
                        break;
                    case 5:
                        checkout.CheckOut();
                        break;
                    case 6:
                        returnItem.ReturnItem();
                        break;
                    case 7:
                        ClosingImage();
                        close = true;
                        break;
                        /*
                    case 8:
                        admin.RunAdminMenu();
                        break; */
                    default:
                        continue;
                }
            }
        }