public void UpdateVShop(VShopInfo vshopInfo) { if (vshopInfo.Id <= 0) { throw new Mall.Core.InvalidPropertyException("请传入合法的微店Id,微店Id必须大于0"); } if (string.IsNullOrWhiteSpace(vshopInfo.StrLogo)) { throw new Mall.Core.InvalidPropertyException("微店Logo不能为空"); } if (string.IsNullOrWhiteSpace(vshopInfo.WXLogo)) { throw new Mall.Core.InvalidPropertyException("微信Logo不能为空"); } if (string.IsNullOrWhiteSpace(vshopInfo.StrBackgroundImage)) { throw new Mall.Core.InvalidPropertyException("微店背景图片不能为空"); } //if (string.IsNullOrWhiteSpace(vshopInfo.Description)) //{ // throw new Mall.Core.InvalidPropertyException("微店描述不能为空"); //} //if (!string.IsNullOrWhiteSpace(vshopInfo.Tags) && vshopInfo.Tags.Split(';').Length > 4) // throw new Mall.Core.InvalidPropertyException("最多只能有4个标签"); if (!string.IsNullOrWhiteSpace(vshopInfo.Tags)) { var tagArray = vshopInfo.Tags.Split(';'); foreach (var tag in tagArray) { if (tag.Length > 4) { throw new Mall.Core.InvalidPropertyException("每个标签限4个字"); } } } var oriVShop = GetVshopById(vshopInfo.Id); if (oriVShop.ShopId != vshopInfo.ShopId) { throw new Mall.Core.InvalidPropertyException("修改微店信息时,不能变更所属店铺"); } oriVShop.HomePageTitle = vshopInfo.HomePageTitle; oriVShop.Tags = vshopInfo.Tags; oriVShop.Description = vshopInfo.Description; string logo = vshopInfo.StrLogo, backgroundImage = vshopInfo.StrBackgroundImage; string wxlogo = vshopInfo.WXLogo; CopyImages(vshopInfo.ShopId, ref logo, ref backgroundImage, ref wxlogo); oriVShop.StrLogo = logo; oriVShop.StrBackgroundImage = backgroundImage; oriVShop.WXLogo = wxlogo; oriVShop.IsOpen = vshopInfo.IsOpen; oriVShop.Name = !string.IsNullOrEmpty(vshopInfo.Name) ? vshopInfo.Name : oriVShop.Name; DbFactory.Default.Update(oriVShop); }
public ActionResult Main() { VShopInfo topShop = ServiceHelper.Create <IVShopService>().GetTopShop(); ViewBag.IsFavorite = false; if (topShop != null) { IQueryable <ProductInfo> productInfos = from item in ( from t in ServiceHelper.Create <IMobileHomeProductsService>().GetMobileHomePageProducts(topShop.ShopId, ChemCloud.Core.PlatformType.WeiXin) orderby t.Sequence, t.Id descending select t).Take(2) select item.ChemCloud_Products; IEnumerable <ProductItem> array = from item in productInfos.ToArray() select new ProductItem() { Id = item.Id, ImageUrl = item.GetImage(ProductInfo.ImageSize.Size_350, 1), MarketPrice = item.MarketPrice, Name = item.ProductName, SalePrice = item.MinSalePrice }; ViewBag.TopShopProducts = array; if (base.CurrentUser != null) { long[] numArray = ( from item in ServiceHelper.Create <IShopService>().GetFavoriteShopInfos(base.CurrentUser.Id) select item.ShopId).ToArray(); ViewBag.IsFavorite = numArray.Contains(topShop.ShopId); } } return(View(topShop)); }
public JsonResult SaveVShopHomePageTitle(string homePageTitle) { VShopInfo vShopByShopId = ServiceHelper.Create <IVShopService>().GetVShopByShopId(base.CurrentSellerManager.ShopId); vShopByShopId.HomePageTitle = homePageTitle; ServiceHelper.Create <IVShopService>().UpdateVShop(vShopByShopId); return(Json(new { success = true })); }
public JsonResult SaveVShopHomePageTitle(string homePageTitle) { VShopInfo vshop = _iVShopService.GetVShopByShopId(CurrentSellerManager.ShopId); vshop.HomePageTitle = homePageTitle; _iVShopService.UpdateVShop(vshop); return(Json(new { success = true })); }
public ActionResult Category(long vShopId) { VShopInfo vShop = ServiceHelper.Create <IVShopService>().GetVShop(vShopId); List <ShopCategoryInfo> list = ServiceHelper.Create <IShopCategoryService>().GetShopCategory(vShop.ShopId).ToList(); IEnumerable <CategoryModel> subCategories = GetSubCategories(list, 0, 0); ViewBag.VShopId = vShopId; return(View(subCategories)); }
public int LogVisit(long id) { VShopInfo vshopById = this.GetVshopById(id); VShopInfo visitNum = vshopById; visitNum.VisitNum = visitNum.VisitNum + 1; this.context.SaveChanges(); return(vshopById.VisitNum); }
public ActionResult GetCouponSuccess(long id) { VshopCouponInfoModel vshopCouponInfoModel = new VshopCouponInfoModel(); ICouponService couponService = ServiceHelper.Create <ICouponService>(); CouponRecordInfo couponRecordById = couponService.GetCouponRecordById(id); if (couponRecordById == null) { throw new HimallException("错误的优惠券编号"); } CouponInfo couponInfo = couponService.GetCouponInfo(couponRecordById.ShopId, couponRecordById.CouponId); if (couponInfo == null) { throw new HimallException("错误的优惠券编号"); } vshopCouponInfoModel.CouponData = couponInfo; vshopCouponInfoModel.CouponId = couponInfo.Id; vshopCouponInfoModel.CouponRecordId = couponRecordById.Id; vshopCouponInfoModel.ShopId = couponInfo.ShopId; vshopCouponInfoModel.IsShowSyncWeiXin = false; if (base.CurrentUser != null && ServiceHelper.Create <IShopService>().IsFavoriteShop(base.CurrentUser.Id, couponInfo.ShopId)) { vshopCouponInfoModel.IsFavoriteShop = true; } vshopCouponInfoModel.CouponId = id; if (couponInfo.IsSyncWeiXin == 1 && base.PlatformType == ChemCloud.Core.PlatformType.WeiXin) { vshopCouponInfoModel.WXJSInfo = ser_wxcard.GetSyncWeiXin(couponInfo.Id, couponRecordById.Id, ThisCouponType, base.Request.Url.AbsoluteUri); if (vshopCouponInfoModel.WXJSInfo != null) { vshopCouponInfoModel.IsShowSyncWeiXin = true; } } string wXLogo = wxlogo; VShopInfo vShopByShopId = ServiceHelper.Create <IVShopService>().GetVShopByShopId(couponInfo.ShopId); if (vShopByShopId != null) { vshopCouponInfoModel.VShopid = vShopByShopId.Id; if (!string.IsNullOrWhiteSpace(vShopByShopId.WXLogo)) { wXLogo = vShopByShopId.WXLogo; } if (string.IsNullOrWhiteSpace(wxlogo) && !string.IsNullOrWhiteSpace(_siteSetting.WXLogo)) { wXLogo = _siteSetting.WXLogo; } } ViewBag.ShopLogo = wXLogo; ViewBag.ShopId = vshopCouponInfoModel.ShopId; ViewBag.FollowUrl = vshopCouponInfoModel.FollowUrl; base.ViewBag.FavText = (vshopCouponInfoModel.IsFavoriteShop ? "己收藏" : "收藏供应商"); ViewBag.VShopid = vshopCouponInfoModel.VShopid; return(View(vshopCouponInfoModel)); }
public ActionResult VshopHomeSite() { VShopInfo vShopByShopId = ServiceHelper.Create <IVShopService>().GetVShopByShopId(base.CurrentSellerManager.ShopId); ViewBag.VShop = vShopByShopId; ViewBag.ShopId = base.CurrentSellerManager.ShopId; ViewBag.SlideImage = ServiceHelper.Create <ISlideAdsService>().GetSlidAds(base.CurrentSellerManager.ShopId, SlideAdInfo.SlideAdType.VShopHome); ViewBag.Banner = ServiceHelper.Create <INavigationService>().GetSellerNavigations(base.CurrentSellerManager.ShopId, PlatformType.WeiXin); return(View(vShopByShopId)); }
private string GetShopAddress(long shopid) { VShopInfo vShopByShopId = Instance <IVShopService> .Create.GetVShopByShopId(shopid); if (vShopByShopId == null) { return("/"); } return(string.Concat("/m-weixin/vshop/Detail/", vShopByShopId.Id)); }
public ActionResult EditVShop(long shopId) { if (shopId != base.CurrentSellerManager.ShopId) { throw new HimallException("获取供应商信息错误"); } VShopInfo vShopByShopId = ServiceHelper.Create <IVShopService>().GetVShopByShopId(shopId) ?? new VShopInfo(); ViewBag.ShopId = base.CurrentSellerManager.ShopId; return(View(vShopByShopId)); }
public JsonResult GetVShopIdByShopId(long shopId) { VShopInfo vShopByShopId = ServiceHelper.Create <IVShopService>().GetVShopByShopId(shopId); Result result = new Result() { success = true, msg = vShopByShopId.Id.ToString() }; return(Json(result)); }
public void AddVisitNumber(long vshopId) { VShopInfo vShopInfo = this.context.VShopInfo.FirstOrDefault((VShopInfo item) => item.Id == vshopId); if (vShopInfo != null) { VShopInfo visitNum = vShopInfo; visitNum.VisitNum = visitNum.VisitNum + 1; this.context.SaveChanges(); } }
public ManagerInfo GetSellerManager(long userId) { ManagerInfo roleName = null; string str = CacheKeyCollection.Seller(userId); if (Cache.Get(str) == null) { roleName = ( from item in context.ManagerInfo where item.Id == userId && item.ShopId != 0 select item).FirstOrDefault(); if (roleName == null) { return(null); } if (roleName.RoleId != 0) { RoleInfo roleInfo = context.RoleInfo.FindById <RoleInfo>(roleName.RoleId); if (roleInfo != null) { List <SellerPrivilege> sellerPrivileges = new List <SellerPrivilege>(); roleInfo.RolePrivilegeInfo.ToList().ForEach((RolePrivilegeInfo a) => sellerPrivileges.Add((SellerPrivilege)a.Privilege)); roleName.RoleName = roleInfo.RoleName; roleName.SellerPrivileges = sellerPrivileges; roleName.Description = roleInfo.Description; } } else { List <SellerPrivilege> sellerPrivileges1 = new List <SellerPrivilege>() { 0 }; roleName.RoleName = "系统管理员"; roleName.SellerPrivileges = sellerPrivileges1; roleName.Description = "系统管理员"; } Cache.Insert(str, roleName); } else { roleName = (ManagerInfo)Cache.Get(str); } if (roleName != null) { VShopInfo vShopInfo = context.VShopInfo.FirstOrDefault((VShopInfo item) => item.ShopId == roleName.ShopId); roleName.VShopId = -1; if (vShopInfo != null) { roleName.VShopId = vShopInfo.Id; } } return(roleName); }
public JsonResult EditVShop(VShopInfo vshopInfo) { if (vshopInfo.Id <= 0) { ServiceHelper.Create <IVShopService>().CreateVshop(vshopInfo); } else { ServiceHelper.Create <IVShopService>().UpdateVShop(vshopInfo); } return(Json(new { success = true })); }
public ActionResult VshopHomeSiteApp() { Models.VshopHomeSiteViewModel model = new Models.VshopHomeSiteViewModel(); //未开通微店就进不去首页设置 VShopInfo vshop = _iVShopService.GetVShopByShopId(CurrentSellerManager.ShopId); model.VShop = vshop; model.ShopId = CurrentSellerManager.ShopId; model.SlideImage = _iSlideAdsService.GetSlidAds(CurrentSellerManager.ShopId, SlideAdInfo.SlideAdType.VShopHome).ToList(); model.Banner = _iNavigationService.GetSellerNavigations(CurrentSellerManager.ShopId, PlatformType.WeiXin).ToList(); return(View(model)); }
public ActionResult Search(string keywords = "", string exp_keywords = "", long cid = 0L, long b_id = 0L, string a_id = "", int orderKey = 1, int orderType = 1, int pageNo = 1, int pageSize = 6, long vshopId = 0L) { long shopId = -1; if (vshopId > 0) { VShopInfo vShop = ServiceHelper.Create <IVShopService>().GetVShop(vshopId); if (vShop != null) { shopId = vShop.ShopId; } } if (!string.IsNullOrWhiteSpace(keywords)) { keywords = keywords.Trim(); } ProductSearch productSearch = new ProductSearch() { shopId = shopId, BrandId = b_id, CategoryId = cid, Ex_Keyword = exp_keywords, Keyword = keywords, OrderKey = orderKey, OrderType = orderType == 1, AttrIds = new List <string>(), PageNumber = pageNo, PageSize = pageSize }; PageModel <ProductInfo> pageModel = ServiceHelper.Create <IProductService>().SearchProduct(productSearch); int total = pageModel.Total; ProductInfo[] array = pageModel.Models.ToArray(); ICommentService commentService = ServiceHelper.Create <ICommentService>(); IEnumerable <ProductItem> productItem = from item in array select new ProductItem() { Id = item.Id, ImageUrl = item.GetImage(ProductInfo.ImageSize.Size_350, 1), SalePrice = item.MinSalePrice, Name = item.ProductName, CommentsCount = commentService.GetCommentsByProductId(item.Id).Count() }; IQueryable <ShopCategoryInfo> shopCategory = ServiceHelper.Create <IShopCategoryService>().GetShopCategory(shopId); IEnumerable <CategoryModel> subCategories = GetSubCategories(shopCategory, 0, 0); ViewBag.ShopCategories = subCategories; ViewBag.Total = total; ViewBag.Keywords = keywords; ViewBag.VShopId = vshopId; return(View(productItem)); }
public JsonResult EditVShop(VShopInfo vshopInfo) { if (vshopInfo.Id > 0) { _iVShopService.UpdateVShop(vshopInfo); } else { _iVShopService.CreateVshop(vshopInfo); } return(Json(new { success = true })); }
public void CreateVshop(VShopInfo vshopInfo) { if (vshopInfo.ShopId <= 0) { throw new InvalidPropertyException("请传入合法的店铺Id,店铺Id必须大于0"); } if (string.IsNullOrWhiteSpace(vshopInfo.Logo)) { throw new InvalidPropertyException("微店Logo不能为空"); } if (string.IsNullOrWhiteSpace(vshopInfo.WXLogo)) { throw new InvalidPropertyException("微信Logo不能为空"); } if (string.IsNullOrWhiteSpace(vshopInfo.BackgroundImage)) { throw new InvalidPropertyException("微店背景图片不能为空"); } if (string.IsNullOrWhiteSpace(vshopInfo.Description)) { throw new InvalidPropertyException("微店描述不能为空"); } if (!string.IsNullOrWhiteSpace(vshopInfo.Tags)) { string tags = vshopInfo.Tags; char[] chrArray = new char[] { ',' }; if (tags.Split(chrArray).Length > 4) { throw new InvalidPropertyException("最多只能有4个标签"); } } if (this.context.VShopInfo.Any((VShopInfo item) => item.ShopId == vshopInfo.ShopId)) { throw new InvalidPropertyException(string.Format("店铺{0}已经创建过微店", vshopInfo.ShopId)); } ShopInfo shop = Instance <IShopService> .Create.GetShop(vshopInfo.ShopId, false); vshopInfo.Name = shop.ShopName; vshopInfo.CreateTime = DateTime.Now; vshopInfo.State = VShopInfo.VshopStates.Normal; string logo = vshopInfo.Logo; string backgroundImage = vshopInfo.BackgroundImage; string wXLogo = vshopInfo.WXLogo; this.CopyImages(vshopInfo.ShopId, ref logo, ref backgroundImage, ref wXLogo); vshopInfo.Logo = logo; vshopInfo.BackgroundImage = backgroundImage; vshopInfo.WXLogo = wXLogo; this.context.VShopInfo.Add(vshopInfo); this.context.SaveChanges(); }
public void CreateVshop(VShopInfo vshopInfo) { if (vshopInfo.ShopId <= 0) { throw new Mall.Core.InvalidPropertyException("请传入合法的店铺Id,店铺Id必须大于0"); } if (string.IsNullOrWhiteSpace(vshopInfo.StrLogo)) { throw new Mall.Core.InvalidPropertyException("微店Logo不能为空"); } if (string.IsNullOrWhiteSpace(vshopInfo.WXLogo)) { throw new Mall.Core.InvalidPropertyException("微信Logo不能为空"); } if (string.IsNullOrWhiteSpace(vshopInfo.StrBackgroundImage)) { throw new Mall.Core.InvalidPropertyException("微店背景图片不能为空"); } //if (string.IsNullOrWhiteSpace(vshopInfo.Description)) //{ // throw new Mall.Core.InvalidPropertyException("微店描述不能为空"); //} if (!string.IsNullOrWhiteSpace(vshopInfo.Tags) && vshopInfo.Tags.Split(',').Length > 4) { throw new Mall.Core.InvalidPropertyException("最多只能有4个标签"); } bool exist = DbFactory.Default.Get <VShopInfo>().Where(item => item.ShopId == vshopInfo.ShopId).Exist(); if (exist) { throw new Mall.Core.InvalidPropertyException(string.Format("店铺{0}已经创建过微店", vshopInfo.ShopId)); } var shopInfo = ServiceProvider.Instance <IShopService> .Create.GetShop(vshopInfo.ShopId); vshopInfo.Name = shopInfo.ShopName;//使用店铺名称作为微店名称 vshopInfo.CreateTime = DateTime.Now; vshopInfo.State = VShopInfo.VShopStates.Normal; string logo = vshopInfo.StrLogo, backgroundImage = vshopInfo.StrBackgroundImage; string wxlogo = vshopInfo.WXLogo; CopyImages(vshopInfo.ShopId, ref logo, ref backgroundImage, ref wxlogo); vshopInfo.StrLogo = logo; vshopInfo.StrBackgroundImage = backgroundImage; vshopInfo.WXLogo = wxlogo; vshopInfo.IsOpen = true; DbFactory.Default.Add(vshopInfo); }
public void CreateVshop(VShopInfo vshopInfo) { if (vshopInfo.ShopId <= 0) { throw new Himall.Core.InvalidPropertyException("请传入合法的诊所Id,诊所Id必须大于0"); } if (string.IsNullOrWhiteSpace(vshopInfo.Logo)) { throw new Himall.Core.InvalidPropertyException("微店Logo不能为空"); } if (string.IsNullOrWhiteSpace(vshopInfo.WXLogo)) { throw new Himall.Core.InvalidPropertyException("微信Logo不能为空"); } if (string.IsNullOrWhiteSpace(vshopInfo.BackgroundImage)) { throw new Himall.Core.InvalidPropertyException("微店背景图片不能为空"); } //if (string.IsNullOrWhiteSpace(vshopInfo.Description)) //{ // throw new Himall.Core.InvalidPropertyException("微店描述不能为空"); //} if (!string.IsNullOrWhiteSpace(vshopInfo.Tags) && vshopInfo.Tags.Split(',').Length > 4) { throw new Himall.Core.InvalidPropertyException("最多只能有4个标签"); } bool exist = Context.VShopInfo.Any(item => item.ShopId == vshopInfo.ShopId); if (exist) { throw new Himall.Core.InvalidPropertyException(string.Format("诊所{0}已经创建过微店", vshopInfo.ShopId)); } var shopInfo = ServiceProvider.Instance <IShopService> .Create.GetShop(vshopInfo.ShopId); vshopInfo.Name = shopInfo.ShopName;//使用诊所名称作为微店名称 vshopInfo.CreateTime = DateTime.Now; vshopInfo.State = VShopInfo.VshopStates.Normal; string logo = vshopInfo.Logo, backgroundImage = vshopInfo.BackgroundImage; string wxlogo = vshopInfo.WXLogo; CopyImages(vshopInfo.ShopId, ref logo, ref backgroundImage, ref wxlogo); vshopInfo.Logo = logo; vshopInfo.BackgroundImage = backgroundImage; vshopInfo.WXLogo = wxlogo; Context.VShopInfo.Add(vshopInfo); Context.SaveChanges(); }
public void UpdateVShop(VShopInfo vshopInfo) { if (vshopInfo.Id <= 0) { throw new InvalidPropertyException("请传入合法的微店Id,微店Id必须大于0"); } if (string.IsNullOrWhiteSpace(vshopInfo.Logo)) { throw new InvalidPropertyException("微店Logo不能为空"); } if (string.IsNullOrWhiteSpace(vshopInfo.WXLogo)) { throw new InvalidPropertyException("微信Logo不能为空"); } if (string.IsNullOrWhiteSpace(vshopInfo.BackgroundImage)) { throw new InvalidPropertyException("微店背景图片不能为空"); } if (string.IsNullOrWhiteSpace(vshopInfo.Description)) { throw new InvalidPropertyException("微店描述不能为空"); } if (!string.IsNullOrWhiteSpace(vshopInfo.Tags)) { string tags = vshopInfo.Tags; char[] chrArray = new char[] { ',' }; if (tags.Split(chrArray).Length > 4) { throw new InvalidPropertyException("最多只能有4个标签"); } } VShopInfo vshopById = this.GetVshopById(vshopInfo.Id); if (vshopById.ShopId != vshopInfo.ShopId) { throw new InvalidPropertyException("修改微店信息时,不能变更所属店铺"); } vshopById.HomePageTitle = vshopInfo.HomePageTitle; vshopById.Tags = vshopInfo.Tags; vshopById.Description = vshopInfo.Description; string logo = vshopInfo.Logo; string backgroundImage = vshopInfo.BackgroundImage; string wXLogo = vshopInfo.WXLogo; this.CopyImages(vshopInfo.ShopId, ref logo, ref backgroundImage, ref wXLogo); vshopById.Logo = logo; vshopById.BackgroundImage = backgroundImage; vshopById.WXLogo = wXLogo; this.context.SaveChanges(); }
public ActionResult ShopCouponList(long shopid) { long num; IEnumerable <CouponInfo> couponList = GetCouponList(shopid); VShopInfo vShopByShopId = ServiceHelper.Create <IVShopService>().GetVShopByShopId(shopid); if (couponList != null) { dynamic viewBag = base.ViewBag; CouponInfo[] array = couponList.ToArray(); viewBag.CouponList = from a in array select new UserCouponInfo() { ShopId = a.ShopId, CouponId = a.Id, Price = a.Price, PerMax = a.PerMax, OrderAmount = a.OrderAmount, Num = a.Num, StartTime = a.StartTime, EndTime = a.EndTime, CreateTime = a.CreateTime, CouponName = a.CouponName, VShop = vShopByShopId }; } ViewBag.Shopid = shopid; dynamic obj = base.ViewBag; num = (vShopByShopId != null ? vShopByShopId.Id : 0); obj.VShopid = num; if (!ServiceHelper.Create <IShopService>().IsFavoriteShop(base.CurrentUser.Id, shopid)) { ViewBag.FavText = "收藏供应商"; } else { ViewBag.FavText = "已收藏"; } WXShopInfo vShopSetting = ServiceHelper.Create <IVShopService>().GetVShopSetting(shopid) ?? new WXShopInfo() { FollowUrl = string.Empty }; ViewBag.FollowUrl = vShopSetting.FollowUrl; return(View()); }
public JsonResult SaveVShopBanner(long?id, string bannerName, string url, int urlType) { VShopInfo vShopByShopId = ServiceHelper.Create <IVShopService>().GetVShopByShopId(base.CurrentSellerManager.ShopId); switch (urlType) { case 1: { object[] str = new object[] { "/m-", PlatformType.WeiXin.ToString(), "/vshop/Search?vshopid=", vShopByShopId.Id }; url = string.Concat(str); break; } case 2: { object[] objArray = new object[] { "/m-", PlatformType.WeiXin.ToString(), "/vshop/Category?vshopid=", vShopByShopId.Id }; url = string.Concat(objArray); break; } case 3: { object[] str1 = new object[] { "/m-", PlatformType.WeiXin.ToString(), "/vshop/introduce/", vShopByShopId.Id }; url = string.Concat(str1); break; } } BannerInfo bannerInfo = new BannerInfo() { Name = bannerName, Platform = PlatformType.WeiXin, ShopId = base.CurrentSellerManager.ShopId, Url = url, Position = 0, UrlType = (BannerInfo.BannerUrltypes)urlType }; if (!id.HasValue) { ServiceHelper.Create <INavigationService>().AddSellerNavigation(bannerInfo); } else { bannerInfo.Id = id.Value; ServiceHelper.Create <INavigationService>().UpdateSellerNavigation(bannerInfo); } return(Json(new { success = true, item = bannerInfo })); }
public void UpdateVShop(VShopInfo vshopInfo) { if (vshopInfo.Id <= 0) { throw new Himall.Core.InvalidPropertyException("请传入合法的微店Id,微店Id必须大于0"); } if (string.IsNullOrWhiteSpace(vshopInfo.Logo)) { throw new Himall.Core.InvalidPropertyException("微店Logo不能为空"); } if (string.IsNullOrWhiteSpace(vshopInfo.WXLogo)) { throw new Himall.Core.InvalidPropertyException("微信Logo不能为空"); } if (string.IsNullOrWhiteSpace(vshopInfo.BackgroundImage)) { throw new Himall.Core.InvalidPropertyException("微店背景图片不能为空"); } //if (string.IsNullOrWhiteSpace(vshopInfo.Description)) //{ // throw new Himall.Core.InvalidPropertyException("微店描述不能为空"); //} if (!string.IsNullOrWhiteSpace(vshopInfo.Tags) && vshopInfo.Tags.Split(',').Length > 4) { throw new Himall.Core.InvalidPropertyException("最多只能有4个标签"); } var oriVShop = GetVshopById(vshopInfo.Id); if (oriVShop.ShopId != vshopInfo.ShopId) { throw new Himall.Core.InvalidPropertyException("修改微店信息时,不能变更所属诊所"); } oriVShop.HomePageTitle = vshopInfo.HomePageTitle; oriVShop.Tags = vshopInfo.Tags; oriVShop.Description = vshopInfo.Description; string logo = vshopInfo.Logo, backgroundImage = vshopInfo.BackgroundImage; string wxlogo = vshopInfo.WXLogo; CopyImages(vshopInfo.ShopId, ref logo, ref backgroundImage, ref wxlogo); oriVShop.Logo = logo; oriVShop.BackgroundImage = backgroundImage; oriVShop.WXLogo = wxlogo; Context.SaveChanges(); }
public ActionResult ShopCouponList(long shopid) { var coupons = GetCouponList(shopid); VShopInfo vshop = _iVShopService.GetVShopByShopId(shopid); if (coupons != null) { ViewBag.CouponList = coupons.ToArray().Select(a => new UserCouponInfo { ShopId = a.ShopId, CouponId = a.Id, Price = a.Price, PerMax = a.PerMax, OrderAmount = a.OrderAmount, Num = a.Num, StartTime = a.StartTime, EndTime = a.EndTime, CreateTime = a.CreateTime, CouponName = a.CouponName, VShop = vshop, ReceiveStatus = Receive(a.Id) }).Where(p => p.ReceiveStatus != 2 && p.ReceiveStatus != 4);//优惠券已经过期、优惠券已领完,则不显示在店铺优惠券列表中 } ViewBag.Shopid = shopid; ViewBag.VShopid = vshop != null ? vshop.Id : 0; var isFav = _iShopService.IsFavoriteShop(CurrentUser.Id, shopid); string favText; if (isFav) { favText = "已收藏"; } else { favText = "收藏店铺"; } ViewBag.FavText = favText; WXShopInfo wxinfo = _iVShopService.GetVShopSetting(shopid) ?? new WXShopInfo() { FollowUrl = string.Empty }; ViewBag.FollowUrl = wxinfo.FollowUrl; return(View()); }
private void AddVshopBuyNumber(IEnumerable <long> orderIds) { IEnumerable <long> source = Enumerable.Select <OrderInfo, long>((IEnumerable <OrderInfo>)Instance <IOrderService> .Create.GetOrders(orderIds), (Func <OrderInfo, long>)(item => item.ShopId)); IVShopService vshopService = Instance <IVShopService> .Create; foreach (long vshopId in Enumerable.Where <long>(Enumerable.Select <long, long>(source, (Func <long, long>)(item => { VShopInfo vshopByShopId = vshopService.GetVShopByShopId(item); if (vshopByShopId != null) { return(vshopByShopId.Id); } return(0L); })), (Func <long, bool>)(item => item > 0L))) { vshopService.AddBuyNumber(vshopId); } }
private void AddVshopBuyNumber(IEnumerable <long> orderIds) { IEnumerable <long> orders = from item in ServiceHelper.Create <IOrderService>().GetOrders(orderIds) select item.ShopId; IVShopService vShopService = ServiceHelper.Create <IVShopService>(); IEnumerable <long> nums = orders.Select <long, long>((long item) => { VShopInfo vShopByShopId = vShopService.GetVShopByShopId(item); if (vShopByShopId != null) { return(vShopByShopId.Id); } return(0); }).Where((long item) => item > 0); foreach (long num in nums) { vShopService.AddBuyNumber(num); } }
public ActionResult EditVShop(long shopId) { if (shopId != CurrentSellerManager.ShopId) { throw new HimallException("获取诊所信息错误"); } var vshop = _iVShopService.GetVShopByShopId(shopId); if (vshop == null) { vshop = new VShopInfo(); } else { vshop.Logo = Core.HimallIO.GetRomoteImagePath(vshop.Logo); vshop.BackgroundImage = Core.HimallIO.GetRomoteImagePath(vshop.BackgroundImage); vshop.WXLogo = Core.HimallIO.GetRomoteImagePath(vshop.WXLogo); } ViewBag.ShopId = CurrentSellerManager.ShopId; return(View(vshop)); }
public JsonResult GetCartProducts() { ShoppingCartInfo cart = (new CartHelper()).GetCart(base.CurrentUser.Id); IProductService productService = ServiceHelper.Create <IProductService>(); IShopService shopService = ServiceHelper.Create <IShopService>(); IVShopService vShopService = ServiceHelper.Create <IVShopService>(); var collection = cart.Items.Select((ShoppingCartItem item) => { ProductInfo product = productService.GetProduct(item.ProductId); ShopInfo shop = shopService.GetShop(product.ShopId, false); if (shop == null) { return(null); } VShopInfo vShopByShopId = vShopService.GetVShopByShopId(shop.Id); SKUInfo sku = productService.GetSku(item.SkuId); return(new { cartItemId = item.Id, skuId = item.SkuId, id = product.Id, imgUrl = string.Concat(product.ImagePath, "/1_50.png"), name = product.ProductName, price = sku.SalePrice, count = item.Quantity, shopId = shop.Id, vshopId = (vShopByShopId == null ? 0 : vShopByShopId.Id), shopName = shop.ShopName, shopLogo = (vShopByShopId == null ? "" : vShopByShopId.Logo), status = (product.AuditStatus != ProductInfo.ProductAuditStatus.Audited || product.SaleStatus != ProductInfo.ProductSaleStatus.OnSale ? 0 : 1) }); }).OrderBy((s) => s.vshopId); var variable = new { products = collection, amount = collection.Sum((item) => item.price * item.count), totalCount = collection.Sum((item) => item.count) }; return(Json(variable)); }
public JsonResult Search(string keywords = "", string exp_keywords = "", long cid = 0L, long b_id = 0L, string a_id = "", int orderKey = 1, int orderType = 1, int pageNo = 1, int pageSize = 6, long vshopId = 0L, string t = "") { long shopId = -1; if (vshopId > 0) { VShopInfo vShop = ServiceHelper.Create <IVShopService>().GetVShop(vshopId); if (vShop != null) { shopId = vShop.ShopId; } } if (!string.IsNullOrWhiteSpace(keywords)) { keywords = keywords.Trim(); } ProductSearch productSearch = new ProductSearch() { shopId = shopId, BrandId = b_id, CategoryId = cid, Ex_Keyword = exp_keywords, Keyword = keywords, OrderKey = orderKey, OrderType = orderType == 1, AttrIds = new List <string>(), PageNumber = pageNo, PageSize = pageSize }; PageModel <ProductInfo> pageModel = ServiceHelper.Create <IProductService>().SearchProduct(productSearch); int total = pageModel.Total; ProductInfo[] array = pageModel.Models.ToArray(); ICommentService commentService = ServiceHelper.Create <ICommentService>(); var variable = from item in array select new { id = item.Id, name = item.ProductName, price = item.MinSalePrice.ToString("F2"), commentsCount = commentService.GetCommentsByProductId(item.Id).Count(), img = item.GetImage(ProductInfo.ImageSize.Size_350, 1) }; return(Json(variable)); }