private StoreBasicInfoModel Transformstoreinfo(StoreBasicInfo storeinfo) { StoreBasicInfoModel result = new StoreBasicInfoModel(); result.Address = storeinfo.Address; result.BrandAuthorize = storeinfo.BrandAuthorize; result.ContactName = storeinfo.ContactName; result.CooperationMode = storeinfo.CooperationMode; result.CurrentECChannel = storeinfo.CurrentECChannel; result.ECExpValue = storeinfo.ECExpValue; result.EditDate = storeinfo.EditDate; result.EditUserName = storeinfo.EditUserName; result.EditUserSysNo = storeinfo.EditUserSysNo; result.Email = storeinfo.Email; result.ExportExpValue = storeinfo.ExportExpValue; result.HaveECExp = storeinfo.HaveECExp; result.HaveExportExp = storeinfo.HaveExportExp; result.InDate = storeinfo.InDate; result.InUserName = storeinfo.InUserName; result.InUserSysNo = storeinfo.InUserSysNo; result.MainBrand = storeinfo.MainBrand; result.MainProductCategory = storeinfo.MainProductCategory; result.Mobile = storeinfo.Mobile; result.Name = storeinfo.Name; result.Phone = storeinfo.Phone; result.QQ = storeinfo.QQ; result.Remark = storeinfo.Remark; result.SellerSysNo = storeinfo.SellerSysNo; result.Site = storeinfo.Site; result.Status = storeinfo.Status; result.StoreName = storeinfo.StoreName; result.SysNo = storeinfo.SysNo; result.ValidDate = storeinfo.ValidDate; //构造商品图片 ImageSize imageSizeMiddle = ImageUrlHelper.GetImageSize(ImageType.Middle); result.LogoURL = ProductFacade.BuildProductImage(imageSizeMiddle, storeinfo.LogoURL); //是否被收藏 #region 是否被收藏 LoginUser CurrUser = UserMgr.ReadUserInfo(); bool StoreIsWished = false; if (CurrUser == null || CurrUser.UserSysNo < 0) { StoreIsWished = false; } else { StoreIsWished = CustomerFacade.IsMyFavoriteSeller(CurrUser.UserSysNo, storeinfo.SellerSysNo.Value); } #endregion result.StoreIsWished = StoreIsWished; return(result); }
private List <ProductImageModel> TransformImageList(List <ProductImage> imageList) { imageList = imageList ?? new List <ProductImage>(); ImageSize imageSizeBig = ImageUrlHelper.GetImageSize(ImageType.Big); ImageSize imageSizeHuge = ImageUrlHelper.GetImageSize(ImageType.Huge); List <ProductImageModel> result = new List <ProductImageModel>(); foreach (var image in imageList) { ProductImageModel model = new ProductImageModel(); model.ImageUrlBig = ProductFacade.BuildProductImage(imageSizeBig, image.ResourceUrl); model.ImageUrlHuge = ProductFacade.BuildProductImage(imageSizeHuge, image.ResourceUrl); result.Add(model); } return(result); }
private List <AttachmentInfo> TransformAttachmentInfo(List <ProductItemInfo> attachmentList) { attachmentList = attachmentList ?? new List <ProductItemInfo>(); ImageSize imageSizeGift = ImageUrlHelper.GetImageSize(ImageType.Tiny); List <AttachmentInfo> result = new List <AttachmentInfo>(); foreach (var item in attachmentList) { AttachmentInfo model = new AttachmentInfo(); model.ID = item.ID; model.ProductName = item.ProductTitle; model.UnitQuantity = item.DisplayQuantity; model.ImageUrl = ProductFacade.BuildProductImage(imageSizeGift, item.DefaultImage); result.Add(model); } return(result); }
private BasicInfoModel TransformBasicInfo(ProductBasicInfo basicInfo) { BasicInfoModel result = new BasicInfoModel(); result.ID = basicInfo.ID; result.Code = basicInfo.Code; result.C3SysNo = basicInfo.CategoryID; result.ProductTitle = basicInfo.ProductTitle; result.PromotionTitle = basicInfo.PromotionTitle; result.ProductMode = basicInfo.ProductMode; result.ProducePlace = basicInfo.ProductEntryInfo.OriginCountryName; result.ProductGroupSysNo = basicInfo.ProductGroupSysNo; result.ProductStatus = (int)basicInfo.ProductStatus; result.ProductType = (int)basicInfo.ProductType; //构造商品图片 ImageSize imageSizeMiddle = ImageUrlHelper.GetImageSize(ImageType.Middle); result.DefaultImageUrl = ProductFacade.BuildProductImage(imageSizeMiddle, basicInfo.DefaultImage); return(result); }
private PromoInfoModel TransformPromoInfo(ProductPromotionInfo promotionInfo) { PromoInfoModel result = new PromoInfoModel(); result.CountDownSysNo = promotionInfo.CountdownSysNo; if (promotionInfo.Countdown != null && promotionInfo.Countdown.EndTime.HasValue) { //计算限时抢购剩余时间 if (promotionInfo.Countdown.EndTime <= DateTime.Now) { result.CountDownLeftSecond = 0; } else { var ts = promotionInfo.Countdown.EndTime.Value - DateTime.Now; result.CountDownLeftSecond = (int)ts.TotalSeconds; } } result.GroupBuyingSysNo = promotionInfo.GroupBuySysNo; //读取单品买赠和厂商赠品列表 result.GiftInfo = new List <GiftItemModel>(); if (promotionInfo.SaleGiftList == null) { promotionInfo.SaleGiftList = new List <SaleGiftInfo>(); } var giftPromoList = promotionInfo.SaleGiftList.Where(item => item.SaleGiftType == SaleGiftType.Single || item.SaleGiftType == SaleGiftType.Vendor); ImageSize imageSizeGift = ImageUrlHelper.GetImageSize(ImageType.Tiny); foreach (var promo in giftPromoList) { if (promo.GiftItemList == null) { promo.GiftItemList = new List <GiftItem>(); } foreach (var giftItem in promo.GiftItemList) { GiftItemModel model = new GiftItemModel(); model.ID = giftItem.ProductSysNo; model.ProductName = giftItem.ProductName; model.ImageUrl = ProductFacade.BuildProductImage(imageSizeGift, giftItem.DefaultImage); model.UnitQuantity = giftItem.UnitQuantity; result.GiftInfo.Add(model); } } //套餐活动信息 result.ComboInfo = new List <ComboInfoModel>(); var comboList = promotionInfo.ComboList ?? new List <ComboInfo>(); ImageSize imageSizeCombo = ImageUrlHelper.GetImageSize(ImageType.Middle); foreach (var combo in comboList) { decimal originalTotal = 0; decimal discount = 0; List <ComboItemModel> comboItemList = new List <ComboItemModel>(); foreach (var item in combo.Items) { ComboItemModel itemModel = new ComboItemModel(); itemModel.ID = item.ProductSysNo; itemModel.Code = item.ProductID; itemModel.ProductTitle = item.ProductName; itemModel.Quantity = item.Quantity; itemModel.ImageUrl = ProductFacade.BuildProductImage(imageSizeCombo, item.DefaultImage); itemModel.CurrentPrice = item.CurrentPrice; var tariffPrice = item.TariffRate * item.CurrentPrice; itemModel.TariffPrice = tariffPrice; itemModel.Discount = item.Discount; if (tariffPrice <= ConstValue.TariffFreeLimit) { originalTotal += item.CurrentPrice * item.Quantity; } else { originalTotal += (item.CurrentPrice + tariffPrice) * item.Quantity; } discount += item.Discount * item.Quantity; comboItemList.Add(itemModel); } ComboInfoModel model = new ComboInfoModel(); if (combo.SysNo.HasValue) { model.SysNo = combo.SysNo.Value; } model.SaleRuleName = combo.SaleRuleName; model.OriginalPrice = originalTotal; model.DiscountPrice = discount; model.TotalPrice = originalTotal + (discount > 0 ? -discount : discount); model.Items = comboItemList; result.ComboInfo.Add(model); } return(result); }