|
Distributing Vendor Definitions |
|
How to install the DEFAULT vendor definitions which are part of the EasyHL7 objects. From frmVendors.vb in the example program.
Private Sub btnInstallVendors_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInstallVendors.Click Dim sPTH As String = "", sVendors As String = "" Try 'oVendor was instantiated in the LoadVendorInfo() sub With oVendor sPTH = .EasyInstallationFolder & "HL7Vendors" If Not IsFolder(sPTH) Then 'Install the Default Vendors into the folder,creating it as we go If Not .InstallDefaultVendors(sPTH, False, True) Then MsgBox(.LastError, MsgBoxStyle.Critical, "Error Installing Default Vendors") Exit Sub End If Else .VendorPath = sPTH sVendors = .ListVendors() If sVendors.Length = 0 Then 'The folder exists, but there are no vendors If Not .InstallDefaultVendors(sPTH, True) Then MsgBox(.LastError, MsgBoxStyle.Critical, "Error Installing Default Vendors") Exit Sub End If End If End If .VendorPath = sPTH End With LoadVendorInfo() Catch ex As Exception MsgBox(ex.ToString) End Try End Sub
Distributing your own EasyHL7 Vendor Definitions To distribute customized vendor definitions with your HL7 solutions you follow 4 steps.
PSEUDOCODE:
'We have created a vendor definition called 'My Vendor' it is HL7 Version '2.3'. 'We have exported that vendor definition to a file called 'My Vendor.ehv'
Private Sub InstallMyVendor() Dim oVendor As New EHL7_MC2005.HL7Vendor Dim sPath As String = "", sVendorID As String = "" Dim sFileName As String = "" With oVendor 'Step 1. Verify that the objects are registered. If Not .IsRegistered Then MsgBox("Need Code to Do Registration and activate the objects") Exit Sub End If If .LicenseExpired Then MsgBox("Demo license is expired. Proceeding further would cause Nag screens!") Exit Sub End If 'Step 2. Set the Vendor Path sPath = .EasyInstallationFolder & "\HL7Definitions" If Not Directory.Exists(sPath) Then 'Code to create the folder End If .VendorPath = sPath 'Step 3. Has 'My Vendor' already been installed? sVendorID = .GetVendorID("My Vendor","2.3") If sVendorID.Length() = 0 Then 'It has not been installed! We need to install it sFileName = .EasyInstallationFolder & "\My Vendor.ehv" If Not File.Exists(sFileName) MsgBox("File not found: " & sFileName) Exit Sub End If If Not .ImportVendor(sFileName) Then MsgBox(.LastError) Exit Sub End If 'Ok We're Done Our Vendor Is Now Installed in <EasyInstallationFolder\HL7Definitions End If End With
End Sub |