public Customer(string name, string email, int phone, bool staff) { SingletonDataCustomer.getInstance(); this.Id = SingletonDataCustomer.NextId; this.Name = name; this.Phone = phone; this.Staff = staff; this.Email = email; }
/// <summary> /// Writes Customer data to binary file, persists nextID /// </summary> public void WriteBinaryData() { //create a formatting object IFormatter formatter = new BinaryFormatter(); //Create a new IO stream to write to the file Objects.bin Stream stream = new FileStream("objects.bin", FileMode.Create, FileAccess.Write, FileShare.None); //use the formatter to serialize the collection and send it to the filestream formatter.Serialize(stream, custList); formatter.Serialize(stream, SingletonDataCustomer.getInstance()); //close the file stream.Close(); }