/// <summary>
        /// 是否可允许自提门店
        /// </summary>
        /// <param name="shopId">商家ID</param>
        /// <returns></returns>
        public object GetIsSelfDelivery(long shopId, long productId, string fromLatLng = "")
        {
            if (shopId <= 0)
            {
                return(Json(new { Message = "请传入合法商家ID", IsSelfDelivery = 0 }));
            }
            if (!(fromLatLng.Split(',').Length == 2))
            {
                return(Json(new { Message = "请传入合法经纬度", IsSelfDelivery = 0 }));
            }

            var query = new CommonModel.ShopBranchQuery()
            {
                ShopId = shopId,
                Status = CommonModel.ShopBranchStatus.Normal
            };
            string address = "", province = "", city = "", district = "", street = "";

            ShopbranchHelper.GetAddressByLatLng(fromLatLng, ref address, ref province, ref city, ref district, ref street);
            if (string.IsNullOrWhiteSpace(city))
            {
                return(Json(new { Message = "无法获取当前城市", IsSelfDelivery = 0 }));
            }

            Region cityInfo = RegionApplication.GetRegionByName(city, Region.RegionLevel.City);

            if (cityInfo == null)
            {
                return(Json(new { Message = "获取当前城市异常", IsSelfDelivery = 0 }));
            }
            query.CityId     = cityInfo.Id;
            query.ProductIds = new long[] { productId };

            var shopBranch = ShopBranchApplication.GetShopBranchsAll(query).Models; //获取该商品所在商家下,且与用户同城内门店,且门店有该商品
            var skuInfos   = ProductManagerApplication.GetSKU(productId);           //获取该商品的sku

            //门店SKU内会有默认的SKU
            if (!skuInfos.Exists(p => p.Id == string.Format("{0}_0_0_0", productId)))
            {
                skuInfos.Add(new DTO.SKU()
                {
                    Id = string.Format("{0}_0_0_0", productId)
                });
            }
            var shopBranchSkus = ShopBranchApplication.GetSkus(query.ShopId, shopBranch.Select(p => p.Id));//门店商品SKU

            //门店商品SKU,只要有一个sku有库存即可
            shopBranch.ForEach(p =>
                               p.Enabled = skuInfos.Where(skuInfo => shopBranchSkus.Where(sbSku => sbSku.ShopBranchId == p.Id && sbSku.Stock > 0 && sbSku.SkuId == skuInfo.Id).Count() > 0).Count() > 0
                               );

            return(Json(new { Message = "", IsSelfDelivery = shopBranch.Where(p => p.Enabled).Count() > 0 ? 1 : 0 }));//至少有一个能够自提的门店,才可显示图标
        }
示例#2
0
        public object GetShopBranchs(long shopId, bool getParent, string skuIds, string counts, int page, int rows, long shippingAddressId, long regionId)
        {
            string[] _skuIds = skuIds.Split(',');
            int[] _counts = counts.Split(',').Select(p => Mall.Core.Helper.TypeHelper.ObjectToInt(p)).ToArray();

            var shippingAddressInfo = ShippingAddressApplication.GetUserShippingAddress(shippingAddressId);
            int streetId = 0, districtId = 0;//收货地址的街道、区域

            var query = new ShopBranchQuery()
            {
                ShopId = shopId,
                PageNo = page,
                PageSize = rows,
                Status = CommonModel.ShopBranchStatus.Normal,
                ShopBranchProductStatus = ShopBranchSkuStatus.Normal
            };
            if (shippingAddressInfo != null)
            {
                query.FromLatLng = string.Format("{0},{1}", shippingAddressInfo.Latitude, shippingAddressInfo.Longitude);//需要收货地址的经纬度
                streetId = shippingAddressInfo.RegionId;
                var parentAreaInfo = RegionApplication.GetRegion(shippingAddressInfo.RegionId, Region.RegionLevel.Town);//判断当前区域是否为第四级
                if (parentAreaInfo != null && parentAreaInfo.ParentId > 0) districtId = parentAreaInfo.ParentId;
                else { districtId = streetId; streetId = 0; }
            }
            bool hasLatLng = false;
            if (!string.IsNullOrWhiteSpace(query.FromLatLng)) hasLatLng = query.FromLatLng.Split(',').Length == 2;

            var region = RegionApplication.GetRegion(regionId, getParent ? CommonModel.Region.RegionLevel.City : CommonModel.Region.RegionLevel.County);//同城内门店
            if (region != null) query.AddressPath = region.GetIdPath();

            #region 3.0版本排序规则
            var skuInfos = ProductManagerApplication.GetSKUs(_skuIds);
            query.ProductIds = skuInfos.Select(p => p.ProductId).ToArray();
            var data = ShopBranchApplication.GetShopBranchsAll(query);
            var shopBranchSkus = ShopBranchApplication.GetSkus(shopId, data.Models.Select(p => p.Id).ToList());//获取该商家下具有订单内所有商品的门店状态正常数据,不考虑库存
            data.Models.ForEach(p =>
            {
                p.Enabled = skuInfos.All(skuInfo => shopBranchSkus.Any(sbSku => sbSku.ShopBranchId == p.Id && sbSku.Stock >= _counts[skuInfos.IndexOf(skuInfo)] && sbSku.SkuId == skuInfo.Id));
            });

            List<Mall.DTO.ShopBranch> newList = new List<Mall.DTO.ShopBranch>();
            List<long> fillterIds = new List<long>();
            var currentList = data.Models.Where(p => hasLatLng && p.Enabled && (p.Latitude > 0 && p.Longitude > 0)).OrderBy(p => p.Distance).ToList();
            if (currentList != null && currentList.Count() > 0)
            {
                fillterIds.AddRange(currentList.Select(p => p.Id));
                newList.AddRange(currentList);
            }
            var currentList2 = data.Models.Where(p => !fillterIds.Contains(p.Id) && p.Enabled && p.AddressPath.Contains(CommonConst.ADDRESS_PATH_SPLIT + streetId + CommonConst.ADDRESS_PATH_SPLIT)).ToList();
            if (currentList2 != null && currentList2.Count() > 0)
            {
                fillterIds.AddRange(currentList2.Select(p => p.Id));
                newList.AddRange(currentList2);
            }
            var currentList3 = data.Models.Where(p => !fillterIds.Contains(p.Id) && p.Enabled && p.AddressPath.Contains(CommonConst.ADDRESS_PATH_SPLIT + districtId + CommonConst.ADDRESS_PATH_SPLIT)).ToList();
            if (currentList3 != null && currentList3.Count() > 0)
            {
                fillterIds.AddRange(currentList3.Select(p => p.Id));
                newList.AddRange(currentList3);
            }
            var currentList4 = data.Models.Where(p => !fillterIds.Contains(p.Id) && p.Enabled).ToList();//非同街、非同区,但一定会同市
            if (currentList4 != null && currentList4.Count() > 0)
            {
                fillterIds.AddRange(currentList4.Select(p => p.Id));
                newList.AddRange(currentList4);
            }
            var currentList5 = data.Models.Where(p => !fillterIds.Contains(p.Id)).ToList();//库存不足的排最后
            if (currentList5 != null && currentList5.Count() > 0)
            {
                newList.AddRange(currentList5);
            }
            if (newList.Count() != data.Models.Count())//如果新组合的数据与原数据数量不一致
            {
                return new
                {
                    success = false
                };
            }
            var needDistance = false;
            if (shippingAddressInfo != null && shippingAddressInfo.Latitude!=0 && shippingAddressInfo.Longitude!=0)
            {
                needDistance = true;
            }
            var storeList = newList.Select(sb =>
            {
                return new
                {
                    ContactUser = sb.ContactUser,
                    ContactPhone = sb.ContactPhone,
                    AddressDetail = sb.AddressDetail,
                    ShopBranchName = sb.ShopBranchName,
                    Id = sb.Id,
                    Enabled = sb.Enabled,
                    Distance = needDistance ? RegionApplication.GetDistance(sb.Latitude, sb.Longitude, shippingAddressInfo.Latitude, shippingAddressInfo.Longitude) : 0
                };
            });

            #endregion

            var result = new
            {
                success = true,
                StoreList = storeList
            };
            return result;
        }
示例#3
0
        public JsonResult GetShopBranchs(long shopId, long regionId, bool getParent, string[] skuIds, int[] counts, int page, int rows, long shippingAddressId)
        {
            var shippingAddressInfo = ShippingAddressApplication.GetUserShippingAddress(shippingAddressId);
            int streetId = 0, districtId = 0;//收货地址的街道、区域

            var query = new ShopBranchQuery()
            {
                ShopId   = shopId,
                PageNo   = page,
                PageSize = rows,
                Status   = ShopBranchStatus.Normal,
                ShopBranchProductStatus = ShopBranchSkuStatus.Normal
            };

            if (shippingAddressInfo != null)
            {
                query.FromLatLng = string.Format("{0},{1}", shippingAddressInfo.Latitude, shippingAddressInfo.Longitude); //需要收货地址的经纬度
                streetId         = shippingAddressInfo.RegionId;
                var parentAreaInfo = RegionApplication.GetRegion(shippingAddressInfo.RegionId, Region.RegionLevel.Town);  //判断当前区域是否为第四级
                if (parentAreaInfo != null && parentAreaInfo.ParentId > 0)
                {
                    districtId = parentAreaInfo.ParentId;
                }
                else
                {
                    districtId = streetId; streetId = 0;
                }
            }
            bool hasLatLng = false;

            if (!string.IsNullOrWhiteSpace(query.FromLatLng))
            {
                hasLatLng = query.FromLatLng.Split(',').Length == 2;
            }

            var region = RegionApplication.GetRegion(regionId, getParent ? Region.RegionLevel.City : Region.RegionLevel.County);

            if (region != null)
            {
                query.AddressPath = region.GetIdPath();
            }

            #region 旧排序规则
            //var skuInfos = ProductManagerApplication.GetSKUs(skuIds);

            //query.ProductIds = skuInfos.Select(p => p.ProductId).ToArray();
            //var data = ShopBranchApplication.GetShopBranchs(query);

            //var shopBranchSkus = ShopBranchApplication.GetSkus(shopId, data.Models.Select(p => p.Id));

            //var models = new
            //{
            //    Rows = data.Models.Select(sb => new
            //    {
            //        sb.ContactUser,
            //        sb.ContactPhone,
            //        sb.AddressDetail,
            //        sb.ShopBranchName,
            //        sb.Id,
            //        Enabled = skuInfos.All(skuInfo => shopBranchSkus.Any(sbSku => sbSku.ShopBranchId == sb.Id && sbSku.Stock >= counts[skuInfos.IndexOf(skuInfo)] && sbSku.SkuId == skuInfo.Id))
            //    }).OrderByDescending(p => p.Enabled).ToArray(),
            //    data.Total
            //};
            #endregion
            #region 3.0版本排序规则
            var skuInfos = ProductManagerApplication.GetSKUs(skuIds);
            query.ProductIds = skuInfos.Select(p => p.ProductId).ToArray();
            var data           = ShopBranchApplication.GetShopBranchsAll(query);
            var shopBranchSkus = ShopBranchApplication.GetSkus(shopId, data.Models.Select(p => p.Id).ToList());//获取该商家下具有订单内所有商品的门店状态正常数据,不考虑库存
            data.Models.ForEach(p =>
            {
                p.Enabled = skuInfos.All(skuInfo => shopBranchSkus.Any(sbSku => sbSku.ShopBranchId == p.Id && sbSku.Stock >= counts[skuInfos.IndexOf(skuInfo)] && sbSku.SkuId == skuInfo.Id));
            });

            List <ShopBranch> newList    = new List <ShopBranch>();
            List <long>       fillterIds = new List <long>();
            var currentList = data.Models.Where(p => hasLatLng && p.Enabled && (p.Latitude > 0 && p.Longitude > 0)).OrderBy(p => p.Distance).ToList();
            if (currentList != null && currentList.Count() > 0)
            {
                fillterIds.AddRange(currentList.Select(p => p.Id));
                newList.AddRange(currentList);
            }
            var currentList2 = data.Models.Where(p => !fillterIds.Contains(p.Id) && p.Enabled && p.AddressPath.Contains(CommonConst.ADDRESS_PATH_SPLIT + streetId + CommonConst.ADDRESS_PATH_SPLIT)).ToList();
            if (currentList2 != null && currentList2.Count() > 0)
            {
                fillterIds.AddRange(currentList2.Select(p => p.Id));
                newList.AddRange(currentList2);
            }
            var currentList3 = data.Models.Where(p => !fillterIds.Contains(p.Id) && p.Enabled && p.AddressPath.Contains(CommonConst.ADDRESS_PATH_SPLIT + districtId + CommonConst.ADDRESS_PATH_SPLIT)).ToList();
            if (currentList3 != null && currentList3.Count() > 0)
            {
                fillterIds.AddRange(currentList3.Select(p => p.Id));
                newList.AddRange(currentList3);
            }
            var currentList4 = data.Models.Where(p => !fillterIds.Contains(p.Id) && p.Enabled).ToList();//非同街、非同区,但一定会同市
            if (currentList4 != null && currentList4.Count() > 0)
            {
                fillterIds.AddRange(currentList4.Select(p => p.Id));
                newList.AddRange(currentList4);
            }
            var currentList5 = data.Models.Where(p => !fillterIds.Contains(p.Id)).ToList();//库存不足的排最后
            if (currentList5 != null && currentList5.Count() > 0)
            {
                newList.AddRange(currentList5);
            }
            if (newList.Count() != data.Models.Count())//如果新组合的数据与原数据数量不一致,则异常
            {
                return(Json <dynamic>(true, data: new { Rows = "" }, camelCase: true));
            }
            var needDistance = false;
            if (shippingAddressInfo != null && shippingAddressInfo.Latitude != 0 && shippingAddressInfo.Longitude != 0)
            {
                needDistance = true;
            }
            var models = new
            {
                Rows = newList.Select(sb => new
                {
                    sb.ContactUser,
                    sb.ContactPhone,
                    sb.AddressDetail,
                    sb.ShopBranchName,
                    sb.Id,
                    Enabled  = sb.Enabled,
                    Distance = needDistance ? RegionApplication.GetDistance(sb.Latitude, sb.Longitude, shippingAddressInfo.Latitude, shippingAddressInfo.Longitude) : 0
                }).ToArray(),
                Total = newList.Count
            };
            #endregion
            return(SuccessResult <dynamic>(data: models, camelCase: true));
        }
示例#4
0
        public JsonResult GetShopBranchs(long shopId, long regionId, bool getParent, string[] skuIds, int[] counts, int page, int rows, long shippingAddressId)
        {
            ShippingAddressInfo userShippingAddress = ShippingAddressApplication.GetUserShippingAddress(shippingAddressId);
            int             streetId   = 0;
            int             districtId = 0;
            ShopBranchQuery query      = new ShopBranchQuery
            {
                ShopId   = shopId,
                PageNo   = page,
                PageSize = rows,
                Status   = 0
            };

            if (userShippingAddress != null)
            {
                query.FromLatLng = string.Format("{0},{1}", userShippingAddress.Latitude, userShippingAddress.Longitude);
                streetId         = userShippingAddress.RegionId;
                Region region = RegionApplication.GetRegion((long)userShippingAddress.RegionId, Region.RegionLevel.Town);
                if ((region != null) && (region.ParentId > 0))
                {
                    districtId = region.ParentId;
                }
                else
                {
                    districtId = streetId;
                    streetId   = 0;
                }
            }
            bool hasLatLng = false;

            if (!string.IsNullOrWhiteSpace(query.FromLatLng))
            {
                hasLatLng = query.FromLatLng.Split(new char[] { ',' }).Length == 2;
            }
            Region region2 = RegionApplication.GetRegion(regionId, getParent ? Region.RegionLevel.City : Region.RegionLevel.County);

            if (region2 != null)
            {
                query.AddressPath = region2.GetIdPath(",");
            }
            List <SKU> skuInfos = ProductManagerApplication.GetSKUs(skuIds);

            query.ProductIds = (from p in skuInfos select p.ProductId).ToArray <long>();
            QueryPageModel <ShopBranch> shopBranchsAll = ShopBranchApplication.GetShopBranchsAll(query);
            List <ShopBranchSkusInfo>   shopBranchSkus = ShopBranchApplication.GetSkus(shopId, from p in shopBranchsAll.Models select p.Id);

            shopBranchsAll.Models.ForEach(delegate(ShopBranch p)
            {
                p.Enabled = skuInfos.All <SKU>(skuInfo => shopBranchSkus.Any <ShopBranchSkusInfo>(sbSku => ((sbSku.ShopBranchId == p.Id) && (sbSku.Stock >= counts[skuInfos.IndexOf(skuInfo)])) && (sbSku.SkuId == skuInfo.Id)));
            });
            List <ShopBranch> source     = new List <ShopBranch>();
            List <long>       fillterIds = new List <long>();
            List <ShopBranch> list2      = (from p in shopBranchsAll.Models
                                            where (hasLatLng && p.Enabled) && ((p.Latitude > 0f) && (p.Longitude > 0f))
                                            orderby p.Distance
                                            select p).ToList <ShopBranch>();

            if ((list2 != null) && (list2.Count <ShopBranch>() > 0))
            {
                fillterIds.AddRange(from p in list2 select p.Id);
                source.AddRange(list2);
            }
            List <ShopBranch> list3 = (from p in shopBranchsAll.Models
                                       where (!fillterIds.Contains(p.Id) && p.Enabled) && p.AddressPath.Contains("," + streetId + ",")
                                       select p).ToList <ShopBranch>();

            if ((list3 != null) && (list3.Count <ShopBranch>() > 0))
            {
                fillterIds.AddRange(from p in list3 select p.Id);
                source.AddRange(list3);
            }
            List <ShopBranch> list4 = (from p in shopBranchsAll.Models
                                       where (!fillterIds.Contains(p.Id) && p.Enabled) && p.AddressPath.Contains("," + districtId + ",")
                                       select p).ToList <ShopBranch>();

            if ((list4 != null) && (list4.Count <ShopBranch>() > 0))
            {
                fillterIds.AddRange(from p in list4 select p.Id);
                source.AddRange(list4);
            }
            List <ShopBranch> list5 = (from p in shopBranchsAll.Models
                                       where !fillterIds.Contains(p.Id) && p.Enabled
                                       select p).ToList <ShopBranch>();

            if ((list5 != null) && (list5.Count <ShopBranch>() > 0))
            {
                fillterIds.AddRange(from p in list5 select p.Id);
                source.AddRange(list5);
            }
            List <ShopBranch> list6 = (from p in shopBranchsAll.Models
                                       where !fillterIds.Contains(p.Id)
                                       select p).ToList <ShopBranch>();

            if ((list6 != null) && (list6.Count <ShopBranch>() > 0))
            {
                source.AddRange(list6);
            }
            if (source.Count <ShopBranch>() != shopBranchsAll.Models.Count <ShopBranch>())
            {
                return(base.Json(new { Rows = "" }, true));
            }
            var data = new
            {
                Rows  = (from sb in source select new { ContactUser = sb.ContactUser, ContactPhone = sb.ContactPhone, AddressDetail = sb.AddressDetail, ShopBranchName = sb.ShopBranchName, Id = sb.Id, Enabled = sb.Enabled }).ToArray(),
                Total = source.Count
            };

            return(base.Json(data, true));
        }
        public object GetShopBranchs(long shopId, bool getParent, string skuIds, string counts, int page, int rows, long shippingAddressId, long regionId)
        {
            string[]            strArray            = skuIds.Split(',');
            int[]               _counts             = Enumerable.ToArray <int>(Enumerable.Select <string, int>((IEnumerable <string>)counts.Split(','), (Func <string, int>)(p => TypeHelper.ObjectToInt((object)p))));
            ShippingAddressInfo userShippingAddress = ShippingAddressApplication.GetUserShippingAddress(shippingAddressId);
            int             streetId        = 0;
            int             districtId      = 0;
            ShopBranchQuery shopBranchQuery = new ShopBranchQuery();

            shopBranchQuery.ShopId   = shopId;
            shopBranchQuery.PageNo   = page;
            shopBranchQuery.PageSize = rows;
            shopBranchQuery.Status   = new ShopBranchStatus?(ShopBranchStatus.Normal);
            ShopBranchQuery query = shopBranchQuery;

            if (userShippingAddress != null)
            {
                query.FromLatLng = string.Format("{0},{1}", (object)userShippingAddress.Latitude, (object)userShippingAddress.Longitude);
                streetId         = userShippingAddress.RegionId;
                Region region = RegionApplication.GetRegion((long)userShippingAddress.RegionId, Region.RegionLevel.Town);
                if (region != null && region.ParentId > 0)
                {
                    districtId = region.ParentId;
                }
                else
                {
                    districtId = streetId;
                    streetId   = 0;
                }
            }
            bool hasLatLng = false;

            if (!string.IsNullOrWhiteSpace(query.FromLatLng))
            {
                hasLatLng = (query.FromLatLng.Split(',').Length == 2 ? 1 : 0) != 0;
            }
            Region region1 = RegionApplication.GetRegion(regionId, getParent ? Region.RegionLevel.City : Region.RegionLevel.County);

            if (region1 != null)
            {
                query.AddressPath = region1.GetIdPath(",");
            }
            List <SKU> skuInfos = ProductManagerApplication.GetSKUs((IEnumerable <string>)strArray);

            query.ProductIds = Enumerable.ToArray <long>(Enumerable.Select <SKU, long>((IEnumerable <SKU>)skuInfos, (Func <SKU, long>)(p => p.ProductId)));
            QueryPageModel <ShopBranch> shopBranchsAll = ShopBranchApplication.GetShopBranchsAll(query);
            List <ShopBranchSkusInfo>   shopBranchSkus = ShopBranchApplication.GetSkus(shopId, Enumerable.Select <ShopBranch, long>((IEnumerable <ShopBranch>)shopBranchsAll.Models, (Func <ShopBranch, long>)(p => p.Id)));

            shopBranchsAll.Models.ForEach((Action <ShopBranch>)(p => p.Enabled = Enumerable.All <SKU>((IEnumerable <SKU>)skuInfos, (Func <SKU, bool>)(skuInfo => Enumerable.Any <ShopBranchSkusInfo>((IEnumerable <ShopBranchSkusInfo>)shopBranchSkus, (Func <ShopBranchSkusInfo, bool>)(sbSku => sbSku.ShopBranchId == p.Id && sbSku.Stock >= _counts[skuInfos.IndexOf(skuInfo)] && sbSku.SkuId == skuInfo.Id))))));
            List <ShopBranch> list1      = new List <ShopBranch>();
            List <long>       fillterIds = new List <long>();
            List <ShopBranch> list2      = Enumerable.ToList <ShopBranch>((IEnumerable <ShopBranch>)Enumerable.OrderBy <ShopBranch, double>(Enumerable.Where <ShopBranch>((IEnumerable <ShopBranch>)shopBranchsAll.Models, (Func <ShopBranch, bool>)(p => hasLatLng && p.Enabled && ((double)p.Latitude > 0.0 && (double)p.Longitude > 0.0))), (Func <ShopBranch, double>)(p => p.Distance)));

            if (list2 != null && Enumerable.Count <ShopBranch>((IEnumerable <ShopBranch>)list2) > 0)
            {
                fillterIds.AddRange(Enumerable.Select <ShopBranch, long>((IEnumerable <ShopBranch>)list2, (Func <ShopBranch, long>)(p => p.Id)));
                list1.AddRange((IEnumerable <ShopBranch>)list2);
            }
            List <ShopBranch> list3 = Enumerable.ToList <ShopBranch>(Enumerable.Where <ShopBranch>((IEnumerable <ShopBranch>)shopBranchsAll.Models, (Func <ShopBranch, bool>)(p => !fillterIds.Contains(p.Id) && p.Enabled && p.AddressPath.Contains("," + (object)streetId + ","))));

            if (list3 != null && Enumerable.Count <ShopBranch>((IEnumerable <ShopBranch>)list3) > 0)
            {
                fillterIds.AddRange(Enumerable.Select <ShopBranch, long>((IEnumerable <ShopBranch>)list3, (Func <ShopBranch, long>)(p => p.Id)));
                list1.AddRange((IEnumerable <ShopBranch>)list3);
            }
            List <ShopBranch> list4 = Enumerable.ToList <ShopBranch>(Enumerable.Where <ShopBranch>((IEnumerable <ShopBranch>)shopBranchsAll.Models, (Func <ShopBranch, bool>)(p => !fillterIds.Contains(p.Id) && p.Enabled && p.AddressPath.Contains("," + (object)districtId + ","))));

            if (list4 != null && Enumerable.Count <ShopBranch>((IEnumerable <ShopBranch>)list4) > 0)
            {
                fillterIds.AddRange(Enumerable.Select <ShopBranch, long>((IEnumerable <ShopBranch>)list4, (Func <ShopBranch, long>)(p => p.Id)));
                list1.AddRange((IEnumerable <ShopBranch>)list4);
            }
            List <ShopBranch> list5 = Enumerable.ToList <ShopBranch>(Enumerable.Where <ShopBranch>((IEnumerable <ShopBranch>)shopBranchsAll.Models, (Func <ShopBranch, bool>)(p => !fillterIds.Contains(p.Id) && p.Enabled)));

            if (list5 != null && Enumerable.Count <ShopBranch>((IEnumerable <ShopBranch>)list5) > 0)
            {
                fillterIds.AddRange(Enumerable.Select <ShopBranch, long>((IEnumerable <ShopBranch>)list5, (Func <ShopBranch, long>)(p => p.Id)));
                list1.AddRange((IEnumerable <ShopBranch>)list5);
            }
            List <ShopBranch> list6 = Enumerable.ToList <ShopBranch>(Enumerable.Where <ShopBranch>((IEnumerable <ShopBranch>)shopBranchsAll.Models, (Func <ShopBranch, bool>)(p => !fillterIds.Contains(p.Id))));

            if (list6 != null && Enumerable.Count <ShopBranch>((IEnumerable <ShopBranch>)list6) > 0)
            {
                list1.AddRange((IEnumerable <ShopBranch>)list6);
            }
            if (Enumerable.Count <ShopBranch>((IEnumerable <ShopBranch>)list1) != Enumerable.Count <ShopBranch>((IEnumerable <ShopBranch>)shopBranchsAll.Models))
            {
                return((object)this.Json(new
                {
                    Success = false
                }));
            }
            var content = new
            {
                Success   = true,
                StoreList = Enumerable.Select((IEnumerable <ShopBranch>)list1, sb =>
                {
                    var fAnonymousType37 = new
                    {
                        ContactUser    = sb.ContactUser,
                        ContactPhone   = sb.ContactPhone,
                        AddressDetail  = sb.AddressDetail,
                        ShopBranchName = sb.ShopBranchName,
                        Id             = sb.Id,
                        Enabled        = sb.Enabled
                    };
                    return(fAnonymousType37);
                })
            };

            return((object)this.Json(content));
        }