private void Document_Update_After(object sender, DocumentEventArgs e)
 {
     // Update the document itself, only if there is no workflow
     try
     {
         if (e.Node.WorkflowStep == null)
         {
             DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID);
         }
         else
         {
             if (e.Node.WorkflowStep.StepIsPublished && DynamicRouteInternalHelper.ErrorOnConflict())
             {
                 DynamicRouteEventHelper.DocumentInsertUpdated_CheckOnly(e.Node.NodeID);
             }
         }
     }
     catch (UrlSlugCollisionException ex)
     {
         LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Document Update After for ${e.Node.NodeAlias}.");
         e.Cancel();
     }
     catch (Exception ex)
     {
         LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Document Update After for ${e.Node.NodeAlias}.");
         e.Cancel();
     }
 }
        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_Copy_After(object sender, DocumentEventArgs e)
 {
     try
     {
         DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID);
     }
     catch (UrlSlugCollisionException ex)
     {
         LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Document Copy for Node {e.Node.NodeAliasPath}");
         e.Cancel();
     }
     catch (Exception ex)
     {
         LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Document Copy for Node {e.Node.NodeAliasPath}");
     }
 }
 private void Document_Publish_After(object sender, WorkflowEventArgs e)
 {
     // Update the document itself
     try
     {
         DynamicRouteEventHelper.DocumentInsertUpdated(e.Document.NodeID);
     }
     catch (UrlSlugCollisionException ex)
     {
         LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Document Publish After of Node {e.Document.NodeID} [{e.Document.NodeAliasPath}]");
         e.Cancel();
     }
     catch (Exception ex)
     {
         LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Document Publish After of Node {e.Document.NodeID} [{e.Document.NodeAliasPath}]");
     }
 }
Exemple #5
0
        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);
                }
            }
        }
        private void Document_ChangeOrder_After(object sender, DocumentChangeOrderEventArgs e)
        {
            // Sometimes ChangeOrder is triggered before the insert (if it inserts before other records),
            // So will use recursion helper to prevent this from running on the insert as well.
            RecursionControl PreventInsertAfter = new RecursionControl("PreventInsertAfter" + e.Node.NodeID);
            var Trigger = PreventInsertAfter.Continue;

            try
            {
                DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID);
            }
            catch (UrlSlugCollisionException ex)
            {
                LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Document Change Order for Node {e.Node.NodeAliasPath}");
                e.Cancel();
            }
            catch (Exception ex)
            {
                LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Document Change Order for Node {e.Node.NodeAliasPath}");
            }
        }
        private void Document_Insert_After(object sender, DocumentEventArgs e)
        {
            // Prevents the CHangeOrderAfter which may trigger before this from creating a double queue item.
            RecursionControl PreventInsertAfter = new RecursionControl("PreventInsertAfter" + e.Node.NodeID);

            if (PreventInsertAfter.Continue)
            {
                try
                {
                    DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID);
                }
                catch (UrlSlugCollisionException ex)
                {
                    LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Document Insert After for Node {e.Node.NodeAliasPath}");
                    e.Cancel();
                }
                catch (Exception ex)
                {
                    LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Document Insert After for Node {e.Node.NodeAliasPath}");
                }
            }
        }
Exemple #8
0
 private void Document_ChangeOrder_After(object sender, DocumentChangeOrderEventArgs e)
 {
     DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID);
 }
Exemple #9
0
 private void Document_InsertLink_After(object sender, DocumentEventArgs e)
 {
     DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID);
 }
Exemple #10
0
 private void Document_Update_After(object sender, DocumentEventArgs e)
 {
     // Update the document itself
     DynamicRouteEventHelper.DocumentInsertUpdated(e.Node.NodeID);
 }