Quintiq file version 2.0
#parent: #root
Method NewCampaignType (
  internal[GUIComponent] parent
) as CampaignType_MP id:Method_DialogCreateEditCampaignType_NewCampaignType
{
  #keys: '[110880.4.841984191]'
  Body:
  [*
    // New campaign type
    
    data := construct( shadow [CampaignType_MP], UnitID := "", Name := "" );// UnitID and Name temporary set to empty, will be base on what user filled in
    
    Dialog.Data( data );
    Dialog.SetDefaultValue();
    Dialog.InitializeDialog();
    
    result := Dialog.DoModal( parent );
    newobj := null( CampaignType_MP );
    
    if( result > 0 ) 
    {
      newobj := CampaignType_MP::Create( data.Unit(),
                                         data.Name(),
                                         data.DefaultMinQuantity(),
                                         data.DefaultMaxQuantity(),
                                         data.DefaultMinDuration(),
                                         data.DefaultMaxDuration(),
                                         data.Color(),
                                         data.HasInputMaxQuantity() and RadioButtonGroupQuantityDuration.BoundValue() = GlobalParameters_MP::GetCampaignTransitionsTypeQuantity(),
                                         data.HasInputMaxDuration() and RadioButtonGroupQuantityDuration.BoundValue() = GlobalParameters_MP::GetCampaignTransitionsTypeDuration(),
                                         false );
    }
    
    return newobj;
  *]
}
