Ejemplo n.º 1
0
 public virtual PromotionContext Evaluate(PromotionFilter filter, PromotionEntriesSet sourceEntriesSet, PromotionEntriesSet targetEntriesSet, bool checkEntryLevelLimit)
 {
     var helper = new PromotionHelper();
     helper.PromotionContext.TargetGroup = PromotionGroup.GetPromotionGroup(PromotionGroup.PromotionGroupKey.Entry).Key;
     helper.PromotionContext.SourceEntriesSet = sourceEntriesSet;
     helper.PromotionContext.TargetEntriesSet = targetEntriesSet;
     helper.Eval(filter, checkEntryLevelLimit);
     return helper.PromotionContext;
 }
        public void SmallMediumParcelMania()
        {
            OrderRepository.Object.Parcels.Add(new SmallParcel(1, 1, 1, 1));
            OrderRepository.Object.Parcels.Add(new SmallParcel(1, 1, 1, 1));
            OrderRepository.Object.Parcels.Add(new SmallParcel(1, 1, 1, 1));
            OrderRepository.Object.Parcels.Add(new MediumParcel(1, 1, 1, 1));
            OrderRepository.Object.Parcels.Add(new MediumParcel(1, 1, 1, 1));
            OrderRepository.Object.Parcels.Add(new MediumParcel(1, 1, 1, 1));
            OrderRepository.Object.Parcels.Add(new MediumParcel(1, 1, 1, 1));

            var promo = PromotionHelper.GetPromotions(OrderRepository.Object.Parcels);

            Assert.AreEqual(2, promo.Count);
        }
Ejemplo n.º 3
0
        protected override void AttachChildControls()
        {
            this.orderId          = this.Page.Request.QueryString["orderId"];
            this.litShipTo        = (System.Web.UI.WebControls.Literal) this.FindControl("litShipTo");
            this.litPhone         = (System.Web.UI.WebControls.Literal) this.FindControl("litPhone");
            this.litAddress       = (System.Web.UI.WebControls.Literal) this.FindControl("litAddress");
            this.litOrderId       = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderId");
            this.litOrderDate     = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderDate");
            this.litOrderStatus   = (OrderStatusLabel)this.FindControl("litOrderStatus");
            this.rptOrderProducts = (WapTemplatedRepeater)this.FindControl("rptOrderProducts");
            this.litTotalPrice    = (System.Web.UI.WebControls.Literal) this.FindControl("litTotalPrice");
            this.litPayTime       = (System.Web.UI.WebControls.Literal) this.FindControl("litPayTime");
            this.orderStatus      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("orderStatus");
            this.txtOrderId       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtOrderId");
            this.litRemark        = (System.Web.UI.WebControls.Literal) this.FindControl("litRemark");
            this.litShipToDate    = (System.Web.UI.WebControls.Literal) this.FindControl("litShipToDate");
            this.litShippingCost  = (System.Web.UI.WebControls.Literal) this.FindControl("litShippingCost");
            this.litCounponPrice  = (System.Web.UI.WebControls.Literal) this.FindControl("litCounponPrice");
            this.litBuildPrice    = (System.Web.UI.WebControls.Literal) this.FindControl("litBuildPrice");
            this.litDisCountPrice = (System.Web.UI.WebControls.Literal) this.FindControl("litDisCountPrice");
            this.litActualPrice   = (System.Web.UI.WebControls.Literal) this.FindControl("litActualPrice");
            this.rptPromotions    = (WapTemplatedRepeater)this.FindControl("rptPromotions");
            this.litTax           = (System.Web.UI.WebControls.Literal) this.FindControl("litTax");
            this.litPayCharge     = (System.Web.UI.WebControls.Literal) this.FindControl("litPayCharge");
            OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);

            if (orderInfo == null)
            {
                base.GotoResourceNotFound("此订单已不存在");
            }
            this.litShipTo.Text    = orderInfo.ShipTo;
            this.litPhone.Text     = orderInfo.CellPhone;
            this.litAddress.Text   = orderInfo.ShippingRegion + orderInfo.Address;
            this.litOrderId.Text   = this.orderId;
            this.litOrderDate.Text = orderInfo.OrderDate.ToString();
            this.litTotalPrice.SetWhenIsNotNull(orderInfo.GetAmount().ToString("F2"));
            this.litOrderStatus.OrderStatusCode = orderInfo.OrderStatus;
            this.litPayTime.SetWhenIsNotNull((orderInfo.PayDate != System.DateTime.MinValue) ? orderInfo.PayDate.ToString("yyyy-MM-dd HH:mm:ss") : "");
            this.orderStatus.SetWhenIsNotNull(((int)orderInfo.OrderStatus).ToString());
            this.txtOrderId.SetWhenIsNotNull(this.orderId.ToString());
            this.litCounponPrice.SetWhenIsNotNull(orderInfo.CouponValue.ToString("F2"));
            this.litShippingCost.SetWhenIsNotNull(orderInfo.AdjustedFreight.ToString("F2"));
            this.litShipToDate.SetWhenIsNotNull(orderInfo.ShipToDate);
            this.litBuildPrice.SetWhenIsNotNull(orderInfo.GetAmount().ToString("F2"));
            this.litDisCountPrice.SetWhenIsNotNull(orderInfo.AdjustedDiscount.ToString("F2"));
            this.litActualPrice.SetWhenIsNotNull(orderInfo.GetTotal().ToString("F2"));
            this.litRemark.SetWhenIsNotNull(orderInfo.Remark);
            this.litTax.SetWhenIsNotNull(orderInfo.Tax.ToString("F2"));
            this.litPayCharge.SetWhenIsNotNull(orderInfo.PayCharge.ToString("F2"));
            this.rptOrderProducts.DataSource = orderInfo.LineItems.Values;
            this.rptOrderProducts.DataBind();
            System.Collections.Generic.List <System.Collections.Generic.KeyValuePair <string, string> > list = new System.Collections.Generic.List <System.Collections.Generic.KeyValuePair <string, string> >();
            if (orderInfo.IsReduced)
            {
                list.Add(new System.Collections.Generic.KeyValuePair <string, string>(PromotionHelper.GetShortName(PromoteType.Reduced), orderInfo.ReducedPromotionName + string.Format(" 优惠:{0}", orderInfo.ReducedPromotionAmount.ToString("F2"))));
            }
            if (orderInfo.IsFreightFree)
            {
                list.Add(new System.Collections.Generic.KeyValuePair <string, string>(PromotionHelper.GetShortName(PromoteType.FullAmountSentFreight), string.Format("{0}", orderInfo.FreightFreePromotionName)));
            }
            if (orderInfo.IsSendTimesPoint)
            {
                list.Add(new System.Collections.Generic.KeyValuePair <string, string>(PromotionHelper.GetShortName(PromoteType.FullAmountSentTimesPoint), string.Format("{0}:送{1}倍", orderInfo.SentTimesPointPromotionName, orderInfo.TimesPoint.ToString("F2"))));
            }
            this.rptPromotions.DataSource = list;
            this.rptPromotions.DataBind();
            PageTitle.AddSiteNameTitle("订单详情");

            WAPHeadName.AddHeadName("订单详情");
        }
Ejemplo n.º 4
0
 public virtual void Reset()
 {
     _helper = new PromotionHelper();
     _helper.PromotionContext.TargetGroup = PromotionGroup.GetPromotionGroup(PromotionGroup.PromotionGroupKey.Entry).Key;
 }