Misys Risque/Value toolkit: how to detect that the instrument displayed at screen is in audit mode?
10/10/2012 2:29 PM
Imagine that the instrument dialog was overloaded by toolkit, and that the sicovam is required to make some SQL query when opening the insturment dialog. If there is no test on the fact that the instrument is displayed in audit mode, this will certainly fail since the sicovam given by the CSRInstrument will correspond to the "new" sicovam and not the one used in current mode.
The right question is then how to detect that the CSRInstrument returned by a CSRInstrumentDialog::new_CSRInstrument is in audit mode?
Quite easy: the toolkit provides a wrapper that gives the opportunity to do some treatment around the audit: CSRInstrumentHistory. All the audit information is stored on the Sophis internal structure DTitre. Since this structure is not exported, using the wrapper is the right solution.
For instance, the following code permits detected in which mode is displayed the instrument:
CSRInstrument* _item = new_CSRInstrument();
_isHisto = CSRInstrumentHistory::IsHistorical(_item->GetDTitre());
_ident = 0;
_date = 0.;