-
-
Save jbubriski/9600897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string GetProductCategory() | |
{ | |
var category = GetFirstCategory(CurrentDocument); | |
if (category != null) | |
{ | |
var qsvalue = category.CategoryID; | |
return "?subject=" + qsvalue; | |
} | |
else | |
{ | |
return String.Empty; | |
} | |
} | |
public SettingsProvider.BaseInfo GetFirstCategory(TreeNode tn) | |
{ | |
if (tn.Categories != null) | |
{ | |
if (tn.Categories.Count > 0) | |
{ | |
return (CategoryInfo)tn.Categories.FirstItem; | |
} | |
else | |
{ | |
return null; | |
} | |
} | |
else if (!tn.Parent.IsRoot()) | |
{ | |
return GetFirstCategory(tn.Parent); | |
} | |
else | |
{ | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment