Skip to content

Instantly share code, notes, and snippets.

@jbubriski
Forked from anonymous/gist:9600510
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbubriski/9600897 to your computer and use it in GitHub Desktop.
Save jbubriski/9600897 to your computer and use it in GitHub Desktop.
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