HTExceptionEventArg : BaseClass ->System.EventArg
Used by some API objects when firing events.
Contains our standard HTException interface and 1 public method.
Void Cancel(String reasonWhy = "Cancelled") - Call this method and whichever operation raised should cancel the operation and return control back to your program.
The HTSQLServerConnector raises (and the several other objects passe through) the TransactionRunning event which uses this class.
Private Sub MyConn_TransactionRunning(sender As Object, e As EventArgs) Handles MyConn.TransactionRunning Try 'If you are curious sender is the HTSQLServerConnector object
'I'm subscribing to this event just to allow for the cancel operation 'to rollback an import operation while it's underway.
Dim e1 As HTExceptionEventArg = e
' Now I'll just give the GUI a bit of a slice to respond Application.DoEvents()
'blnCancel is a local variable set when the user clicks the cancel button If blnCancel Then e1.Cancel() End If Catch ex As Exception
End Try End Sub
When you call the Cancel() method in this case then the currently executing SQL Transaction will be canceled and rolled back.
Programming Note: Cancel() must provide a string containing a reason why it was cancelled. The default value is "Cancelled", but you can pass any string you like EXCEPT for an empty string. Calling Cancel("") would have no effect.
|
HTImportEventArg : BaseClass ->HTExceptionEventArg
Used by API objects performing Import Operations when firing events.
Contains our standard HTException interface + the HTExceptionEventArg Cancel() method as well as:
Public Properties (ReadOnly)
Integer BatchIndex - The index of the operation (or 1 if it's a single operation)
Integer BatchCount - The number of operations in the Batch (or 1 if it's a single operation)
Integer PassNumber - The pass number if the operation is iterative (like Training your Schema which may make multiple passes on 1 message)
String AdditionalInfo - Any custom or informational String information which might be passed down from the entity raising the event.
Public Properties (Read / Write) For Import Events and Fatal Error Handling
Boolean RefreshAndRetry - If set to True the Import Operation will Refresh it's internal UPSInfo class and try and import the HL7 message again.
Boolean RetrainAndRetry - If set to True and all other conditions for retraining are also True the Import Operation will attempt to dynamically train the schema to accept the HL7 message.
The HL7StringAnalyzer class raises the ImportCompleted event which uses this class.
Private Sub Analyzer_ImportCompleted(sender As Object, e As EventArgs) Handles Analyzer.ImportCompleted Try 'Cast e as HTTPImportEventArg Dim e1 As HTImportEventArg = e
'In this event sender is a HL7ImportResults object Dim oRes As HL7ImportResults = sender
Dim s As String If oRes.OperationWasSuccessful Then s = "#" & e1.BatchIndex.ToString() & " - Message ID [" + oRes.MessageID + "] imported on attempt #" & oRes.PassNumber.ToString() If oRes.LoadCount > 1 Then s += " (RELOAD)" End If TraceIn(s) If Not blnCancel Then Return End If
If blnCancel Then TraceIn("Cancelling....") e1.Cancel("Cancelled in the ImportCompleted Event") Return End If If oRes.FatalErrorWasEncountered Then 'This is the money 'Which Pass Number are we on If oRes.PassNumber < 3 Then '--- I'm going to Refresh and Retry on passnumber 1
If oRes.PassNumber = 1 Then s = "Addressable Issues were encountered on message #" & e1.BatchIndex.ToString() TraceIn(s)
e1.RefreshAndRetry = True
Return End If If oRes.PassNumber = 2 Then
If CheckBoxAutoFixImport.Checked Then If MyKey.AllowAPIToAlterSchema Then s = "Message #" & e1.BatchIndex.ToString() & "Refresh And retry was unsuccessful. Attempting Training" TraceIn(s) e1.RetrainAndRetry = True End If End If
End If End If Else ' No Fatal Error TraceIn("An excpeption occurred: " + oRes.LastException.ExtendedErrorMessage)
End If
Catch ex As Exception TraceIn("System Error ImportCompleted()..." & ex.Message) End Try End Sub
Programming Note: Cancel() must provide a string containing a reason why it was cancelled. The default value is "Cancelled", but you can pass any string you like EXCEPT for an empty string. Calling Cancel("") would have no effect.
|
HTTrainingEventArg : BaseClass ->HTExceptionEventArg
Used by API objects performing Training Operations when firing events.
Contains our standard HTException interface + the HTExceptionEventArg Cancel() method as well as:
ReadOnly Integer BatchIndex - The index of the operation (or 1 if it's a single operation)
ReadOnly Integer BatchCount - The number of operations in the Batch (or 1 if it's a single operation)
ReadOnly Integer PassNumber - The pass number if the operation is iterative (like Training your Schema which may make multiple passes on 1 message)
ReadOnly String AdditionalInfo - Any custom or informational String information which might be passed down from the entity raising the event.
The HTTrainingEventArg is functionally equivalent to the HTImportEventArg. but is only used in Training Operations.
