' SummaryPage2_TaskManagerAccountApps_ApplicationSummary
Option Explicit On
Option Strict On

' #################################################################
' Task Manager Account Applications Summary Script

' Version: 1.00 (05/02/2015)

' Usage: Task Manager
' #################################################################

' Constants

' Objects
Private mTaskManagerAccountApp As finTaskManagerAccountApp

' Other
Private mView As String

Public Function Main(source As Object,
                     eventId As String,
                     eventArgs As ISKeyValueList,
                     ByRef handled As Boolean,
                     ByRef returnValues As ISKeyValueList,
                     ByRef text As String) As Boolean

Dim Index As Integer
Dim TaskManagerAccountApps As finTaskManagerAccountApps

  ' Assume Success
  Main = True

  ' Initialise
  Index = eventArgs.GetInteger("Index")
  TaskManagerAccountApps = DirectCast(source, finTaskManagerAccountApps)
  If Index >= 0 AndAlso Index < TaskManagerAccountApps.Count Then
    mTaskManagerAccountApp = TaskManagerAccountApps(Index)
  End If

  ' Get Constants
  With ScriptInfo.Constants
  End With

  ' Handle Events
  Select Case eventId
    Case ""
      ' Main event, i.e., return main page content
      Main = CreatePage(text)
  End Select

End Function

Private Function CreatePage(ByRef html As String) As Boolean

  ' Assume Success
  CreatePage = True

  ' Use Summary Page from Account Application Type (pass ContextData so Constants etc are available to the Summary Script)
  html = finBL.SummaryPageFunctions.AccountAppSummary(False, mTaskManagerAccountApp.AccountApp, ScriptInfo.ContextData.ToKeyValueList())

End Function