Esempio n. 1
0
        private void Document_Update_After(object sender, DocumentEventArgs e)
        {
            if (e.Node.ClassName.Equals("PbcLinear.Product"))
            {
                TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);
                var          relatedProductCategories = tree.SelectNodes(SiteContext.CurrentSiteName, "/Products/%",
                                                                         e.Node.DocumentCulture,
                                                                         false, "PbcLinear.ProductSubCategory", string.Empty, "NodeOrder", -1, true, e.Node.NodeGUID,
                                                                         ProductCategoryRelationshipName,
                                                                         true).ToList();

                DocumentAliasInfoProvider.DeleteNodeAliases(e.Node.NodeID);
                foreach (var category in relatedProductCategories)
                {
                    DocumentAliasInfoProvider.SetDocumentAliasInfo(new DocumentAliasInfo
                    {
                        AliasNodeID     = e.Node.NodeID,
                        AliasURLPath    = TreePathUtils.GetSafeNodeAliasPath(string.Format("{0}/{1}", category.NodeAliasPath, e.Node.DocumentName), "PbcLinear"),
                        AliasSiteID     = SiteContext.CurrentSiteID,
                        AliasCulture    = "",
                        AliasExtensions = ""
                    }, SiteContext.CurrentSiteName);
                }
            }
        }
Esempio n. 2
0
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        Response.ContentType = "text/xml";

        // Get parent blog alias path from url
        string blogAliasPath = QueryHelper.GetString("aliaspath", String.Empty);
        string validPath = TreePathUtils.GetSafeNodeAliasPath(blogAliasPath, CMSContext.CurrentSiteName).TrimEnd('/') + "/%";

        // Set blog path to the repetet to get appropiate posts
        repeater.Path = validPath;
    }
Esempio n. 3
0
        protected CMS.DocumentEngine.TreeNode FindProductCategory(string nodeAliasPath)
        {
            string path        = TreePathUtils.GetSafeNodeAliasPath(nodeAliasPath, CurrentSiteName);
            var    subCategory = TreeHelper.GetDocument(CurrentSiteName, path, Culture, true,
                                                        "PbcLinear.ProductSubCategory",
                                                        true, true, CurrentUser);
            var category = TreeHelper.GetDocument(CurrentSiteName, path, Culture, true, "PbcLinear.ProductCategory",
                                                  true, true, CurrentUser);
            var returnedCategory = new CMS.DocumentEngine.TreeNode();

            if (subCategory != null)
            {
                returnedCategory = subCategory;
            }


            if (category != null)
            {
                returnedCategory = category;
            }
            return(returnedCategory);
        }