Quintiq file version 2.0
#parent: #root
Method OnOK () id:Method_DialogCreateEditSalesLevel_OnOK
{
  #keys: '[135040.0.183113912]'
  Body:
  [*
    // When the user clicks ok, 
    // we either create or edit the data
    this.ApplyChanges();
    
    data := DataHolderDialogData.Data();
    
    if( isnull( data.WrappedInstance() ) )
    {
      
      newSalesLevel := SalesLevel_MP::Create( data.Name(),
                             data.MacroPlan(), 
                             false //isfromdb
                            );
      // Access the form, select the new sales level
      DataHolderForm.Data().ListSalesLevel().SelectByKey( newSalesLevel.Key() );
      
    }
    else
    {
     data.WrappedInstance().Update( edtName.Text(),  // Read-only, apply changes to shadow is not taking place for read-only attribute when editing
                                    false //isfromdb
                                    );  
    }
    
    this.Close();
  *]
}
