public void AddCachedContractInformation(UserSelectedContext catalogInfo, Dictionary <string, string> contractdictionary) { _cache.AddItem <Dictionary <string, string> >(CACHE_CONTRACT_GROUPNAME, CACHE_CONTRACT_PREFIX, CACHE_CONTRACT_NAME, ContractDictionaryCacheKey(catalogInfo), TimeSpan.FromHours(HOURS_FOR_CONTRACTDICT_TO_CACHE), contractdictionary); }
/// <summary> /// Method to set up the cross-references needed to be able to check for a cart/order being submitted /// </summary> public static void StartChangeOrderBlock(string orderNumber, string newOrderNumber, ICacheRepository cache) { if (orderNumber != null && newOrderNumber != null) { string cachekey = string.Format("ChangeOrder_Order2NewOrderId_{0}", orderNumber); cache.AddItem <string>(CACHE_GROUPNAME, CACHE_PREFIX, CACHE_NAME, cachekey, TimeSpan.FromMinutes(5), newOrderNumber); // create the cart2order cross-reference } }
/// <summary> /// Method to set up the cross-references needed to be able to check for a cart/order being submitted /// </summary> public static void StartOrderBlock(Guid cartId, string orderNumber, ICacheRepository cache) { if (cartId != null && orderNumber != null) { string cachekey = string.Format("Cart2OrderId_{0}", cartId); cache.AddItem <string>(CACHE_GROUPNAME, CACHE_PREFIX, CACHE_NAME, cachekey, TimeSpan.FromMinutes(5), orderNumber); // create the cart2order cross-reference } }
public Core.Models.SiteCatalog.PriceReturn GetPrices(string BranchId, string customerNumber, DateTime shipDate, List <Core.Models.SiteCatalog.Product> products) { List <Price> cachedPriceList = null; List <Product> uncachedProductList = null; BuildCachedPriceList(BranchId, customerNumber, products, out cachedPriceList, out uncachedProductList); PriceReturn retVal = new PriceReturn(); retVal.Prices.AddRange(cachedPriceList); if (uncachedProductList.Count > 0) { List <Price> uncachedPrices = new List <Price>(); uncachedPrices = _priceRepository.GetPrices(BranchId, customerNumber, shipDate, uncachedProductList); foreach (Price p in uncachedPrices) { _priceCacheRepository.AddItem(CACHE_GROUPNAME, CACHE_PREFIX, CACHE_NAME, GetCacheKey(p.BranchId, p.CustomerNumber, p.ItemNumber), TimeSpan.FromHours(2), p); } retVal.Prices.AddRange(uncachedPrices); } return(retVal); }
public CategoriesReturn GetCategories(int from, int size, string catalogType) { CategoriesReturn categoriesReturn = _catalogCacheRepository .GetItem <CategoriesReturn>(CACHE_GROUPNAME, CACHE_PREFIX, CACHE_NAME, GetCategoriesCacheKey(from, size, catalogType)); if (categoriesReturn == null) { categoriesReturn = _catalogRepository.GetCategories(from, size, catalogType); AddCategoryImages(categoriesReturn); AddCategorySearchName(categoriesReturn); _catalogCacheRepository.AddItem <CategoriesReturn>(CACHE_GROUPNAME, CACHE_PREFIX, CACHE_NAME, GetCategoriesCacheKey(from, size, catalogType), TimeSpan.FromHours(2), categoriesReturn); } return(categoriesReturn); }
public Customer GetCustomerByCustomerNumber(string customerNumber, string branchId) { var customerFromCache = _customerCacheRepository.GetItem <Customer>(CACHE_GROUPNAME, CACHE_PREFIX, CACHE_NAME, GetCacheKey(string.Format("{0}-{1}", customerNumber, branchId))); if (customerFromCache == null) { var queryOrg = new CommerceServer.Foundation.CommerceQuery <KeithLink.Svc.Core.Models.Generated.Organization>("Organization"); queryOrg.SearchCriteria.WhereClause = "u_organization_type = '0' AND u_customer_number = '" + customerNumber + "' AND u_branch_number = '" + branchId + "'"; // org type of customer CommerceQueryOperationResponse res = (Svc.Impl.Helpers.FoundationService.ExecuteRequest(queryOrg.ToRequest())).OperationResponses[0] as CommerceQueryOperationResponse; if (res.CommerceEntities.Count > 0) { List <Customer> results = BuildCustomerList(res.CommerceEntities); _customerCacheRepository.AddItem <Customer>(CACHE_GROUPNAME, CACHE_PREFIX, CACHE_NAME, GetCacheKey(string.Format("{0}-{1}", customerNumber, branchId)), TimeSpan.FromHours(4), results[0]); return(results[0]); } else { return(null); } } else { return(customerFromCache); } }
public void AddItem(CacheItem item) { var mapped = _accessObjectMapper.MapToAccessCacheItem(item); _dbConnection.AddItem(mapped); }