Quintiq file version 2.0
#parent: #root
Method CopyStrategy (
  Strategy selection,
  internal[GUIComponent] parent,
  Boolean copyfromdialog
) as Strategy id:Method_ScenarioManager_DialogCreateEditStrategy_CopyStrategy
{
  #keys: '[112884.0.704997307]'
  Body:
  [*
    // Copy strategy
    // There will 2 transactions for copying for maintenance purpose, because there is quite some logic involved during creation of Strategy in the Editor.
    strategy := selection.Copy( ScenarioManager,
                                selection,
                                Strategy::GetUniqueStrategyName( selection.Name(), ScenarioManager ),
                                selection.DisplayIndex(),
                                selection.Description(),
                                selection.IsVisible() );
    
    // Copy strategy from the dialog.
    if( copyfromdialog )
    {
      SelectionStrategy.Data( strategy );
    }
    else
    {
      Dialog.EditStrategy( strategy, parent );
    }
    
    return strategy;
  *]
}
