Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod CanDragAndDropResourceNodes ( 
 | 
  Unit dpfocusedunit, 
 | 
  output String feedback_o, 
 | 
  Units units 
 | 
) declarative remote as Boolean 
 | 
{ 
 | 
  Description: 
 | 
  [* 
 | 
    If current supply chain view is displaying all root unit, dragging and dropping of resource nodes should not be allowed (Resource nodes are unit nodes that has parent) 
 | 
    control / shift key is to prevent collision with other drag and drop. 
 | 
  *] 
 | 
  TextBody: 
 | 
  [* 
 | 
    // If current supply chain view is displaying all root unit, dragging and dropping of resource nodes should not be allowed (Resource nodes are unit nodes that has parent) 
 | 
    // control / shift key is to prevent collision with other drag and drop 
 | 
    feedback_o := ''; 
 | 
     
 | 
    // Check if the selected set of units has different parents 
 | 
    if( units.Size() > 0 and exists( units, Elements, el, el.Parent() <> units.Element( 0 ).Parent() ) ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_SupplyChainView_CanDragAndDropResourceNodes_DifferentLevel(); 
 | 
    } 
 | 
    else 
 | 
    { 
 | 
      level := units.Element( 0 ).Level(); 
 | 
      parentname := guard( units.Element( 0 ).Parent().Name(), '' ); 
 | 
      // Check if dpfocusedunit is null 
 | 
      if( isnull( dpfocusedunit ) ) 
 | 
      { 
 | 
        // Check if level is not equals to 1 
 | 
        if( level <> 1 ) 
 | 
        { 
 | 
        feedback_o := Translations::MP_SupplyChainView_CanDragAndDropResourceNodes_DrillTowards( parentname ); 
 | 
        } 
 | 
      } 
 | 
      else 
 | 
      { 
 | 
        // Check if dpfocusedunit's level + 1 is not equals to level 
 | 
        // or dpfocusedunit's name is not equals to parentname 
 | 
        if( dpfocusedunit.Level() + 1 <> level or parentname <> dpfocusedunit.Name() ) 
 | 
        { 
 | 
          feedback_o := Translations::MP_SupplyChainView_CanDragAndDropResourceNodes_DrillTowards( parentname ); 
 | 
     
 | 
          // Check if level equals to 1 
 | 
          if( level = 1 ) 
 | 
          { 
 | 
            feedback_o := Translations::MP_SupplyChainView_CanDragAndDropResourceNodes_DrillTowardsRootLevel(); 
 | 
          } 
 | 
        } 
 | 
      } 
 | 
    } 
 | 
     
 | 
    return feedback_o = ''; 
 | 
  *] 
 | 
} 
 |