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 );
  *]
}
