/// <summary>
 /// delete a member from the system
 /// </summary>
 /// <param name="member"> member to delete </param>
 public void delete(Member member)
 {
     if (member.Tools != null && member.Tools.Length > 0)
     {
         Console.WriteLine("\nCannot delete this member! The member is currently borrowing tools.");
         Console.WriteLine("\nPress any key to continue.");
         Console.ReadKey();
     }
     else
     {
         members.delete(member);
         Console.WriteLine("\n" + member.FirstName + " " + member.LastName + " has been removed. ");
         Console.WriteLine("\nPress any key to continue.");
         Console.ReadKey();
     }
 }
Beispiel #2
0
        // The staff menu
        public static void StaffMenu()
        {
            Console.Clear();
            Console.WriteLine("Welcome to the Tool Library");
            Console.WriteLine("================Staff Menu================");
            Console.WriteLine("1. Add a new tool");
            Console.WriteLine("2. Add new pieces of an existing tool");
            Console.WriteLine("3. Remove some pieces of a tool");
            Console.WriteLine("4. Register a new member");
            Console.WriteLine("5. Remove a member");
            Console.WriteLine("6. Find the contact number of a member");
            Console.WriteLine("0. Return to main menu");
            Console.WriteLine("===============================");
            Console.WriteLine("");
            Console.WriteLine("Please make a selection (1-6, or 0 to return to main menu)");

            switch (Console.ReadLine())
            {
            case "1":
                Console.Clear();
                Console.WriteLine("Welcome to the Tool Library");
                Console.WriteLine("================Staff Menu================");
                Console.WriteLine("1. Add a new tool");
                Console.WriteLine("==========================================");
                Console.WriteLine("");


                ToolTypesAndCatergories();
                Console.ReadLine();

                AddingTools();


                Console.WriteLine("Press any key to go back to staff menu");
                Console.ReadLine();
                StaffMenu();
                break;

            case "2":
                Console.Clear();
                Console.WriteLine("Welcome to the Tool Library");
                Console.WriteLine("================Staff Menu================");
                Console.WriteLine("2. Add new pieces of an existing tool");
                Console.WriteLine("==========================================");
                Console.WriteLine("");

                ToolTypesAndCatergories();
                Console.ReadLine();

                Console.WriteLine("Press any key to go back to staff menu");
                Console.ReadLine();
                StaffMenu();
                break;

            case "3":
                Console.Clear();
                Console.WriteLine("Welcome to the Tool Library");
                Console.WriteLine("================Staff Menu================");
                Console.WriteLine("3. Remove some pieces of a tool");
                Console.WriteLine("==========================================");
                Console.WriteLine("");

                ToolTypesAndCatergories();
                Console.ReadLine();

                Console.WriteLine("Press any key to go back to staff menu");
                Console.ReadLine();
                StaffMenu();
                break;

            case "4":
                Console.Clear();
                Console.WriteLine("Welcome to the Tool Library");
                Console.WriteLine("================Staff Menu================");
                Console.WriteLine("4. Register a new member");
                Console.WriteLine("==========================================");
                Console.WriteLine("");

                Member NewMember = new Member();

                Console.WriteLine("Please enter first name: ");
                NewMember.FirstName = Console.ReadLine();

                Console.WriteLine("Please enter last name: ");
                NewMember.LastName = Console.ReadLine();

                Console.WriteLine("Please enter contact number: ");
                NewMember.ContactNumber = Console.ReadLine();

                Console.WriteLine("Please enter four digit PIN: ");
                NewMember.PIN = Console.ReadLine();
                //MemberCollection memberCollection = new MemberCollection();
                librarySystem.add(NewMember);
                Console.WriteLine("New member " + NewMember.FirstName + "has been added");


                Console.WriteLine("Press any key to go back to staff menu");
                Console.ReadLine();
                StaffMenu();
                break;

            case "5":
                Console.Clear();
                Console.WriteLine("Welcome to the Tool Library");
                Console.WriteLine("================Staff Menu================");
                Console.WriteLine("5. Remove a member");
                Console.WriteLine("==========================================");
                Console.WriteLine("");

                Member RemoveMember = new Member();

                Console.WriteLine("Please enter first name you want to delete: ");
                RemoveMember.FirstName = Console.ReadLine();

                Console.WriteLine("Please enter last name you want to delete: ");
                RemoveMember.LastName = Console.ReadLine();

                //Console.WriteLine("Please enter contact number: ");
                //RemoveMember.ContactNumber = Console.ReadLine();

                //Console.WriteLine("Please enter four digit PIN: ");
                //RemoveMember.PIN = Console.ReadLine();
                MemberCollection deleteMember = new MemberCollection();
                deleteMember.delete(RemoveMember);

                Console.WriteLine("Press any key to go back to staff menu");
                Console.ReadLine();
                StaffMenu();
                break;

            case "6":
                Console.Clear();
                Console.WriteLine("Welcome to the Tool Library");
                Console.WriteLine("================Staff Menu================");
                Console.WriteLine("6. Find the contact number of a member");
                Console.WriteLine("==========================================");
                Console.WriteLine("");

                Member searchmember = new Member();

                Console.WriteLine("Enter the Members First and Last Name seperated by a space");
                string[] Input = Console.ReadLine().Split("");
                // no error checking done
                string UserName = Input[1] + Input[0];

                // redirect to method that does the search
                MemberCollection membersearch = new MemberCollection();

                //membersearch.search();

                Console.WriteLine("Press any key to go back to staff menu");
                Console.ReadLine();
                StaffMenu();
                break;

            case "0":
                MainMenu();
                break;

            default:
                MainMenu();
                break;
            }
        }
Beispiel #3
0
 /// <summary>
 /// delete a borrower to tool's borrowing member collection
 /// </summary>
 /// <param name="member"> member who returns this tool </param>
 public void deleteBorrower(Member aMember)
 {
     toolBorrowers.delete(aMember);
     availableQuantity++;
 }
 public void deleteBorrower(Member aMember)
 {
     Borrowing_Tools.delete(aMember);
 }
 // delete a member from the system
 public void delete(Member aMember)
 {
     memberCollection.delete(aMember);
 }