public static int GetParentCategory(int childItemId, int portalId)
{
int parentId;
string cacheKey = Utility.CacheKeyPublishItemParentCategoryId + childItemId.ToString(CultureInfo.InvariantCulture); // +"PageId";
if (ModuleBase.UseCachePortal(portalId))
{
object o = DataCache.GetCache(cacheKey);
parentId = o != null ? Convert.ToInt32(o.ToString()) : DataProvider.Instance().GetParentCategory(childItemId, portalId);
if (parentId != -1)
{
DataCache.SetCache(cacheKey, parentId, DateTime.Now.AddMinutes(ModuleBase.CacheTimePortal(portalId)));
Utility.AddCacheKey(cacheKey, portalId);
}
}
else
{
parentId = DataProvider.Instance().GetParentCategory(childItemId, portalId);
}
return parentId;
}