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


C# TreeProvider.OrderNodesByDate方法代码示例

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


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

示例1: RaisePostBackEvent


//.........这里部分代码省略.........
                try
                {
                    // Set the culture code
                    string language = ValidationHelper.GetString(Param2, "");
                    if (!string.IsNullOrEmpty(language))
                    {
                        CMSContext.PreferredCultureCode = language;
                    }

                    // Refresh the document
                    if (nodeId > 0)
                    {
                        treeContent.NodeID = nodeId;

                        AddScript("SelectNode(" + nodeId + "); \n");
                    }
                }
                catch (Exception ex)
                {
                    log.LogEvent(EventLogProvider.EVENT_TYPE_ERROR, DateTime.Now, "Content", "SETCULTURE", currentUser.UserID, currentUser.UserName, nodeId, documentName, HTTPHelper.GetUserHostAddress(), EventLogProvider.GetExceptionLogMessage(ex), CMSContext.CurrentSite.SiteID, HTTPHelper.GetAbsoluteUri());
                    AddAlert(GetString("ContentRequest.ErrorChangeLanguage"));
                }
                break;

            // Sorting
            case "sortalphaasc":
            case "sortalphadesc":
            case "sortdateasc":
            case "sortdatedesc":
                // Set the preferred culture code
                try
                {
                    // Get document to sort
                    TreeNode node = tree.SelectSingleNode(nodeId);

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

                            case "sortalphadesc":
                                tree.OrderNodesAlphabetically(nodeId, false);
                                break;

                            case "sortdateasc":
                                tree.OrderNodesByDate(nodeId, true);
                                break;

                            case "sortdatedesc":
                                tree.OrderNodesByDate(nodeId, false);
                                break;
                        }

                        // Log the synchronization tasks for the entire tree level
                        if (SettingsKeyProvider.GetBoolValue(siteName + ".CMSStagingLogChanges"))
                        {
                            // Log the synchronization tasks for the entire tree level
                            string fakeAlias = node.NodeAliasPath.TrimEnd('/') + "/child";
                            DocumentSynchronizationHelper.LogDocumentChangeOrder(siteName, fakeAlias, tree);
                        }
                    }
                    else
                    {
                        AddAlert(GetString("ContentRequest.SortDenied"));
                    }

                    // Refresh the tree
                    if (nodeId > 0)
                    {
                        treeContent.ExpandNodeID = nodeId;
                        treeContent.NodeID = nodeId;
                        AddScript("SelectNode(" + nodeId + "); \n");
                    }
                }
                catch (Exception ex)
                {
                    log.LogEvent(EventLogProvider.EVENT_TYPE_ERROR, DateTime.Now, "Content", "SORT", currentUser.UserID, currentUser.UserName, nodeId, documentName, HTTPHelper.GetUserHostAddress(), EventLogProvider.GetExceptionLogMessage(ex), CMSContext.CurrentSite.SiteID, HTTPHelper.GetAbsoluteUri());
                    AddAlert(GetString("ContentRequest.ErrorSort"));
                }
                break;
        }

        // Maintain scrollbar position
        string script =
        @"var elm = jQuery('#handle_" + nodeId + @"');
          var pnl = jQuery('#" + pnlTreeArea.ClientID + @"');
          var origScroll = " + ScrollPosition + @";
          var elmOff = elm.offset();
          var elmPos = (elmOff == null) ? 0 : elmOff.top;
          var scroll = ((elmPos < origScroll) || (elmPos > (origScroll + pnl.height())));
          pnl.scrollTop(origScroll);
          if(scroll){pnl.animate({ scrollTop: elmPos - 20 }, 300);};";

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "MaintainScrollbar", script, true);
    }
开发者ID:puentepr,项目名称:kentico-site-example,代码行数:101,代码来源:Tree.aspx.cs

示例2: SortDocumentsByDate

    /// <summary>
    /// Sorts a content tree subsection by date from oldest to newest. Called when the "Sort documents by date" button is pressed.
    /// Expects the "CreateDocumentStructure" method to be run first.
    /// </summary>
    private bool SortDocumentsByDate()
    {
        // Create an instance of the Tree provider
        TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);

        // Select a node
        TreeNode node = tree.SelectSingleNode(CMSContext.CurrentSiteName, "/API-Example", "en-us");

        if (node != null)
        {
            // Sort its child nodes by date - descending
            tree.OrderNodesByDate(node.NodeID, false);

            return true;
        }

        return false;
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:22,代码来源:Default.aspx.cs

示例3: RaisePostBackEvent


//.........这里部分代码省略.........
                {
                    // Set the device name
                    string deviceName = ValidationHelper.GetString(Param2, string.Empty);
                    CMSContext.CurrentDeviceProfileName = deviceName;

                    // Refresh the document
                    if (nodeId > 0)
                    {
                        treeElem.SelectedNodeID = nodeId;

                        AddScript("SelectNode(" + nodeId + ");");
                    }
                }
                catch (Exception ex)
                {
                    log.LogEvent(EventLogProvider.EVENT_TYPE_ERROR, DateTime.Now, "Content", "SETDEVICE", currentUser.UserID, currentUser.UserName, nodeId, documentName, HTTPHelper.UserHostAddress, EventLogProvider.GetExceptionLogMessage(ex), CMSContext.CurrentSite.SiteID, HTTPHelper.GetAbsoluteUri());
                    AddAlert(GetString("ContentRequest.ErrorChangeLanguage"));
                }
                break;

            // Sorting
            case "sortalphaasc":
            case "sortalphadesc":
            case "sortdateasc":
            case "sortdatedesc":
                // Set the preferred culture code
                try
                {
                    // Get document to sort
                    TreeNode node = tree.SelectSingleNode(nodeId);

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

                            case "sortalphadesc":
                                tree.OrderNodesAlphabetically(nodeId, false);
                                break;

                            case "sortdateasc":
                                tree.OrderNodesByDate(nodeId, true);
                                break;

                            case "sortdatedesc":
                                tree.OrderNodesByDate(nodeId, false);
                                break;
                        }

                        // Log the synchronization tasks for the entire tree level
                        if (SettingsKeyProvider.GetBoolValue(siteName + ".CMSStagingLogChanges"))
                        {
                            // Log the synchronization tasks for the entire tree level
                            string fakeAlias = node.NodeAliasPath.TrimEnd('/') + "/child";
                            DocumentSynchronizationHelper.LogDocumentChangeOrder(siteName, fakeAlias, tree);
                        }
                    }
                    else
                    {
                        AddAlert(GetString("ContentRequest.SortDenied"));
                    }

                    // Refresh the tree
                    if (nodeId > 0)
                    {
                        treeElem.ExpandNodeID = nodeId;
                        treeElem.SelectedNodeID = nodeId;
                        if (IsProductTree)
                        {
                            AddScript("window.frames['contentview'].location.replace(window.frames['contentview'].location);");
                        }
                        else
                        {
                            AddScript("SelectNode(" + nodeId + ");");
                        }
                    }
                }
                catch (Exception ex)
                {
                    log.LogEvent(EventLogProvider.EVENT_TYPE_ERROR, DateTime.Now, "Content", "SORT", currentUser.UserID, currentUser.UserName, nodeId, documentName, HTTPHelper.UserHostAddress, EventLogProvider.GetExceptionLogMessage(ex), CMSContext.CurrentSite.SiteID, HTTPHelper.GetAbsoluteUri());
                    AddAlert(GetString("ContentRequest.ErrorSort"));
                }
                break;
        }

        // Maintain scrollbar position
        string script =
        @"
        SetSelectedNodeId(currentNodeId);
        MaintainScroll('" + nodeId + @"','" + pnlTreeArea.ClientID + @"', " + ScrollPosition + @");
        HideAllContextMenus();
        ";

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "MaintainScrollbar", script, true);
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:101,代码来源:CMSDeskTree.ascx.cs


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