private Dictionary<int, string> BuildCatList(int displaylevels = 20, Boolean showHidden = false, Boolean showArchived = false, int parentid = 0, String catreflist = "", String prefix = "", bool displayCount = false, bool showEmpty = true, string groupref = "", string breadcrumbseparator = ">",string lang = "") { if (lang == "") lang = Utils.GetCurrentCulture(); var rtnDic = new Dictionary<int, string>(); var strCacheKey = "NBrightBuy_BuildCatList" + PortalSettings.Current.PortalId + "*" + displaylevels + "*" + showHidden.ToString(CultureInfo.InvariantCulture) + "*" + showArchived.ToString(CultureInfo.InvariantCulture) + "*" + parentid + "*" + catreflist + "*" + prefix + "*" + Utils.GetCurrentCulture() + "*" + showEmpty + "*" + displayCount + "*" + groupref + "*" + lang; var objCache = NBrightBuyUtils.GetModCache(strCacheKey); if (objCache == null | StoreSettings.Current.DebugMode) { var grpCatCtrl = new GrpCatController(lang); var d = new Dictionary<int, string>(); var rtnList = new List<GroupCategoryData>(); rtnList = grpCatCtrl.GetTreeCategoryList(rtnList, 0, parentid, groupref,breadcrumbseparator); var strCount = ""; foreach (var grpcat in rtnList) { if (displayCount) strCount = " (" + grpcat.entrycount.ToString("") + ")"; if (grpcat.depth < displaylevels) { if (showEmpty || grpcat.entrycount > 0) { if (grpcat.ishidden == false || showHidden) { var addprefix = new String(' ', grpcat.depth).Replace(" ", prefix); if (catreflist == "") rtnDic.Add(grpcat.categoryid, addprefix + grpcat.categoryname + strCount); else { if (grpcat.categoryref != "" && (catreflist + ",").Contains(grpcat.categoryref + ",")) { rtnDic.Add(grpcat.categoryid, addprefix + grpcat.categoryname + strCount); } } } } } } NBrightBuyUtils.SetModCache(-1, strCacheKey, rtnDic); } else { rtnDic = (Dictionary<int, string>)objCache; } return rtnDic; }
private Dictionary<int, string> BuildCatList(int displaylevels = 20, Boolean showHidden = false, Boolean showArchived = false, int parentid = 0, String catreflist = "", String prefix = "", bool displayCount = false, bool showEmpty = true, string groupref = "", string breadcrumbseparator = ">", string lang = "") { if (lang == "") lang = Utils.GetCurrentCulture(); var rtnDic = new Dictionary<int, string>(); var grpCatCtrl = new GrpCatController(lang); var d = new Dictionary<int, string>(); var rtnList = new List<GroupCategoryData>(); rtnList = grpCatCtrl.GetTreeCategoryList(rtnList, 0, parentid, groupref, breadcrumbseparator); var strCount = ""; foreach (var grpcat in rtnList) { if (displayCount) strCount = " (" + grpcat.entrycount.ToString("") + ")"; if (grpcat.depth < displaylevels) { if (showEmpty || grpcat.entrycount > 0) { if (grpcat.ishidden == false || showHidden) { var addprefix = new String(' ', grpcat.depth).Replace(" ", prefix); if (catreflist == "") rtnDic.Add(grpcat.categoryid, addprefix + grpcat.categoryname + strCount); else { if (grpcat.categoryref != "" && (catreflist + ",").Contains(grpcat.categoryref + ",")) { rtnDic.Add(grpcat.categoryid, addprefix + grpcat.categoryname + strCount); } } } } } } return rtnDic; }