hongji.li
2023-11-07 1a1ba3ad5ed9e4380185aa1ccad20204a0e5f115
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
Quintiq file version 2.0
#parent: #root
Method SetAttributeAfterApplyData () id:Method_DialogCreateEditUnit_SetAttributeAfterApplyData
{
  #keys: '[121072.0.302404206]'
  Body:
  [*
    // Set attributes before commitng the data
    data := Dialog.Data();
    data.IconName( LabelImageString.Text() );
    
    parentunit := null( Unit );
    
    if( CheckBoxParent.Checked() )
    {
      parentunit := SelectionParent.Data();
    }
    data.Parent( relset, parentunit );
    
    start := Date::MinDate();
    end := Date::MaxDate();
    if( CheckBoxHasStart.Checked() )
    {
      start := GUIDateTimeSelectorStart.DateTime().Date();
    }
    if( CheckBoxHasEnd.Checked() )
    {
      end := GUIDateTimeSelectorEnd.DateTime().Date();
    }
    
    if( CheckBoxHasUserFrozenFutureDuration.Checked() )
    {
      GUIDurationSelectorUserFrozenFutureDuration.Enabled( false );
      data.UserFrozenFutureDuration( GUIDurationSelectorUserFrozenFutureDuration.Duration() );     
    }
    
    capacitytype := data.CapacityType()
    istransport := capacitytype = GlobalParameters_MP::GetCapacityTypeTransportTime()
                   or capacitytype = GlobalParameters_MP::GetCapacityTypeTransportQuantity();
    // set to false if user set it to true and change to transport type later              
    if ( istransport )
    {
      data.HasCapacitySmoothing( false );
    }               
    
    data.StartDate( start );
    data.EndDate( end );
  *]
}