/// <summary> /// 附近门店设置 /// </summary> /// <returns></returns> public ActionResult NearShopBranchSetting() { MobileHomeTopicsInfo[] infoArray = this._iMobileHomeTopicService.GetMobileHomeTopicInfos(PlatformType.Mobile, 0L).ToArray <MobileHomeTopicsInfo>(); List <ShopBranchTagModel> allShopBranchTagInfos = ShopBranchApplication.GetAllShopBranchTagInfos(); List <SelectListItem> list3 = new List <SelectListItem>(); SelectListItem item2 = new SelectListItem { Selected = true }; item2.Value = 0.ToString(); item2.Text = "请选择..."; list3.Add(item2); List <SelectListItem> list2 = list3; foreach (ShopBranchTagModel model in allShopBranchTagInfos) { SelectListItem item = new SelectListItem { Selected = false, Value = model.Id.ToString(), Text = model.Title }; list2.Add(item); } ViewBag.ShopBranchTags = list2; ViewBag.imageAds = this._iSlideAdsService.GetSlidAdsOrInit(0, SlideAdInfo.SlideAdType.NearShopBranchSpecial).ToList <SlideAdInfo>(); ViewBag.IsOpenStore = (SiteSettingApplication.GetSiteSettings() != null) && SiteSettingApplication.GetSiteSettings().IsOpenStore; IEnumerable <TopicModel> enumerable = from item in infoArray select new TopicModel { FrontCoverImage = item.Himall_Topics.frontCoverImage, Id = item.Id, Name = item.Himall_Topics.Name, Tags = item.Himall_Topics.Tags, Sequence = item.Sequence }; return(View(enumerable)); }
// Methods public ActionResult Add() { List <ShopBranchTagModel> allShopBranchTagInfos = ShopBranchApplication.GetAllShopBranchTagInfos(); List <SelectListItem> list2 = new List <SelectListItem>(); foreach (ShopBranchTagModel model in allShopBranchTagInfos) { SelectListItem item = new SelectListItem { Selected = false, Value = model.Id.ToString(), Text = model.Title }; list2.Add(item); } ((dynamic)base.ViewBag).ShopBranchTags = list2; ShopBranch branch = new ShopBranch { IsStoreDelive = true, ServeRadius = 0, DeliveFee = 0, DeliveTotalFee = 0, FreeMailFee = 0 }; return(base.View(branch)); }
public ActionResult NearShopBranchSetting() { var shopBranchTagInfos = ShopBranchApplication.GetAllShopBranchTagInfos(); List <SelectListItem> tagList = new List <SelectListItem> { new SelectListItem { Selected = true, Value = 0.ToString(), Text = "请选择..." } }; foreach (var item in shopBranchTagInfos) { tagList.Add(new SelectListItem { Selected = false, Value = item.Id.ToString(), Text = item.Title }); } ViewBag.ShopBranchTags = tagList; //轮播图 ViewBag.imageAds = _iSlideAdsService.GetSlidAdsOrInit(0, Entities.SlideAdInfo.SlideAdType.NearShopBranchSpecial).ToList(); //门店授权 ViewBag.IsOpenStore = SiteSettingApplication.SiteSettings.IsOpenStore; return(View(SiteSettingApplication.SiteSettings)); }
public JsonResult TagList() { var shopBranchTagInfos = ShopBranchApplication.GetAllShopBranchTagInfos(); var dataGrid = new DataGridModel <ShopBranchTagModel>() { rows = shopBranchTagInfos, total = shopBranchTagInfos.Count() }; return(Json(dataGrid)); }
/// <summary> /// 标签列表 /// </summary> /// <returns></returns> public JsonResult TagList() { List <ShopBranchTagModel> shopBranchTagInfos = ShopBranchApplication.GetAllShopBranchTagInfos(); return(this.Json((object)new DataGridModel <ShopBranchTagModel>() { rows = (IEnumerable <ShopBranchTagModel>)shopBranchTagInfos, total = Enumerable.Count <ShopBranchTagModel>((IEnumerable <ShopBranchTagModel>)shopBranchTagInfos) })); }
/// <summary> /// 周边门店管理 /// </summary> /// <returns></returns> public ActionResult Management() { List <ShopBranchTagModel> allShopBranchTagInfos = ShopBranchApplication.GetAllShopBranchTagInfos(); List <SelectListItem> list5 = new List <SelectListItem>(); SelectListItem item3 = new SelectListItem { Selected = true }; item3.Value = 0.ToString(); item3.Text = "请选择..."; list5.Add(item3); List <SelectListItem> list2 = list5; foreach (ShopBranchTagModel model in allShopBranchTagInfos) { SelectListItem item = new SelectListItem { Selected = false, Value = model.Id.ToString(), Text = model.Title }; list2.Add(item); } ((dynamic)base.ViewBag).ShopBranchTags = list2; List <ShopInfo> allShops = ObjectContainer.Current.Resolve <IShopService>().GetAllShops(); List <SelectListItem> list6 = new List <SelectListItem>(); SelectListItem item4 = new SelectListItem { Selected = true }; item4.Value = 0.ToString(); item4.Text = "请选择..."; list6.Add(item4); List <SelectListItem> list4 = list6; foreach (ShopInfo info in allShops) { SelectListItem item2 = new SelectListItem { Selected = false, Value = info.Id.ToString(), Text = info.ShopName }; list4.Add(item2); } ((dynamic)base.ViewBag).Shops = list4; return(base.View()); }
public ActionResult Edit(long id) { ShopBranch shopBranchById = ShopBranchApplication.GetShopBranchById(id); List <ShopBranchTagModel> allShopBranchTagInfos = ShopBranchApplication.GetAllShopBranchTagInfos(); List <SelectListItem> list2 = new List <SelectListItem>(); foreach (ShopBranchTagModel model in allShopBranchTagInfos) { SelectListItem item = new SelectListItem { Selected = (shopBranchById.ShopBranchTagId == null) ? false : (shopBranchById.ShopBranchTagId.Split(new char[] { ',' }).Contains <string>(model.Id.ToString()) ? true : false), Value = model.Id.ToString(), Text = model.Title }; list2.Add(item); } ((dynamic)base.ViewBag).ShopBranchTags = list2; return(base.View(shopBranchById)); }
// GET: SellerAdmin/ShopBranch public ActionResult Add() { //门店标签 var shopBranchTagInfos = ShopBranchApplication.GetAllShopBranchTagInfos(); List <SelectListItem> tagList = new List <SelectListItem>(); foreach (var item in shopBranchTagInfos) { tagList.Add(new SelectListItem { Selected = false, Value = item.Id.ToString(), Text = item.Title }); } ViewBag.ShopBranchTags = tagList; return(View(new ShopBranch { IsStoreDelive = true, ServeRadius = 0, DeliveFee = 0, DeliveTotalFee = 0, FreeMailFee = 0 })); }
public ActionResult Edit(long id) { var shopBranch = ShopBranchApplication.GetShopBranchById(id); //门店标签 var shopBranchTagInfos = ShopBranchApplication.GetAllShopBranchTagInfos(); List <SelectListItem> tagList = new List <SelectListItem>(); foreach (var item in shopBranchTagInfos) { tagList.Add(new SelectListItem { Selected = (shopBranch.ShopBranchTagId == null ? false : shopBranch.ShopBranchTagId.Split(',').Contains(item.Id.ToString()) ? true : false), Value = item.Id.ToString(), Text = item.Title }); } ViewBag.ShopBranchTags = tagList; return(View(shopBranch)); }
public JsonResult ShopTagList(int page, int rows, string titleKeyword) { Func <ShopBranchTagModel, bool> predicate = null; List <ShopBranchTagModel> allShopBranchTagInfos = ShopBranchApplication.GetAllShopBranchTagInfos(); if (!string.IsNullOrEmpty(titleKeyword)) { if (predicate == null) { predicate = n => n.Title.Contains(titleKeyword); } allShopBranchTagInfos = allShopBranchTagInfos.Where <ShopBranchTagModel>(predicate).ToList <ShopBranchTagModel>(); } var data = new { rows = from item in allShopBranchTagInfos.Skip <ShopBranchTagModel>(((page - 1) * rows)).Take <ShopBranchTagModel>(rows) select new { id = item.Id, name = item.Title, imgUrl = "", url = "/" + item.Id, tags = "" }, total = allShopBranchTagInfos.Count }; return(base.Json(data)); }
public JsonResult ShopTagList(int page, int rows, string titleKeyword) { var shopBranchTagInfos = ShopBranchApplication.GetAllShopBranchTagInfos(); if (!string.IsNullOrEmpty(titleKeyword)) { shopBranchTagInfos = shopBranchTagInfos.Where(n => n.Title.Contains(titleKeyword)).ToList(); } var list = new { rows = shopBranchTagInfos.Skip((page - 1) * rows).Take(rows).Select(item => new { id = item.Id, name = item.Title, imgUrl = "", url = "/" + item.Id, tags = "" }), total = shopBranchTagInfos.Count }; return(Json(list)); }
public ActionResult Add(ShopBranch shopBranch) { try { long num; if (!string.Equals(shopBranch.PasswordOne, shopBranch.PasswordTwo)) { throw new HimallException("两次密码输入不一致!"); } if (string.IsNullOrWhiteSpace(shopBranch.PasswordOne) || string.IsNullOrWhiteSpace(shopBranch.PasswordTwo)) { throw new HimallException("密码不能为空!"); } if (shopBranch.ShopBranchName.Length > 15) { throw new HimallException("门店名称不能超过15个字!"); } if (shopBranch.AddressDetail.Length > 50) { throw new HimallException("详细地址不能超过50个字!"); } if ((shopBranch.Latitude <= 0f) || (shopBranch.Longitude <= 0f)) { throw new HimallException("请搜索地址地图定位!"); } shopBranch.ShopId = base.CurrentSellerManager.ShopId; shopBranch.CreateDate = DateTime.Now; ShopBranchApplication.AddShopBranch(shopBranch, out num); try { string[] strs = new string[] { num.ToString() }; string[] strArray2 = string.IsNullOrEmpty(shopBranch.ShopBranchTagId) ? new string[0] : shopBranch.ShopBranchTagId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); ShopBranchApplication.SetShopBrandTagInfos(this.convertLongs(strs), this.convertLongs(strArray2)); } catch { } List <ShopBranchTagModel> allShopBranchTagInfos = ShopBranchApplication.GetAllShopBranchTagInfos(); List <SelectListItem> list2 = new List <SelectListItem>(); foreach (ShopBranchTagModel model in allShopBranchTagInfos) { SelectListItem item = new SelectListItem { Selected = (shopBranch.ShopBranchTagId == null) ? false : (shopBranch.ShopBranchTagId.Split(new char[] { ',' }).Contains <string>(model.Id.ToString()) ? true : false), Value = model.Id.ToString(), Text = model.Title }; list2.Add(item); } ((dynamic)base.ViewBag).ShopBranchTags = list2; } catch (Exception exception) { BaseController.Result result = new BaseController.Result { success = false, msg = exception.Message }; return(base.Json(result)); } BaseController.Result data = new BaseController.Result { success = true }; return(base.Json(data)); }
public ActionResult Management(long?shopBranchTagId) { var shopBranchTagInfos = ShopBranchApplication.GetAllShopBranchTagInfos(); List <SelectListItem> tagList = new List <SelectListItem>() { new SelectListItem { Selected = true, Value = 0.ToString(), Text = "请选择..." } }; foreach (var item in shopBranchTagInfos) { tagList.Add(new SelectListItem { Selected = false, Value = item.Id.ToString(), Text = item.Title }); } if (shopBranchTagId.HasValue) { var item = tagList.FirstOrDefault(t => t.Value == shopBranchTagId.ToString()); if (item != null) { item.Selected = true; } } ViewBag.ShopBranchTags = tagList; var shops = EngineContext.Current.Resolve <IShopService>().GetAllShops(); List <SelectListItem> shopList = new List <SelectListItem> { new SelectListItem { Selected = true, Value = 0.ToString(), Text = "请选择..." } }; foreach (var item in shops) { if (!string.IsNullOrEmpty(item.ShopName)) { shopList.Add(new SelectListItem { Selected = false, Value = item.Id.ToString(), Text = item.ShopName }); } } ViewBag.Shops = shopList; return(View()); }
public ActionResult Add(ShopBranch shopBranch) { try { if (!string.Equals(shopBranch.PasswordOne, shopBranch.PasswordTwo)) { throw new MallException("两次密码输入不一致!"); } if (string.IsNullOrWhiteSpace(shopBranch.PasswordOne) || string.IsNullOrWhiteSpace(shopBranch.PasswordTwo)) { throw new MallException("密码不能为空!"); } if (shopBranch.ShopBranchName.Length > 15) { throw new MallException("门店名称不能超过15个字!"); } if (shopBranch.AddressDetail.Length > 50) { throw new MallException("详细地址不能超过50个字!"); } if (shopBranch.Latitude <= 0 || shopBranch.Longitude <= 0) { throw new MallException("请搜索地址地图定位!"); } if (!shopBranch.IsAboveSelf && !shopBranch.IsStoreDelive) { throw new MallException("至少需要选择一种配送方式!"); } if (shopBranch.IsStoreDelive && shopBranch.IsFreeMail && shopBranch.FreeMailFee <= 0) { throw new MallException("满额包邮金额必须大于0!"); } if (!shopBranch.IsStoreDelive) { shopBranch.IsFreeMail = false; } if (!shopBranch.IsFreeMail) { shopBranch.FreeMailFee = 0; } shopBranch.ShopId = CurrentSellerManager.ShopId; shopBranch.CreateDate = DateTime.Now; long shopBranchId; ShopBranchApplication.AddShopBranch(shopBranch, out shopBranchId); if (!string.IsNullOrWhiteSpace(shopBranch.ShopBranchTagId)) { var tags = shopBranch.ShopBranchTagId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(p => long.Parse(p)).ToList(); ShopBranchApplication.SetShopBrandTagInfos(new List <long> { shopBranch.Id }, tags); } //门店标签 var shopBranchTagInfos = ShopBranchApplication.GetAllShopBranchTagInfos(); List <SelectListItem> tagList = new List <SelectListItem>(); foreach (var item in shopBranchTagInfos) { tagList.Add(new SelectListItem { Selected = (shopBranch.ShopBranchTagId == null ? false : shopBranch.ShopBranchTagId.Split(',').Contains(item.Id.ToString()) ? true : false), Value = item.Id.ToString(), Text = item.Title }); } ViewBag.ShopBranchTags = tagList; if (CityExpressConfigApplication.GetDaDaCityExpressConfig(CurrentShop.Id).IsEnable) { var dada_shop_id = GetNewDadaStoreId(CurrentShop.Id, shopBranch.Id); var _area = RegionApplication.GetRegion(shopBranch.AddressId); var _city = GetCity(_area); var json = ExpressDaDaHelper.shopAdd(CurrentShop.Id, shopBranch.ShopBranchName, 5, _city.ShortName, _area.Parent.Name, shopBranch.AddressDetail, shopBranch.Longitude, shopBranch.Latitude, shopBranch.ContactUser, shopBranch.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) { return(Json(new Result() { success = true, msg = "但同步门店至达达物流失败,可能所在城市达达不支持" })); } if (string.IsNullOrWhiteSpace(shopBranch.DaDaShopId) && (status == "success" || code == 7718)) { shopBranch.DaDaShopId = dada_shop_id; ShopBranchApplication.UpdateShopBranch(shopBranch); } } } catch (Exception ex) { return(Json(new Result() { success = false, msg = ex.Message })); } return(Json(new Result() { success = true })); }