Quintiq file version 2.0
#parent: #root
Method OnOK () id:Method_DialogCreateEditShiftPattern_OnOK
{
  #keys: '[139394.1.114480793]'
  Body:
  [*
    // On ok
    this.ApplyChanges();
    data := DataHolderDialogData.Data();
    
    if( isnull( data.WrappedInstance() ) )
    {
      ShiftPattern::Create( MacroPlan,
                            EditFieldName.Text(),
                            data.NumberOfDays(),
                            data.MinimumDuration(),
                            false /*isfromdb*/ );
    }
    else
    {
      // Edit
      if( not DataHolderIsCopy.Data() )
      {
        data.WrappedInstance().Update( EditFieldName.Text(), 
                                       data.NumberOfDays(),
                                       data.MinimumDuration(),
                                       false /*isfromdb*/ );
      }
      // Copy
      else
      {
        data.WrappedInstance().Copy( EditFieldName.Text(),
                                     data.NumberOfDays(),
                                     data.MinimumDuration(),
                                     MacroPlan );
      }
    }
    
    this.Close();
  *]
}
