This topic applies to the following presentation project types:
MVC Web presentation project type. Refer to Creating an MVC Web Application.
Web Forms Application presentation project types. Refer to Creating Web Forms Application Projects.
Web Forms Mobile Application presentation project types. Refer to Creating Web Forms Mobile Application Projects.
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
Component – The Unisys.Component object. Refer to Getting the Component Object above for more information.
ListName – This is the name of the list to be retrieved.
ListFormat – The format string for the list if it is a multi-column list.
Examples:
%2%3%4 - Columns 2,3 and 4 will be concatenated into the displayText for display in the listbox
%255%6 - Special format indicates that all 6 columns of the list will be sent back to the client as separate columns. They will not be concatenated.
HostColumn – The column to be used for sending/receiving values to/from the host.
DisplayColumn – The column to be displayed in the listbox.
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:
A parameter can have one of the following directions:
Input: The data is sent to the AB Suite application
Output: The data is sent from the AB Suite application
Input/Output: The data is sent to and returned from the AB Suite application
A parameter can be one of the following AB Suite types:
String (string)
Number (int)
Signed Number (double)
Boolean (bool)
Date (DateTime)
In a public method, the parameters have an associated order that defines the sequence of parameters in the method call.
Public methods contain an associate logic which is written using LDL+. Typically, the public method calls does not make use of GLB.Work, which makes them stateless. This helps the public methods to expose as REST operations.
Function Signature
public static bool Unisys.ABSuiteEAE.Connector.ABSuiteEAEConnection.CallPublicSegmentMethod( Unisys.Component Component, string PMName, ref object[] PMParams, string dateFormat)
Parameter Descriptions
Component – The Unisys.Component object. Refer to Getting the Component Object above for more information.
PMName – This is the name of the public segment method to call.
PMParams – The parameters for the public segment method; this is an array of objects passed by reference.
dateFormat – A standard string format used when dealing with the DateTime class in C#. For example "yyyyMMdd". This format must match the format that the host application expects for a Date specification. This allows the string representation to be converted to a DateTime object and vice versa.
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. }