CSharp · Console
using System;
using System.Threading.Tasks;
namespace Celin
{
// Namespace for the Work With Addresses Form
namespace W01012B
{
// The Grid Defintion
public class Row
{
// Grid Columns
public long z_AN8_19 { get; set; }
public string z_ALPH_20 { get; set; }
}
// The Form Defintion
public class FormData : AIS.FormData<Row>
{
// Form Field "Search Type"
public AIS.FormField<string> z_AT1_54 { get; set; }
}
// Form Response
public class Response : AIS.FormResponse
{
// Form Parameter
public AIS.Form<FormData> fs_P01012_W01012B { get; set; }
}
// Form Request
public class Request : AIS.FormRequest
{
public Request()
{
// Form name to call
formName = "P01012_W01012B";
// Version
version = "ZJDE0001";
// Read-only
formServiceAction = "R";
// Return Maximum 10 rows
maxPageSize = "10";
// Return Form Field 54 and Grid Columns 19 and 20
returnControlIDs = "54|1[19,20]";
// Create Form Action
formActions = new []
{
// Set the Search Type to "C"
new AIS.FormAction { controlID = "54", command = AIS.FormAction.SetControlValue , value = "C" },
// Press the Find Button
new AIS.FormAction { controlID = "15", command = AIS.FormAction.DoAction }
};
}
}
}
public class Program
{
public static async Task Main()
{
// Initialise the E1 AIS Client
var e1 = new AIS.Server("https://demo.steltix.com/jderest/v2/");
// Set Credentials
e1.AuthRequest.username = "demo";
e1.AuthRequest.password = "demo";
try
{
// Authenticate
await e1.AuthenticateAsync();
Console.WriteLine("{0}, Welcome to {1}", e1.AuthResponse.userInfo.alphaName, e1.AuthResponse.environment);
// Submit Concrete Request and Response
var p01012 = await e1.RequestAsync<W01012B.Response>(new W01012B.Request());
// Get the Form Parameter, semantics simplicity
var form = p01012.fs_P01012_W01012B;
// Output the Form
Console.WriteLine("{0} ({1})", form.title, p01012.currentApp);
Console.WriteLine("{0}: {1}", form.data.z_AT1_54.title, form.data.z_AT1_54.value);
// Output the Grid Rows
foreach (var row in form.data.gridData.rowset)
{
Console.WriteLine("{0,-10} {1}", row.z_AN8_19, row.z_ALPH_20);
}
// Sign-out
await e1.LogoutAsync();
Console.WriteLine("Goodbye!");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}