public void Populate() { string name = "Harry Potter and the Philosopher's Stone"; string cast = "Daniel Radcliffe"; string director = "Chris Columbus"; int runtime = 159; Movie.GenreType genre = Movie.GenreType.Adventure; Movie.ClassificationType classification = Movie.ClassificationType.ParentalGuidance; DateTime date = new DateTime(2001, 11, 16); int copies = 6; movieBST.Insert(new Movie(name, cast, director, runtime, genre, classification, date, copies)); name = "Harry Potter and the Chamber of Secrets"; runtime = 161; date = new DateTime(2002, 11, 15); movieBST.Insert(new Movie(name, cast, director, runtime, genre, classification, date, copies)); name = "Harry Potter and the Prisoner of Azkaban"; runtime = 142; director = "Alfonso Cuaron"; date = new DateTime(2004, 5, 31); movieBST.Insert(new Movie(name, cast, director, runtime, genre, classification, date, copies)); name = "Harry Potter and the Goblet of Fire"; runtime = 157; director = "Mike Newell"; classification = Movie.ClassificationType.Mature; date = new DateTime(2005, 11, 18); movieBST.Insert(new Movie(name, cast, director, runtime, genre, classification, date, copies)); name = "Harry Potter and the Order of the Phoenix"; runtime = 138; director = "David Yates"; date = new DateTime(2007, 7, 12); movieBST.Insert(new Movie(name, cast, director, runtime, genre, classification, date, copies)); name = "Harry Potter and the Half-Blood Prince"; runtime = 153; date = new DateTime(2009, 7, 15); movieBST.Insert(new Movie(name, cast, director, runtime, genre, classification, date, copies)); name = "Harry Potter and the Deathly Hallows: Part 1"; runtime = 147; date = new DateTime(2010, 11, 19); movieBST.Insert(new Movie(name, cast, director, runtime, genre, classification, date, copies)); name = "Harry Potter and the Deathly Hallows: Part 2"; runtime = 130; date = new DateTime(2011, 7, 15); movieBST.Insert(new Movie(name, cast, director, runtime, genre, classification, date, copies)); }
/// <summary> /// Displays the Staff menu options until the user enters '0' /// </summary> public static void ShowStaffMenu() { string staffMenu = "Staff Menu".PadLeft(90, '=').PadRight(180, '=') + "\n 1.\t Add a new movie" + "\n 2.\t Remove a movie" + "\n 3.\t Register a new Member" + "\n 4.\t Find a registered member's phone number" + "\n 0.\t Return to main menu" + "\n".PadRight(180, '=') + "\n\nPlease make a selection (1-4, or 0 to return to main menu)\n"; string input = ""; while (input != "0") { input = ""; Console.Clear(); Console.WriteLine(staffMenu); input = Console.ReadLine(); if (input == "0") { //exit break; } else if (input == "1") { //add a movie to the library string input2 = ""; while (input2 != "0") { Console.Clear(); Console.WriteLine("Add a new movie".PadLeft(90, '=').PadRight(180, '=')); Console.Write("Please enter the title of the movie you wish to add, or enter '0' to exit:\n\t"); input2 = Console.ReadLine(); if (input2 == "0") { break; } else { Console.Write("Who directed the movie:\n\t"); string director = Console.ReadLine(); Console.Write("Who was the lead actor/actress:\n\t"); string starring = Console.ReadLine(); Console.Write("How long is the movie in minutes:\n\t"); int runtime = int.Parse(Console.ReadLine()); Console.WriteLine("Genres:"); string[] genrePossibilities = Enum.GetNames(typeof(Movie.GenreType)); for (int i = 0; i < genrePossibilities.Length; i++) { Console.WriteLine("\t" + (i + 1) + ". " + genrePossibilities[i]); } Console.Write("Please select the genre from the options above (1-9):\n\t"); int genreNumber = int.Parse(Console.ReadLine()); Movie.GenreType genre = (Movie.GenreType)(genreNumber - 1); Console.WriteLine(genre); string[] classificationPossibilities = Enum.GetNames(typeof(Movie.ClassificationType)); for (int i = 0; i < classificationPossibilities.Length; i++) { Console.WriteLine("\t" + (i + 1) + ". " + classificationPossibilities[i]); } Console.Write("Please select the classification from the options above (1-4):\n\t"); int classificationNumber = int.Parse(Console.ReadLine()); Movie.ClassificationType classification = (Movie.ClassificationType)(classificationNumber - 1); Console.WriteLine(classification); Console.Write("What is the year of release (yyyy):\n\t"); int dateYear = int.Parse(Console.ReadLine()); Console.Write("What is the month of release (mm):\n\t"); int dateMonth = int.Parse(Console.ReadLine()); Console.Write("What is the date of release (dd):\n\t"); int dateDate = int.Parse(Console.ReadLine()); DateTime date = new DateTime(dateYear, dateMonth, dateDate); Console.Write("How many copies does the library own:\n\t"); int copies = int.Parse(Console.ReadLine()); Movie movie = new Movie(input2, starring, director, runtime, genre, classification, date, copies); movieCollection.AddMovie(movie); Console.Clear(); Console.WriteLine("Added " + movie.GetTitle()); input2 = "0"; Console.ReadKey(); } } } else if (input == "2") { //Remove a movie from the library string input2 = ""; while (input2 != "0") { Console.Clear(); Console.WriteLine("Remove a movie".PadLeft(90, '=').PadRight(180, '=')); Console.Write("What is the title of the movie you want to remove:\n\t"); input2 = Console.ReadLine(); if (input2 == "0") { break; } else { Movie movie = movieCollection.SearchMovie(input2); if (movie != null) { //is this the movie you mean Console.Clear(); Console.WriteLine("Remove a movie".PadLeft(90, '=').PadRight(180, '=')); Console.WriteLine(movie.DisplayMovie()); Console.WriteLine("".PadRight(180, '=') + "\n 1.\t Yes, this is the movie i want to remove" + "\n 2.\t No, i want to search again" + "\n 0.\t Return to menu" + "\n".PadRight(180, '=') + "\n\nPlease make a selection (1-2, or 0 to return to main menu)\n"); string response = Console.ReadLine(); if (response == "0") { //user wishes to exit break; } else if (response == "1") { //delete the movie if (movie.notBeingRented()) { Console.Clear(); Console.WriteLine("Remove the the movie"); movieCollection.RemoveMovie(movie); input2 = "0"; Console.Read(); } else { Console.Clear(); Console.WriteLine("Sorry, that movie is currently being rented so it cannot be deleted. :("); Console.ReadKey(); } } else if (response == "2") { //the given movie is incorrect Console.Clear(); Console.WriteLine("Don't delete this movie"); Console.ReadKey(); } else { ShowWrongInput(); } } else { //no movie exists } } } } else if (input == "3") { //Register a new member string input2 = ""; while (input2 != "0") { Console.Clear(); Console.WriteLine("Register a new Member".PadLeft(90, '=').PadRight(180, '=')); Console.Write("Please enter the first name of the member you wish to add, or enter '0' to exit:\n\t"); input2 = Console.ReadLine(); if (input2 == "0") { break; } else { Console.Write("What is their last name:\n\t"); string last = Console.ReadLine(); Console.Write("What is their address:\n\t"); string address = Console.ReadLine(); Console.Write("What is their phone number:\n\t"); string phone = Console.ReadLine(); Console.Write("Please ask the new member to enter a four diget password:\n\t"); string password = Console.ReadLine(); memberCollection.AddMember(input2, last, address, phone, password); Console.Clear(); Console.WriteLine("Welcome to the library, " + input2); input2 = "0"; Console.ReadKey(); } } } else if (input == "4") { //Find the phone number of a member string input2 = ""; while (input2 != "0") { Console.Clear(); Console.WriteLine("Find a registered member's phone number".PadLeft(90, '=').PadRight(180, '=')); Console.Write("Please enter the first name of the member you wish to add, or enter '0' to exit:\n\t"); input2 = Console.ReadLine(); if (input2 == "0") { break; } else { Console.Write("What is their last name:\n\t"); string last = Console.ReadLine(); string phone = memberCollection.FindPhone(input2, last); Console.Clear(); Console.WriteLine(input2 + "'s phone number is: " + phone); input2 = "0"; Console.ReadKey(); } } } else { //Input unrecognised ShowWrongInput(); } } }