Controlling the Runtime Behavior for AB Suite and EAE

This topic applies to the following presentation project types:

This section contains advanced topics for programming in an ePortal presentation project that uses an AB Suite/EAE data source. Refer to Integrating an AB Suite Application with ePortal before reading this topic.

When you use an AB Suite/EAE data source, ePortal provides public static functions that you can call from C# code in your presentation project. In the case of an MVC application, you can write code in the controller; refer to Programming in the Controller for MVC Web for more information. In the case of a web forms application, you can write code in the code-behind (.aspx.cs) file; refer to Programming in the Code-Behind File for more information.

Getting the Component Object

In order to use the functions, you must supply an object of type Unisys.Component as the first parameter. You can obtain the component object from the session object.

In an MVC controller, you can obtain the component using the following code:

Unisys.Component component = (Unisys.Component)Session["controllername"];

Where controllername is the name of the controller that you supplied when you scaffolded your application with the Scaffold Unisys Controller for ePortal Data Source with Views Dialog or the Scaffold Unisys Controller for ePortal Data Source Dialog. The controller name is case sensitive in this case.

In the code-behind file of a Web Forms project, you can obtain the component using the following code:

 Unisys.Component component = (Unisys.Component)Session["component"];

For a Web Forms project, the string “component” is always used to get the component object from the session.

GetList

The function GetList is used to retrieve a list from the list repository.

Function Signature

public static System.Data.DataTable Unisys.ABSuiteEAE.Connector.ABSuiteEAEConnection.GetList(
       Unisys.Component Component,
       string ListName,
       string ListFormat,
       int HostColumn,
       int DisplayColumn)

Parameter Descriptions

Returned Value

Returns the list as a System.Data.DataTable; returns null if an error occurred.

Sample Code

Unisys.Component component = (Unisys.Component)Session["component"];
    System.Data.DataTable myTable =
          Unisys.ABSuiteEAE.Connector.ABSuiteEAEConnection.GetList(component
                "myList", "%2", 1, 2);
    if (myTable == null)
    {
        // Failure.
    }
    Else
    {
        // Success.
    }

CallPublicSegmentMethod

The function CallPublicSegmentMethod is used to call a public segment method in an AB Suite application. This function cannot be used with an EAE application.

The parameters for the public segment method are supplied as an array of objects that is passed by reference. The array is passed by reference so that it can be updated with information returned from the host application.

Public Method Characteristics

A public method has zero or more parameters. The following are the characteristics of the parameters:

Function Signature

public static bool Unisys.ABSuiteEAE.Connector.ABSuiteEAEConnection.CallPublicSegmentMethod(
       Unisys.Component Component,
       string PMName,
       ref object[] PMParams,
       string dateFormat)

Parameter Descriptions

Returned Value

Returns true if the call succeeds, of false otherwise.

Sample Code

Unisys.Component component = (Unisys.Component)Session["myController"];
// Declare an Object array to hold the parameters.
object[] objParams = new object[3];
string methodName = "MethodExample1";
 
// Set parameters: 
objParams[0] = "string1";
int i = System.Convert.ToInt32("2");
objParams[1] = i;
decimal d = System.Convert.ToDecimal("2.2");
objParams[2] = d;

bool rslt = Unisys.ABSuiteEAE.Connector.ABSuiteEAEConnection.CallPublicSegmentMethod(
component, methodName, ref objParams, "yyyyMMdd");

if (rslt)
{
    // Success.  Retrieve returned parameters:
    string outparam0 = (string)objParams[0];
    string outparam1 = ((int)objParams[1]).ToString();
}
else
{
    // Failure.
}