Quintiq file version 2.0
#parent: #root
Method OnOK () id:Method_DialogCreateEditCurrency_OnOK
{
  #keys: '[139394.0.576904389]'
  Body:
  [*
    // On ok
    Form.ApplyChanges();
    
    data := DataHolderDialogData.Data();
    currency := data.WrappedInstance();
    
    // New
    if( isnull( currency ) )
    {
      currency := Currency_MP::Create( data.ID(),
                           MacroPlan,
                           data.Name(),
                           data.Symbol(),
                           false, //isdefault
                           false /*isfromdb*/ );
      // Access the form, select the currency and focus on list
      DataHolderForm.Data().ListCurrency().SelectByKey( currency.Key() );
    }
    else
    {
      data.WrappedInstance().Update( EditFieldID.Text(), // ID is read only, the changes wont be applied
                                     data.Name(),
                                     data.Symbol(),
                                     data.IsBase(),
                                     false /*isfromdb*/ );
    }
    
    Form.Close();
  *]
}
