Sir,
i have created a new class and using event onMappingEntityToDataSource
class AcxLedgerJournalEntity
{
/// <summary>
///
/// </summary>
/// <param name="_sender"></param>
/// <param name="_eventArgs"></param>
[DataEventHandler(tableStr(LedgerJournalEntity), DataEventType::MappingEntityToDataSource)]
public static void LedgerJournalEntity_onMappingEntityToDataSource(Common _sender, DataEventArgs _eventArgs)
{
}
}
but how can i get the instance or objects of DataEntityRuntimeContext entityCtx, DataEntityDataSourceRuntimeContext dataSourceCtx.
public void mapEntityToDataSource(DataEntityRuntimeContext entityCtx, DataEntityDataSourceRuntimeContext dataSourceCtx)
{
if (entityCtx.getDatabaseOperation() == DataEntityDatabaseOperation::Insert
|| entityCtx.getDatabaseOperation() == DataEntityDatabaseOperation::Update)
{
// When editing through the entity, always delay tax calculation to avoid
// a O(n^2) tax calculation while importing multiple lines. The journal will
// automatically calculate taxes later at posting time or when necessary.
this.DelayTaxCalculation = NoYes::Yes;
switch (dataSourceCtx.name())
{
case dataEntityDataSourceStr(LedgerJournalEntity, LedgerJournalTable):
dataSourceCtx.setBuffer(LedgerJournalEntityBase::findOrCreateLedgerJournalHeader(this));
break;
}
super(entityCtx, dataSourceCtx);
}
}