private void RelationshipNameSiteInfo_Delete_After(object sender, ObjectEventArgs e)
 {
     if (RelHelper.IsStagingEnabled())
     {
         RelationshipNameSite_CreateStagingTask((RelationshipNameSiteInfo)e.Object, TaskTypeEnum.RemoveFromSite);
     }
 }
 /// <summary>
 /// Handle the Removal of Node Categories when not bound to the document, since binding to the Nodes don't seem to operate right.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void NonBindingNodeDocument_ProcessTask_After(object sender, StagingSynchronizationEventArgs e)
 {
     if (e.TaskType == TaskTypeEnum.DeleteObject)
     {
         // Don't want to trigger updates as we set the data in the database, so we won't log synchronziations
         using (new CMSActionContext()
         {
             LogSynchronization = false,
             LogIntegration = false
         })
         {
             if (e.ObjectType.ToLower() == "cms.treecategory")
             {
                 DataTable NodeCategoryTable = e.TaskData.Tables[0];
                 // Translate tables
                 int NodeID     = RelHelper.TranslateBindingTranslateID((int)NodeCategoryTable.Rows[0]["NodeID"], e.TaskData, "cms.node");
                 int CategoryID = RelHelper.TranslateBindingTranslateID((int)NodeCategoryTable.Rows[0]["CategoryID"], e.TaskData, "cms.category");
                 if (NodeID > 0 && CategoryID > 0)
                 {
                     TreeCategoryInfo.Provider.Remove(NodeID, CategoryID);
                 }
             }
         }
     }
 }
 private void RelationshipName_Update_After(object sender, ObjectEventArgs e)
 {
     if (RelHelper.IsStagingEnabled())
     {
         RelationshipName_CreateStagingTask((RelationshipNameInfo)e.Object, TaskTypeEnum.UpdateObject);
     }
 }
コード例 #4
0
        public static object GetBindingCategoryWhere(EvaluationContext context, params object[] parameters)
        {
            string BindingClass      = ValidationHelper.GetString(parameters[0], "");
            string ObjectIDFieldName = "[" + SqlHelper.EscapeQuotes(ValidationHelper.GetString(parameters[1], "")) + "]";
            string LeftFieldName     = "[" + SqlHelper.EscapeQuotes(ValidationHelper.GetString(parameters[2], "")) + "]";
            string RightFieldName    = "[" + SqlHelper.EscapeQuotes(ValidationHelper.GetString(parameters[3], "")) + "]";

            string[]      Values         = ValidationHelper.GetString(parameters[4], "").Split("|;,".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            string        ObjIDTableName = null;
            IdentityType  IdentType      = IdentityType.ID;
            ConditionType CondType       = ConditionType.Any;

            if (parameters.Length > 5)
            {
                IdentType = (IdentityType)ValidationHelper.GetInteger(parameters[5], 0);
            }
            if (parameters.Length > 6)
            {
                CondType = (ConditionType)ValidationHelper.GetInteger(parameters[6], 0);
            }
            if (parameters.Length > 7)
            {
                ObjIDTableName = SqlHelper.EscapeQuotes(ValidationHelper.GetString(parameters[7], "").Trim('.'));
            }

            return(RelHelper.GetBindingCategoryWhere(BindingClass, ObjectIDFieldName, LeftFieldName, RightFieldName, Values, IdentType, CondType, ObjIDTableName));
        }
 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 Relationship_Insert_Or_Delete_After(object sender, ObjectEventArgs e)
        {
            RelationshipInfo     RelationshipObj     = (RelationshipInfo)e.Object;
            RelationshipNameInfo RelationshipNameObj = RelationshipNameInfo.Provider.Get(RelationshipObj.RelationshipNameId);

            if (IsCustomAdhocRelationshipName(RelationshipNameObj))
            {
                TreeNode LeftNode = new DocumentQuery().WhereEquals("NodeID", RelationshipObj.LeftNodeId).FirstOrDefault();
                if (RelHelper.IsStagingEnabled(LeftNode.NodeSiteID))
                {
                    DocumentSynchronizationHelper.LogDocumentChange(LeftNode.NodeSiteName, LeftNode.NodeAliasPath, TaskTypeEnum.UpdateDocument, LeftNode.TreeProvider);
                }
            }
        }
        private void ProcessTask_After(object sender, StagingSynchronizationEventArgs e)
        {
            if (e.TaskType == TaskTypeEnum.UpdateDocument || e.TaskType == TaskTypeEnum.CreateDocument || e.TaskType == TaskTypeEnum.MoveDocument || e.TaskType == TaskTypeEnum.PublishDocument || e.TaskType == TaskTypeEnum.ArchiveDocument)
            {
                // Seems the first table is always the node's table, the table name dose change by the document page type.
                DataTable NodeTable = e.TaskData.Tables[0];
                if (NodeTable != null && NodeTable.Columns.Contains("NodeGuid"))
                {
                    // Don't want to trigger updates as we set the data in the database, so we won't log synchronziations
                    TreeNode NodeObj = new DocumentQuery().WhereEquals("NodeGUID", NodeTable.Rows[0]["NodeGuid"]).FirstOrDefault();

                    using (new CMSActionContext()
                    {
                        LogSynchronization = false,
                        LogIntegration = false
                    })
                    {
                        List <int> NewNodeCategoryIDs = RelHelper.NewBoundObjectIDs(e, TreeCategoryInfo.OBJECT_TYPE, "NodeID", "CategoryID", CategoryInfo.TYPEINFO);

                        // Now handle categories, deleting categories not found, and adding ones that are not set yet.
                        TreeCategoryInfo.Provider.Get().WhereEquals("NodeID", NodeObj.NodeID).WhereNotIn("CategoryID", NewNodeCategoryIDs).ForEachObject(x => x.Delete());
                        List <int> CurrentCategories = TreeCategoryInfo.Provider.Get().WhereEquals("NodeID", NodeObj.NodeID).Select(x => x.CategoryID).ToList();
                        foreach (int NewCategoryID in NewNodeCategoryIDs.Except(CurrentCategories))
                        {
                            TreeCategoryInfo.Provider.Add(NodeObj.NodeID, NewCategoryID);
                        }
                    }
                    if (RelHelper.IsStagingEnabled(NodeObj.NodeSiteID))
                    {
                        TaskTypeEnum TaskTypeToUse = e.TaskType;
                        switch (e.TaskType)
                        {
                        case TaskTypeEnum.MoveDocument:
                            TaskTypeToUse = TaskTypeEnum.UpdateDocument;
                            break;
                        }
                        // Check if we need to generate a task for a server that isn't the origin server
                        RelHelper.CheckIfTaskCreationShouldOccur(NodeObj.NodeGUID, TaskTypeToUse);
                    }
                }
                else
                {
                    Service.Resolve <IEventLogService>().LogEvent(EventTypeEnum.Error, "RelationshipExended", "No Node Table Found", eventDescription: "First Table in the incoming Staging Task did not contain the Node GUID, could not processes.");
                }
            }
        }
コード例 #8
0
        public static object GetDocumentCategoryWhere(EvaluationContext context, params object[] parameters)
        {
            ConditionType CondType            = ConditionType.Any;
            string        DocumentIDTableName = "CMS_Document";

            string[] Values = new string[] { };
            if (parameters.Length > 0)
            {
                Values = ValidationHelper.GetString(parameters[0], "").Split("|;,".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            }
            if (parameters.Length > 1)
            {
                CondType = (ConditionType)ValidationHelper.GetInteger(parameters[1], 0);
            }
            if (parameters.Length > 2)
            {
                DocumentIDTableName = SqlHelper.EscapeQuotes(ValidationHelper.GetString(parameters[2], "CMS_Document")).Trim('.');
            }
            return(RelHelper.GetDocumentCategoryWhere(Values, CondType, DocumentIDTableName));
        }
 private void TreeCategory_Insert_Or_Delete_After(object sender, ObjectEventArgs e)
 {
     RelHelper.HandleNodeBindingInsertUpdateDeleteEvent(((TreeCategoryInfo)e.Object).NodeID, TreeCategoryInfo.OBJECT_TYPE);
 }
 private void NonBindingLogTask_Before(object sender, StagingLogTaskEventArgs e)
 {
     RelHelper.SetBetterBindingTaskTitle(e, TreeCategoryInfo.OBJECT_TYPE, "NodeID", "CategoryID", "Category", CategoryInfo.TYPEINFO);
 }