예제 #1
0
        private static Catalog_V01 LoadCatalogFromService(string isoCountryCode)
        {
            if (string.IsNullOrEmpty(isoCountryCode))
            {
                return(null);
            }

            Catalog_V01 catalog = null;

            using (var proxy = ServiceClientProvider.GetCatalogServiceProxy())
            {
                try
                {
                    var response = proxy.GetCatalog(new GetCatalogRequest1(new GetCatalogRequest_V01(isoCountryCode))).GetCatalogResult as GetCatalogResponse_V01;

                    if (response == null || response.Status != ServiceResponseStatusType.Success || response.Catalog == null)
                    {
                        throw new ApplicationException(
                                  "CatalogProvider.LoadCatalogFromService error. GetCatalogResponse indicates error.");
                    }
                    catalog = response.Catalog;
                }
                catch (Exception ex)
                {
                    LoggerHelper.Error(string.Format("LoadCatalogFromService error, country Code: {0} {1}",
                                                     isoCountryCode, ex));
                }
            }
            return(catalog);
        }
            private Catalog_V01 GetChinaCatalog()
            {
                Catalog_V01 result;

                result             = new Catalog_V01();
                result.CountryCode = "CN";
                result.Items       = new CatalogItemList();
                result.Items.Add(HLConfigManager.Configurations.APFConfiguration.DistributorSku, new CatalogItem()
                {
                    SKU = HLConfigManager.Configurations.APFConfiguration.DistributorSku, IsInventory = false
                });

                return(result);
            }
예제 #3
0
 private static void SaveCatalogToCache(string cacheKey, Catalog_V01 catalog)
 {
     HttpRuntime.Cache.Insert(cacheKey, catalog, null, DateTime.Now.AddMinutes(CatalogCacheMinutes),
                              Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, OnCatalogCacheRemove);
 }