示例#1
0
        protected override void Render(HtmlTextWriter writer)
        {
            PromotionInfo promotionInfo;

            if (this.IsAnonymous)
            {
                promotionInfo = ProductBrowser.GetAllProductPromotionInfo(this.ProductId);
            }
            else
            {
                promotionInfo = ProductBrowser.GetProductPromotionInfo(this.ProductId);
            }
            string value = string.Empty;

            if (promotionInfo != null)
            {
                string arg = Globals.GetSiteUrls().UrlData.FormatUrl("FavourableDetails", new object[]
                {
                    promotionInfo.ActivityId
                });

                //判断是否为购物车控件调用 true:是
                if (!isShoppingCart)
                {
                    switch (promotionInfo.PromoteType)
                    {
                    case PromoteType.Discount:
                        value = string.Format("<div>促销信息:<span class=\"promotiontype\">直接打折</span><span class=\"promotionname\">{0}</span></div>", promotionInfo.Name);
                        //PC端调用
                        if (!IsVshop)
                        {
                            value = string.Format("<dt>促销信息 </dt><dd><span class=\"promotiontype\">直接打折</span><span class=\"promotionname\">{0}</span></dd>    ", promotionInfo.Name);
                        }
                        if (IsVProductList)
                        {
                            value = "<div class='promoteImg'>促</div>";
                        }
                        break;

                    case PromoteType.Amount:
                        value = string.Format("<div>促销信息:<span class=\"promotiontype\">固定金额出售</span><span class=\"promotionname\">{0}</span></div>", promotionInfo.Name);
                        //PC端调用
                        if (!IsVshop)
                        {
                            value = string.Format("<dt>促销信息 </dt><dd><span class=\"promotiontype\">固定金额出售</span><span class=\"promotionname\">{0}</span></dd>    ", promotionInfo.Name);
                        }
                        if (IsVProductList)
                        {
                            value = "<div class='promoteImg'>促</div>";
                        }
                        break;

                    case PromoteType.Reduced:
                        value = string.Format("<div>促销信息:<span class=\"promotiontype\">减价优惠</span><span class=\"promotionname\">{0}</span></div>", promotionInfo.Name);
                        if (!IsVshop)
                        {
                            value = string.Format("<dt>促销信息 </dt><dd><span class=\"promotiontype\">减价优惠</span><span class=\"promotionname\">{0}</span></dd>", promotionInfo.Name);
                        }
                        if (IsVProductList)
                        {
                            value = "<div class='promoteImg'>促</div>";
                        }
                        break;

                    case PromoteType.QuantityDiscount:
                        value = string.Format("<div>促销信息:<span class=\"promotiontype\">批发打折</span><span class=\"promotionname\">{0}</span></div>", promotionInfo.Name);
                        if (!IsVshop)
                        {
                            value = string.Format("<dt>促销信息 </dt><dd><span class=\"promotiontype\">批发打折</span><span class=\"promotionname\">{0}</span></dd>", promotionInfo.Name);
                        }
                        if (IsVProductList)
                        {
                            value = "<div class='promoteImg'>促</div>";
                        }
                        break;

                    case PromoteType.SentGift:
                    {
                        GiftInfo gift = ProductBrowser.GetGift(promotionInfo.GiftID);
                        if (gift != null)
                        {
                            value = string.Format("<div>促销信息:<span class=\"promotiontype\">赠品</span><span class=\"promotionname\">{1}</span></div>", gift.Name);
                            if (!IsVshop)
                            {
                                value = string.Format("<dt>促销信息 </dt><dd><span class=\"promotiontype\">赠品</span><span class=\"promotionname\">{1}</span></dd>", gift.Name);
                            }
                            if (IsVProductList)
                            {
                                value = "<div class='promoteImg'>促</div>";
                            }
                        }
                        else
                        {
                            value = string.Format("<div>促销信息:<span class=\"promotiontype\">买商品送礼品</span><span class=\"promotionname\">{0}</span></div>", promotionInfo.Name);
                            if (!IsVshop)
                            {
                                value = string.Format("<dt>促销信息 </dt><dd><span class=\"promotiontype\">买商品送礼品</span><span class=\"promotionname\">{0}</span></dd>", promotionInfo.Name);
                            }
                            if (IsVProductList)
                            {
                                value = "<div class='promoteImg'>促</div>";
                            }
                        }
                        break;
                    }

                    case PromoteType.SentProduct:
                        value = string.Format("<div>促销信息:<span class=\"promotiontype\">有买有送</span><span class=\"promotionname\">{0}</span></div>", promotionInfo.Name);
                        if (!IsVshop)
                        {
                            value = string.Format("<dt>促销信息 </dt><dd><span class=\"promotiontype\">有买有送</span><span class=\"promotionname\">{0}</span></dd>", promotionInfo.Name);
                        }
                        if (IsVProductList)
                        {
                            value = "<div class='promoteImg'>促</div>";
                        }
                        break;

                    case PromoteType.ProductPromotion:
                        value = string.Format("<div>促销信息:<span class=\"promotiontype\">单品满减</span><span class=\"promotionname\">{0}</span></div>", promotionInfo.Name);
                        if (!IsVshop)
                        {
                            value = string.Format("<dt>促销信息 </dt><dd><span class=\"promotiontype\">单品满减</span><span class=\"promotionname\">{0}</span></dd>", promotionInfo.Name);
                        }
                        if (IsVProductList)
                        {
                            value = "<div class='promoteImg'>促</div>";
                        }
                        break;

                    case PromoteType.PresentProduct:
                        value = string.Format("<div>促销信息:<span class=\"promotiontype\">有买有送(选择商品)</span><span class=\"promotionname\">{0}</span></div>", promotionInfo.Name);
                        if (!IsVshop)
                        {
                            value = string.Format("<dt>促销信息 </dt><dd><span class=\"promotiontype\">有买有送(选择商品)</span><span class=\"promotionname\">{0}</span></dd>", promotionInfo.Name);
                        }
                        if (IsVProductList)
                        {
                            value = "<div class='promoteImg'>促</div>";
                        }
                        break;

                    case PromoteType.SecondReducePrice:
                        value = string.Format("<div>促销信息:<span class=\"promotiontype\">第二件减价</span><span class=\"promotionname\">{0}</span></div>", promotionInfo.Name);
                        if (!IsVshop)
                        {
                            value = string.Format("<dt>促销信息 </dt><dd><span class=\"promotiontype\">第二件减价</span><span class=\"promotionname\">{0}</span></dd>", promotionInfo.Name);
                        }
                        if (IsVProductList)
                        {
                            value = "<div class='promoteImg'>促</div>";
                        }
                        break;

                    case PromoteType.ProductDiscount:
                        value = string.Format("<div>促销信息:<span class=\"promotiontype\">第二件打折</span><span class=\"promotionname\">{0}</span></div>", promotionInfo.Name);
                        if (!IsVshop)
                        {
                            value = string.Format("<dt>促销信息 </dt><dd><span class=\"promotiontype\">第二件打折</span><span class=\"promotionname\">{0}</span></dd>", promotionInfo.Name);
                        }
                        if (IsVProductList)
                        {
                            value = "<div class='promoteImg'>促</div>";
                        }
                        break;
                    }
                    writer.Write(value);
                }
                else
                {
                    if (promotionInfo.PromoteType != PromoteType.PresentProduct)
                    {
                        if (IsVCartList)
                        {
                            //微信购物车显示
                            value = string.Format("<span class=\"activityname\">{0}</span>", promotionInfo.Name);
                        }
                        else
                        {
                            value = string.Format("<div class=\"promotionname\">{0}</div>", promotionInfo.Name);
                        }
                        writer.Write(value);
                    }
                }
            }
        }