当前位置: 首页>>代码示例>>C#>>正文


C# TreeProvider.SetNodeOrder方法代码示例

本文整理汇总了C#中TreeProvider.SetNodeOrder方法的典型用法代码示例。如果您正苦于以下问题:C# TreeProvider.SetNodeOrder方法的具体用法?C# TreeProvider.SetNodeOrder怎么用?C# TreeProvider.SetNodeOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TreeProvider的用法示例。


在下文中一共展示了TreeProvider.SetNodeOrder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RaisePostBackEvent

    public void RaisePostBackEvent(string eventArgument)
    {
        if (eventArgument == "move")
        {
            // Keep current user object
            CurrentUserInfo cu = CMSContext.CurrentUser;

            // Parse input value
            string[] values = hdnMoveId.Value.Split(';');

            // Create tree provider
            TreeProvider tree = new TreeProvider(cu);

            // Get tree node object
            int nodeId = ValidationHelper.GetInteger(values[1], 0);
            TreeNode node = tree.SelectSingleNode(nodeId);

            // Check whether node exists
            if (node == null)
            {
                ShowError(GetString("ContentRequest.ErrorMissingSource"));
                return;
            }

            try
            {
                // Check permissions
                if (cu.IsAuthorizedPerDocument(node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Allowed)
                {
                    // Switch by action
                    switch (values[0])
                    {
                        case "up":
                            node = tree.MoveNodeUp(nodeId);
                            break;

                        case "down":
                            node = tree.MoveNodeDown(nodeId);
                            break;

                        case "top":
                            node = tree.SelectSingleNode(nodeId);
                            tree.SetNodeOrder(nodeId, DocumentOrderEnum.First);
                            break;

                        case "bottom":
                            node = tree.SelectSingleNode(nodeId);
                            tree.SetNodeOrder(nodeId, DocumentOrderEnum.Last);
                            break;
                    }

                    if (node != null)
                    {
                        if (!RequiresDialog)
                        {
                            ScriptHelper.RegisterStartupScript(this, typeof(string), "refreshAfterMove", ScriptHelper.GetScript("parent.RefreshTree(" + node.NodeParentID + ", " + node.NodeParentID + ");"));
                        }

                        // Log the synchronization tasks for the entire tree level
                        if (SettingsKeyProvider.GetBoolValue(node.NodeSiteName + ".CMSStagingLogChanges"))
                        {
                            // Log the synchronization tasks for the entire tree level
                            DocumentSynchronizationHelper.LogDocumentChangeOrder(node.NodeSiteName, node.NodeAliasPath, tree);
                        }
                    }
                    else
                    {
                        ShowError(GetString("ContentRequest.MoveFailed"));
                    }
                }
                else
                {
                    ShowError(GetString("ContentRequest.MoveDenied"));
                }
            }
            catch (Exception ex)
            {
                EventLogProvider log = new EventLogProvider();
                log.LogEvent(EventLogProvider.EVENT_TYPE_ERROR, DateTime.Now, "Content", "MOVE", cu.UserID, cu.UserName, nodeId, node.DocumentName, HTTPHelper.UserHostAddress, EventLogProvider.GetExceptionLogMessage(ex), CMSContext.CurrentSite.SiteID, HTTPHelper.GetAbsoluteUri());

                ShowError(GetString("ContentRequest.MoveFailed") + " : " + ex.Message);
            }
        }
        else if (eventArgument == "refresh")
        {
            // Register the refresh script after the 'move' action is performed
            Hashtable parameters = WindowHelper.GetItem(Identifier) as Hashtable;
            if ((parameters != null) && (parameters.Count > 0))
            {
                int refreshNodeId = ValidationHelper.GetInteger(parameters["refreshnodeid"], 0);
                string refreshScript = "parent.RefreshTree(" + refreshNodeId + ", " + refreshNodeId + ")";
                ScriptHelper.RegisterStartupScript(this, typeof(string), "refreshAfterMove", refreshScript, true);
            }
            else
            {
                // If node id not found refresh whole content tree
                ScriptHelper.RegisterStartupScript(this, typeof(string), "refreshAllAfterMove", "parent.RefreshTree(" + NodeID + ", " + NodeID + ")", true);
            }
        }
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:100,代码来源:DocumentList.ascx.cs

示例2: RaisePostBackEvent

    public void RaisePostBackEvent(string eventArgument)
    {
        CurrentUserInfo currentUser = CMSContext.CurrentUser;

        // Current Node ID
        int nodeId = ValidationHelper.GetInteger(Param1, 0);

        TreeProvider tree = new TreeProvider(currentUser);
        EventLogProvider log = new EventLogProvider();

        string documentName = string.Empty;
        string action = Action.ToLower();
        string siteName = CMSContext.CurrentSiteName;

        // Process the request
        switch (action)
        {
            case "refresh":
                treeContent.NodeID = nodeId;
                AddScript("currentNodeId = " + nodeId + ";\n");

                break;

            case "moveup":
            case "movedown":
            case "movetop":
            case "movebottom":
                // Move the document up (document order)
                try
                {
                    if (nodeId == 0)
                    {
                        AddAlert(GetString("ContentRequest.ErrorMissingSource"));
                        return;
                    }

                    // Get document to move
                    TreeNode node = tree.SelectSingleNode(nodeId);

                    // Check the permissions for document
                    if (currentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Allowed)
                    {
                        switch (action)
                        {
                            case "moveup":
                                node = tree.MoveNodeUp(nodeId);
                                break;

                            case "movedown":
                                node = tree.MoveNodeDown(nodeId);
                                break;

                            case "movetop":
                                node = tree.SelectSingleNode(nodeId);
                                tree.SetNodeOrder(nodeId, DocumentOrderEnum.First);
                                break;

                            case "movebottom":
                                node = tree.SelectSingleNode(nodeId);
                                tree.SetNodeOrder(nodeId, DocumentOrderEnum.Last);
                                break;
                        }

                        if (node != null)
                        {
                            // Log the synchronization tasks for the entire tree level
                            if (SettingsKeyProvider.GetBoolValue(siteName + ".CMSStagingLogChanges"))
                            {
                                // Log the synchronization tasks for the entire tree level
                                DocumentSynchronizationHelper.LogDocumentChangeOrder(siteName, node.NodeAliasPath, tree);
                            }

                            // Select the document in the tree
                            documentName = node.DocumentName;

                            treeContent.ExpandNodeID = node.NodeParentID;
                            treeContent.NodeID = node.NodeID;
                            AddScript("currentNodeId = " + node.NodeID + ";\n");
                        }
                        else
                        {
                            AddAlert(GetString("ContentRequest.MoveFailed"));
                        }
                    }
                    else
                    {
                        // Select the document in the tree
                        treeContent.NodeID = nodeId;

                        AddAlert(GetString("ContentRequest.MoveDenied"));
                    }
                }
                catch (Exception ex)
                {
                    log.LogEvent(EventLogProvider.EVENT_TYPE_ERROR, DateTime.Now, "Content", "MOVE", currentUser.UserID, currentUser.UserName, nodeId, documentName, HTTPHelper.GetUserHostAddress(), EventLogProvider.GetExceptionLogMessage(ex), CMSContext.CurrentSite.SiteID, HTTPHelper.GetAbsoluteUri());
                    AddAlert(GetString("ContentRequest.MoveFailed") + " : " + ex.Message);
                }
                break;

            case "setculture":
//.........这里部分代码省略.........
开发者ID:puentepr,项目名称:kentico-site-example,代码行数:101,代码来源:Tree.aspx.cs

示例3: RaisePostBackEvent

    public void RaisePostBackEvent(string eventArgument)
    {
        var currentUser = MembershipContext.AuthenticatedUser;

        // Current Node ID
        int nodeId = ValidationHelper.GetInteger(Param1, 0);

        TreeProvider tree = new TreeProvider(currentUser);

        string documentName = string.Empty;
        string action = Action.ToLowerCSafe();
        string siteName = SiteContext.CurrentSiteName;

        // Process the request
        switch (action)
        {
            case "refresh":
                treeElem.SelectedNodeID = nodeId;
                AddScript("currentNodeId = " + nodeId + ";");
                break;

            case "moveup":
            case "movedown":
            case "movetop":
            case "movebottom":
                // Move the document up (document order)
                try
                {
                    if (nodeId == 0)
                    {
                        AddAlert(GetString("ContentRequest.ErrorMissingSource"));
                        return;
                    }

                    // Get document to move
                    TreeNode node = tree.SelectSingleNode(nodeId);

                    // Check whether node exists
                    if (node == null)
                    {
                        ShowError(GetString("ContentRequest.ErrorMissingSource"));
                        return;
                    }

                    // Check the permissions for document
                    if (currentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Allowed)
                    {
                        // Root of products tree can not be moved
                        if (!IsProductTree || (node.NodeAliasPath.CompareToCSafe(StartingAliasPath, true) != 0))
                        {
                            switch (action)
                            {
                                case "moveup":
                                    tree.MoveNodeUp(node);
                                    break;

                                case "movedown":
                                    tree.MoveNodeDown(node);
                                    break;

                                case "movetop":
                                    tree.SetNodeOrder(node, DocumentOrderEnum.First);
                                    break;

                                case "movebottom":
                                    tree.SetNodeOrder(node, DocumentOrderEnum.Last);
                                    break;
                            }

                            // Log the synchronization tasks for the entire tree level
                            DocumentSynchronizationHelper.LogDocumentChangeOrder(siteName, node.NodeAliasPath, tree);

                            // Select the document in the tree
                            documentName = node.GetDocumentName();

                            treeElem.ExpandNodeID = node.NodeParentID;
                            treeElem.SelectedNodeID = node.NodeID;
                            AddScript("currentNodeId = " + node.NodeID + ";");
                        }
                    }
                    else
                    {
                        // Select the document in the tree
                        treeElem.SelectedNodeID = nodeId;

                        AddAlert(GetString("ContentRequest.MoveDenied"));
                    }
                }
                catch (Exception ex)
                {
                    EventLogProvider.LogEvent(EventType.ERROR, "Content", "MOVE", EventLogProvider.GetExceptionLogMessage(ex), RequestContext.RawURL, currentUser.UserID, currentUser.UserName, nodeId, documentName, RequestContext.UserHostAddress, SiteContext.CurrentSite.SiteID);
                    AddAlert(GetString("ContentRequest.MoveFailed") + " : " + ex.Message);
                }
                break;

            case "setculture":
                // Set the preferred culture code
                try
                {
                    // Set the culture code
//.........这里部分代码省略.........
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:101,代码来源:CMSDeskTree.ascx.cs


注:本文中的TreeProvider.SetNodeOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。