chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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;
  *]
}