Exemplo n.º 1
0
        public static void MainMenu(MemberCollection memberCollection, MovieCollection movieCollection)
        {
            Console.Clear();
            Console.WriteLine("Welcome to the Community Library\n"
                              + "============Main Menu===========\n"
                              + "1. Staff Login\n"
                              + "2. Member Login\n"
                              + "0. Exit\n"
                              + "================================\n"
                              + "Please make a selection (1-2, or 0 to exit): ");
            string response = Console.ReadLine();

            if (response == "1")
            {
                bool isLoggedIn = StaffLogin();
                if (isLoggedIn)
                {
                    StaffMenu staffMenu = new StaffMenu();
                    staffMenu.Menu(memberCollection, movieCollection);
                }
                else
                {
                    Console.WriteLine("Incorrect login, press any key to return to menu...");
                    Console.ReadLine();
                    MainMenu(memberCollection, movieCollection);
                }
            }
            else if (response == "2")
            {
                int memberIndex = MemberLogin(memberCollection);
                if (memberIndex != -1)
                {
                    MemberMenu memberMenu = new MemberMenu();
                    memberMenu.Menu(memberCollection, memberIndex, movieCollection);
                }
                else
                {
                    Console.WriteLine("Incorrect login, press any key to return to menu...");
                    Console.ReadLine();
                    MainMenu(memberCollection, movieCollection);
                }
            }
            else if (response == "0")
            {
                Environment.Exit(0);
            }
            else
            {
                Console.WriteLine("Invalid input, please make a selection (1-2, or 0 to exit.\n"
                                  + "Press enter to continue...");

                Console.ReadLine();
                MainMenu(memberCollection, movieCollection);
            }
        }
Exemplo n.º 2
0
        private static int MemberLogin(MemberCollection memberCollection)
        {
            Console.Clear();
            Console.WriteLine("==========Member Login==========\n"
                              + "Please enter your username (LastnameFirstname): ");
            string memberUser = Console.ReadLine();

            Console.WriteLine("Please enter your password: ");
            string memberPass  = Console.ReadLine();
            int    memberIndex = memberCollection.ValidateLogin(memberUser, memberPass);

            return(memberIndex);
        }
Exemplo n.º 3
0
        public void Menu(MemberCollection memberCollection, int memberIndex, MovieCollection movieCollection)
        {
            Console.Clear();
            Console.WriteLine("==========Member Menu===========\n"
                              + "1. Display all movies\n"
                              + "2. Borrow a movie DVD\n"
                              + "3. Return a movie DVD\n"
                              + "4. List current borrowed movie DVDs\n"
                              + "5. Display top 10 most popular movies\n"
                              + "0. Return to main menu\n"
                              + "================================\n"
                              + "Please make a selection (1-5, or 0 to exit): ");
            string response = Console.ReadLine();

            if (response == "1")
            {
                movieCollection.DisplayAll();
                Menu(memberCollection, memberIndex, movieCollection);
            }
            else if (response == "2")
            {
                BorrowDVD(memberCollection, memberIndex, movieCollection);
                Menu(memberCollection, memberIndex, movieCollection);
            }
            else if (response == "3")
            {
                ReturnDVD(memberCollection, memberIndex, movieCollection);
                Menu(memberCollection, memberIndex, movieCollection);
            }
            else if (response == "4")
            {
                DisplayBorrowed(memberCollection, memberIndex, movieCollection);
                Menu(memberCollection, memberIndex, movieCollection);
            }
            else if (response == "4")
            {
            }
            else if (response == "0")
            {
                Program.MainMenu(memberCollection, movieCollection);
            }
            else
            {
                Console.WriteLine("Invalid input, please make a selection (1-5, or 0 to return to main menu.\n"
                                  + "Press enter to continue...");
                Console.ReadLine();
                Menu(memberCollection, memberIndex, movieCollection);
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            MemberCollection memberCollection = new MemberCollection();
            MovieCollection  movieCollection  = new MovieCollection();

            //MemberCollection.memberCollection = new MemberCollection();

            PopulateMembersAndMovies(memberCollection, movieCollection);

            MainMenu(memberCollection, movieCollection);

            /*  Console.WriteLine("Creating new member......");
             * Member member = new Member();
             * member.RegisterMember();*/
        }
        public void Menu(MemberCollection memberCollection, MovieCollection movieCollection)
        {
            Console.Clear();
            Console.WriteLine("Welcome to the Community Library\n"
                              + "===========Staff Menu===========\n"
                              + "1. Add a new movie DVD\n"
                              + "2. Remove a movie DVD\n"
                              + "3. Register a new Member\n"
                              + "4. Find a registered member's phone number\n"
                              + "0. Return to main menu\n"
                              + "================================\n"
                              + "Please make a selection (1-4, or 0 to return to main menu): ");
            string response = Console.ReadLine();

            if (response == "1")
            {
                AddDVD(movieCollection);
                Menu(memberCollection, movieCollection);
            }
            else if (response == "2")
            {
                RemoveDVD(movieCollection);
                Menu(memberCollection, movieCollection);
            }
            else if (response == "3")
            {
                RegisterMember(memberCollection);
                Menu(memberCollection, movieCollection);
            }
            else if (response == "4")
            {
                FindMemberPhone(memberCollection);
                Menu(memberCollection, movieCollection);
            }
            else if (response == "0")
            {
                Program.MainMenu(memberCollection, movieCollection);
            }
            else
            {
                Console.WriteLine("Invalid input, please make a selection (1-4, or 0) to return to main menu.\n"
                                  + "Press enter to continue...");
                Console.ReadLine();
                Menu(memberCollection, movieCollection);
            }
        }
Exemplo n.º 6
0
        public void ReturnDVD(MemberCollection memberCollection, int memberIndex, MovieCollection movieCollection)
        {
            Console.WriteLine("Please enter the Movie TITLE: ");
            string movieTitle  = Console.ReadLine();
            bool   movieExists = movieCollection.MovieExists(movieTitle);

            if (movieExists)
            {
                memberCollection.members[memberIndex].ReturnDVD(movieTitle);
                memberCollection.members[memberIndex].NumDVDsBorrowed--;
                movieCollection.ReturnDVD(movieTitle);
            }
            else
            {
                Console.WriteLine("\n{0} is not in the catalog.\n"
                                  + "Press any key to return to menu...", movieTitle);
            }
        }
        public void RegisterMember(MemberCollection memberCollection)
        {
            Member newMember = new Member();

            newMember.RegisterMember();
            if (memberCollection.MemberAlreadyExists(newMember))
            {
                Console.WriteLine("\nMember already exists.\n"
                                  + "Please enter any key to return...");
                Console.ReadLine();
            }
            else
            {
                memberCollection.AddMember(newMember);
                Console.WriteLine("Member successfully registered.\n"
                                  + "Press any key to return to Staff Menu");
                Console.ReadLine();
            }
        }
        public void FindMemberPhone(MemberCollection memberCollection)
        {
            Console.WriteLine("Please enter member's FIRST and LAST name: ");
            string fullName    = Console.ReadLine();
            int    memberIndex = memberCollection.SearchMembers(fullName);

            if (memberIndex >= 0)
            {
                Console.WriteLine("The member {0}'s phone number is: {1}\n",
                                  fullName, memberCollection.members[memberIndex].ContactNumber);
                Console.WriteLine("Press any key to return to menu...");
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("Member {0} was unable to be found.\n", fullName);
                Console.WriteLine("Press any key to return to menu...");
                Console.ReadLine();
            }
        }
Exemplo n.º 9
0
        public static void PopulateMembers(MemberCollection memberCollection)
        {
            Member member = new Member();

            member.FirstName = "Anthony"; member.LastName = "Warden";
            member.FullName  = "Anthony Warden"; member.UserName = "******";
            member.Password  = "******"; member.ContactNumber = "0400123";
            member.Address   = "5 Flint Street";
            memberCollection.AddMember(member);
            Member member1 = new Member();

            member1.FirstName = "Jemma"; member1.LastName = "Cross";
            member1.FullName  = "Jemma Cross"; member1.UserName = "******";
            member1.Password  = "******"; member1.ContactNumber = "0475982";
            member1.Address   = "8 Crescent Court";
            memberCollection.AddMember(member1);
            Member member2 = new Member();

            member2.FirstName = "Mark"; member2.LastName = "Greenslope";
            member2.FullName  = "Mark Greenslope"; member2.UserName = "******";
            member2.Password  = "******"; member2.ContactNumber = "0469287";
            member2.Address   = "12 Adelaide Circuit";
            memberCollection.AddMember(member2);
        }
Exemplo n.º 10
0
        public void BorrowDVD(MemberCollection memberCollection, int memberIndex, MovieCollection movieCollection)
        {
            if (memberCollection.members[memberIndex].NumDVDsBorrowed < 10)
            {
                Console.WriteLine("Please enter the Movie TITLE: ");
                string movieTitle = Console.ReadLine();

                if (movieCollection.MovieExists(movieTitle))
                {
                    if (movieCollection.Search(movieTitle).CopiesAvailable > 0)
                    {
                        memberCollection.members[memberIndex].BorrowDVD(movieTitle);
                        movieCollection.BorrowDVD(movieTitle);
                        Console.WriteLine("{0} Borrowed!\nPlease any key to return to menu...", movieTitle);
                    }
                    else
                    {
                        Console.WriteLine("There are no more copies of {0} available.", movieTitle);
                        Console.WriteLine("Press any key to return to menu...");
                    }
                }
                else
                {
                    Console.WriteLine("\n{0} is not in the catalog.\n"
                                      + "Press any key to return to menu...", movieTitle);
                }
            }
            else
            {
                Console.WriteLine("\nSorry, you've already got 10 DVDs borrowed.\n"
                                  + "Please return a DVD before borrowing another one.\n"
                                  + "Please any key to return to menu...");
            }

            Console.ReadLine();
        }
Exemplo n.º 11
0
 public static void PopulateMembersAndMovies(MemberCollection memberCollection, MovieCollection movieCollection)
 {
     PopulateMembers(memberCollection);
     PopulateMovies(movieCollection);
 }
Exemplo n.º 12
0
 public void DisplayBorrowed(MemberCollection memberCollection, int memberIndex, MovieCollection movieCollection)
 {
     Console.WriteLine("Currently Borrowed: ");
     memberCollection.members[memberIndex].DisplayBorrowed(movieCollection);
 }