/// <summary> /// Quietly removes an address from the collection that matches the existing address type /// </summary> /// <param name="phoneNumber"></param> private void RemoveExistingPhoneNumber(EntityPhoneNumber phoneNumber) { EntityPhoneNumber existingPhone = GetPhoneNumberByType(phoneNumber.Type.Guid); if (existingPhone != null) RemovePhoneNumber(existingPhone); }
/// <summary> /// Removes an EntityPhoneNumber from this entity /// </summary> /// <param name="phoneNumber">EntityPhoneNumber to remove</param> /// <remarks>This method wraps <see cref="List<T>.Remove"/>.</remarks> public void RemovePhoneNumber(EntityPhoneNumber phoneNumber) { PhoneNumbers.Remove(phoneNumber); }
/// <summary> /// Gets the index of a particular EntityPhoneNumber /// </summary> /// <param name="phoneNumber">EntityPhoneNumber to get the index of</param> /// <returns>The index of the specified EntityPhoneNumber</returns> /// <remarks>This method wraps <see cref="IList<T>.IndexOf"/>.</remarks> public int GetIndexOfPhoneNumber(EntityPhoneNumber phoneNumber) { return PhoneNumbers.IndexOf(phoneNumber); }
/// <summary> /// Inserts an EntityPhoneNumber into the EntityPhoneNumber collection. /// </summary> /// <param name="index">The index to insert the <paramref name="phoneNumber"/> into.</param> /// <param name="phoneNumber">The EntityPhoneNumber to insert into the collection.</param> /// <remarks>This method wraps <see cref="List<T>.Insert"/>.</remarks> public void InsertPhoneNumber(int index, EntityPhoneNumber phoneNumber) { // IMPORTANT!!! MAKE SURE that you put any logic that you place into this method // into the AddPhoneNumber method as well!!!! RemoveExistingPhoneNumber(phoneNumber); PhoneNumbers.Insert(index, phoneNumber); }
/// <summary> /// Checks to see whether an EntityPhoneNumber exists in the /// EntityPhoneNumber collection /// </summary> /// <param name="phoneNumber">EntityPhoneNumber to check</param> /// <returns>True if the EntityPhoneNumber exists, false if not</returns> /// <remarks>This method wraps <see cref="List<T>.Contains"/>.</remarks> public bool ContainsPhoneNumber(EntityPhoneNumber phoneNumber) { return PhoneNumbers.Contains(phoneNumber); }