Class T_BizObj (unit BO)

Inherits from

TDataModule

Constructors



Functions

function BeginTrans : Boolean;

for the sake of this example beginning a transaction is updating the "InUseBy" field and "InUseAt" fields in the main table.

function CommitTrans : Boolean;

When changes have been made, commit trans will call the applyupdate methods of any tables and then update the lock fields in the main table.

function Delete : Boolean;


function Edit : Boolean ;


function Get(What : Variant) : Boolean;


function New : Boolean;


function RollbackTrans : Boolean;

Rollback trans will blow away any cache changes that have been made and release release the lock on the record.

function Save: Boolean;


procedure NewBeforeEdit(DataSet: TDataSet);

the new before insert will check to see if we are in a transaction and if not it will call begin transaction it will then call the before insert that was specified for the table

procedure NewBeforePost(DataSet : TDataSet);

MainTable.

procedure SetMainTable(Table : TTable);

the set main table is responsible for hooking the before edit event of the main table.

procedure clearTransFields;


Properties

property InTransaction : boolean

the InTransaction property is a read only property to publish the fInTrans variable which states that the bisiness object is in a transaction or not.

property MainTable : TTable

this property represents the main table that the locks will be held in.

Events

Variables

fInTrans : Boolean;


fMainTable : TTable;


fOldBeforeEdit : TDataSetNotifyEvent;


fOldBeforePost : TDataSetNotifyEvent;



Constructors


Functions


function BeginTrans : Boolean;

for the sake of this example beginning a transaction is updating the "InUseBy" field and "InUseAt" fields in the main table. If the lock has been held longer than 15 miniutes, the lock will be ignored. If someone else has locked this record, a message box telling when the record was locked and by whom will be shown


function CommitTrans : Boolean;

When changes have been made, commit trans will call the applyupdate methods of any tables and then update the lock fields in the main table. this method should be overridden with inherited called at the end of the procedure because the _BizObj class cannot possibly know how to apply all updates for any tables that need to have them applied.


function Delete : Boolean;


function Edit : Boolean ;


function Get(What : Variant) : Boolean;


function New : Boolean;


function RollbackTrans : Boolean;

Rollback trans will blow away any cache changes that have been made and release release the lock on the record. This method should be overridden in a subclassed module because the _BizObj class cannot possibly know how to blow away all changes.


function Save: Boolean;


procedure NewBeforeEdit(DataSet: TDataSet);

the new before insert will check to see if we are in a transaction and if not it will call begin transaction it will then call the before insert that was specified for the table


procedure NewBeforePost(DataSet : TDataSet);

MainTable.post;


procedure SetMainTable(Table : TTable);

the set main table is responsible for hooking the before edit event of the main table. If the main table is changed the old ones have to be restored.


procedure clearTransFields;


Properties


property InTransaction : boolean

the InTransaction property is a read only property to publish the fInTrans variable which states that the bisiness object is in a transaction or not.


property MainTable : TTable

this property represents the main table that the locks will be held in. This has to be a table object, and it is recommended that this object be the one that editing is done in. If this is not filled in, when the commit, rollback or begin transaction methods fire, an error will happen.


Events


Variables


fInTrans : Boolean;


fMainTable : TTable;


fOldBeforeEdit : TDataSetNotifyEvent;


fOldBeforePost : TDataSetNotifyEvent;