COMConnector Common.bas

This code sample shows creating the message handler:

Option Strict Off
Option Explicit On
Module Common
    Dim conn As New JDECOMCONNECTOR2Lib.Connector
    Dim connRole As JDECOMCONNECTOR2Lib.IConnector2
    'Dim messageHandler As New messageHandler
    'Dim mHandlerInterface As ImessageHandler
    Dim lngAccessNumber As Integer
    Public Sub comm_Initialize()
        connRole = conn
        On Error GoTo errorHandler
        frmLogin.DefInstance.bLoginEnv = False
        frmLogin.DefInstance.Show()
        While Not frmLogin.DefInstance.bLoginEnv
            System.Windows.Forms.Application.DoEvents()
        End While
        lngAccessNumber = connRole.E1_Event_Login(frmLogin.
DefInstance.
txtUserName.Text, frmLogin.DefInstance.txtPassword.Text, frmLogin.
DefInstance.txtenvironment.Text, frmLogin.DefInstance.txtrole.Text)
        'Debugging  Purpose
        'lngAccessNumber = connRole.E1_Event_Login("JP6849777", 
"PASSWORD", "TDEVNIS2", "*ALL")
        connRole = conn
        Exit Sub
errorHandler:
        MsgBox("Login Failed. You can't Use this Application")

    End Sub

    ' NOTE: the code in this module is particular to this prototype.
    ' Different code is used in a production version to send messages to 
    ' JD Edwards EnterpriseOne using JD Edwards communication protocols.

    Public Sub SendSubscriptionToOneWorld(ByRef eventName As String,
ByRef oneworldevent As EventClass.IOWEvent, ByRef mode As Integer)
        'mHandlerInterface.SubscribeEvent lngAccessNumber, conn, 
eventName, oneworldevent, mode
        On Error GoTo errorHandler
        connRole.E1_Event_Subscribe(lngAccessNumber, oneworldevent)
        Exit Sub
errorHandler:
        MsgBox("Subscirbe Method Failed. You can't Use this 
Application")
    End Sub
    Public Sub SendUnSubscribeToOneWorld(ByRef eventName As String,
ByRef oneworldevent As EventClass.IOWEvent, ByRef mode As Integer)
        On Error GoTo errorHandler
        'mHandlerInterface.UnSubscribeEvent lngAccessNumber, conn, 
eventName, oneworldevent, mode
        connRole.E1_Event_UnSubscribe(lngAccessNumber)
        Exit Sub
errorHandler:
        MsgBox("UnSubscirbe Method Failed. You can't Use this 
Application")
    End Sub
    Public Sub SendLogoffToOneWorld()
        'mHandlerInterface.SubscribeEvent lngAccessNumber, conn, 
eventName, oneworldevent, mode
        On Error GoTo errorHandler
        connRole.E1_Event_Logoff(lngAccessNumber)
        Exit Sub
errorHandler:
        MsgBox("LogOff Method Failed. Terminate ComConnector 
Process and End the Application")
    End Sub
    Public Sub getEventListFromOneWorld(ByRef eventList As String)
        On Error GoTo errorHandler
        'mHandlerInterface.GetEventList lngAccessNumber, conn, 
eventList
        eventList = connRole.E1_Event_GetEventList(lngAccessNumber)
        Exit Sub
errorHandler:
        MsgBox("GetEventList Method Failed. You can't Use this 
Application")
    End Sub
    Public Sub getEventTemplateFromOneWorld(ByRef eventName As 
String, ByRef eventTemplate As String)
        On Error GoTo errorHandler
        'mHandlerInterface.GetEventTemplate lngAccessNumber, 
eventName, conn, eventTemplate
        Exit Sub
errorHandler:
        MsgBox("GetEventTemplate Method Failed. You can't Use this 
Application")
    End Sub
End Module