예제 #1
0
        static void Main(string[] args)
        {
            Console.Clear();
            MemberCollection MemberCollection = new MemberCollection();

            MemberCollection.PreMadeMembers();
            MovieCollection MovieCollection = new MovieCollection();

            MovieCollection.PreMadeMovies();
            Menus.MainMenu();
        }
예제 #2
0
        //Member Menu
        public static void MemberMenu()
        {
            MovieCollection  MovieCollection  = new MovieCollection();
            MemberCollection MemberCollection = new MemberCollection();
            Action           printMenu        = () =>
            {
                Console.WriteLine("1. Display all movies");
                Console.WriteLine("2. Borrow a movie DVD");
                Console.WriteLine("3. Return a movie DVD");
                Console.WriteLine("4. List current borrowed movie DVDs");
                Console.WriteLine("5. Display top 10 most popular movies");
                Console.WriteLine("0. Return to the main menu");
            };

            Console.WriteLine("\n===========Member Menu==========");
            printMenu();
            Console.WriteLine("================================");
            Console.WriteLine(" \n Please make a selection (1-5," +
                              " or 0 to return to the main menu) ");

            int choice = GetUserChoice(printMenu, 6);

            if (choice == 0)
            {
                MainMenu();
            }
            switch (choice)
            {
            case 1:
                MovieCollection.DisplayAllMovies();
                Console.WriteLine("\n\nPress any key to go back to members menu");
                Console.ReadKey();
                MemberMenu();
                break;

            case 2:
                MemberCollection.CheckerIfMemberHasMoreThan10Borrow
                    (MemberCollection.FindMember(currentUserName));
                MovieCollection.DisplayAllMovies();
                Console.WriteLine("\n\n=========Borrow a movie DVD========");
                Console.Write("Enter the title of the movie you want to borrow: ");
                string title = Console.ReadLine();
                MemberCollection.BorrowMovie(MemberCollection.FindMember(currentUserName),
                                             MovieCollection.FindMovie(title));
                Console.ReadKey();
                MemberMenu();
                break;

            case 3:
                Console.WriteLine("==========Return a movie DVD=============");
                Console.Write("Enter the title of the movie you want to return: ");
                title = Console.ReadLine();
                MemberCollection.ReturnBorrowedMovie(MemberCollection.FindMember(currentUserName), MovieCollection.FindMovie(title));
                Console.ReadKey();
                MemberMenu();
                break;

            case 4:
                Console.WriteLine("========Currently borrowed movies=========");
                MemberCollection.CurrentBorrowedMovie(MemberCollection.FindMember(currentUserName));
                Console.ReadKey();
                MemberMenu();
                break;

            case 5:
                Console.WriteLine("=============Top 10 movies==========");
                MovieCollection.DisplayTop10();
                Console.ReadKey();
                MemberMenu();
                break;

            case 0:
                MainMenu();
                break;
            }
        }
예제 #3
0
        //Staff Menu
        public static void StaffMenu()
        {
            MemberCollection MemberCollection = new MemberCollection();
            MovieCollection  MovieCollection  = new MovieCollection();

            //Creating the staff menu option
            Action printMenu = () =>
            {
                Console.WriteLine("1. Add a new movie DVD");
                Console.WriteLine("2. Remove a movie DVD");
                Console.WriteLine("3. Register a new Member");
                Console.WriteLine("4. Find a registered member's phone number");
                Console.WriteLine("5. Display member info");     //TODO: Delete after
                Console.WriteLine("0. Return to the main menu");
            };

            Console.WriteLine("\n===========Staff Menu==========");
            printMenu();
            Console.WriteLine("================================");
            Console.WriteLine(" \n Please make a selection (1-5," +
                              " or 0 to return to the main menu) "); //TODO: Change from 5 to 4 after testing

            int choice = GetUserChoice(printMenu, 6);

            if (choice == 0)
            {
                Console.WriteLine("");
                MainMenu();
            }
            switch (choice)
            {
            case 1:     //Add movie
                MovieCollection.AddMovie();
                Console.WriteLine("\nPress any key to go back to staff menu");
                Console.ReadKey();
                StaffMenu();
                break;

            case 2:     //Remove movie
                MovieCollection.RemoveMovie();
                Console.WriteLine("\nPress any key to go back to staff menu");
                Console.ReadKey();
                StaffMenu();
                break;

            case 3:     //Add new member
                MemberCollection.AddMember();
                Console.WriteLine("\nPress any key to go back to staff menu");
                Console.ReadKey();
                StaffMenu();
                break;

            case 4:    //Find member phone number from their name
                MemberCollection.FindMemberContactPhoneNumber();
                StaffMenu();
                break;

            case 5:    //Show all of the members info
                MemberCollection.DisplayAllMembersInfo();
                StaffMenu();
                break;
            }
        }