Quintiq file version 2.0
#parent: #root
Method OnOK () id:Method_DialogCreateEditLane_OnOK
{
  #keys: '[139394.0.1497255404]'
  Body:
  [*
    // When the user clicks ok, 
    // we either create or edit the data
    
    this.ApplyChanges();
    /* Since Name declaratively refers to SystemName,
       Set SystemName to EditorName.
       This is not done in the Editor's binding because the name will not appear
       on the editor when editing existing operation */
    data := DataHolderDialogData.Data();
    data.SystemName( EditFieldName.Text() );
    
    if( isnull( data.WrappedInstance() ) )
    {
      data.Commit();
      // Access the form, select the new lane
      DataHolderForm.Data().ListLanes().SelectByKey( data.WrappedInstance().Key() );
    }
    else
    {
      data.WrappedInstance().Update( DropDownListUnit.Data(),
                                     EditFieldID.Text(),
                                     EditFieldName.Text(),
                                     data.IsEnabled(),
                                     data.Start(),
                                     data.End(),
                                     data.UserLeadTime(),
                                     data.StandardDeviationLeadTimeLane(),
                                     false /*isfromdb*/ );
    }                                
                                    
    this.Close();
  *]
}
