Exemplo n.º 1
0
        private void MainMenu()
        {
            Console.WriteLine(" ");
            Console.WriteLine("----------------Staff Menu----------------\r");
            Console.WriteLine("Choose a function from the following options:");
            Console.WriteLine("\t1 - Display all Movie DVDs");
            Console.WriteLine("\t2 - Display all Movie DVDs of a specefic genre");
            Console.WriteLine("\t3 - Add a new Movie DVD");
            Console.WriteLine("\t4 - Rent out or return a Movie DVD");
            Console.WriteLine("\t5 - Logout and return to main menu");
            Console.WriteLine("\tn - Close the app");
            Console.Write("\r\nSelect an option and press Enter key: ");

            switch (Console.ReadLine())
            {
            case "n":
                appStatus = false;
                break;

            case "1":
                displayMenu = false;
                DVDCollection.displayAll();
                //DVDCollection.displayLibrary();
                displayMenu = true;
                break;

            case "2":
                displayMenu  = false;
                displayMovie = true;
                break;

            case "3":
                Console.WriteLine("--------Add a Movie DVD--------");
                Console.Write("Title: ");
                string titleInput = Console.ReadLine();
                Console.Write("Starring: ");
                string starringInput = Console.ReadLine();
                Console.Write("Director: ");
                string directorInput = Console.ReadLine();
                Console.Write("Duration: ");
                float durationInput = float.Parse(Console.ReadLine());
                Console.Write("Genre: ");
                string genreInput = Console.ReadLine();                 //TODO: need to add a function, which will allow the admin to choose the genre i.e. 1 = drama, 2= blah...
                Console.Write("Classification: ");
                string classificationInput = Console.ReadLine();
                Console.Write("Release Date (DD): ");
                int dateInput = int.Parse(Console.ReadLine());
                Console.Write("Release Month (MM): ");
                int monthInput = int.Parse(Console.ReadLine());
                Console.Write("Release Year (YYYY): ");
                int yearInput = int.Parse(Console.ReadLine());
                DVD newDVD    = new DVD(titleInput, starringInput, directorInput, durationInput, genreInput, classificationInput, dateInput, monthInput, yearInput);
                DVDCollection.insertDVD(newDVD);
                break;

            case "4":
                displayMenu     = false;
                displayBorrower = true;
                break;

            case "5":
                staff.changeLogInStatus(false);
                displayLogin = true;
                displayMenu  = false;
                break;
            }
        }
Exemplo n.º 2
0
        private BTreeNode right; // reference to its right child

        public BTreeNode(DVD dvd)
        {
            this.dvd = dvd;
            left     = null;
            right    = null;
        }
Exemplo n.º 3
0
        public void LendMovie()
        {
            Console.Clear();
            Console.WriteLine("------------------Lend a Movie------------------\r");
            Console.WriteLine("Title of the movie that customer wants to borrow:");
            string movieTitleInput = Console.ReadLine();

            //check if there is a movie with the inputed title.
            if (DVDCollection.searchMyCollection(movieTitleInput) != null)
            {
                Console.WriteLine("Customer First Name:");
                string firstNameInput = Console.ReadLine();
                Console.WriteLine("Customer Last Name:");
                string lastNameInput = Console.ReadLine();
                Console.WriteLine("Customer Contact Number:");
                string phoneInput = Console.ReadLine();

                //check if movie with that title exists. else tell inform that movie doesnt exist.
                //check if customer with those details exist -> append just the borrower's DVDArr
                //else if no customer exist -> add details with the movie to borrowerArr


                //the dvd that will be added to the borrower's DVDArr.
                DVD movieBorrowed = DVDCollection.searchMyCollection(movieTitleInput);
                Console.WriteLine(movieBorrowed.getTitle());

                Borrower customer = new Borrower(firstNameInput, lastNameInput, phoneInput, new DVD[10]);

                //check if borrower's details already exist in DVDCollection
                if (DVDCollection.checkBorrower(customer) != 100)
                {
                    Console.WriteLine(DVDCollection.checkBorrower(customer));
                    DVDCollection.appendBorrowerMovie(DVDCollection.getBorrower(DVDCollection.checkBorrower(customer)),
                                                      movieTitleInput);
                }
                //else add the customer to the management system and
                //then add the movie to that customers borrowed movies array.
                else
                {
                    DVDCollection.addBorrower(customer);
                    DVDCollection.appendBorrowerMovie(customer, movieTitleInput);
                    Console.WriteLine();
                    Console.WriteLine("Customer has been added. Press enter to continue.");
                    Console.ReadLine();
                }
                //check if borrower exists

                /* if (DVDCollection.checkBorrower(customer) != 100)
                 * {
                 *  // append the movie of the borrower that exists in the datastructre.
                 *  DVDCollection.appendBorrowerMovie(
                 *      DVDCollection.getBorrower(DVDCollection.checkBorrower(customer)),
                 *      movieTitleInput);
                 * }
                 * //else add the customer to the management system and
                 * //then add the movie to that customers borrowed movies array.
                 * else
                 * {
                 *  DVDCollection.addBorrower(customer);
                 *  DVDCollection.appendBorrowerMovie(customer, movieTitleInput);
                 * }*/
                displayLendMovie = false;
                displayBorrower  = true;
            }

            /*foreach (Borrower oldCustomer in DVDCollection.getBorrowerArr()) // O(n)
             * {
             *  if (oldCustomer.getPhoneNum().CompareTo(contactInput) == 0) //as the phone number is unique
             *  {
             *
             *
             *      //oldCustomer.addMoreMovies(movieTitleInput);
             *  }
             *  else
             *  {
             *      DVDCollection.addBorrower(newBorrower);
             *      DVDCollection.addMovie(newBorrower, movieTitleInput);
             *  }
             * }*/
        }