public void AddClient(object sender, ChoiceEventArgs e) { Client.InputClient(out client); one.Add(client); Console.WriteLine("New Client Added"); }
static public void Load(PhoneBook phoneBook) { BinaryReader dataIn; try { dataIn = new BinaryReader( new FileStream("SaveBook.dat", FileMode.Open)); } catch (IOException exc) { Console.WriteLine("Cannot Open SaveBook File For Input"); Console.WriteLine("Reason: " + exc.Message); return; } try { phoneBook.Count = dataIn.ReadInt32(); Client client = new Client(); for (int i = 0; i < phoneBook.Count; i++) { client.firstName = dataIn.ReadString(); client.lastName = dataIn.ReadString(); client.foneNumber = dataIn.ReadInt32(); client.adress = dataIn.ReadString(); phoneBook.Add(client); phoneBook.Count--; } } catch (IOException exc) { Console.WriteLine("Error Reading Inventory File"); Console.WriteLine("Reason: " + exc.Message); } finally { dataIn.Close(); } }