Skip to content

Instantly share code, notes, and snippets.

Created March 17, 2014 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/9600510 to your computer and use it in GitHub Desktop.
Save anonymous/9600510 to your computer and use it in GitHub Desktop.
public string GetProductCategory()
{
var category = GetFirstCategory(CurrentDocument);
if (category != null)
{
var qsvalue = category.GetValue("CategoryID");
return "?subject=" + qsvalue;
}
else
{
return String.Empty;
}
}
public SettingsProvider.BaseInfo GetFirstCategory(TreeNode tn)
{
if (tn.Categories != null)
{
return tn.Categories.FirstItem;
}
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