/// <summary> /// Removes the phone. /// </summary> /// <param name="organizationPhone">The organization phone.</param> public void RemovePhone(OrganizationPhone organizationPhone) { if (_organizationPhones.Contains(organizationPhone)) { RaiseEvent(new OrganizationPhoneRemovedEvent(Key, Version, organizationPhone)); } }
/// <summary> /// Adds the phone. /// </summary> /// <param name="organizationPhone">The organization phone.</param> public void AddPhone(OrganizationPhone organizationPhone) { RaiseEvent(new OrganizationPhoneAddedEvent(Key, Version, organizationPhone)); if (organizationPhone.IsPrimary) { MakePrimary(organizationPhone); } }
/// <summary>Makes the phone primary.</summary> /// <param name="organizationPhone">The organization phone.</param> public void MakePrimary(OrganizationPhone organizationPhone) { Check.IsNotNull(organizationPhone, "organizationPhone is required."); var currentPrimary = OrganizationPhones.FirstOrDefault(oa => oa.IsPrimary); if (currentPrimary != organizationPhone) { RaiseEvent(new OrganizaionPrimaryPhoneChangedEvent(Key, Version, organizationPhone.GetHashCode())); } }