OpenPetra
Free Administration Software for Non-Profits
Ict.Petra.Server.MCommon.TPagedDataSet Class Reference

Universal class that can run any SQL SELECT query and return the resulting rows in 'pages' that contain a certain amount of rows. Especially useful for Find screens, but also for other screens where a lot of data is requested but might never be fully accessed. More...

Classes

class  TAsyncFindParameters
 

Public Member Functions

 TPagedDataSet (DataTable ATypedTable)
 Runs a SQL SELECT query and returns the first 'page' containing a certain amount of rows. More...
 
void ExecuteQuery (string AConfigFileName, string ASessionID, string AContext=null, TDataBase ADataBase=null)
 Executes the query. Always call this method in a separate Thread to execute the query asynchronously! More...
 
void ExecuteQueryDirectly (string AContext=null, TDataBase ADataBase=null)
 Executes the query directly. not in a separate thread. without progress tracker. More...
 
DataTable GetData (Int16 APage, Int16 APageSize)
 Returns a DataTable for the requested 'Page'. More...
 
DataTable GetAllData ()
 Returns all data that was found by executing the SQL SELECT Statement. More...
 

Properties

TAsyncFindParameters FindParameters [get, set]
 Pass in an instance of TAsyncFindParameters to set the parameters for the query execution More...
 
TProgressState Progress [get]
 get the current progress More...
 
System.Int32 TotalRecords [get]
 Returns the number of records that was returned by the query More...
 
System.Int16 TotalPages [get]
 Returns the number of Pages that were created More...
 

Detailed Description

Universal class that can run any SQL SELECT query and return the resulting rows in 'pages' that contain a certain amount of rows. Especially useful for Find screens, but also for other screens where a lot of data is requested but might never be fully accessed.

Execution of the query can happen asynchronously by executing ExecuteQuery in a separate Thread!

Constructor & Destructor Documentation

◆ TPagedDataSet()

Ict.Petra.Server.MCommon.TPagedDataSet.TPagedDataSet ( DataTable  ATypedTable)
inline

Runs a SQL SELECT query and returns the first 'page' containing a certain amount of rows.

See also
For an example of how to use this class: look at the Ict.Petra.Server.MPartner.Partner.UIConnectors.TPartnerFindUIConnector class.
Parameters
ATypedTableif you want the result to be a typed datatable, you need to specify the type here, otherwise just pass new DataTable()
Returns
void

Member Function Documentation

◆ ExecuteQuery()

void Ict.Petra.Server.MCommon.TPagedDataSet.ExecuteQuery ( string  AConfigFileName,
string  ASessionID,
string  AContext = null,
TDataBase  ADataBase = null 
)
inline

Executes the query. Always call this method in a separate Thread to execute the query asynchronously!

Parameters
AConfigFileNamepath to the config file
ASessionIDthe id of the current session
AContextContext in which this quite generic Method gets called (e.g. 'Partner Find'). This is optional but should be specified to aid in debugging as it gets logged in case Exceptions happen when the DB Transaction is taken out and the Query gets executed.
ADataBaseAn instantiated TDataBase object, or null (default = null). If null gets passed then the Method executes DB commands with a new Database connection

An instance of TAsyncFindParameters with set up Properties must exist before this procedure can get called!

◆ ExecuteQueryDirectly()

void Ict.Petra.Server.MCommon.TPagedDataSet.ExecuteQueryDirectly ( string  AContext = null,
TDataBase  ADataBase = null 
)
inline

Executes the query directly. not in a separate thread. without progress tracker.

Parameters
AContextContext in which this quite generic Method gets called (e.g. 'Partner Find'). This is optional but should be specified to aid in debugging as it gets logged in case Exceptions happen when the DB Transaction is taken out and the Query gets executed.
ADataBaseAn instantiated TDataBase object, or null (default = null). If null gets passed then the Method executes DB commands with a new Database connection

An instance of TAsyncFindParameters with set up Properties must exist before this procedure can get called!

◆ GetAllData()

DataTable Ict.Petra.Server.MCommon.TPagedDataSet.GetAllData ( )
inline

Returns all data that was found by executing the SQL SELECT Statement.

ExecuteQuery (or ExecuteFullQuery) needs to be called before to execute the SQL SELECT Statement to be able to return data.

Returns
DataTable holding all data that was found by executing the SQL SELECT Statement. This is an copy of the TPagedDataSet's internal DataTable, so the caller is free to do with it what it wants without affecting the internal DataTable of the TPagedDataSet.

◆ GetData()

DataTable Ict.Petra.Server.MCommon.TPagedDataSet.GetData ( Int16  APage,
Int16  APageSize 
)
inline

Returns a DataTable for the requested 'Page'.

ExecuteQuery (or ExecuteFullQuery) needs to be called before to execute the SQL SELECT Statement to be able to return data.

Parameters
APageThe 'Page' that should be returned
APageSizeNumber of DataRows that a 'Page' should contain.
Returns
DataTable containing 'PageSize' (or less if the 'TotalRecords' are less than that value) DataRows.

Property Documentation

◆ FindParameters

TAsyncFindParameters Ict.Petra.Server.MCommon.TPagedDataSet.FindParameters
getset

Pass in an instance of TAsyncFindParameters to set the parameters for the query execution

◆ Progress

TProgressState Ict.Petra.Server.MCommon.TPagedDataSet.Progress
get

get the current progress

◆ TotalPages

System.Int16 Ict.Petra.Server.MCommon.TPagedDataSet.TotalPages
get

Returns the number of Pages that were created

◆ TotalRecords

System.Int32 Ict.Petra.Server.MCommon.TPagedDataSet.TotalRecords
get

Returns the number of records that was returned by the query


The documentation for this class was generated from the following file: