Quintiq file version 2.0
#parent: #root
Method OnOK () id:Method_DialogEditLaneLegs_OnOK
{
  #keys: '[139394.0.1547082414]'
  Body:
  [*
    // On ok
    this.ApplyChanges();
    
    data := DataHolderDialogData.Data();
    isbatchedit := DataHolderDialogDatas.Data().Size() > 1;
    
    // Special handling for lead time
    if( CheckBoxHasUserLeadTime.Checked() )
    {
      data.UserLeadTime( data.LeadTime() );
    }
    
    LaneLeg::Update( DataHolderDialogDatas.Data(),
                     data.Name(),
                     data.AsOriginStockingPointLeg(),
                     data.AsDestinationStockingPointLeg(),
                     false /*is batch edit isenabled*/,
                     data.IsEnabled(),
                     CheckboxBatchEditStart.Checked() or not isbatchedit,
                     data.Start(),
                     CheckboxBatchEditEnd.Checked() or not isbatchedit,
                     data.End(),
                     CheckboxBatchEditLeadTime.Checked() or not isbatchedit,
                     CheckBoxHasUserLeadTime.Checked(),
                     DurationSelectorLeadTime.Duration(),
                     false /*isbatchedit std lead time*/,
                     false /*has std lead time */,
                     Duration::MinDuration(), /*stdleadtime*/
                     not isbatchedit or CheckboxBatchEditCO2Emission.Checked(),
                     data.CO2Emission());  
    
    this.Close();
  *]
}
