lazhen
2025-01-07 b3987122cbbc46c5c59d3173f37fca3170b6dc5a
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
51
52
53
54
Quintiq file version 2.0
#parent: #root
Method EditLane (
  internal[GUIComponent] parent,
  structured[Lane] selection,
  Boolean isfilteredbyunit
) id:Method_DialogCreateEditLane_EditLane
{
  #keys: '[109478.0.549376948]'
  Body:
  [*
    // Edit lanes
    
    isbatchedit := selection.Size() > 1;
    Dialog.ShowHideComponentForBatchEdit( isbatchedit );
    Dialog.SetFilters( isfilteredbyunit );
    
    data := shadow( selection.Element( 0 ) );
    Dialog.Data( data );
    
    result := this.DoModal( parent );
    
    if( result > 0 )
    {
      /* TWO Transaction is expected in editing single lane
         1. Update cost, we need to call Commit to commit the shadow costs
         2. Update lane, we need to call Update to updated the TypeIndex
      */
      if( not isbatchedit )
      {
        selection.Element( 0 ).UpdateTypeIndex( EditorID.Text() );      // Read-only, apply changes to shadow is not taking place for read-only attribute when editing.
        data.Commit();
      }
      // To keep only one transaction if the user did not change the ID
      else
      {
        Lane::Update( selection,
                      data.Unit(),
                      EditorID.Text(),      // Read-only, apply changes to shadow is not taking place for read-only attribute when editing.
                      data.Name(),
                      false /* isBatchEditIsEnabled */,
                      data.IsEnabled(),
                      CheckBoxBatchEditStart.Checked(),
                      data.Start(),
                      CheckBoxBatchEditEnd.Checked(),
                      data.End(),
                      CheckBoxBatchEditDuration.Checked(),
                      data.UserLeadTime(),
                      CheckBoxBatchEditStandardDeviationLeadTime.Checked(),
                      data.StandardDeviationLeadTimeLane() );
      }
    }
  *]
}