It contains:
Create method.
This is called once at server startup and defines the
App-level event handlers
for all instances (user sessions) of the HomeBanking application.
HomeBanking::Create
{
HomeBanking.AddEvent(event:"UserData", HomeBanking.OpenFirst);
HomeBanking.AddEvent(event:"Timeout", HomeBanking.AppTimeout);
HomeBanking.AddEvent(event:"Quit", HomeBanking.QuitSession);
HomeBanking.AddEvent(event:"LastWindowClosed", HomeBanking.LastWinClosed);
HomeBanking.AddEvent(event:"Action", item:"1010", HomeBanking.SignOff);
HomeBanking.AddEvent(event:"Action", item:"1001", HomeBanking.MainMenu);
HomeBanking.AddEvent(event:"Action", item:"1005", HomeBanking.QuickBal);
HomeBanking.AddEvent(event:"Action", item:"1006", HomeBanking.AcctInfo);
HomeBanking.AddEvent(event:"Action", item:"1007", HomeBanking.BillPmt);
HomeBanking.AddEvent(event:"Action", item:"1008", HomeBanking.Xfer);
HomeBanking.AddEvent(event:"Action", item:"1009", HomeBanking.CustServ);
}
|
Scripts such as this one above are called event handlers ony because they are "linked"
to incoming events via the AddEvent method. Incidentally, the notation X::Y { } is a
declaration of a script "Y" belonging to "X"; it is invoked by X.Y() and referred to
as X.Y - complicated?
Setup method. This is called for each new App
instance, that is, to set up each user session.
Application global variables, that is those which will be available to all Form instances in a single session, should be declared here.
HomeBanking::Setup
{
String ThisAppID;
VHB Tandem;
// Declare application global variables
String sUser; // VCN ID
String sPIN; // VCH Passcode
Status stResult; // global status object for VHB response
Boolean bSignedOn; // Does the user have a Tandem session?
Boolean bPendingTransaction; // Pending transaction flag
Boolean bBump; // Bump to next bus day flag
Boolean bTimeout; // Timeout flag
Boolean bGlobalError; // Global Error flag (used?)
Boolean bDemoUser; // Demonstration account flag
Boolean bNoData; // Used by Form 121 functions.
Boolean bTransConfirm; // transaction confirmed flag
String sEventData; // Generic string for user entered data
String sLastOpenNonModal; // last open non-modal form to close
some declarations removed for brevity
HomeBanking.GetUserData(); // User information from AOL - screen name, etc. } |
HomeBanking::SignOff
{
HomeBanking.InitObject("f24");
}
|
f24::Setup
{
String sText;
// ***********************************
// * Get a list of all account which *
// * have had activity during this *
// * session *
// ***********************************
lFromAccount.Clear();
stResult = Tandem.GetActiveAccounts(lFromAccount);
if (stResult == 0)
{
// **********************************
// * Display a message to the user *
// * if there are any accounts that *
// * have had activity . *
// **********************************
if (1 <= lFromAccount.Length())
{
f24.Open( );
sText = "Would you like a download or printed record of ";
sText.append("transactions captured during this HomeBanking session?");
f24.DisplayItem(field:"1", type:"text", sText);
}
else
{
HomeBanking.Close("f24");
subGoodBye();
}
}
else
{
HomeBanking.Close("f24");
subGoodBye();
}
}
|
subGoodBye
{
HomeBanking.Alert("Thank you for using HomeBanking.");
subQuitApp();
}
|
subQuitApp
{
Tandem.Logout();
HomeBanking.Exit(); // Exit Session
}
|
HomeBanking::LastWinClosed
{
Boolean bDone;
// Just in case last window was closed halfway through a Tandem transaction,
// complete it by doing a cancel.
Tandem.CancelConfirm();
bDone = false;
if (EventObject == "f30")
{
HomeBanking.InitObject("f24");
bDone = true;
}
if (EventObject == "f30d")
{
HomeBanking.InitObject("f24");
bDone = true;
}
if (EventObject == "f20")
{
HomeBanking.Alert("Thank you for using HomeBanking.");
HomeBanking.Exit(); // Exit Session
bDone = true;
}
if ( ! bDone)
subMainMenu();
}
|