//----- List accessors -----// /// <summary> /// Add an address to this customer /// </summary> /// <param name="vo"></param> public void addAddress(AddressVO vo) { if (vo == null || this.addresses == null || this.addresses.Contains(vo)) { return; } this.addresses.Add(new AddressVO(vo)); }
/// <summary> /// Returns the additional address for the customer /// </summary> /// <returns></returns> public AddressVO getAdditionalAddress() { AddressVO custAddr = this.addresses.Find(delegate(AddressVO addrObj) { return(addrObj.ContactTypeCode == CustomerAddressTypes.ADDITIONAL_ADDRESS && addrObj.ContMethodTypeCode == "POSTALADDR"); }); return(custAddr); }
/// <summary> /// Returns the mailing address of the customer /// </summary> /// <returns></returns> public AddressVO getMailingAddress() { AddressVO custAddr = (from addr in this.addresses where addr.ContactTypeCode == CustomerAddressTypes.MAILING_ADDRESS && addr.ContMethodTypeCode == "POSTALADDR" select addr).FirstOrDefault(); return(custAddr); }
/// <summary> /// If home address exists, updates it if not adds a new address object for the customer /// </summary> /// <param name="address1"></param> /// <param name="address2"></param> /// <param name="unit"></param> /// <param name="city"></param> /// <param name="zipcode"></param> /// <param name="country"></param> /// <param name="state"></param> /// <param name="vnotes"> </param> public void updateHomeAddress(string address1, string address2, string unit, string city, string zipcode, string country, string state, string vnotes) { bool homeAddressUpdated = false; AddressVO customerAddr = (from addr in this.addresses where addr.ContactTypeCode == CustomerAddressTypes.HOME_ADDRESS && addr.ContMethodTypeCode == "POSTALADDR" select addr).FirstOrDefault(); if (customerAddr != null) { customerAddr.Address1 = address1; customerAddr.Address2 = address2; customerAddr.UnitNum = unit; customerAddr.City = city; customerAddr.ZipCode = zipcode; customerAddr.State_Code = state; customerAddr.Country_Name = country; customerAddr.Notes = vnotes; homeAddressUpdated = true; } if (!(homeAddressUpdated)) { AddressVO custAddr = new AddressVO(); custAddr.Address1 = address1; custAddr.Address2 = address2; custAddr.UnitNum = unit; custAddr.City = city; custAddr.ZipCode = zipcode; custAddr.State_Code = state; custAddr.Country_Name = country; custAddr.Notes = vnotes; custAddr.ContactTypeCode = CustomerAddressTypes.HOME_ADDRESS; custAddr.ContMethodTypeCode = "POSTALADDR"; this.addAddress(custAddr); } }
public AddressVO(AddressVO avo) { if (avo != null) { this.Address1 = avo.Address1; this.Address2 = avo.Address2; this.City = avo.City; this.State_Code = avo.State_Code; this.State_Name = avo.State_Name; this.ZipCode = avo.ZipCode; this.UnitNum = avo.UnitNum; this.Country_Code = avo.Country_Code; this.Country_Name = avo.Country_Name; this.Notes = avo.Notes; this.ContactTypeCode = avo.ContactTypeCode; this.ContMethodTypeCode = avo.ContMethodTypeCode; this.CustAddress = avo.CustAddress; this.AlternateString = avo.AlternateString; } else { this.initialize(); } }