Exemple #1
0
        /// <summary>
        /// 添加违章查询城市配置
        /// </summary>
        /// <param name="model"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool AddPeccancyCityConfig(PeccancyQueryCityModel model, string user)
        {
            var result = false;

            try
            {
                using (var dbhelper = new Tuhu.Component.Common.SqlDbHelper(grconnectionString))
                {
                    result = DalPeccancyQueryConfig.AddPeccancyCityConfig(dbhelper, model);
                    if (result)
                    {
                        var log = new PeccancyConfigOprLogModel
                        {
                            LogType       = "PeccancyCityConfig",
                            IdentityId    = $"{model.CityId}",
                            OperationType = "Add",
                            OldValue      = null,
                            NewValue      = JsonConvert.SerializeObject(model),
                            Remarks       = $"添加 违章查询城市:{model.CityName} 的配置",
                            Operator      = user,
                        };
                        LoggerManager.InsertLog("PeccancyConfigOprLog", log);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("AddPeccancyCityConfig", ex);
            }
            return(result);
        }
Exemple #2
0
        /// <summary>
        /// 更新违章查询省份配置
        /// </summary>
        /// <param name="province"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool UpdatePeccancyProvinceConfig(PeccancyQueryProvinceModel province, string user)
        {
            var result = false;

            try
            {
                var oldValue = DalPeccancyQueryConfig.GetPeccancyProvinceConfigByProvinceId(province.ProvinceId);
                if (oldValue != null)
                {
                    using (var dbhelper = new Tuhu.Component.Common.SqlDbHelper(grconnectionString))
                    {
                        result = DalPeccancyQueryConfig.UpdatePeccancyProvinceConfig(dbhelper, province);
                    }
                    if (result)
                    {
                        var log = new PeccancyConfigOprLogModel
                        {
                            LogType       = "PeccancyProvinceConfig",
                            IdentityId    = $"{province.ProvinceId}",
                            OperationType = "Update",
                            OldValue      = JsonConvert.SerializeObject(oldValue),
                            NewValue      = JsonConvert.SerializeObject(province),
                            Remarks       = $"更新 违章查询省份:{province.ProvinceName} 的配置",
                            Operator      = user,
                        };
                        LoggerManager.InsertLog("PeccancyConfigOprLog", log);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("UpdatePeccancyProvinceConfig", ex);
            }
            return(result);
        }
Exemple #3
0
        /// <summary>
        /// 查看违章配置操作记录详情
        /// </summary>
        /// <param name="pkid"></param>
        /// <returns></returns>
        public PeccancyConfigOprLogModel GetPeccancyConfigOprLog(int pkid)
        {
            var result = null as PeccancyConfigOprLogModel;

            try
            {
                result = DalPeccancyQueryConfig.GetPeccancyConfigOprLog(pkid);
            }
            catch (Exception ex)
            {
                Logger.Error("GetPeccancyConfigOprLog", ex);
            }
            return(result);
        }
Exemple #4
0
        /// <summary>
        /// 查看违章配置操作日志
        /// </summary>
        /// <param name="logType"></param>
        /// <param name="identityId"></param>
        /// <returns></returns>
        public List <PeccancyConfigOprLogModel> SelectPeccancyConfigOprLog(string logType, string identityId)
        {
            var result = null as List <PeccancyConfigOprLogModel>;

            try
            {
                result = DalPeccancyQueryConfig.SelectPeccancyConfigOprLog(logType, identityId);
            }
            catch (Exception ex)
            {
                Logger.Error("SelectPeccancyConfigOprLog", ex);
            }
            return(result);
        }
Exemple #5
0
        /// <summary>
        /// 根据城市Id获取违章查询城市配置
        /// </summary>
        /// <param name="cityId"></param>
        /// <returns></returns>
        public PeccancyQueryCityModel GetPeccancyCityConfigByCityId(int cityId)
        {
            PeccancyQueryCityModel peccancyCityModel = null;

            try
            {
                peccancyCityModel = DalPeccancyQueryConfig.GetPeccancyCityConfigByCityId(cityId);
            }
            catch (Exception ex)
            {
                Logger.Error("GetPeccancyCityConfigByCityId", ex);
            }
            return(peccancyCityModel);
        }
Exemple #6
0
        /// <summary>
        /// 根据省份Id获取违章查询省份配置
        /// </summary>
        /// <param name="provinceId"></param>
        /// <returns></returns>
        public PeccancyQueryProvinceModel GetPeccancyProvinceConfigByProvinceId(int provinceId)
        {
            PeccancyQueryProvinceModel model = null;

            try
            {
                model = DalPeccancyQueryConfig.GetPeccancyProvinceConfigByProvinceId(provinceId);
            }
            catch (Exception ex)
            {
                Logger.Error("GetPeccancyProvinceConfigByProvinceId", ex);
            }
            return(model);
        }
Exemple #7
0
        /// <summary>
        /// 查询违章查询城市配置
        /// </summary>
        /// <param name="provinceId"></param>
        /// <param name="cityId"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public Tuple <List <PeccancyQueryCityModel>, int> SelectPeccancyCityConfig(int provinceId, int cityId, int pageIndex, int pageSize)
        {
            var result = new Tuple <List <PeccancyQueryCityModel>, int>(null, 0);

            try
            {
                result = DalPeccancyQueryConfig.SelectPeccancyCityConfig(provinceId, cityId, pageIndex, pageSize);
            }
            catch (Exception ex)
            {
                Logger.Error("SelectPeccancyCityConfig", ex);
            }
            return(result);
        }
Exemple #8
0
        /// <summary>
        /// 获取所有配置的省份
        /// </summary>
        /// <returns></returns>
        public List <PeccancyRegionMiniModel> GetAllPeccancyProvinces()
        {
            List <PeccancyRegionMiniModel> result = null;

            try
            {
                result = DalPeccancyQueryConfig.GetAllPeccancyProvinces();
            }
            catch (Exception ex)
            {
                Logger.Error("GetAllPeccancyProvinces", ex);
            }
            return(result);
        }
Exemple #9
0
        /// <summary>
        /// 获取该省份下的城市配置数量
        /// </summary>
        /// <param name="provinceId"></param>
        /// <returns></returns>
        public int GetPeccancyCityConfigCountByPrvinceId(int provinceId)
        {
            var cityCount = -1;

            try
            {
                cityCount = DalPeccancyQueryConfig.GetPeccancyCityConfigCountByPrvinceId(provinceId);
            }
            catch (Exception ex)
            {
                Logger.Error("GetPeccancyCityConfigCountByPrvinceId", ex);
            }
            return(cityCount);
        }
Exemple #10
0
        /// <summary>
        /// 省份配置是否重复
        /// </summary>
        /// <param name="peccancyProvinceModel"></param>
        /// <returns></returns>
        public PeccancyQueryProvinceModel GetRepeatPeccancyProvinceConfig(PeccancyQueryProvinceModel peccancyProvinceModel)
        {
            PeccancyQueryProvinceModel result = null;

            try
            {
                result = DalPeccancyQueryConfig.GetRepeatPeccancyProvinceConfig(peccancyProvinceModel);
            }
            catch (Exception ex)
            {
                Logger.Error("GetRepeatPeccancyProvinceConfig", ex);
            }
            return(result);
        }
Exemple #11
0
        /// <summary>
        /// 获取该省份下的城市--下拉框选项
        /// </summary>
        /// <param name="provinceId"></param>
        /// <returns></returns>
        public List <PeccancyRegionMiniModel> GetPeccancyCitiesByProvinceId(int provinceId)
        {
            List <PeccancyRegionMiniModel> result = null;

            try
            {
                var configs = DalPeccancyQueryConfig.GetPeccancyCitiesByProvinceId(provinceId);
                result = configs?.Select(s => new PeccancyRegionMiniModel {
                    RegionId = s.CityId, RegionName = s.CityName
                }).ToList();
            }
            catch (Exception ex)
            {
                Logger.Error("GetPeccancyCitiesByProvinceId", ex);
            }
            return(result);
        }
Exemple #12
0
        /// <summary>
        /// 删除违章查询城市配置
        /// </summary>
        /// <param name="cityId"></param>
        /// <returns></returns>
        public bool DeletePeccancyCityConfig(int cityId, string user)
        {
            var result = false;

            try
            {
                var oldValue = DalPeccancyQueryConfig.GetPeccancyCityConfigByCityId(cityId);
                if (oldValue != null)
                {
                    using (var dbhelper = new Tuhu.Component.Common.SqlDbHelper(grconnectionString))
                    {
                        result = DalPeccancyQueryConfig.DeletePeccancyCityConfigByCityId(dbhelper, cityId);
                    }
                    if (result)
                    {
                        var log = new PeccancyConfigOprLogModel
                        {
                            LogType       = "PeccancyCityConfig",
                            IdentityId    = $"{oldValue.CityId}",
                            OperationType = "Delete",
                            OldValue      = JsonConvert.SerializeObject(oldValue),
                            NewValue      = null,
                            Remarks       = $"删除 违章查询城市:{oldValue.CityName} 的配置",
                            Operator      = user,
                        };
                        LoggerManager.InsertLog("PeccancyConfigOprLog", log);
                    }
                }
                else
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("DeletePeccancyCityConfig", ex);
            }
            return(result);
        }
Exemple #13
0
        /// <summary>
        /// 删除违章查询省份配置
        /// </summary>
        /// <param name="provinceId"></param>
        /// <returns></returns>
        public bool DeletePeccancyProvinceConfig(int provinceId, string user)
        {
            var result = false;

            try
            {
                using (var dbhelper = new Tuhu.Component.Common.SqlDbHelper(grconnectionString))
                {
                    var oldValue = DalPeccancyQueryConfig.GetPeccancyProvinceConfigByProvinceId(provinceId);
                    if (oldValue != null)
                    {
                        var cityConfigs = DalPeccancyQueryConfig.GetPeccancyCitiesByProvinceId(provinceId);
                        if (cityConfigs != null && cityConfigs.Any())
                        {
                            dbhelper.BeginTransaction();
                            var deleteProvince = DalPeccancyQueryConfig.DeletePeccancyCityConfigByProvinceId(dbhelper, provinceId);
                            var deleteCity     = DalPeccancyQueryConfig.DeletePeccancyProvinceConfig(dbhelper, provinceId);//同时删除该省份下的所有城市配置
                            if (deleteProvince && deleteCity)
                            {
                                dbhelper.Commit();
                                result = true;
                                #region  除的省份和城市记录日志
                                var logs        = new List <PeccancyConfigOprLogModel>();
                                var provinceLog = new PeccancyConfigOprLogModel
                                {
                                    LogType       = "PeccancyProvinceConfig",
                                    IdentityId    = $"{oldValue.ProvinceId}",
                                    OperationType = "Delete",
                                    OldValue      = JsonConvert.SerializeObject(oldValue),
                                    NewValue      = null,
                                    Remarks       = $"删除 违章查询省份:{oldValue.ProvinceName} 的配置",
                                    Operator      = user,
                                };
                                logs.Add(provinceLog);
                                foreach (var city in cityConfigs)
                                {
                                    var cityLog = new PeccancyConfigOprLogModel
                                    {
                                        LogType       = "PeccancyCityConfig",
                                        IdentityId    = $"{city.CityId}",
                                        OperationType = "Delete",
                                        OldValue      = JsonConvert.SerializeObject(city),
                                        NewValue      = null,
                                        Remarks       = $"删除 违章查询城市:{city.CityName} 的配置",
                                        Operator      = user,
                                    };
                                    logs.Add(cityLog);
                                }
                                if (logs.Any())
                                {
                                    logs.ForEach(s => LoggerManager.InsertLog("PeccancyConfigOprLog", s));
                                }
                                #endregion
                            }
                        }
                        else
                        {
                            result = DalPeccancyQueryConfig.DeletePeccancyProvinceConfig(dbhelper, provinceId);
                            if (result)
                            {
                                var log = new PeccancyConfigOprLogModel
                                {
                                    LogType       = "PeccancyProvinceConfig",
                                    IdentityId    = $"{oldValue.ProvinceId}",
                                    OperationType = "Delete",
                                    OldValue      = JsonConvert.SerializeObject(oldValue),
                                    NewValue      = null,
                                    Remarks       = $"删除 违章查询省份:{oldValue.ProvinceName} 的配置",
                                    Operator      = user,
                                };
                                LoggerManager.InsertLog("PeccancyConfigOprLog", log);
                            }
                        }
                    }
                    else
                    {
                        result = true;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("DeletePeccancyProvinceConfig", ex);
            }
            return(result);
        }