Пример #1
0
        public static bool InsertRootProductMappingCacheWithBlackList(long productID, string searchEnginesServiceUrl, TimeSpan?expiry = null)
        {
            var client   = new ProtoBufServiceStackClient(searchEnginesServiceUrl);
            var response = client.Send <GetRootProductMappingResponse>(new GetRootProductMappingRequest {
                ProductID = productID, RegionID = 0, IncludeBlackList = true, GetFacet = false, SortType = RootProductMappingSortType.PriceWithVAT
            });

            if (response.RootProductMapping != null)
            {
                RootProductMappingBAL.InsertRootProductMappingIntoCache(response.RootProductMapping, 0, RootProductMappingSortType.PriceWithVAT, true, expiry);
                return(true);
            }
            else
            {
                Log.ErrorFormat("InsertRootProductMappingWithBlackListIntoCache failed - ProductID {0}", productID);
                return(false);
            }
        }
Пример #2
0
        public static bool InsertRootProductMappingCache(long productID, string searchEnginesServiceUrl, TimeSpan?expiry = null)
        {
            var client   = new ProtoBufServiceStackClient(searchEnginesServiceUrl);
            var response = client.Send <GetRootProductMappingResponse>(new GetRootProductMappingRequest {
                ProductID = productID, RegionID = 0, IncludeBlackList = false, GetFacet = true, SortType = RootProductMappingSortType.PriceWithVAT
            });

            if (response.RootProductMapping != null)
            {
                if (response.RootProductMapping.NumMerchant > 0)
                {
                    RedisPriceLogAdapter.PushRootProductPrice(productID, response.RootProductMapping.MinPrice, response.RootProductMapping.MaxPrice, response.RootProductMapping.MeanPrice, DateTime.Now.Date);
                }
                RootProductMappingBAL.InsertRootProductMappingIntoCache(response.RootProductMapping, 0, RootProductMappingSortType.PriceWithVAT, false, expiry);
                return(true);
            }
            else
            {
                Log.ErrorFormat("InsertRootProductMappingIntoCache failed - ProductID {0}", productID);
                return(false);
            }
        }