public IList <Distributor> GetActivesByPriceGroup(PriceGroup pG, int?maxResults) { //Cache Section string cacheKey = null; MembershipHelperUser mhu = MembershipHelper.GetUser(); if (mhu != null) { cacheKey = string.Format("DISTRIBUTORS_{0}_{1}_{2}_{3}", mhu.UserId, typeof(Distributor).ToString(), pG.ID, maxResults); } object result = CacheManager.GetCached(typeof(Distributor), cacheKey); if (result == null) { ExecutePermissionValidator epv = new ExecutePermissionValidator(); epv.ClassType = typeof(PriceList); epv.KeyIdentifier = Config.SeePriceLists; bool CanSeeAll = PermissionManager.Check(epv); IList priceListIds = null; if (!CanSeeAll) { priceListIds = PermissionManager.GetPermissionIdentifiers(typeof(PriceList), PermissionAction.Create); } IList <Distributor> d = repository.GetActivesByPriceGroup(pG, maxResults, priceListIds); CacheManager.AddItem(typeof(Distributor), cacheKey, d); result = d; } return(result as IList <Distributor>); }