/// <summary> /// Read all members in a member list /// </summary> private void GetMembersFromFile() { try { if (File.Exists(m_filePath)) { using (StreamReader sr = new StreamReader(m_filePath)) { while (!sr.EndOfStream) { string name = sr.ReadLine(); long pNumber = long.Parse(sr.ReadLine()); int memberID = int.Parse(sr.ReadLine()); BoatList boatList = new BoatList(memberID); m_members.Add(new Member(name, pNumber, memberID, boatList)); } sr.Close(); } } } catch (Exception ex) { throw ex; } }
public Member(string a_name, long a_pNumber, int a_memberID, BoatList a_boatList) { if (a_name == "" || a_name == null) { throw new ArgumentNullException("name is null"); } if (a_pNumber.ToString().Length != 12 && a_pNumber >= 100000000000) { throw new ArgumentException("pNumber has an invalid format. Should be YYYYMMDDXXXX"); } if (a_memberID < 1) { throw new ArgumentException("Invalid memberID"); } m_name = a_name; m_pNumber = a_pNumber; m_memberID = a_memberID; m_boatList = a_boatList; }