xiaoding721
2023-11-13 e4edcfd0b987b239526f5375881b919789782dad
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
38
39
40
41
42
43
44
45
46
47
48
49
50
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;
  *]
}