purplehaze1
Programmer
A customer can have multiple insurances. So in user interface,
I have 4 checkboxes representing multiple insurance types.
If any box is checked, first I see if the checked insurance type
already exists in the collection before I create a new one. The following code works but is rather long when I check for each insurancetype in the collection,
I was wondering if there's more efficient way to do it. Examples would be greate.
Thanks.
Private Sub SaveInsuranceTypes()
Dim BlueCross, MCC, Medicaid As InsuranceType
Dim Medicare, NoCoverage As InsuranceType
BlueCross = oRequest.InsuranceTypes.getInsuranceByType(oInsurance.InsuranceType.BlueCross)
If BlueCross Is Nothing Then
If chkBlueCross.Checked Then
BlueCross = New InsuranceType()
With BlueCross
.InsuranceTypeID = .InsuranceTypes.BlueCross
End With
ocustomer.InsuranceTypes.add(BlueCross)
End If
Else
If Not chkBlueCross.Checked Then
BlueCross.delete()
End If
End If
MCC = oRequest.InsuranceTypes.getInsuranceByType(oInsurance.InsuranceType.ManagedCareCommercial)
If MCC Is Nothing Then
If chkManagedCare.Checked Then
MCC = New InsuranceType()
With MCC
.InsuranceTypeID = .InsuranceTypes.MCC
End With
ocustomer.InsuranceTypes.add(MCC)
End If
Else
If Not chkManagedCare.Checked Then
MCC.Delete()
End If
End If
.....(same for other insuranceTypes)
.....
End Sub
I have 4 checkboxes representing multiple insurance types.
If any box is checked, first I see if the checked insurance type
already exists in the collection before I create a new one. The following code works but is rather long when I check for each insurancetype in the collection,
I was wondering if there's more efficient way to do it. Examples would be greate.
Thanks.
Private Sub SaveInsuranceTypes()
Dim BlueCross, MCC, Medicaid As InsuranceType
Dim Medicare, NoCoverage As InsuranceType
BlueCross = oRequest.InsuranceTypes.getInsuranceByType(oInsurance.InsuranceType.BlueCross)
If BlueCross Is Nothing Then
If chkBlueCross.Checked Then
BlueCross = New InsuranceType()
With BlueCross
.InsuranceTypeID = .InsuranceTypes.BlueCross
End With
ocustomer.InsuranceTypes.add(BlueCross)
End If
Else
If Not chkBlueCross.Checked Then
BlueCross.delete()
End If
End If
MCC = oRequest.InsuranceTypes.getInsuranceByType(oInsurance.InsuranceType.ManagedCareCommercial)
If MCC Is Nothing Then
If chkManagedCare.Checked Then
MCC = New InsuranceType()
With MCC
.InsuranceTypeID = .InsuranceTypes.MCC
End With
ocustomer.InsuranceTypes.add(MCC)
End If
Else
If Not chkManagedCare.Checked Then
MCC.Delete()
End If
End If
.....(same for other insuranceTypes)
.....
End Sub