Example #1
0
 public void AddBoat(Boat m_boat, int memberlistnumber)
 {
     if (m_boat == null)
     {
         return;
     }
     memberList[memberlistnumber].boatlist.Add(m_boat);
 }
Example #2
0
 public Boat AddBoat()
 {
     Console.WriteLine("Write the boat name: ");
     Boat v_boat = new Boat(Console.ReadLine());
     if (v_boat.name == "")
     {
         ErrorMessege();
         return null;
     }
     v_boat.type = SelectBoatType();
     if (v_boat.type == "")
     {
         ErrorMessege();
         return null;
     }
     Console.WriteLine("Write the boat length: ");
     v_boat.length = int.Parse(Console.ReadLine());
     return v_boat;
 }
Example #3
0
 public void VerboseListBoatPrint(Boat v_boat)
 {
     Console.WriteLine("Name of Boat: {0}    Type of Boat: {1}   Boat Length: {2}", v_boat.name, v_boat.type, v_boat.length);
 }
Example #4
0
 public void SelectListBoat(Boat v_boat, int lisnumber)
 {
     Console.WriteLine("{0}. Name: {1}    Type: {2}  Length{3}", lisnumber,v_boat.name, v_boat.type, v_boat.length);
 }
Example #5
0
 public void EditBoat(int boatListNumber, int memberListNumber, Boat m_boat)
 {
     memberList[memberListNumber].boatlist[boatListNumber] = m_boat;
 }
Example #6
0
        public List<Member> LoadMembers()
        {
            List<Member> memberList = new List<Member>();
            bool newMember = false;
            Member m_member = new Member();
            Boat m_boat = new Boat();
            string line;
            MemberReadStatus stat = MemberReadStatus.Indefinite;
            using (StreamReader reader = new StreamReader("../../Registry.txt"))
            {
                while ((line = reader.ReadLine()) != null)
                {
                    if(line == "[MemberName]")
                    {
                        if (newMember == true)
                        {
                            memberList.Add(m_member);
                        }
                        else if (newMember == false)
                        {
                            newMember = true;
                        }
                        stat = MemberReadStatus.Name;
                        line = reader.ReadLine();
                    }
                    if (line == "[Personal-Number]")
                    {
                        stat = MemberReadStatus.PersonalNumber;
                        line = reader.ReadLine();
                    }
                    if (line == "[Member-ID]")
                    {
                        stat = MemberReadStatus.MemberID;
                        line = reader.ReadLine();
                        m_member.boatlist = new List<Boat>();
                    }
                    if (line == "[BoatName]")
                    {
                        stat = MemberReadStatus.BoatName;
                        line = reader.ReadLine();
                    }
                    if (line == "[Type]")
                    {
                        stat = MemberReadStatus.Type;
                        line = reader.ReadLine();
                    }
                    if (line == "[Length]")
                    {
                        stat = MemberReadStatus.Length;
                        line = reader.ReadLine();
                    }

                    switch (stat)
                    {
                        case MemberReadStatus.Name:
                            m_member = new Member(line);
                            break;
                        case MemberReadStatus.PersonalNumber:
                            m_member.personalNumber = line;
                            break;
                        case MemberReadStatus.MemberID:
                            m_member.memberID = int.Parse(line);
                            break;
                        case MemberReadStatus.BoatName:
                            m_boat = new Boat(line);
                            break;
                        case MemberReadStatus.Type:
                            m_boat.type = line;
                            break;
                        case MemberReadStatus.Length:
                            m_boat.length = int.Parse(line);
                            m_member.boatlist.Add(m_boat);
                            break;
                    }
                }
                memberList.Add(m_member);
            }

            return memberList;
        }