public JsonResult UpdatePartnerCache()
        {
            var regionids = CarInsuranceManager.GetRegionIds();
            var result    = CarInsuranceManager.UpdatePartnerCache(regionids);

            return(Json(new { Status = result }));
        }
        public ActionResult UpdateInsuranceRegions(int insurancePartnerId, string regions)
        {
            var status    = -1;
            var oldRegion = CarInsuranceManager.GetRegionByInsurancePartner(insurancePartnerId);

            if (CarInsuranceManager.UpdateInsuranceRegions(insurancePartnerId, regions))
            {
                status = 1;
            }
            var regionIds = oldRegion?.Select(x => x.CityId)?.ToList() ?? new List <int>();

            if (!regionIds.Any())
            {
                regionIds.Add(0);
            }
            regionIds.AddRange(regions
                               ?.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                               ?.Select(x => int.Parse(x))
                               ?.ToList() ?? new List <int>());
            CarInsuranceManager.UpdatePartnerCache(regionIds);
            return(Json(new
            {
                status = status,
                msg = status > 0 ? "更新成功" : "更新失败"
            }));
        }
        public ActionResult UpdateInsurance(int insurancePartnerId, string name, string img, string linkUrl,
                                            string insuranceId, string providerCode, string regionCode, string remarks, string title, string subTitle,
                                            string tagText, string tagColor, int displayIndex, int isEnable, string regions)
        {
            var status = -1;

            name         = name?.Trim();
            img          = img?.Trim();
            insuranceId  = insuranceId?.Trim();
            linkUrl      = linkUrl?.Trim();
            providerCode = providerCode?.Trim();
            regionCode   = regionCode?.Trim();
            remarks      = remarks?.Trim();
            title        = title?.Trim();
            subTitle     = subTitle?.Trim();
            tagText      = tagText?.Trim();
            tagColor     = tagColor?.Trim();
            regions      = regions?.Trim();

            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(title) ||
                (string.IsNullOrEmpty(providerCode) && string.IsNullOrEmpty(linkUrl)) || string.IsNullOrEmpty(img))
            {
                return(Json(new { status = status, msg = status > 0 ? "更新成功" : "更新失败,输入不允许为空" }));
            }

            var oldRegion = CarInsuranceManager.GetRegionByInsurancePartner(insurancePartnerId);

            if (CarInsuranceManager.UpdateInsurance(insurancePartnerId, name, img, linkUrl,
                                                    insuranceId, remarks, title, subTitle, tagText, tagColor, displayIndex, isEnable,
                                                    regionCode, providerCode) && CarInsuranceManager.UpdateInsuranceRegions(insurancePartnerId, regions))
            {
                status = 1;
            }
            var regionIds = oldRegion?.Select(x => x.CityId)?.ToList() ?? new List <int>();

            if (!regionIds.Any())
            {
                regionIds.Add(0);
            }
            regionIds.AddRange(regions
                               ?.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                               ?.Select(x => int.Parse(x))
                               ?.ToList() ?? new List <int>());
            CarInsuranceManager.UpdatePartnerCache(regionIds);
            return(Json(new
            {
                status = status,
                msg = status > 0 ? "更新成功" : "更新失败"
            }));
        }
        public ActionResult DeleteInsurance(int insurancePartnerId)
        {
            var status    = -1;
            var oldRegion = CarInsuranceManager.GetRegionByInsurancePartner(insurancePartnerId);

            if (CarInsuranceManager.DeleteInsurance(insurancePartnerId))
            {
                status = 1;
            }
            var regionIds = oldRegion?.Select(x => x.CityId)?.ToList() ?? new List <int>();

            if (!regionIds.Any())
            {
                regionIds.Add(0);
            }
            CarInsuranceManager.UpdatePartnerCache(regionIds);
            return(Json(new
            {
                status = status,
                msg = status > 0 ? "删除成功" : "删除失败"
            }));
        }