コード例 #1
0
    /// <summary>
    /// Checks whether node with given node ID is contained in a products tree,
    /// considering the ProductsStartingPath setting.
    /// </summary>
    /// <param name="nodeId">NodeID of a node to be checked on.</param>
    private bool IsAllowedInProductsStartingPath(int nodeId)
    {
        var nodePath = TreePathUtils.GetAliasPathByNodeId(nodeId);
        var nodeSite = TreePathUtils.GetNodeSite(nodeId);

        if (String.IsNullOrEmpty(nodePath))
        {
            return(false);
        }

        if (!String.IsNullOrEmpty(ProductsStartingPath))
        {
            if ((TreePathUtils.GetNodeIdByAliasPath(nodeSite.SiteName, ProductsStartingPath) > 0) &&
                !nodePath.StartsWithCSafe(ProductsStartingPath, true))
            {
                // Products starting path is defined and node on that path exists,
                // but our node is not contained within that path
                return(false);
            }
        }

        return(true);
    }