Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method NewTransitionType ( 
 | 
  internal[GUIComponent] parent, 
 | 
  String fromcampaignname, 
 | 
  String tocampaignname 
 | 
) as TransitionType_MP id:Method_DialogCreateEditTransitionType_NewTransitionType 
 | 
{ 
 | 
  #keys: '[127238.0.515909593]' 
 | 
  Body: 
 | 
  [* 
 | 
    // New transition type 
 | 
     
 | 
    data := construct( shadow [TransitionType_MP], UnitID := "", Name := "" ); // Set both UnitID and Name to empty, will be handled in SetDefaultValue and Create method 
 | 
     
 | 
    Dialog.Data( data ); 
 | 
    Dialog.SetDefaultValue(); 
 | 
     
 | 
    //if provided set the from and to campaign types 
 | 
    if( fromcampaignname.Length() > 0 ) 
 | 
    { 
 | 
      SelectionFromCampaignType.BoundValue( fromcampaignname ); 
 | 
    } 
 | 
    if( tocampaignname.Length() > 0 ) 
 | 
    { 
 | 
      SelectionToCampaignType.BoundValue( tocampaignname ); 
 | 
    } 
 | 
     
 | 
    this.UpdateCheckboxState(); 
 | 
     
 | 
    result := Dialog.DoModal( parent ); 
 | 
    newobj := null( TransitionType_MP ); 
 | 
     
 | 
    if( result > 0 ) 
 | 
    { 
 | 
      newobj := TransitionType_MP::Create( data.Unit(), 
 | 
                                           data.DefaultMinQuantity(), 
 | 
                                           data.DefaultMaxQuantity(), 
 | 
                                           data.DefaultMinDuration(), 
 | 
                                           data.DefaultMaxDuration(), 
 | 
                                           data.FromCampaignType(), 
 | 
                                           data.ToCampaignType(), 
 | 
                                           data.HasInputMaxQuantity() and RadioButtonGroupQuantityDuration.BoundValue() = GlobalParameters_MP::GetCampaignTransitionsTypeQuantity(), 
 | 
                                           data.HasInputMaxDuration() and RadioButtonGroupQuantityDuration.BoundValue() = GlobalParameters_MP::GetCampaignTransitionsTypeDuration(), 
 | 
                                           false ); 
 | 
    } 
 | 
     
 | 
    return newobj; 
 | 
  *] 
 | 
} 
 |