Quintiq file version 2.0
#parent: #root
Method OnOK () id:Method_DialogCreateEditProductLevel_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() ) )
    {
      newproductlevel := ProductLevel_MP::Create( data.Name(),
                                                  data.IsProductCategory(),
                                                  MacroPlan,
                                                  false );
      // Access the form, select new product level
      DataHolderForm.Data().ListProductLevel().SelectByKey( newproductlevel.Key() );
    }
    else
    {
      data.WrappedInstance().Update(edtName.Text(),  // Read-only, apply changes to shadow is not taking place for read-only attribute when editing
                                    data.IsProductCategory(),
                                    false );
    }
    
    this.Close();
  *]
}
