Пример #1
0
        public bool SaveCouponActivityWebConfig(WebCouponActivity configObject, string userName)
        {
            bool result = false;

            try
            {
                if (configObject != null)
                {
                    configObject.PromotionDescription = string.Empty;
                    configObject.PromotionCodeChannel = string.Empty;
                    result = DbGungnirManager.Execute(conn => handler.SaveCouponActivityWebConfig(conn, configObject, userName));
                    if (result)
                    {
                        var key = configObject.ActivityId == -1 ? configObject.ActivityKey?.ToString() : configObject.ActivityId.ToString();
                        using (var client = new Service.Config.CacheClient())
                        {
                            var serviceResult = client.RemoveRedisCacheKey("Config1", $"WebCouponActivity/{key}");
                            serviceResult.ThrowIfException(true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                var exception = new ActivityException(1, "SaveCouponActivityWebConfig", ex);
                Logger.Error("SaveCouponActivityWebConfig", exception);
                throw ex;
            }
            return(result);
        }
        /// <summary>
        /// 刷新喷漆打折服务缓存
        /// </summary>
        /// <returns></returns>
        public bool RefreshPaintDiscountConfigCache()
        {
            var result = false;

            try
            {
                var models = dbScopeManagerProductcatalogRead.Execute(conn =>
                                                                      DalPaintDiscountConfig.GetAllPaintDiscountService(conn));
                var servicePids = models?.Select(s => s.ServicePid).Distinct().ToList();
                if (servicePids != null && servicePids.Any())
                {
                    using (var client = new Service.Config.CacheClient())
                    {
                        var cacheResult = client.RefreshPaintDiscountConfigCache(servicePids);
                        cacheResult.ThrowIfException(true);
                        result = cacheResult.Result;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("RefreshPaintDiscountConfigCache", ex);
            }
            return(result);
        }
        public static bool UpdateFooterCache()
        {
            using (var client = new Service.Config.CacheClient())
            {
                var serviceResult = client.UpdateCarInsuranceFooterCache();

                return(serviceResult.Result);
            }
        }
        public static bool UpdatePartnerCache(IEnumerable <int> regionIds)
        {
            if (regionIds == null || !regionIds.Any())
            {
                return(true);
            }
            regionIds = regionIds.Distinct();
            var success = true;

            using (var client = new Service.Config.CacheClient())
            {
                foreach (var regionId in regionIds)
                {
                    var serviceResult = client.UpdateCarInsurancePartnerCache(regionId);
                    success = serviceResult.Result && success;
                }
            }
            return(success);
        }
Пример #5
0
        /// <summary>
        /// 刷新年检代办服务缓存
        /// </summary>
        /// <returns></returns>
        public bool RefreshAnnualInspectionAgentCache()
        {
            var result = false;

            try
            {
                var models      = dbScopeManagerGungnirRead.Execute(conn => DalVehicleAnnualInspectionAgent.GetAllCarNoPrefix(conn));
                var carNoPrefix = models?.Select(s => s.PlatePrefix).ToList();
                if (carNoPrefix != null && carNoPrefix.Any())
                {
                    using (var client = new Service.Config.CacheClient())
                    {
                        var cacheResult = client.RefreshVehicleAnnualInspectionAgentCache(carNoPrefix);
                        cacheResult.ThrowIfException(true);
                        result = cacheResult.Result;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("RefreshAnnualInspectionAgentCache", ex);
            }
            return(result);
        }