Example #1
0
        /// <summary>
        /// Lists members.
        /// </summary>
        public void listMembers(View view, MemberList memberList)
        {
            string listTypeInput = view.listMembersView();

            if (memberList.getMembers().Count == 0)
            {
                view.errorMessage(6);
                return;
            }

            if (listTypeInput == "1")
            {
                view.compactListView(memberList);
            }

            if (listTypeInput == "2")
            {
                view.verboseListView(memberList);

                //Error handling
            }
            else if (listTypeInput != "1" && listTypeInput != "2")
            {
                view.errorMessage(2);
                return;
            }
        }
Example #2
0
 /// <summary>
 /// Checks if member ID exists in member list.
 /// </summary>
 /// <returns>
 /// Boolean.
 /// </returns>
 public bool checkID(MemberList memberList, int memberId)
 {
     foreach (Member member in memberList.getMembers())
     {
         if (memberId == member.Id)
         {
             return(true);
         }
     }
     return(false);
 }
Example #3
0
 /// <summary>
 /// Renders the compact member list view.
 /// </summary>
 public void compactListView(MemberList memberList)
 {
     Console.WriteLine("\n-----COMPACT MEMBER LIST-----\n");
     Console.WriteLine("___________________");
     foreach (Member member in memberList.getMembers())
     {
         string memberInfoString = $"\nName: {member.Name}\nId: {member.Id}\nNumber of boats: {member.getBoats().Count}\n";
         Console.WriteLine(memberInfoString);
         Console.WriteLine("___________________");
     }
 }
Example #4
0
        /// <summary>
        /// Renders the verbose member list view.
        /// </summary>
        public void verboseListView(MemberList memberList)
        {
            Console.WriteLine("\n-----VERBOSE MEMBER LIST-----\n");
            Console.WriteLine("___________________");

            foreach (Member member in memberList.getMembers())
            {
                int    i = 1;
                string memberInfoString = $"\nName: {member.Name}\nPersonal number: {member.Number}\nId: {member.Id}\n";
                Console.WriteLine(memberInfoString);

                //Writes out each boats information
                foreach (Boat boat in member.getBoats())
                {
                    string boatInfoString = $"Boat #{i}\nType: {boat.Type}\nLength: {boat.Length}\n";
                    i++;
                    Console.WriteLine(boatInfoString);
                }
                Console.WriteLine("___________________");
            }
        }