Ejemplo n.º 1
0
        /// <summary>
        /// 获取所有车牌前缀
        /// </summary>
        /// <returns></returns>
        public Dictionary <string, List <string> > GetAllCarNoPrefix()
        {
            var result = null as Dictionary <string, List <string> >;

            try
            {
                var prefix = dbScopeManagerGungnirRead.Execute(conn => DalVehicleAnnualInspectionAgent.GetAllCarNoPrefix(conn));
                result = prefix.GroupBy(s => s.ProvinceName).ToDictionary(c => c.Key, c => c.Select(s => s.PlatePrefix).Distinct().ToList());
            }
            catch (Exception ex)
            {
                Logger.Error("GetAllCarNoPrefix", ex);
            }
            return(result);
        }
Ejemplo n.º 2
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);
        }