Developing .NET Class DLLs
Manager Contents
User Contents

Contents

Introduction
    Dynamic Link Libraries
    Data Links
            Automatic Lookups
            Event Hooks
DLL Function Interface
    Visual Basic .NET Interface
    Interface Parameters
            dtSessionRecord
            FormType
            Category
            opCode
            theTableField
            theTableFieldValue
            dtRecord
            dtParams
            colHTML
            errString
Modifying CATSWeb Field Properties and HTML
    Modifying HTML in Drill Down Results
    Modifying Field Captions in Drill Down Results
Implementing Custom Validation Routines
Registering for Post-method Calls

    Standard Method
    Alternate Method
Troubleshooting with DumpDataHTML

Introduction

CATSWeb V8 and subsequent releases are written using 100% VB.NET. CATSWeb is extermely configurable, but you may encounter limitations that can only be overcome by writing some custom code.
  • You may need to accomplish something outside of the scope of standard functionality, such as performing some complex task that is unique to your organization.
  • You may need to automate some portion of your business process.
  • CATSWeb functionality can be extended by utlizing external code functions within Dynamic Link Libraries (DLLs).

Dynamic Link Libraries (DLLs)

DLLs can house external shared code and business logic. Each DLL can contain one or more functions, properties or methods as desired. Each function that is called by CATSWeb can perform one or more specific tasks.

  • .NET DLLs
    • By default, CATSWeb provides support for DLLs written using VB.NET (such as Visual Studio .NET 2010), and are considered to be .NET Class DLLs.
    • A knowledge of Visual Basic .NET is required to write one of these DLLs. AssurX offers Developer and API courses that provide instruction on how to create one of these DLLs.
    • .NET Class DLL functions called by CATSWeb have a specific interface definition, in which several parameters of various types are passed to the function. Each function can return one or more parameters and values to CATSWeb, which can alter the standard behavior of CATSWeb. They can utilize CATSWeb API functions, methods and properties, making them a very powerful tool for enhancing the functionality of your system. The functions within a DLL can be defined to CATSWeb using ActiveX DLL Data Links, ActiveX DLL with Parameters Data Links and Web Service Data Links.

  • CATSWeb V8 Compatibility with VB6 DLLs
    • CATSWeb V8 is not compatible with VB6 because VB6 doesn't support Unicode. To work with CATSWeb V8, any VB6 legacy DLLs will need to be re-written using VB.NET and ADO.NET.

Data Links

Data Links can retrieve data from almost any source imaginable, and are also a key component of Event Hooks, Automatic Lookups, Intelligent Lists, .Drill Down Links, Display Parts, etc.

.NET Class DLL functions can perform a variety of operations, including:
  • Automatic Lookups:
  • Event Hooks:
    • Actions can be taken during various events, such as when a form is added, edited or loaded, reloaded or deleted. Click here for an overview of the event settings.
    • Can return values or perform custom actions such as:
      • Calculate and returning replacement field values during Add or Edit mode.
      • Performing custom validations and returning error messages.
    • Conditions can be defined to determine if the condtions are right to allow the Event Hook to run.
      • Conditions can be defined within the Conditions,section of the Event Hook. These conditions are checked before the Event Hook calls the .NET Class DLL function. If the conditions are false, the Event Hook will not call the .NET Class DLL.
      • Conditions can be defined within the code of the .NET Class function that is called by the Event Hook. In this scenario, the Event Hook is always run, but the code within the .NET Class function checks the conditions and nust exit if the condtions are not right to perform the tasks within the function.
    • Can perform custom actions during a Post-method Call.
      • Return custom status messages.
      • When used in conjunction with the CATSWeb API.
        • Return custom E-Mail notifications.
        • Complex workflows can be created. Event Hooks can be created that automatically add, edit or delete records, perform workflow operations, etc.
    • Can be used to implement Dynamic Forms via Form Load Event Hooks. The appearance of a Dynamic Form will change, based upon some condition. See examples below.
      • Change the properties of fields or sections on the form, such as visiblility, editabiity, etc.
      • Dynamically add data to a form, including HTML, JavaScript, etc.
DLL Function Interface

.NET Class DLLs developed for use with CATSWeb
ActiveX DLL Data Links or ActiveX DLL with Parameters Data Links must include functions that have a specific interface definition..

Visual Basic .NET Interface



Here is a function written in Visual Basic .NET 2010 (the preferred method) which shows the required interface.

Public Function MySampleProcedure (ByVal dtSessionRecord As System.Data.DataTable, _
    ByVal FormType As Short, _
    ByVal Category As String, _
    ByVal opCode As Short, _
    ByVal theTableField As String, _
    ByVal theTableFieldValue As String, _
    ByVal dtRecord As System.Data.DataTable, _
    ByVal dtParams As System.Data.DataTable, _
    ByRef colHTML As ASXCollection.ASXCollection, _
    ByRef errString As String) _
    As System.Data.DataTable
Dim myDataTable As New System.Data.DataTable

{Application-specific code to fill the myDataTable or colHTML with data}

Set MySampleProcedure = myDataTable

End Function

As shown, the function should return an ADO.NET DataTable. The DataTable that is returned may be set to Nothing, or may contain 1 or more columns and 1 or more rows, based upon the requirments of the property.

  • All parameters declared with the "ByVal" keyword are passed by value, meaning they are purely input parameters to the property. These can be used to determine which actions to take within each function. These include the following.
  • The remaining parameters that have the "ByRef" keyword are bi-directional parameters passed by reference instead of by value. The DLL procedure can modify these parameters and CATSWeb will be able to read the changes. These include the following.
Back to Top


The Interface parameters are as follows:
  • dtSessionRecord: An ADO.NET DataTable containing the session record for the current CATSWeb user. This recordset contains many parameters which are useful for record filtering or other applications. To see all that is available, examine the CATSWeb Sessions table or Database Schema Document. Here are some of the most useful fields:
    • ConnectString: The ADO connection string used to connect to the CATSWeb database. Utilizing this string for your own CATSWeb connections will assure that the procedure functions even if the system administrator makes changes, or if the DLL is deployed in a different CATSWeb system.a different CATSWeb system..
    • EmployeeID: The Employee ID of the current user.
    • EmployeeName: The name of the current user.
    • Department: The department of the current user.
    • EMailAddress1: The E-mail address of the current user.

  • formType: A short integer parameter specifying the type of form the function is getting called from or for. Utilizes the CWEB_FORMTYPE_ set of values that are described within the CATSWeb Public Constants. See below for some examples.
    Form Type Value Constant
    Issue 1 CWEB_FORMTYPE_ISSUE
    Actions 4 CWEB_FORMTYPE_CA
    Subtasks 55 CWEB_FORMTYPE_SUBTASKS
    Subforms 108 CWEB_FORMTYPE_SUBFORM
    Notes 10 CWEB_FORMTYPE_NOTES
    Links 36 CWEB_FORMTYPE_LINK
    File Attachments 37 CWEB_FORMTYPE_ATTACHMENT
    Signatures 46 CWEB_FORMTYPE_SIGNATURE
    Group 26 CWEB_FORMTYPE_ADMIN_GROUP
    Department 24 CWEB_FORMTYPE_ADMIN_DEPARTMENT
    Personality 170 CWEB_FORMTYPE_ADMIN_EMPLOYEE_PERSONALITY
    Employee 23 CWEB_FORMTYPE_ADMIN_PERSONNEL

  • category: Variable length string.
    Operation Value
    List Values The category of the form.
    Default Value The category of the form.
    Drill Down The category of the record being drilled down on.
    Event Hook The category of the record being operated on.
    Post-method Call The category of the record being operated on.

  • opCode: A short integer variable which indicates the type of operation in process when the function is called. Utilizes the CWEB_OPCODE_ set of values that are described within the CATSWeb Public Constants. See below for some examples.
    Operation Value Constant
    List Values 1 CWEB_OPCODE_LIST_VALUES
    Default Value 2 CWEB_OPCODE_DEFAUALT_VALUE
    Drill Down 3 CWEB_OPCODE_DRILLDOWN
    Event Hook 4 CWEB_OPCODE_EVENT_HOOK
    CWEB_OPCODE_AUTO_LOOKUP
    CWEB_OPCODE_INITIAL_CALL
    Post-method Call 5 CWEB_OPCODE_POSTMETHOD_DLL_CALL

  • theTableField: Variable length string.
    Operation Value
    List Values The name of the field that requires the data.
    Default Value The name of the field that requires the data.
    Drill Down The name of the field or control that was clicked by the user.
    Event Hook

    The string equivalent of the action code. Utilizes the CWEB_ACTION_ set of values that are described within the CATSWeb Public Constants. See below for some examples.

    • CWEB_ACTION_ADD (1)
    • CWEB_ACTION_EDIT (2)
    • CWEB_ACTION_DELETE (3)
    Post-method Call

    The string equivalent of the action code. Utilizes the CWEB_ACTION_ set of values that are described within the CATSWeb Public Constants. See below for some examples.

    • CWEB_ACTION_ADD (1)
    • CWEB_ACTION_EDIT (2)
    • CWEB_ACTION_DELETE (3)

  • theTableFieldValue:  Variable length string.
    Operation Value
    List Values Empty string.
    Default Value Empty string.
    Drill Down the value of the field that was clicked by the user.
    Event Hook The string equivalent of the record ID (e.g. IncidentID, ActionID, etc.), unless the Event Hook is for a record being newly added. The string will be empty in that case since a record ID has not yet been assigned.
    Post-method Call The string equivalent of the record ID (e.g. IncidentID, ActionID, etc.), even when a record was newly added.

  • dtRecord: An ADO.NET DataTable.
    Operation Value
    List Values Nothing.
    Default Value Nothing.
    Drill Down A complete copy of the record being drilled down on.
    Event Hook

    All the values submitted by the user.

    • ActiveX DLL and Web Service Data Links that are used by Display Parts are passed the Display Part configuration record.
    Post-method Call All the values submitted by the user, as modified by any Event Hook operations.

  • dtParams: An ADO.NET DataTable.
    Operation Value
    Event Hook

    In most cases, this parameter will be set to Nothing.

    • ActiveX DLL and Web Service Data Links that are used by Display Parts are passed the Issue/Action/Subtask record.
    Post-method Call

    In most cases, this parameter will be set to Nothing.

    • Post-method Call Event Hooks that run during Signature Controlled events can test values within this parameter to determine if the final signature has been added.
      • If any signature controlled operations completed, dtParams will be open and contain a single record for each operation that completed.
      • Each record will contain a single field (AsxCompletedApprovalOpCodes) that will contain the Approval Op Code of the operation.

    • AsxCompletedApprovalOpCodes values:
    Record
    Type
    Approval Type Value CATSWeb Constant
    Issue Issue Submission Approval 1 CWEB_APPROVAL_OP_ISSUE_SUBMISSION
    Issue Preliminary Disposition Approval 2 CWEB_APPROVAL_OP_PRELIM_DISP
    Issue   Final Disposition Approval 3 CWEB_APPROVAL_OP_FINAL_DISP
    Issue Final Issue Approval 4 CWEB_APPROVAL_OP_FINAL_ISSUE
    Action Action Completion Approval 24 CWEB_APPROVAL_OP_ACTION_COMPLETION
    Action Action Closing Approval 22 CWEB_APPROVAL_OP_ACTION_CLOSING
    Subtask Subtask Completion Approval 41 CWEB_APPROVAL_OP_SUBTASK_COMPLETION
    Subtask Subtask Closing Approval 42 CWEB_APPROVAL_OP_SUBTASK_CLOSING

  • colHTML - Collection. This is not a standard .NET collection, but is actually a special AssurX collection, that is very similar to a VB6 VBA collection. See ASXCollection for details.

    During some operations, it will contain IIS Server Variables on input.
    Operation IIS Server Variables Value
    List Values N Nothing.
    Default Value N Nothing.
    Drill Down Y On output: your function code may add entries to the collection that can modify or replace some or all of the Field Captions or HTML that CATSWeb displays to the user. See below for more information.
    Event Hook Y

    On input: will contain field property changes made by previous event hooks.

    On output: During Form Preload, Form Load or Form Reload operations: Your function code may add entries to the collection that can modify or replace some or all of the Field Properties or HTML that CATSWeb displays to the user. See below for more information.

    Post-method Call Y Nothing.

  • errString - On input, this variable-length string parameter will be empty. Normally your procedure code should not modify this parameter.
    • Event Hooks: .If called as an Event Hook, setting this string to any value other than empty will cause the recordset returned to CATSWeb to be ignored. However, no error in CATSWeb will be triggered or displayed.
    • Drill Down Links: If your function is being called from a drill down link, and it encounters an error, it should handle the error and fill the errString with error text. CATSWeb will display the text to the user in an error message.
      • Note that because of the way CATSWeb calls the function, it cannot read values from the Error object that would be raised from the DLL function. The error must be handled by the function. The only way for CATSWeb to display a specific error message to a user accessing a drill down link is via this parameter.
    • If called for any other reason, this parameter will be ignored.
Back to Top


Modifying CATSWeb Field Properties and HTML

CATSWeb Form Field Properties and HTML may be changed dynamically at runtime via Event Hooks. Click here to see how to modify form field properties using Configurable Actions.

Event Hooks can be configured to use an ActiveX DLL Data Link, ActiveX DLL with Parameters Data Link or Web Service Data Link. The associated .NET Class DLL function can return values to CATSWeb for a variety of purposes, such as Error and Status messages, modifying Form Field Properties, modifying form field values, etc. For more information on these capabilities in conjunction with Event Hooks, see the CATSWeb Technical Note titled Implementing Dynamic Forms. If you do not have this document, you may request it from AssurX Technical Support
..
  • Form Field Properties

    Event Hooks that operate during Form Load or Reload can modify Form Field Properties. This can be useful for making a form dynamic, creating sophisticated workflows, etc. As with all Event Hooks, the .NET Class DLL function must return data back to CATSWeb to identify the specific field or control properties that are to be modified.

    • The data returned must have specific string keys, which are comprised of:
      • Field or Control Names, such as Text3 or FixedTextArea001.
      • A property suffix. See Form Field Properties for details on the suffxies.

    • The data returned must have specific string values.
      • Some properties require True or False.
      • Some properties require a string value, such as an HTML color, a caption or a fill specification.

    • CATSWeb looks for the named strings in the returned data, and if present, uses them to modify the desired Form Field Properties. Data can be returned in two different ways.

      • colHTML: Collection items can be added to the colHTML collection. This is the preferred method. See the help for ASXCollection for details on usage. The examples below set the editability of the Text3 field to either true or false.
        • False: colHTML.Add("False", "text3" + CWEB_SUFFIX_EDITABLE)
        • True: colHTML.Add("True", "text3" + CWEB_SUFFIX_EDITABLE)

      • Table field columns and values can be added to the DataTable that is returned by the function. It works in a similar fashion to what is described above, only the data is returned in the DataTable (instead of colHTML.The example below sets the editability of the Text3 field to false.
        • Dim dtTemp As System.Data.DataTable = Nothing
          Dim temprow As System.Data.DataRow = Nothing
          dim strFieldProperty AS String = "text3" + CWEB_SUFFIX_EDITABLE
          dtTemp = New DataTable("Temp")
          dtTemp.Columns.Add(strFieldProperty, Type.GetType("System.String"))
          temprow = dtTemp.NewRow()
          temprow(strFieldProperty) = "False"
          dtTemp.Rows.Add(temprow)
          FunctionName = dtTemp

  • HTML

    • colHTML is also used in conjunction with Form Load, Reload and Form Pre-load Event Hooks to implement Dynamic Forms.The entire Body or Page can be returned using the String Names below. It can also return custom content for Display Parts. For more information on these capabilities, see the CATSWeb Technical Note titled Implementing Dynamic Forms. If you do not have this document, you may request it from AssurX Technical Support.

      String Name CATSWeb Constant Usage
      !BODY! CWEB_HTML_BODY If specified, the body of the page will be replaced by this HTML. In this context, "body" means all of the area below the horizontal rule that appears at the bottom of the CATSWeb page header. In either case, the HTML specified should not include the <HTML>, <HEAD>, or <BODY> tags, or their corresponding end tags. Those will already be included by CATSWeb.
      !PAGE! CWEB_HTML_PAGE If specified, the entire page will be replaced with this HTML. The HTML must include the <HTML>, <HEAD>, or <BODY> tags, their corresponding end tags, and everything in between.

Modifying HTML in Drill Down Results

When a .NET Class DLL is used in conjunction with a Drill Down Link, CATSWeb takes the DataTable returned by the DLL function and formats it for display. The page is comprised entirely of HTML. Optionally, the DLL function can make modifications to the HTML generated, and can even replace the entire page with its own HTML. This is done via the colHTML parameter.

When the DLL function is called by CATSWeb, the colHTML parameter will contain most of the IIS server variables, such as HTTP_USER_AGENT, REMOTE_ADDR, etc. On output, your function code may add entries to the collection that can modify or replace some or all of the Field Captions or HTML that CATSWeb displays to the user.

  • The DLL function can add HTML strings to the colHTML collection for return to CATSWeb. The strings must have specific keys (names). CATSWeb looks for the named strings in the collection, and if present, uses them to modify the HTML.
  • For example, this code in the DLL function causes CATSWeb to display a custom title, overriding the title specified in the drill down link definition:
colHTML.Add("This is My Custom Title", "!TITLE!")
Many of the strings override similar parameters in the drill down link definition, and that topic should be referred to for more information on these parameters. Utilizes the CWEB_HTML_ set of values that are described within the CATSWeb Public Constants. The available named strings are:
String Name CATSWeb Constant Usage
!TITLE! CWEB_HTML_TITLE Specifies a custom title
!SUBTITLE! CWEB_HTML_SUBTITLE Specifies a custom subtitle
!HELPFILE! CWEB_HTML_HELP_FILE Specifies the help file
!DISPLAYMODE! CWEB_HTML_DISPLAYMODE Specify "1" to display data in a form, or "2" to display it in a table
!FIELDSPERROW! CWEB_HTML_FIELDS_PER_ROW For form display, specifies number of fields per row
!SUPPRESSHEADER! CWEB_HTML_SUPPRESS_HEADER Specify "-1" to suppress the standard CATSWeb page header, or "0" to enable it
!LINKFIELDS! CWEB_HTML_LINK_FIELDS Specifies which fields become links
!URLS! CWEB_HTML_URLS Specifies URLs for the links
!URLREPLACEMENTS! CWEB_HTML_URL_REPLACEMENTS Specifies replacements for the URLs
!PREDATATEXT! CWEB_HTML_FIELDS_PRE_DATA_TEXT Specifies additional HTML that is placed after the title and subtitle, and immediately before the formatted data
!POSTDATATEXT! CWEB_HTML_FIELDS_POST_DATA_TEXT Specifies additional HTML that is placed immediately after the formatted data
!BODY! CWEB_HTML_BODY If specified, the body of the page will be replaced by this HTML. In this context, "body" means all of the area below the horizontal rule that appears at the bottom of the CATSWeb page header. If the page header is suppressed by the drill down link setting or the !SUPPRESSHEADER! override, the HTML will occupy the entire visible page. In either case, the HTML specified should not include the <HTML>, <HEAD>, or <BODY> tags, or their corresponding end tags. Those will already be included by CATSWeb.
!PAGE! CWEB_HTML_PAGE If specified, the entire page will be replaced with this HTML. The HTML must include the <HTML>, <HEAD>, or <BODY> tags, their corresponding end tags, and everything in between.

Note that if the "!PAGE!" or "!BODY!" strings are returned to CATSWeb as a result of the function being called from a drill down link, there is no need to return a recordset at all. The function can simply return Nothing.

Back to Top



Modifying Field Captions in Drill Down Results

The colHTML collection can also be used to specify custom captions for the fields in the returned ADO.NET DataTable. To do this, add a string containing the custom caption to the collection. The key of the string must be set to the actual recordset field name.

For example, issues are stored in the CATSWeb Incident table and the "IncidentID" field contains the record ID. CATSWeb users are not accustomed to the term "Incident". A better caption for the IncidentID field might be "Issue ID". To make the caption replacement, add a line of code like this:
colHTML.Add "Issue ID", "IncidentID"
You may choose to replace none, some, or all of the field captions in this way.

Implementing Custom Validation Routines

When a .NET Class function is called by an Event Hook, it can perform complex validations of user submissions and return validation error messages back to CATSWeb for presentation to the user. To return validation errors, the returned recordset must contain a string field named AsxValidationErrorMessage . One record is included for each validation error, with the error text in the AsxValidationErrorMessage field.



The Visual Basic .NET 2010 code below shows an example of a validation routine:

Public Function CustomValidation (ByVal dtSessionRecord As System.Data.DataTable, _
    ByVal FormType As Short, _
    ByVal Category As String, _
    ByVal opCode As Short, _
    ByVal theTableField As String, _
    ByVal theTableFieldValue As String, _
    ByVal dtRecord As System.Data.DataTable, _
    ByVal dtParams As System.Data.DataTable, _
    ByRef colHTML As ASXCollection.ASXCollection, _
    ByRef errString As String) _
    As System.Data.DataTable

Dim theFunctionName As String = "CustomValidation"
Dim strErr As String = vbEmpty

Dim dtTemp As New System.Data.DataTable = Nothing
Dim temprow As DataRow = Nothing
Dim theFieldName As String = vbEmpty
Dim theSubmittedCategory As String = vbEmpty
Dim theValidationErrorMessage As String = vbEmpty
Try
'Synthesize a new ADO.NET DataTable that includes an "AsxValidationErrorMessage" text field. This is 'the only field the DataTable needs when returning
'validation errors to CATSWeb
dtTemp = New DataTable("Temp")

'As an example, add a validation error message regarding
'the category that the user submitted. In a real implementation,
'you would read whatever fields needed to be validated.

' Retrieve the Category field from the Form.
theSubmittedCategory = dtRecord.Rows(0).Item("Category")

'Perform some sort of an error validation
If theSubmittedCategory = "Basic Action Form" Then

'Add a column to the DataTable
theFieldName = "AsxValidationErrorMessage"
dtTemp.Columns.Add(theFieldName, Type.GetType("System.String"))

'Create the validation error message
theValidationErrorMessage = "The Category you entered (" + __
theSubmittedCategory + ") is not valid."

' Create a new row in our DataTable.
temprow = dtTemp.NewRow()

'Insert our information into the row
temprow(theTableFieldName) = theValidationErrorMessage

' Add our new row to the DataTable.
dtTemp.Rows.Add(temprow)

'Add a few more validation error messages just for illustration.

' Create a new row in our DataTable.
temprow = dtTemp.NewRow()

theValidationErrorMessage = "Your entry in the FooBar field is not valid."
temprow(theTableFieldName) = theValidationErrorMessage

' Add our new row to the DataTable.
dtTemp.Rows.Add(temprow)

' Create a new row in our DataTable.
temprow = dtTemp.NewRow()

theValidationErrorMessage = "Your entry in the FooBar field is not valid."
temprow(theTableFieldName) = theValidationErrorMessage

' Add our new row to the DataTable.
dtTemp.Rows.Add(temprow)

'Now return the DataTable containing the validation error
'messages. When CATSWeb finds the AsxValidationErrorMessage field,
'it will  automatically loop through and 'display all of the error messages.

CustomValidation = dtTemp

Catch ex As Exception
CustomValidation = Nothing
strErr = theFunctionName + " Error: " + StackErrNET(ex)

Finally
'CLEAN UP

End Try


End Function


Back to Top


Registering for Post-method Calls (Standard Method)

When a .NET Class DLL function is called by an Event Hook (via an ActiveX DLL Data Link, ActiveX DLL with Parameters Data Link or Web Service Data Link), it is called during the initial call of the CATSWeb process, prior to any action CATSWeb may need to take. This includes standard validations that CATSWeb usually performs, as well as the actual process of adding, editing or deleting the record. In some applications it is desirable for the function to be called after the CATSWeb process has completed (such as after a record has been successfully added).

  • For example, if the function is designed to send a custom E-mail message after a new record is added, the appropriate time for doing so is after the submission passes all validation tests.
  • CATSWeb provides a means for a DLL function to register itself (or a different function) for a post-method call at the end of the process. The registration occurs during the initial call from the Event Hook. An Alternate Method is also available.

The code below shows how to accomplish this using Visual Basic.NET 2010:

Public Function SendCustomEmail(ByVal dtSessionRecord As System.Data.DataTable, _
    ByVal FormType As Short, _
    ByVal Category As String, _
    ByVal opCode As Short, _
    ByVal theTableField As String, _
    ByVal theTableFieldValue As String, _
    ByVal dtRecord As System.Data.DataTable, _
    ByVal dtParams As System.Data.DataTable, _
    ByRef colHTML As ASXCollection.ASXCollection, _
    ByRef errString As String) _
    As System.Data.DataTable

Dim theFunctionName As String = "SendCustomEmail"
Dim strErr As String = vbEmpty

Dim dtTemp As New System.Data.DataTable = Nothing
Dim temprow As DataRow = Nothing
Dim theFieldName As String = vbEmpty
Dim theSubmittedCategory As String = vbEmpty
Dim theValidationErrorMessage As String = vbEmpty
Try

Select Case opCode
Case CWEB_OPCODE_EVENT_HOOK

' We are being called in the beginning of the CATSWeb process.
' The only action we need to take here is to pass back a reference to
' ourselves (our progID and function name) in the returned
' recordset so that we can be called again at the end of the
' process.

' Begin by creating a ADO.NET DataTable  from scratch that we will later
' return back to CATSWeb.
dtTemp = New DataTable("Temp")

'Add a column to the DataTable
dtTemp.Columns.Add(CWEB_FLD_ASSURX_POSTMETHOD_PROGID, Type.GetType("System.String"))

'Add a column to the DataTable
dtTemp.Columns.Add(CWEB_FLD_ASSURX_POSTMETHOD_PROPERTY, Type.GetType("System.String"))


' Add our data to the DataTable. We will just
' be returning back a single record containing our values
' in the appropriate fields.

' Create a new row in our DataTable.
temprow = dtTemp.NewRow()

theValidationErrorMessage = "Your entry in the FooBar field is not valid."
temprow(CWEB_FLD_ASSURX_POSTMETHOD_PROGID) = "Sample.Class"
temprow(CWEB_FLD_ASSURX_POSTMETHOD_PROPERTY) = theFunctionName

' Add our new row to the DataTable.
dtTemp.Rows.Add(temprow)


' We are done. Return our DataTable back to CATSWeb.

SendCustomEmail = dtTemp
Exit Function

Case CWEB_OPCODE_POSTMETHOD_DLL_CALL

' We are being called at the end of the process.

{Put code here to send custom E-mail}

Case Else

' We are being called for some unknown reason. Exit now.

Exit Function

End Select


Catch ex As Exception
SendCustomEmail = Nothing
strErr = theFunctionName + " Error: " + StackErrNET(ex)

Finally
'CLEAN UP

End Try

End Function

Back to Top


Registering for Post-method Calls (Alternate Method)

The ActiveX DLL with Parameters Data Links offer an alternate method of registering for post-method calls. This method causes the optional parameters stored in the data link record to be passed to the DLL in colHTML, just as it is during the initial call. To use this method, return the following information in the function's output .NET DataTable.

  • CWEB_FLD_ASSURX_POSTMETHOD_PROGID ("AsxPostMethodProgID") - Return the name of the data link, instead of the programmatic ID.

  • CWEB_FLD_ASSURX_POSTMETHOD_DATA_LINK ("AsxPostMethodDataLink") - Return "-1" to signal CATSWeb to make the post-process call using the data link's configuration data.

  • CWEB_FLD_ASSURX_POSTMETHOD_PROPERTY ("AsxPostMethodProperty") - Not used. This field may be Null or be entirely omitted from the recordset.

Back to Top


Troubleshooting with DumpDataHTML

It is often desirable to know exactly what values are being passed into a .NET Class DLL during various Event Hook calls.AssurX's validation DLL (AssurXValidation.dll) contains a property named DumpDataHTML which implements a universal data dump routine.

  • When it is called as an Event Hook, it creates an HTML file that contains a listing of the all of the parameters values that are passed to the function, including dtRecord, dtSessionRecord, colHTML. Where applicable, it automatically registers itself for a post-process call, then creates a second file showing a dump of the data for the post-process phase. The dump files are named in a manner that allows the data for different events to be easily distinguished (e.g., DumpDataHTML_Issue_Add_InitialCall.htm, DumpDataHTML_Issue_Add_PostProcessCall.htm, DumpDataHTML_Issue_PreLoad_View_InitialCall.htm).

To utilize DumpDataHTML, do the following:

  • Locate AssurXValidation.dll on the CATSWeb CD-ROM or electronic media. Use Windows Explorer to read the version number and assure it is 8.00 or higher. If it has a lower version, obtain a new file from later CATSWeb Service Packs (Build 18 min).

  • Copy AssurXValidation.dll to your CATSWeb installation directory on the Web server. If a prior version already exists, you may need to restart IIS to eliminate possible file sharing violations during the copy process.
  • On the Web server, open a command window and change to the CATSWeb installation directory. Use REGASM to register the DLL,
  • Add a new ActiveX DLL Data Link with the following settings:
    • Data Link Name - AssurXValidation_DumpDataHTML
    • Programmatic ID - AssurXValidation.ValidationClass
    • Property Name - DumpDataHTML
  • You may now use this data link in any Event Hook. Make the Event Hook active during the events that you wish to receive data dumps for.
  • When DumpDataHTML is called, by default it will create its dump file in the CATSWeb installation directory on the Web server. This means that the IIS account must have permission to read, write and delete files in this folder, else the file will not be created. If you prefer to have the dump files created in a different location, you may:
    • For 64 bit Windows systems systems:
      • Add a string value named "DumpDataHTMLFolder" to the "HKLM\Software\Wow6432Node\AssurX\CATSWeb V8" registry key (create the key first if it does not exist) and set the value to a folder location using a full path (ex: "C:\Temp").
      • Assure that the IIS account has permission to read, write and delete files in this folder, and assure that it can read the registry key.

Back to Top