private void Document_Move_After(object sender, DocumentEventArgs e) { // Update on the Node itself, this will rebuild itself and it's children DynamicRouteInternalHelper.CommitTransaction(true); try { DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID); var PreviousParentNodeID = Thread.GetData(Thread.GetNamedDataSlot("PreviousParentIDForNode_" + e.Node.NodeID)); if (PreviousParentNodeID != null && (int)PreviousParentNodeID != e.TargetParentNodeID) { // If differnet node IDs, it moved to another parent, so also run Document Moved check on both new and old parent DynamicRouteEventHelper.DocumentMoved((int)PreviousParentNodeID, e.TargetParentNodeID); } } catch (UrlSlugCollisionException ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Document After Before for Node {e.Node.NodeAliasPath}"); e.Cancel(); } catch (Exception ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Document Move After for Node {e.Node.NodeAliasPath}"); } }
private void Document_Move_After(object sender, DocumentEventArgs e) { var Slot = Thread.AllocateNamedDataSlot("PreviousParentIDForNode_" + e.Node.NodeID); var PreviousParentNodeID = Thread.GetData(Slot); if (PreviousParentNodeID != null) { // Check if the move was just ordering if ((int)PreviousParentNodeID != e.TargetParentNodeID) { DynamicRouteEventHelper.DocumentMoved((int)PreviousParentNodeID, e.TargetParentNodeID); } else { // Just update the document which will check for siblings with NodeOrder DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID); } } }