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


C# Document.refreshXmlSortOrder方法代码示例

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


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

示例1: UpdateSortOrder

        public void UpdateSortOrder(int ParentId, string SortOrder)
        {

            try
            {
                if (BasePage.ValidateUserContextID(BasePage.umbracoUserContextID))
                {

                    if (SortOrder.Trim().Length > 0)
                    {
                        string[] tmp = SortOrder.Split(',');

                        bool isContent = false;
                        if (helper.Request("app") == "content" | helper.Request("app") == "")
                            isContent = true;

                        //CHANGE:Allan Stegelmann Laustsen, we need to know if the node is in media.
                        bool isMedia = false;
                        if (helper.Request("app") == "media")
                        {
                            isMedia = true;
                        }
                        //CHANGE:End

                        for (int i = 0; i < tmp.Length; i++)
                        {
                            if (tmp[i] != "" && tmp[i].Trim() != "")
                            {
                                new cms.businesslogic.CMSNode(int.Parse(tmp[i])).sortOrder = i;

                                if (isContent)
                                {
                                    Document d = new Document(int.Parse(tmp[i]));
                                    // refresh the xml for the sorting to work
                                    if (d.Published)
                                    {
                                        d.refreshXmlSortOrder();
                                        library.UpdateDocumentCache(int.Parse(tmp[i]));
                                    }
                                }
                                //CHANGE:Allan Laustsen, to update the sortorder of the media node in the XML, re-save the node....
                                else if (isMedia)
                                {
                                    new cms.businesslogic.media.Media(int.Parse(tmp[i])).Save();
                                }
                                //CHANGE:End
                            }
                        }

                        // Refresh sort order on cached xml
                        if (isContent)
                        {
                            System.Xml.XmlNode parentNode;

                            if (ParentId == -1)
                                parentNode = content.Instance.XmlContent.DocumentElement;
                            else
                                parentNode = content.Instance.XmlContent.GetElementById(ParentId.ToString());

                            //only try to do the content sort if the the parent node is available... 
                            if (parentNode != null)
                                content.SortNodes(ref parentNode);


                            // Load balancing - then refresh entire cache
                            if (UmbracoSettings.UseDistributedCalls)
                                library.RefreshContent();
                        }
                       

                        // fire actionhandler, check for content
                        if ((helper.Request("app") == "content" | helper.Request("app") == "") && ParentId > 0)
                            global::umbraco.BusinessLogic.Actions.Action.RunActionHandlers(new Document(ParentId), ActionSort.Instance);                        
                    }
                }

            }
            catch (Exception ex)
            {
                BusinessLogic.Log.Add(global::umbraco.BusinessLogic.LogTypes.Debug, ParentId, ex.ToString());
            }

        }
开发者ID:elrute,项目名称:Triphulcas,代码行数:83,代码来源:nodeSorter.asmx.cs


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