コード例 #1
0
        /// <summary>
        /// 获取所有城市数据(到市一级)
        /// </summary>
        /// <returns>Json格式</returns>
        public ActionResult GetAllRegion()
        {
            var manager = new BaoYangActivitySettingManager();
            var regions = manager.GetAllRegion();

            return(Json(new { Status = regions.Any(), Data = regions }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public ActionResult SelectBaoYangActivityVehicle(BaoYangActivityVehicleSearchModel model, int pageIndex = 1, int pageSize = 20)
        {
            if (model == null)
            {
                return(Json(new { Status = false, Msg = "未知的查询对象" }, JsonRequestBehavior.AllowGet));
            }
            if (model.BrandCategories == null || !model.BrandCategories.Any() || model.Brands == null || !model.Brands.Any())
            {
                return(Json(new { Status = false, Msg = "请选择车型信息" }, JsonRequestBehavior.AllowGet));
            }
            if (string.IsNullOrWhiteSpace(model.OilViscosity))
            {
                return(Json(new { Status = false, Msg = "请选择机油等级" }, JsonRequestBehavior.AllowGet));
            }
            if (model.MaxPrice < model.MinPrice)
            {
                return(Json(new { Status = false, Msg = "最高价不得小于最低价" }, JsonRequestBehavior.AllowGet));
            }
            var manager = new BaoYangActivitySettingManager();

            if (model.OilLevels != null && model.OilLevels.Any())
            {
                var oilLevels = manager.GetAllOilLevel();
                if (oilLevels == null || !oilLevels.Any())
                {
                    return(Json(new { Status = false, Msg = "无法获取机油等级信息" }, JsonRequestBehavior.AllowGet));
                }
                model.OilLevels = oilLevels.Where(s => model.OilLevels.Contains(s.OilType)).Select(v => v.OilLevel).Distinct().ToList();
            }
            var result    = manager.SelectBaoYangActivityVehicle(model, pageIndex, pageSize);
            var totalPage = (result.Item2 % pageSize == 0) ? ((int)result.Item2 / pageSize) : ((int)result.Item2 / pageSize + 1);

            return(Json(new { Status = result.Item1 != null, Data = result.Item1, TotalCount = result.Item2, TotalPage = totalPage },
                        JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public ActionResult GetActivitySettingItemForAdd(string type)
        {
            List <BaoYangType> list = new List <BaoYangType>();
            var manager             = new BaoYangActivitySettingManager();
            var package             = manager.GetBaoYangPackageDescriptionByType(type);

            foreach (var item in package?.Items?.ToList() ?? new List <BaoYangTypeDescription>())
            {
                BaoYangType m = new BaoYangType
                {
                    Package = new BaoYangPackage()
                    {
                        Type  = package.PackageType,
                        Name  = package.ZhName,
                        Items = string.Join(",", package.Items.Select(v => v.BaoYangType))
                    },
                    Name        = item.ZhName,
                    CatalogName = item.CatalogName,
                    Type        = item.BaoYangType
                };
                if (!string.Equals(item.CatalogName, "Oil"))
                {
                    m.BrandList = BaoYangActivitySettingManager.GetRelevanceBrand(item.CatalogName)?.Select(s => s.Brand)?.ToList();
                    m.SerieList = BaoYangActivitySettingManager.GetRelevanceSeries(item.CatalogName)?.Select(s => s.Series)?.ToList();
                }
                list.Add(m);
            }
            return(Json(new { Status = list != null && list.Any(), Data = list }));
        }
コード例 #4
0
        public List <BaoYangPackage> GetBaoYangPackage()
        {
            var manager = new BaoYangActivitySettingManager();
            var list    = manager.GetBaoYangPackageDescription();

            return(list ?? new List <BaoYangPackage>());
        }
コード例 #5
0
        public ActionResult ServiceType(int id, string ActivityNum)
        {
            var manager = new BaoYangActivitySettingManager();
            var list    = manager.GetBaoYangPackageDescription();

            ViewData["BaoYangActivityId"] = id;
            ViewData["ActivityNum"]       = ActivityNum;
            return(View(list));
        }
コード例 #6
0
        public ActionResult GetBaoYangOprLogByIdentityIdAndType(string identityId, string type)
        {
            if (string.IsNullOrWhiteSpace(identityId) || string.IsNullOrWhiteSpace(type))
            {
                return(Json(new { Status = false, Msg = "未知的查询对象" }, JsonRequestBehavior.AllowGet));
            }
            var manager = new BaoYangActivitySettingManager();
            var result  = manager.GetBaoYangOprLogByIdentityIdAndType(identityId, type);

            return(Json(new { Status = result != null, Data = result }, JsonRequestBehavior.AllowGet));
        }
コード例 #7
0
        public ActionResult GetBaoYangActivityNameByActivityId(string activityId)
        {
            var result = string.Empty;

            if (!string.IsNullOrWhiteSpace(activityId))
            {
                var manager = new BaoYangActivitySettingManager();
                result = manager.GetBaoYangActivityNameByActivityId(activityId);
            }
            return(Json(new { Status = !string.IsNullOrWhiteSpace(result), Data = result }, JsonRequestBehavior.AllowGet));
        }
コード例 #8
0
        public ActionResult MultDeleteBaoYangActivityRegion(List <int> regionIds)
        {
            if (regionIds == null || !regionIds.Any())
            {
                return(Json(new { Status = false, Msg = "未知的删除对象" }, JsonRequestBehavior.AllowGet));
            }
            var manager = new BaoYangActivitySettingManager();
            var user    = User.Identity.Name;
            var result  = manager.MultDeleteBaoYangActivityRegion(regionIds, user);

            return(Json(new { Status = result, Msg = $"批量删除{(result.Item1 ? "成功" : "失败")},清除缓存{(result.Item2 ? "成功" : "失败")}" }, JsonRequestBehavior.AllowGet));
        }
コード例 #9
0
        public ActionResult SelectBaoYangActivityRegion(List <int> regionIds, int pageIndex = 1, int pageSize = 20)
        {
            if (regionIds == null || !regionIds.Any())
            {
                return(Json(new { Status = false, Msg = "请选择城市" }, JsonRequestBehavior.AllowGet));
            }
            var manager    = new BaoYangActivitySettingManager();
            var result     = manager.SelectBaoYangActivityRegion(regionIds, pageIndex, pageSize);
            var totalCount = regionIds.Count;
            var totalPage  = (totalCount % pageSize == 0) ? ((int)totalCount / pageSize) : ((int)totalCount / pageSize + 1);

            return(Json(new { Status = result != null, Data = result, TotalCount = totalCount, TotalPage = totalPage },
                        JsonRequestBehavior.AllowGet));
        }
コード例 #10
0
        /// <summary>
        /// 查询保养活动地区配置
        /// </summary>
        /// <param name="regionIds"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public List <OilViscosityRegionModel> SelectOilViscosityRegionConfig(List <int> regionIds, int pageIndex, int pageSize)
        {
            var result = null as List <OilViscosityRegionModel>;

            try
            {
                result = dbScopeManagerGungnirRead.Execute(conn => DalBaoYangOilViscosityPriorityConfig.SelectOilViscosityRegionConfig(conn, regionIds, pageIndex, pageSize));
                var regions = new BaoYangActivitySettingManager().GetAllRegion();
                if (result != null && result.Any() && regions.Any())
                {
                    var directRegion = new int[4] {
                        1, 2, 19, 20
                    };
                    result.ForEach(s =>
                    {
                        if (directRegion.Contains(s.RegionId))
                        {
                            var region = regions.Where(r => r.RegionId == s.RegionId)?.FirstOrDefault();
                            if (region != null)
                            {
                                s.ProvinceName = region.RegionName;
                                s.CityName     = region.RegionName;
                            }
                        }
                        else
                        {
                            regions.ForEach(r =>
                            {
                                if (r.ChildRegions != null)
                                {
                                    var region = r.ChildRegions.Where(c => c.RegionId == s.RegionId)?.FirstOrDefault();
                                    if (region != null)
                                    {
                                        s.ProvinceName = r.RegionName;
                                        s.CityName     = region.RegionName;
                                        return;
                                    }
                                }
                            });
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                Logger.Error("SelectOilViscosityRegionConfig", ex);
            }
            return(result);
        }
コード例 #11
0
        public ActionResult MultiAddOrEditBaoYangActivityRegion(List <int> regionIds, string activityId)
        {
            if (regionIds == null || !regionIds.Any())
            {
                return(Json(new { Status = false, Msg = "请选择要编辑的对象" }, JsonRequestBehavior.AllowGet));
            }
            if (string.IsNullOrWhiteSpace(activityId))
            {
                return(Json(new { Status = false, Msg = "活动不能为空" }, JsonRequestBehavior.AllowGet));
            }
            var manager = new BaoYangActivitySettingManager();
            var user    = User.Identity.Name;
            var result  = manager.MultiAddOrEditBaoYangActivityRegion(regionIds, activityId, user);

            return(Json(new { Status = result, Msg = $"批量编辑{(result.Item1 ? "成功" : "失败")},清除缓存{(result.Item2 ? "成功" : "失败")}" }, JsonRequestBehavior.AllowGet));
        }
コード例 #12
0
        public ActionResult AddItem(BaoYangPackage model, int id, string ActivityNum)
        {
            List <BaoYangType> list = new List <BaoYangType>();
            var manager             = new BaoYangActivitySettingManager();
            var items = manager.GetBaoYangTypesConfig(model.Type) ?? new List <BaoYangTypeDescription>();

            foreach (var item in items)
            {
                BaoYangType m = new BaoYangType();
                m.Package     = model;
                m.Name        = item.ZhName;
                m.CatalogName = item.CatalogName;
                m.Type        = item.BaoYangType;
                m.BrandList   = BrandItem(m.CatalogName);
                m.SerieList   = SeriesList(m.CatalogName);
                list.Add(m);
            }
            ViewBag.BaoYangTypeList       = list;
            ViewData["BaoYangActivityId"] = id;
            ViewData["ActivityNum"]       = ActivityNum;
            BaoYangType models = new BaoYangType();

            return(View(models));
        }