private void LogTask_Before(object sender, StagingLogTaskEventArgs e) { if (e.Task.TaskTitle.IndexOf("Update Url Slug", StringComparison.InvariantCultureIgnoreCase) == 0) { // Update the TItle UrlSlugInfo UrlSlug = (UrlSlugInfo)e.Object; var DocQuery = DocumentHelper.GetDocuments() .WhereEquals("nodeID", UrlSlug.UrlSlugNodeID) .Columns("NodeAlias, DocumentCulture"); if (!string.IsNullOrWhiteSpace(UrlSlug.UrlSlugCultureCode)) { DocQuery.Culture(UrlSlug.UrlSlugCultureCode); } else { DocQuery.CombineWithDefaultCulture(); DocQuery.CombineWithAnyCulture(); } var Node = DocQuery.FirstOrDefault(); if (UrlSlug.UrlSlugIsCustom) { e.Task.TaskTitle = $"Add Custom Url Slug '{UrlSlug.UrlSlug}' for page {Node.NodeAlias} [{Node.DocumentCulture}]"; } else { e.Task.TaskTitle = $"Restore Url Slug for page {Node.NodeAlias} [{Node.DocumentCulture}] to default"; } } }
private void LogTask_Before(object sender, StagingLogTaskEventArgs e) { RelHelper.UpdateTaskDataWithNodeBinding(e, new NodeBinding_DocumentLogTaskBefore_Configuration[] { new NodeBinding_DocumentLogTaskBefore_Configuration(new NodeBazInfo(), nameof(NodeBazInfo.NodeBazNodeID) + " = {0}") }); }
private void LogTask_Before(object sender, StagingLogTaskEventArgs e) { RelHelper.UpdateTaskDataWithNodeBinding(e, new NodeBinding_DocumentLogTaskBefore_Configuration[] { new NodeBinding_DocumentLogTaskBefore_Configuration( new TreeCategoryInfo(), "NodeID = {0}") }); }
private void LogTask_After(object sender, StagingLogTaskEventArgs e) { try { if (e.Task.TaskDocumentID > 0 && CallContext.GetData("DeleteTasks") != null) { TreeNode Node = DocumentHelper.GetDocument(e.Task.TaskDocumentID, null); if (((List <Tuple <int, DateTime> >)CallContext.GetData("DeleteTasks")).Any(x => x.Item1 == e.Task.TaskNodeID && x.Item2 > e.Task.TaskTime) && (DateTime.Now - e.Task.TaskTime).TotalSeconds < 10) { e.Task.Delete(); } } } catch (Exception ex) { Service.Resolve <IEventLogService>().LogException("RelExtended", "LogTaskAfterError", ex, additionalMessage: "For task " + e.Task.TaskDocumentID); } }
private void LogTask_After(object sender, StagingLogTaskEventArgs e) { try { if (e.Task.TaskDocumentID > 0 && CallContext.GetData("DeleteTasks") != null) { TreeNode Node = DocumentHelper.GetDocument(e.Task.TaskDocumentID, null); if (((List <int>)CallContext.GetData("DeleteTasks")).Contains(Node.NodeID) && (DateTime.Now - e.Task.TaskTime).TotalSeconds < 10) { e.Task.Delete(); } } } catch (Exception ex) { EventLogProvider.LogException("RelExtended", "LogTaskAfterError", ex, additionalMessage: "For task " + e.Task.TaskDocumentID); } }
/// <summary> /// Stop staging tasks from being created for any object type that is in the excluded-types list. This prevents tasks from /// being created in the staging source environment. /// </summary> /// <param name="sender">The calling object</param> /// <param name="e">The StagingLogTaskEventArgs arguments</param> public void LogTaskBefore(object sender, StagingLogTaskEventArgs e) { if (_stagingCustomizationModuleHelper.IsExcludedMediaLibraryFile(e.Object)) { var mediaFileInfo = e.Object as MediaFileInfo; var mediaLibraryInfo = mediaFileInfo?.Parent as MediaLibraryInfo; var message = $"Preventing creation of staging task for media file in an excluded library, {mediaLibraryInfo?.LibraryName}."; _stagingCustomizationModuleHelper.LogInformation("ExcludeMediaFile", message); e.Cancel(); return; } if (_stagingCustomizationModuleHelper.IsExcludedObjectType(e.Object)) { var message = $"Preventing creation of staging task for excluded type, {e.Object?.TypeInfo?.ObjectType}."; _stagingCustomizationModuleHelper.LogInformation("ExcludeObjectType", message); e.Cancel(); } }
private void NonBindingLogTask_Before(object sender, StagingLogTaskEventArgs e) { RelHelper.SetBetterBindingTaskTitle(e, TreeCategoryInfo.OBJECT_TYPE, "NodeID", "CategoryID", "Category", CategoryInfo.TYPEINFO); }