Quintiq file version 2.0
#parent: #root
Method OnOK () id:Method_DialogCreateEditCurrencyRate_OnOK
{
  #keys: '[139394.0.576914037]'
  Body:
  [*
    // On ok
    Form.ApplyChanges();
    
    data := DataHolderDialogData.Data();
    selection := DataHolderEditingData.Data();
    
    // New
    if( isnull( data.WrappedInstance() ) )
    {
      newcurrencyrate := CurrencyRate_MP::Create( data.Currency_MP(),
                                                  data.Start(),
                                                  data.Rate(),
                                                  false );
      
      // Access the form, select the new currency rate
      DataHolderForm.Data().ListCurrencyRate().SelectByKey( newcurrencyrate.Key() );
    }
    else
    {
      CurrencyRate_MP::Update( selection,
                               data.Currency_MP(),
                               dsStart.Date(), // Start is ReadOnly, changes will not be applied.
                               data.Rate() );
    }
    
    
    Form.Close();
  *]
}
