public JsonResult LoadRegionByCity(string cityId)
        {
            if (!string.IsNullOrWhiteSpace(cityId))
            {
                ICityRepository cityRepository = new CityRepository(_connectionString);
                var             cityApp        = new CityApplication(cityRepository);

                var regionList = cityApp.GetAll();

                regionList = regionList.Where(c => c.Id == cityId.ToInt32());

                var regionData = regionList.Select(r => new SelectListItem()
                {
                    Text  = r.Region.Name,
                    Value = r.Region.Id.ToString(),
                });

                return(Json(regionData, JsonRequestBehavior.AllowGet));
            }
            else
            {
                IRegionRepository regionRepository = new RegionRepository(_connectionString);
                var regionApp = new RegionApplication(regionRepository);

                var regionData = regionApp.GetAll().Select(g => new SelectListItem()
                {
                    Text  = g.Name,
                    Value = g.Id.ToString()
                }).ToList();

                return(Json(regionData, JsonRequestBehavior.AllowGet));
            }
        }
        public object GetRegion(string fromLatLng = "")
        {
            string address   = string.Empty;
            string province  = string.Empty;
            string city      = string.Empty;
            string district  = string.Empty;
            string street    = string.Empty;
            string str       = string.Empty;
            string newStreet = string.Empty;

            ShopbranchHelper.GetAddressByLatLng(fromLatLng, ref address, ref province, ref city, ref district, ref street);
            if (district == "" && street != "")
            {
                district = street;
                street   = "";
            }
            string addressComponents = RegionApplication.GetAddress_Components(city, district, street, out newStreet);

            if (addressComponents.Split(',').Length <= 3)
            {
                newStreet = string.Empty;
            }
            return((object)this.Json(new
            {
                fullPath = addressComponents,
                showCity = string.Format("{0} {1} {2}", (object)province, (object)city, (object)district),
                street = newStreet
            }));
        }
Esempio n. 3
0
        public object GetAll(long?parentRegionId = null)
        {
            var regions = RegionApplication.GetSubRegion(0, true);
            var models  = regions.Select(p => new
            {
                id   = p.Id,
                name = p.Name,
                city = (p.Sub != null ? p.Sub.Select(c => new
                {
                    id = c.Id,
                    name = c.Name,
                    area = (c.Sub != null ? c.Sub.Select(a => new
                    {
                        id = a.Id,
                        name = a.Name,
                        country = (a.Sub != null ? a.Sub.Select(v => new
                        {
                            id = v.Id,
                            name = v.Name
                        }) : null)
                    }) : null)
                }) : null)
            });

            return(Json(models));
        }
Esempio n. 4
0
        /// <summary>
        /// 个人入驻商家信息
        /// </summary>
        /// <returns></returns>
        public ActionResult Steps1()
        {
            long   CompanyRegionId         = 0;
            long   BusinessLicenceRegionId = 0;
            string RefuseReason            = "";
            var    step1 = ShopApplication.GetShopProfileSteps1(CurrentSellerManager.ShopId, out CompanyRegionId, out BusinessLicenceRegionId, out RefuseReason);

            ViewBag.CompanyRegionIds         = RegionApplication.GetRegionPath((int)CompanyRegionId);
            ViewBag.BusinessLicenceRegionIds = RegionApplication.GetRegionPath((int)BusinessLicenceRegionId);
            ViewBag.RefuseReason             = RefuseReason;

            long uid = ShopApplication.GetShopManagers(CurrentSellerManager.ShopId);
            //管理员信息
            var model = MemberApplication.GetMembers(uid);

            step1.RealName = model.RealName;
            Mall.DTO.MemberAccountSafety mMemberAccountSafety = MemberApplication.GetMemberAccountSafety(uid);
            step1.MemberEmail = mMemberAccountSafety.Email;
            step1.MemberPhone = mMemberAccountSafety.Phone;

            //温馨提示
            ModelState.AddModelError("Phone", "多个联系方式用,号分隔");
            ModelState.AddModelError("ContactPhone", "多个联系方式用,号分隔");
            return(View(step1));
        }
Esempio n. 5
0
 // GET: Admin/RegionArea
 public ActionResult Management()
 {
     #region TDO:ZYF 是否启用京东地址库
     ViewBag.IsOpenJdRegion = RegionApplication.IsOpenJdRegion();
     #endregion
     return(View());
 }
Esempio n. 6
0
 public JsonResult DelRegion(int RegionId)
 {
     RegionApplication.DelRegion(RegionId);
     return(Json(new Result()
     {
         success = true, msg = "删除成功"
     }));
 }
Esempio n. 7
0
 public JsonResult ResetRegions()
 {
     RegionApplication.ResetRegion();
     return(Json(new Result()
     {
         success = true, msg = "重置成功!"
     }));
 }
Esempio n. 8
0
        /// <summary>
        /// 进入立即购买提交页面
        /// </summary>
        /// <param name="skuIds">库存ID集合</param>
        /// <param name="counts">库存ID对应的数量</param>
        /// <param name="GroupActionId">拼团活动编号</param>
        /// <param name="GroupId">拼团编号</param>
        public ActionResult Submit(string skuIds, string counts, int islimit = 0, long shippingAddressId = 0, string couponIds = "")
        {
            var coupons = CouponApplication.ConvertUsedCoupon(couponIds);
            var result  = OrderApplication.GetMobileSubmit(UserId, skuIds, counts, shippingAddressId, coupons);

            ViewBag.InvoiceContext   = result.InvoiceContext;
            ViewBag.InvoiceTitle     = result.InvoiceTitle;
            ViewBag.skuIds           = skuIds;
            ViewBag.counts           = counts;
            ViewBag.IsCashOnDelivery = result.IsCashOnDelivery;
            ViewBag.address          = null == result.Address || result.Address.NeedUpdate ? null : result.Address;
            ViewBag.ConfirmModel     = result;
            ViewBag.Islimit          = islimit == 1 ? true : false;

            var orderTag = Guid.NewGuid().ToString("N");

            ViewBag.OrderTag    = orderTag;
            Session["OrderTag"] = orderTag;

            InitOrderSubmitModel(result);
            #region 是否开启门店授权
            ViewBag.IsOpenStore = SiteSettingApplication.SiteSettings != null && SiteSettingApplication.SiteSettings.IsOpenStore;
            #endregion

            #region TDO:ZYF 3.2注释是否提供发票
            //bool ProvideInvoice = false;
            //if (result.products != null)
            //    ProvideInvoice = ShopApplication.HasProvideInvoice(result.products.Select(p => p.shopId).ToList());
            //ViewBag.ProvideInvoice = ProvideInvoice;
            #endregion

            bool canIntegralPerMoney = true, canCapital = true;
            CanDeductible(out canIntegralPerMoney, out canCapital);
            ViewBag.CanIntegralPerMoney = canIntegralPerMoney;
            ViewBag.CanCapital          = canCapital;
            ViewBag.productType         = result.ProductType;
            string shipperAddress = string.Empty, shipperTelPhone = string.Empty;
            if (result.ProductType == 1)
            {
                var virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(result.ProductId);
                if (virtualProductInfo != null && virtualProductInfo.ValidityType && DateTime.Now > virtualProductInfo.EndDate.Value)
                {
                    throw new HimallException("该虚拟商品已过期,不支持下单");
                }
                if (result.products != null && result.products.Count > 0)
                {
                    var verificationShipper = ShopShippersApplication.GetDefaultVerificationShipper(result.products.FirstOrDefault().shopId);
                    if (verificationShipper != null)
                    {
                        shipperAddress  = RegionApplication.GetFullName(verificationShipper.RegionId) + " " + verificationShipper.Address;
                        shipperTelPhone = verificationShipper.TelPhone;
                    }
                }
            }
            ViewBag.ShipperAddress  = shipperAddress;
            ViewBag.ShipperTelPhone = shipperTelPhone;
            return(View());
        }
Esempio n. 9
0
        public JsonResult DaDaConfig(ShopBranchDaDaConfigModel model)
        {
            long   shopId = CurrentShop.Id;
            Result result = new Result
            {
                success = false,
                msg     = "未知错误"
            };

            if (ModelState.IsValid)
            {
                if (model.IsEnable)
                {
                    if (string.IsNullOrWhiteSpace(model.app_key) || string.IsNullOrWhiteSpace(model.app_secret) || string.IsNullOrWhiteSpace(model.source_id))
                    {
                        result.success = false;
                        result.msg     = "数据错误,请填写必填信息";
                        return(Json(result));
                    }
                }
                var data = CityExpressConfigApplication.GetDaDaCityExpressConfig(shopId);
                data.IsEnable   = model.IsEnable;
                data.app_key    = model.app_key;
                data.app_secret = model.app_secret;
                data.source_id  = model.source_id;
                CityExpressConfigApplication.Update(CurrentShop.Id, data);
                result.msg = "";
                //同步开通达达门店
                var sblist = ShopBranchApplication.GetShopBranchByShopId(shopId).Where(d => string.IsNullOrWhiteSpace(d.DaDaShopId));
                foreach (var item in sblist)
                {
                    var    dada_shop_id = GetNewDadaStoreId(CurrentShop.Id, item.Id);
                    var    _area        = RegionApplication.GetRegion(item.AddressId);
                    var    _city        = GetCity(_area);
                    var    json         = ExpressDaDaHelper.shopAdd(shopId, item.ShopBranchName, 5, _city.ShortName, _area.Parent.Name, item.AddressDetail, item.Longitude, item.Latitude, item.ContactUser, item.ContactPhone, dada_shop_id);
                    var    resultObj    = JsonConvert.DeserializeObject(json) as JObject;
                    string status       = resultObj["status"].ToString();
                    int    code         = int.Parse(resultObj["code"].ToString());
                    if (status == "fail" && code != 7718)
                    {
                        result.msg = "但部份同步门店失败,可能所在城市达达不支持";
                    }
                    if (string.IsNullOrWhiteSpace(item.DaDaShopId) && (status == "success" || code == 7718))
                    {
                        item.DaDaShopId = dada_shop_id;
                        ShopBranchApplication.UpdateShopBranch(item);
                    }
                }
                result.success = true;
            }
            else
            {
                result.success = false;
                result.msg     = "数据错误,请填写必填信息";
            }

            return(Json(result));
        }
Esempio n. 10
0
        /// <summary>
        /// 获取市级的所有子区域
        /// </summary>
        /// <param name="regionId"></param>
        /// <returns></returns>
        public JsonResult GetCitySubRegions(int regionId)
        {
            var region    = RegionApplication.GetRegion(regionId, CommonModel.Region.RegionLevel.County);
            var subRegion = RegionApplication.GetSubRegion(region.ParentId);

            return(Json(new
            {
                regions = subRegion,
                selectId = region.Id
            }, true));
        }
Esempio n. 11
0
        /// <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 }));//至少有一个能够自提的门店,才可显示图标
        }
Esempio n. 12
0
        /// <summary>
        /// 获得编辑收获地址页面
        /// </summary>
        /// <param name="addressId">收货地址Id</param>
        /// <param name="returnURL">返回url路径</param>
        public ActionResult EditShippingAddress(long addressId = 0, string returnURL = "")
        {
            var ShipngInfo = OrderApplication.GetUserAddress(addressId);

            ViewBag.addId = addressId;
            if (ShipngInfo != null)
            {
                ViewBag.fullPath = RegionApplication.GetRegionPath(ShipngInfo.RegionId);
                ViewBag.fullName = RegionApplication.GetFullName(ShipngInfo.RegionId);
            }
            return(View(ShipngInfo));
        }
Esempio n. 13
0
        public ActionResult EditShippingAddress(long addressId = 0L, string returnURL = "")
        {
            ShippingAddressInfo userAddress = OrderApplication.GetUserAddress(addressId);

            ViewBag.addId = addressId;
            if (userAddress != null)
            {
                ViewBag.fullPath = RegionApplication.GetRegionPath(userAddress.RegionId);
                ViewBag.fullName = RegionApplication.GetFullName(userAddress.RegionId, " ");
            }
            return(base.View(userAddress));
        }
Esempio n. 14
0
        //   [OutputCache(Duration = 1000)]
        public JsonResult GetAllRegion()
        {
            var region = RegionApplication.GetAllRegions().ToList();
            //region = region.Where(p => p.ParentId == 1944).ToList();

            List <Mall.CommonModel.Region> regions = new List <CommonModel.Region>();
            var province = region.Where(a => a.Level == CommonModel.Region.RegionLevel.Province).ToList();

            foreach (var r in province)
            {
                var model = new CommonModel.Region();
                model.Id        = r.Id;
                model.Level     = r.Level;
                model.Name      = r.Name;
                model.ShortName = r.ShortName;
                //var sub = RegionApplication.GetSubRegion(r.Id);
                //var city = sub.Select(a => new Mall.CommonModel.Region()
                //{
                //    Id = a.Id,
                //    Name = a.Name,
                //    ShortName = a.ShortName,
                //    Level = CommonModel.Region.RegionLevel.City,
                //    Sub = new List<CommonModel.Region>()
                //}).ToList();
                //model.Sub = city;
                //foreach (var m in model.Sub)
                //{
                //    var citySub = RegionApplication.GetSubRegion(m.Id);
                //    var county = citySub.Select(a => new Mall.CommonModel.Region()
                //    {
                //        Id = a.Id,
                //        Name = a.Name,
                //        Sub = new List<CommonModel.Region>()
                //    }).ToList();
                //    m.Sub = county;
                //    foreach (var v in m.Sub)
                //    {
                //        var villageSub = RegionApplication.GetSubRegion(v.Id);
                //        var village = villageSub.Select(a => new Mall.CommonModel.Region()
                //        {
                //            Id = a.Id,
                //            Name = a.Name
                //        }).ToList();
                //        v.Sub = village;
                //    }
                //}
                regions.Add(model);
            }
            // string json = Newtonsoft.Json.JsonConvert.SerializeObject(regions);

            // return json;
            return(Json(regions));
        }
Esempio n. 15
0
        public JsonResult GetRegionTree(int id)
        {
            var region = RegionApplication.GetRegion(id);

            if (region == null)
            {
                var rid = RegionApplication.GetDefaultRegionId();
                region = RegionApplication.GetRegion(rid);
            }


            Dictionary <string, object> map = new Dictionary <string, object>();

            //[
            //{ level:1,list:[{id,name,shortname}]},
            //{ level:2,list:[{id,name,shortname}]},
            //{ level:3,list:[{id,name,shortname}]},
            //]

            //添加子集
            if (region.Sub != null)
            {
                map.Add(
                    ((int)region.Level + 1).ToString(),
                    region.Sub.Select(p => new
                {
                    Id        = p.Id,
                    Name      = p.Name,
                    ShortName = p.ShortName,
                    option    = "",
                }).ToList());
            }
            var parent = 0;

            do
            {
                parent = region.ParentId; //上级节点
                var cur     = region.Id;  //当前节点
                var level   = (int)region.Level;
                var regions = RegionApplication.GetSubRegion(parent);
                var list    = regions.Select(p => new
                {
                    Id        = p.Id,
                    Name      = p.Name,
                    ShortName = p.ShortName,
                    option    = p.Id == cur ? "true" : ""
                }).ToList();
                map.Add(level.ToString(), list);
                region = region.Parent;
            } while (parent > 0);
            return(Json(map, JsonRequestBehavior.AllowGet));
        }
Esempio n. 16
0
        /// <summary>
        /// 获取 下级区域数据
        /// </summary>
        /// <param name="parent"></param>
        /// <returns></returns>
        public JsonResult GetSubRegion(int parent)
        {
            var regions = RegionApplication.GetSubRegion(parent);
            var models  = regions.Select(p => new
            {
                p.Id,
                p.Name,
                p.ShortName,
                p.Level
            }).ToList();

            return(Json(models, JsonRequestBehavior.AllowGet));
        }
Esempio n. 17
0
        public object GetExistShopBranch(long shopId, long regionId, string productIds)
        {
            var query = new ShopBranchQuery();
            query.Status = ShopBranchStatus.Normal;
            query.ShopId = shopId;

            var region = RegionApplication.GetRegion(regionId, CommonModel.Region.RegionLevel.City);
            query.AddressPath = region.GetIdPath();
            query.ProductIds = productIds.Split(',').Select(p => long.Parse(p)).ToArray();
            query.ShopBranchProductStatus = ShopBranchSkuStatus.Normal;
            var existShopBranch = ShopBranchApplication.Exists(query);

            return new { success = true, ExistShopBranch = existShopBranch ? 1 : 0 };
        }
Esempio n. 18
0
        public JsonResult ExistShopBranch(int shopId, int regionId, long[] productIds)
        {
            ShopBranchQuery query = new ShopBranchQuery
            {
                Status = 0,
                ShopId = shopId
            };

            query.AddressPath = RegionApplication.GetRegion((long)regionId, Region.RegionLevel.City).GetIdPath(",");
            query.ProductIds  = productIds;
            bool data = ShopBranchApplication.Exists(query);

            return(base.Json(data, JsonRequestBehavior.AllowGet));
        }
Esempio n. 19
0
        /// <summary>
        /// 点击立即购买调用的GET方法,但是重定向到了Submit页面
        /// </summary>
        /// <param name="skuIds">多个库存Id</param>
        /// <param name="counts">每个库存对应的数据量</param>
        /// <param name="regionId">客户收货地区的id</param>
        /// <param name="collpids">组合购Id集合</param>
        /// <returns>订单提交页面的数据</returns>
        public ActionResult SubmitByProductId(string skuIds, string counts, long?regionId, string collpids = null, string CouponIds = "", sbyte productType = 0, long productId = 0)
        {
            //Logo
            ViewBag.Logo = SiteSettings.Logo; //获取Logo
                                              //设置会员信息
            ViewBag.Member = CurrentUser;
            var coupons     = CouponApplication.ConvertUsedCoupon(CouponIds);
            var submitModel = OrderApplication.SubmitByProductId(UserId, skuIds, counts, regionId, collpids, coupons, productType);

            ViewBag.IsCashOnDelivery = submitModel.IsCashOnDelivery;
            ViewBag.IsLimitBuy       = submitModel.IsLimitBuy;

            InitOrderSubmitModel(submitModel);
            #region 是否开启门店授权
            ViewBag.IsOpenStore = SiteSettingApplication.SiteSettings != null && SiteSettingApplication.SiteSettings.IsOpenStore;
            #endregion
            #region 是否提供发票
            //bool ProvideInvoice = false;
            //if (submitModel.products != null)
            //    ProvideInvoice = ShopApplication.HasProvideInvoice(submitModel.products.Select(p => p.shopId).ToList());
            //ViewBag.ProvideInvoice = ProvideInvoice;
            #endregion

            bool canIntegralPerMoney = true, canCapital = true;
            CanDeductible(out canIntegralPerMoney, out canCapital);
            ViewBag.CanIntegralPerMoney = canIntegralPerMoney;
            ViewBag.CanCapital          = canCapital;

            ViewBag.Keyword = SiteSettings.Keyword;
            if (productType == 1 && productId > 0)
            {
                submitModel.VirtualProductItemInfos = ProductManagerApplication.GetVirtualProductItemInfoByProductId(productId);
                var virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(productId);
                if (virtualProductInfo != null && virtualProductInfo.ValidityType && DateTime.Now > virtualProductInfo.EndDate.Value)
                {
                    throw new MallException("该虚拟商品已过期,不支持下单");
                }
            }
            submitModel.ProductType = productType;
            if (productType == 1 && submitModel.products != null && submitModel.products.Count > 0)
            {
                var verificationShipper = ShopShippersApplication.GetDefaultVerificationShipper(submitModel.products.FirstOrDefault().shopId);
                if (verificationShipper != null)
                {
                    ViewBag.ShipperAddress  = RegionApplication.GetFullName(verificationShipper.RegionId) + " " + verificationShipper.Address;
                    ViewBag.ShipperTelPhone = verificationShipper.TelPhone;
                }
            }
            return(View("Submit", submitModel));
        }
Esempio n. 20
0
        public JsonResult List(int pageSize, int pageNo, string fromLatLng, string shopId)
        {
            bool isOpenStore = SiteSettingApplication.GetSiteSettings() != null && SiteSettingApplication.GetSiteSettings().IsOpenStore;

            if (!isOpenStore)
            {
                throw new Core.HimallException("门店未授权!");
            }
            ShopBranchQuery query = new ShopBranchQuery();

            query.PageNo     = pageNo;
            query.PageSize   = pageSize;
            query.Status     = ShopBranchStatus.Normal;
            query.CityId     = -1;
            query.FromLatLng = fromLatLng;
            query.OrderKey   = 2;
            query.OrderType  = true;
            if (query.FromLatLng.Split(',').Length != 2)
            {
                return(Json(new { Success = false, Message = "无法获取您的当前位置,请确认是否开启定位服务!" }, JsonRequestBehavior.AllowGet));
            }

            if (!string.IsNullOrWhiteSpace(shopId))//如果传入了商家ID,则只取商家下门店
            {
                query.ShopId = TypeHelper.ObjectToInt(shopId, 0);
                if (query.ShopId <= 0)
                {
                    return(Json(new { Success = false, Message = "无法定位到商家!" }, JsonRequestBehavior.AllowGet));
                }
            }
            else//否则取用户同城门店
            {
                string address = "", province = "", city = "", district = "", street = "";
                ShopbranchHelper.GetAddressByLatLng(query.FromLatLng, ref address, ref province, ref city, ref district, ref street);
                if (string.IsNullOrWhiteSpace(city))
                {
                    return(Json(new { Success = false, Message = "无法定位到城市!" }, JsonRequestBehavior.AllowGet));
                }

                Region cityInfo = RegionApplication.GetRegionByName(city, Region.RegionLevel.City);
                if (cityInfo != null)
                {
                    query.CityId = cityInfo.Id;
                }
            }
            var shopBranchs = ShopBranchApplication.GetNearShopBranchs(query);

            return(Json(new { Success = true, Models = shopBranchs.Models, Total = shopBranchs.Total }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 21
0
        public JsonResult ExistShopBranch(int shopId, int regionId, long[] productIds)
        {
            var query = new CommonModel.ShopBranchQuery();

            query.Status = CommonModel.ShopBranchStatus.Normal;
            query.ShopId = shopId;

            var region = RegionApplication.GetRegion(regionId, CommonModel.Region.RegionLevel.City);

            query.AddressPath = region.GetIdPath();
            query.ProductIds  = productIds;
            var existShopBranch = ShopBranchApplication.Exists(query);

            return(Json(existShopBranch, JsonRequestBehavior.AllowGet));
        }
Esempio n. 22
0
        public ActionResult Step2()
        {
            Entities.ShopInfo.ShopStage Stage = Entities.ShopInfo.ShopStage.Agreement;
            var shop = ShopApplication.GetShopProfileStep2(CurrentSellerManager.ShopId, out Stage);

            if (Stage == Entities.ShopInfo.ShopStage.CompanyInfo)
            {
                return(RedirectToAction("step1"));
            }

            ViewBag.BankRegionIds = RegionApplication.GetRegionPath(shop.BankRegionId);


            return(View(shop));
        }
Esempio n. 23
0
        /// <summary>
        /// 获得编辑收获地址页面
        /// </summary>
        /// <param name="addressId">收货地址Id</param>
        /// <param name="returnURL">返回url路径</param>
        public ActionResult EditShippingAddress(long addressId = 0, string returnURL = "")
        {
            var ShipngInfo = OrderApplication.GetUserAddress(addressId);

            ViewBag.addId = addressId;
            if (ShipngInfo != null)
            {
                ViewBag.fullPath = RegionApplication.GetRegionPath(ShipngInfo.RegionId);
                ViewBag.fullName = RegionApplication.GetFullName(ShipngInfo.RegionId);
            }
            #region 是否开启门店授权
            ViewBag.IsOpenStore = SiteSettingApplication.SiteSettings != null && SiteSettingApplication.SiteSettings.IsOpenStore;
            #endregion
            return(View(ShipngInfo));
        }
Esempio n. 24
0
        public JsonResult ExistShopBranch(int shopId, int regionId, long[] productIds)
        {
            var query = new ShopBranchQuery();

            query.Status = ShopBranchStatus.Normal;
            query.ShopId = shopId;

            var region = RegionApplication.GetRegion(regionId, Region.RegionLevel.City);

            query.AddressPath = region.GetIdPath();
            query.ProductIds  = productIds;
            var existShopBranch = ShopBranchApplication.Exists(query);

            return(SuccessResult <dynamic>(data: existShopBranch));
        }
        /// <summary>
        /// 列表
        /// </summary>
        /// <param name="query"></param>
        /// <param name="rows"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public JsonResult List(ShopBranchQuery query, int rows, int page)
        {
            query.PageNo   = page;
            query.PageSize = rows;
            if (query.AddressId.HasValue)
            {
                query.AddressPath = RegionApplication.GetRegionPath(query.AddressId.Value);
            }
            QueryPageModel <ShopBranch> shopBranchs = ShopBranchApplication.GetShopBranchs(query);

            return(this.Json((object)new DataGridModel <ShopBranch>()
            {
                rows = (IEnumerable <ShopBranch>)shopBranchs.Models,
                total = shopBranchs.Total
            }));
        }
Esempio n. 26
0
        public JsonResult List(ShopBranchQuery query)
        {
            query.ShopId = (int)CurrentSellerManager.ShopId;
            if (query.AddressId.HasValue)
            {
                query.AddressPath = RegionApplication.GetRegionPath(query.AddressId.Value);
            }
            var shopBranchs = ShopBranchApplication.GetShopBranchs(query);
            var dataGrid    = new DataGridModel <ShopBranch>()
            {
                rows  = shopBranchs.Models,
                total = shopBranchs.Total
            };

            return(Json(dataGrid));
        }
        public object GetExistShopBranch(long shopId, long regionId, string productIds)
        {
            ShopBranchQuery query = new ShopBranchQuery();

            query.Status = new ShopBranchStatus?(ShopBranchStatus.Normal);
            query.ShopId = shopId;
            Region region = RegionApplication.GetRegion(regionId, Region.RegionLevel.City);

            query.AddressPath = region.GetIdPath(",");
            query.ProductIds  = Enumerable.ToArray <long>(Enumerable.Select <string, long>((IEnumerable <string>)productIds.Split(','), (Func <string, long>)(p => long.Parse(p))));
            return((object)this.Json(new
            {
                Success = true,
                ExistShopBranch = ShopBranchApplication.Exists(query) ? 1 : 0
            }));
        }
Esempio n. 28
0
        /// <summary>
        /// 银行账户信息
        /// </summary>
        /// <returns></returns>
        public ActionResult Step4()
        {
            Cache.Remove(CacheKeyCollection.CACHE_SHOP(CurrentSellerManager.ShopId, false));
            ShopInfo.ShopStage Stage = ShopInfo.ShopStage.Agreement;
            var shop = ShopApplication.GetShopProfileStep2(CurrentSellerManager.ShopId, out Stage);

            if (Stage == ShopInfo.ShopStage.CompanyInfo)
            {
                return(RedirectToAction("step3"));
            }

            ViewBag.BankRegionIds = RegionApplication.GetRegionPath(shop.BankRegionId);
            ViewBag.fullName      = RegionApplication.GetFullName(shop.BankRegionId);

            return(View(shop));
        }
Esempio n. 29
0
        public JsonResult AddRegion(Himall.CommonModel.Region.RegionLevel level, string regionName, string path, long parentId)
        {
            if (string.IsNullOrWhiteSpace(regionName))
            {
                throw new HimallException("区域名称不能为空");
            }
            if (regionName.Length > 30)
            {
                throw new HimallException("区域名称30个字符以内");
            }
            //  RegionApplication.AddRegion(regionName, level, path);
            //  var region = RegionApplication.GetAllRegions().Max(a => a.Id);
            var id = RegionApplication.AddRegion(regionName, parentId);

            return(Json(new { success = true, msg = "添加成功!", Id = id }));
        }
        public void LoadDropDownFiltersBag()
        {
            IGenderRepository genderRepository = new GenderRepository(_connectionString);
            var genderApp = new GenderApplication(genderRepository);

            ViewBag.Genders = genderApp.GetAll().Select(g => new SelectListItem()
            {
                Text  = g.Name,
                Value = g.Id.ToString()
            }).ToList();

            ICityRepository cityRepository = new CityRepository(_connectionString);
            var             cityApp        = new CityApplication(cityRepository);

            ViewBag.Cities = cityApp.GetAll().Select(g => new SelectListItem()
            {
                Text  = g.Name,
                Value = g.Id.ToString()
            }).ToList();

            IRegionRepository regionRepository = new RegionRepository(_connectionString);
            var regionApp = new RegionApplication(regionRepository);

            ViewBag.Regions = regionApp.GetAll().Select(g => new SelectListItem()
            {
                Text  = g.Name,
                Value = g.Id.ToString()
            }).ToList();

            IClassificationRepository classificationRepository = new ClassificationRepository(_connectionString);
            var classificationApp = new ClassificationApplication(classificationRepository);

            ViewBag.Classifications = classificationApp.GetAll().Select(g => new SelectListItem()
            {
                Text  = g.Name,
                Value = g.Id.ToString()
            }).ToList();

            IUserSysRepository userRepository = new UserSysRepository(_connectionString);
            var userApp = new UserApplication(userRepository);

            ViewBag.Sellers = userApp.GetAll().Select(g => new SelectListItem()
            {
                Text  = g.Login,
                Value = g.Id.ToString()
            }).ToList();
        }