예제 #1
0
        public JsonResult GetLimitAreaSaleCity()
        {
            Tuple <int, List <LimitSaleRegionModel> > result2;
            var municipalit = new[] { "上海市", "北京市", "天津市", "重庆市" };
            var dbresult    = LimitAreaSaleManager.SelectRegions();
            var result      = new List <LimitSaleRegionModel>();

            foreach (var province in dbresult)
            {
                if (municipalit.Contains(province.RegionName))
                {
                    var regionModel = new LimitSaleRegionModel()
                    {
                        ProvinceId   = province.PKID,
                        ProvinceName = province.RegionName,
                        CityId       = province.PKID,
                        CityName     = province.RegionName
                    };
                    result.Add(regionModel);
                }
                else
                {
                    foreach (var city in province.ChildrenRegion)
                    {
                        var regionModel = new LimitSaleRegionModel()
                        {
                            ProvinceId   = province.PKID,
                            ProvinceName = province.RegionName,
                            CityId       = city.PKID,
                            CityName     = city.RegionName
                        };
                        result.Add(regionModel);
                    }
                }
            }
            var tableData = LimitAreaSaleManager.SelectLimitAreaSaleCityInfo();
            var tempdata  = (from a in result
                             join b in tableData on a.CityId equals b.CityId into temp
                             from b in temp.DefaultIfEmpty()
                             select new LimitSaleRegionModel
            {
                Pkid = b.Pkid,
                //ProductConfigId = limitPkid,
                ProvinceId = a.ProvinceId,
                ProvinceName = a.ProvinceName,
                CityId = a.CityId,
                CityName = a.CityName,
                IsAllowSale = b?.IsAllowSale ?? 0,
                WarehouseId = b?.WarehouseId,
                WarehouseName = b?.WarehouseName,
                SupplierId = b?.SupplierId,
                SupplierName = b?.SupplierName,
                //Pid= KeyWord,
            }).Where(r => (r.IsAllowSale == IsAllowSale || IsAllowSale == 2) && (r.ProvinceId == ProvinceId || ProvinceId == 0) && (r.CityId == CityId || CityId == 0)).OrderBy(r => r.Pkid).ToList();

            result2 = new Tuple <int, List <LimitSaleRegionModel> >(tempdata.Count, tempdata.Skip(PageSize * (PageIndex - 1)).Take(PageSize).ToList());
            return(Json(result2));
            // }
        }
        public JsonResult CityAgingSearch()
        {
            Tuple <int, List <CityAreaAgingModel> > result2;
            var municipalit = new[] { "上海市", "北京市", "天津市", "重庆市" }; //4个直辖市
            var dbresult    = LimitAreaSaleManager.SelectRegions();
            var result      = new List <LimitSaleRegionModel>();

            foreach (var province in dbresult)
            {
                if (municipalit.Contains(province.RegionName))
                {
                    var regionModel = new LimitSaleRegionModel()
                    {
                        ProvinceId   = province.PKID,
                        ProvinceName = province.RegionName,
                        CityId       = province.PKID,
                        CityName     = province.RegionName
                    };
                    result.Add(regionModel);
                }
                else
                {
                    foreach (var city in province.ChildrenRegion)
                    {
                        var regionModel = new LimitSaleRegionModel()
                        {
                            ProvinceId   = province.PKID,
                            ProvinceName = province.RegionName,
                            CityId       = city.PKID,
                            CityName     = city.RegionName
                        };
                        result.Add(regionModel);
                    }
                }
            }

            var tableData = CityAgingManage.SelectCityAgingInfo();
            var tempdata  = (from a in result
                             join b in tableData on a.CityId equals b.CityId into temp
                             from b in temp.DefaultIfEmpty()
                             select new CityAreaAgingModel
            {
                PKid = b?.PKid ?? -1,                 //PKid
                ProvinceId = a.ProvinceId,
                ProvinceName = a.ProvinceName,
                CityId = a.CityId,
                CityName = a.CityName,
                IsShow = b?.IsShow ?? 1,                 // 1 时效性 默认打开
                Title = b?.Title ?? "",
                Content = b?.Content ?? ""
            }).Where(
                r => (r.ProvinceId == ProvinceId || ProvinceId == 0) && (r.CityId == CityId || CityId == 0))
                            .OrderBy(r => r.CityId).ToList();

            result2 = new Tuple <int, List <CityAreaAgingModel> >(tempdata.Count,
                                                                  tempdata.Skip(PageSize * (PageIndex - 1)).Take(PageSize).ToList());
            return(Json(result2));
        }
예제 #3
0
        public JsonResult GetLimitAreaSalePid()
        {
            Tuple <int, List <LimitAreaSaleModel> > result;

            if (!string.IsNullOrEmpty(KeyWord))
            {
                result = new Tuple <int, List <LimitAreaSaleModel> >(1, LimitAreaSaleManager.GetProductByPid(KeyWord));
            }
            else
            {
                var db = LimitAreaSaleManager.GetLimitAreaSalePidList(PageSize, PageIndex, KeyWord, IsLimit);
                result = new Tuple <int, List <LimitAreaSaleModel> >(db.Select(r => r.TotalCount).FirstOrDefault(), db);
            }
            return(Json(result));
        }
예제 #4
0
        public JsonResult SelectAllProvince()
        {
            var result   = new List <LimitSaleRegionModel>();
            var dbresult = LimitAreaSaleManager.SelectRegions();

            foreach (var province in dbresult)
            {
                var regionModel = new LimitSaleRegionModel()
                {
                    ProvinceId   = province.PKID,
                    ProvinceName = province.RegionName,
                    CityId       = province.PKID,
                    CityName     = province.RegionName
                };
                result.Add(regionModel);
            }
            return(Json(result));
        }
예제 #5
0
        public JsonResult SaveLimitAreaSalePid(string pid, int isLimit)
        {
            var result = LimitAreaSaleManager.SaveLimitAreaSalePid(pid, isLimit, User.Identity.Name);

            if (result)
            {
                return(Json(new
                {
                    status = 1
                }));
            }
            else
            {
                return(Json(new
                {
                    status = 0
                }));
            }
        }
예제 #6
0
        public JsonResult SaveLimitAreaSaleCity(int productConfigId, int cityId, string cityName, int isAllowSale, int warehouseId, string warehouseName, int supplierId, string supplierName, string muticityCheckedIds)
        {
            bool result     = true;
            var  warehouses = LimitAreaSaleManager.SelectWarehouse();

            warehouseName = warehouses.Where(r => r.WarehouseId == warehouseId).Select(r => r.WarehouseName).FirstOrDefault();
            var suppliers = LimitAreaSaleManager.SelectSupplier();

            supplierName = suppliers.Where(r => r.SupplierId == supplierId).Select(r => r.SupplierName).FirstOrDefault();
            if (string.IsNullOrEmpty(muticityCheckedIds))
            {
                result = LimitAreaSaleManager.SaveLimitAreaSaleCity(productConfigId, cityId, cityName, isAllowSale,
                                                                    warehouseId, warehouseName, supplierId, supplierName, User.Identity.Name);
            }

            else
            {
                //批量新增
                var list = muticityCheckedIds.Split(',').ToList();
                foreach (var item in list)
                {
                    cityId   = Convert.ToInt32(item.Split(';')[0]);
                    cityName = item.Split(';')[1];
                    result   = result && LimitAreaSaleManager.SaveLimitAreaSaleCity(productConfigId, cityId, cityName, isAllowSale,
                                                                                    warehouseId, warehouseName, supplierId, supplierName, User.Identity.Name);
                }
            }
            if (result)
            {
                return(Json(new
                {
                    status = 1
                }));
            }
            else
            {
                return(Json(new
                {
                    status = 0
                }));
            }
        }
예제 #7
0
        public JsonResult Refreshcache(string pid)
        {
            var result = LimitAreaSaleManager.Refreshcache(new List <string> {
                pid
            });

            if (result)
            {
                return(Json(new
                {
                    status = 1
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new
                {
                    status = 0
                }, JsonRequestBehavior.AllowGet));
            }
        }
예제 #8
0
        public ActionResult SelectWarehouse()
        {
            var result = LimitAreaSaleManager.SelectWarehouse();

            return(Json(result));
        }
예제 #9
0
        public ActionResult SelectSupplier()
        {
            var result = LimitAreaSaleManager.SelectSupplier();

            return(Json(result));
        }