VB code snippet for using the generalNotificationManager


Private Sub Notify_Click()


On Error GoTo Err_Trap

Dim bStatus As Boolean


'### GeneralNotificationManager interface
Dim generalNotificationManagerEx As GENERALNOTIFICATIONMANAGER450Lib.GeneralNotificationManager
Set generalNotificationManagerEx = New GeneralNotificationManager

'### GeneralNotificationRequest
Dim generalNotificationRequestEx As GENERALNOTIFICATIONMANAGER450Lib.GeneralNotificationRequest
Set generalNotificationRequestEx = generalNotificationManagerEx.GeneralNotificationRequest

'### initialize the request interface in germand and as confidential
bStatus = generalNotificationRequestEx.Initialize(enGerman, enYes)

Dim IAddress As GENERALNOTIFICATIONMANAGER450Lib.Address
Set IAddress = generalNotificationRequestEx.CreateAddress

'### set notification parameters
Dim strNotificationID As String
strNotificationID = "N3000"
Dim dNotificationDate As Date
dNotificationDate = DateValue("2010-9-21")
Dim lNotificationTimestamp As Long
lRequestTimestamp = 1316590422

bStatus = generalNotificationRequestEx.SetNotification(strNotificationID, dNotificationDate,  _
                                                       lNotificationTimestamp)

'### set transform
Dim strFromEAN As String
strFromEAN = "2000000000001"
Dim strViaEAN As String
strViaEAN = "2011111111111"
Dim strToEAN As String
strToEAN = "2034567890222"

bStatus = generalNotificationRequestEx.SetTransport(strFromEAN, "", "", strViaEAN, strToEAN, "")

'### set sender
IAddress.Initialize
bStatus = IAddress.SetPerson("Aerztin", "Patricia", "Frau", "Dr. med.", "")
bStatus = IAddress.SetPostal("Arztgasse 17b5", "", "4000", "Basel", "BS", "")
bStatus = generalNotificationRequestEx.SetSender(strFromEAN, "", "Arzt", IAddress)

'### set recipient
IAddress.Initialize
bStatus = IAddress.SetCompany("Krankenkasse AG", "Sektion Basel", "")
bStatus = IAddress.SetPostal("Kassengraben 222", "", "4000", "Basel", "", "")
bStatus = generalNotificationRequestEx.SetRecipient(strToEAN, "", "", IAddress)


'### patient
IAddress.Initialize
Dim dBirthdate As Date
dBirthdate = DateValue("1950-1-1")
bStatus = IAddress.SetPerson("Muster", "Peter", "Herr", "", "c/o Mieter Karl")
bStatus = IAddress.SetPostal("Musterstrasse 5", "", "7304", "Maienfeld", "", "")
bStatus = generalNotificationRequestEx.SetPatient(eSex, dBirthdate, "756.1234.5678.90", IAddress)

'### set message
Dim strMessage As String
strMessage = "A test message!"
bStatus = generalNotificationRequestEx.SetMessage(strMessage, "")

bStatus = generalNotificationRequestEx.Finalize()


'### get the notification xml
Dim lGenerationAttributes As Long
lGenerationAttributes = 0
Dim strOutFile As String
Dim lValidationError As Long
lValidationError = 0
Dim lTimestamp As Long
lTimestamp = 0

Dim generalNotificationResponseEx As GENERALNOTIFICATIONMANAGER450Lib.GeneralNotificationResponse

bStatus = generalNotificationManagerEx.GetXML(lGenerationAttributes, strOutFile, lValidationError, lTimestamp,  _
                                              generalNotificationResponseEx)

Dim strTargetFile As String
strTargetFile = "GeneralNotificationExample.xml"
FileCopy strOutFile, strTargetFile

Exit Sub

Err_Trap:
    MsgBox "Error: " & Err.Description, vbCritical, _
           "Opps! Error" & Str$(Err.Number)
'### relase resources
Set generalNotificationResponseEx = Nothing
Set generalNotificationRequestEx = Nothing
Set generalNotificationManagerEx = Nothing

End Sub