/// <summary> /// Copy constructor /// </summary> /// <param name="theOther"></param> public Address(Address origAddress) { this.street = origAddress.street; this.zip = origAddress.zip; this.city = origAddress.city; this.country = origAddress.country; }
/// <summary> /// Copy Constructor /// </summary> /// <param name="origContact"></param> public Contact(Contact origContact) { this.firstName = origContact.firstName; this.lastName = origContact.lastName; this.address = new Address(origContact.address); }
/// <summary> /// 2nd constructor /// </summary> /// <param name="firstName"></param> /// <param name="lastName"></param> /// <param name="address"></param> public Contact(string firstName, string lastName, Address address) { this.firstName = firstName; this.lastName = lastName; this.address = new Address(address); }
/// <summary> /// Default constructor /// </summary> public Contact() { // Initialize the address field this.address = new Address(); }
/// <summary> /// Reads and validates Address information /// </summary> /// <returns>True/false</returns> private bool ReadAddress(out Address address) { // Fetch values string street = txtStreet.Text; string city = txtCity.Text; string zip = txtZip.Text; Countries country = (Countries)cmbCountry.SelectedIndex; // Check Validity if (InputUtility.ValidateString(street) && InputUtility.ValidateString(city) && InputUtility.ValidateString(zip)) { address = new Address(street, city, zip, country); return true; } address = null; return false; }
/// <summary> /// Calls the overloaded method in order to add a Contact /// </summary> /// <param name="firstName"></param> /// <param name="lastName"></param> /// <param name="addressIn"></param> /// <returns>True/false</returns> public bool AddContact(string firstName, string lastName, Address addressIn) { return AddContact(new Contact(firstName, lastName, addressIn)); }