コード例 #1
0
ファイル: RecommendManager.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// 获取首页新品上市商品列表
        /// </summary>
        /// <returns></returns>
        public List <RecommendItemModel> GetHomeRecommendProductList()
        {
            var config = AppSettings.GetCachedConfig();
            List <RecommendItemModel> res        = new List <RecommendItemModel>();
            List <RecommendProduct>   resultList = RecommendFacade.QueryNewRecommendProduct(config.CountRecommendProductItemList, ConstValue.LanguageCode, ConstValue.CompanyCode);

            if (null != resultList && resultList.Count > 0)
            {
                foreach (var item in resultList)
                {
                    RecommendItemModel model = new RecommendItemModel()
                    {
                        Code     = item.ProductID,
                        ID       = item.SysNo,
                        ImageUrl = ProductFacade.BuildProductImage(ImageUrlHelper.GetImageSize(ImageType.Middle), item.DefaultImage),
                        Price    = new SalesInfoModel()
                        {
                            CurrentPrice = item.RealPrice, BasicPrice = item.BasicPrice, TariffPrice = item.TariffPrice, CashRebate = item.CashRebate
                        },
                        ProductTitle   = item.ProductTitle,
                        PromotionTitle = item.PromotionTitle
                    };
                    res.Add(model);
                }
            }
            return(res);
        }
コード例 #2
0
ファイル: RecommendManager.cs プロジェクト: sanlonezhang/ql
        public List <RecommendItemModel> GetHomeRecommendItemList(int postionID, int count)
        {
            var recommendItemEntityList      = RecommendFacade.QueryRecommendProduct(0, 0, postionID, count, ConstValue.LanguageCode, ConstValue.CompanyCode);
            List <RecommendItemModel> result = new List <RecommendItemModel>();
            ImageSize imageSize = ImageUrlHelper.GetImageSize(ImageType.Middle);

            foreach (var itemEntity in recommendItemEntityList)
            {
                RecommendItemModel itemModel = new RecommendItemModel();
                itemModel.ID             = itemEntity.SysNo;
                itemModel.ProductTitle   = itemEntity.BriefName;
                itemModel.PromotionTitle = itemEntity.PromotionTitle;
                itemModel.Code           = itemEntity.ProductID;
                itemModel.ImageUrl       = ProductFacade.BuildProductImage(imageSize, itemEntity.DefaultImage);
                var priceModel = new SalesInfoModel();
                itemModel.Price         = priceModel;
                priceModel.BasicPrice   = itemEntity.BasicPrice;
                priceModel.CurrentPrice = itemEntity.RealPrice;
                priceModel.CashRebate   = itemEntity.CashRebate;
                priceModel.TariffPrice  = itemEntity.TariffPrice;
                priceModel.FreeEntryTax = itemEntity.TariffPrice <= ConstValue.TariffFreeLimit;
                decimal realTariffPrice = priceModel.TariffPrice;
                if (priceModel.FreeEntryTax)
                {
                    realTariffPrice = 0;
                }
                priceModel.TotalPrice = itemEntity.CurrentPrice + itemEntity.CashRebate + realTariffPrice;

                result.Add(itemModel);
            }

            return(result);
        }
コード例 #3
0
        private RecommendItemModel MapFloorItem(FloorItemProduct itemEntity, ImageSize imageSize)
        {
            RecommendItemModel itemModel = new RecommendItemModel();

            itemModel.ID           = itemEntity.ProductSysNo;
            itemModel.ProductTitle = itemEntity.ProductTitle;
            //itemModel.PromotionTitle = itemEntity.PromotionTitle;
            itemModel.Code     = "";
            itemModel.ImageUrl = ProductFacade.BuildProductImage(imageSize, itemEntity.DefaultImage);
            var priceModel = new SalesInfoModel();

            itemModel.Price         = priceModel;
            priceModel.BasicPrice   = itemEntity.BasicPrice ?? 0m;
            priceModel.CurrentPrice = itemEntity.ProductPrice ?? 0m;
            priceModel.CashRebate   = itemEntity.CashRebate ?? 0m;;
            priceModel.TariffPrice  = 0;
            priceModel.TotalPrice   = itemEntity.RealPrice ?? 0m;

            return(itemModel);
        }
コード例 #4
0
        public List <RecommendItemModel> MapAdvItem(List <SaleAdvertisementItem> advItemList)
        {
            List <RecommendItemModel> result = new List <RecommendItemModel>();

            if (advItemList == null)
            {
                return(result);
            }
            ImageSize imageSize = ImageUrlHelper.GetImageSize(ImageType.Big);

            foreach (var itemEntity in advItemList)
            {
                RecommendItemModel itemModel = new RecommendItemModel();
                itemModel.ID           = itemEntity.ProductSysNo;
                itemModel.ProductTitle = itemEntity.ProductTitle;
                itemModel.Code         = itemEntity.ProductCode;
                itemModel.ImageUrl     = ProductFacade.BuildProductImage(imageSize, itemEntity.DefaultImage);
                var priceModel = new SalesInfoModel();
                itemModel.Price         = priceModel;
                priceModel.BasicPrice   = itemEntity.MarketPrice;
                priceModel.CurrentPrice = itemEntity.CurrentPrice;
                priceModel.CashRebate   = itemEntity.CashRebate;
                priceModel.FreeEntryTax = itemEntity.ProductTariffAmt <= ConstValue.TariffFreeLimit;
                priceModel.TariffPrice  = itemEntity.ProductTariffAmt;
                decimal realTariffPrice = priceModel.TariffPrice;
                if (priceModel.FreeEntryTax)
                {
                    realTariffPrice = 0;
                }
                priceModel.TotalPrice = itemEntity.CurrentPrice + itemEntity.CashRebate + realTariffPrice;

                result.Add(itemModel);
            }

            return(result);
        }