private OrderInfo GetOrderInfo(ShoppingCartInfo shoppingCartInfo) { OrderInfo orderInfo = ShoppingProcessor.ConvertShoppingCartToOrder(shoppingCartInfo, this.isGroupBuy, this.isCountDown, this.isSignBuy); if (orderInfo == null) { return(null); } if (this.chkTax.Checked) { orderInfo.Tax = (orderInfo.GetTotal() * decimal.Parse(this.litTaxRate.Text)) / 100M; if (this.isBundling) { BundlingInfo bundlingInfo = ProductBrowser.GetBundlingInfo(this.bundlingid); orderInfo.Tax = (bundlingInfo.Price * decimal.Parse(this.litTaxRate.Text)) / 100M; } } orderInfo.InvoiceTitle = this.txtInvoiceTitle.Text; if (this.isGroupBuy) { GroupBuyInfo productGroupBuyInfo = ProductBrowser.GetProductGroupBuyInfo(shoppingCartInfo.LineItems[this.productSku].ProductId); orderInfo.GroupBuyId = productGroupBuyInfo.GroupBuyId; orderInfo.NeedPrice = productGroupBuyInfo.NeedPrice; } if (this.isCountDown) { CountDownInfo countDownInfo = ProductBrowser.GetCountDownInfo(this.shoppingCart.LineItems[this.productSku].ProductId); orderInfo.CountDownBuyId = countDownInfo.CountDownId; } if (this.isBundling) { BundlingInfo info5 = ProductBrowser.GetBundlingInfo(this.bundlingid); orderInfo.BundlingID = info5.BundlingID; orderInfo.BundlingPrice = info5.Price; orderInfo.Points = this.shoppingCart.GetPoint(info5.Price); } orderInfo.OrderId = this.GenerateOrderId(); orderInfo.OrderDate = DateTime.Now; IUser user = HiContext.Current.User; orderInfo.UserId = user.UserId; orderInfo.Username = user.Username; if (!user.IsAnonymous) { Member member = user as Member; orderInfo.EmailAddress = member.Email; orderInfo.RealName = member.RealName; orderInfo.QQ = member.QQ; orderInfo.Wangwang = member.Wangwang; orderInfo.MSN = member.MSN; } orderInfo.Remark = Globals.HtmlEncode(this.txtMessage.Text); orderInfo.OrderStatus = OrderStatus.WaitBuyerPay; orderInfo.RefundStatus = RefundStatus.None; this.FillOrderCoupon(orderInfo); this.FillOrderShippingMode(orderInfo, shoppingCartInfo); this.FillOrderPaymentMode(orderInfo); return(orderInfo); }
private void BindShoppingCartInfo(ShoppingCartInfo shoppingCart) { if (shoppingCart.LineItems.Values.Count > 0) { this.cartProductList.DataSource = shoppingCart.LineItems.Values; this.cartProductList.DataBind(); this.cartProductList.ShowProductCart(); } if (shoppingCart.LineGifts.Count > 0) { IEnumerable <ShoppingCartGiftInfo> source = shoppingCart.LineGifts.Where <ShoppingCartGiftInfo>(delegate(ShoppingCartGiftInfo s) { return(s.PromoType == 0); }); IEnumerable <ShoppingCartGiftInfo> enumerable2 = shoppingCart.LineGifts.Where <ShoppingCartGiftInfo>(delegate(ShoppingCartGiftInfo s) { return(s.PromoType == 5); }); this.cartGiftList.DataSource = source; this.cartGiftList.FreeDataSource = enumerable2; this.cartGiftList.DataBind(); this.cartGiftList.ShowGiftCart(source.Count <ShoppingCartGiftInfo>() > 0, enumerable2.Count <ShoppingCartGiftInfo>() > 0); } if (shoppingCart.IsReduced) { this.litProductAmount.Text = string.Format("商品金额:{0}", Globals.FormatMoney(shoppingCart.GetAmount())); this.hlkReducedPromotion.Text = shoppingCart.ReducedPromotionName + string.Format(" 优惠:{0}", shoppingCart.ReducedPromotionAmount.ToString("F2")); this.hlkReducedPromotion.NavigateUrl = Globals.GetSiteUrls().UrlData.FormatUrl("FavourableDetails", new object[] { shoppingCart.ReducedPromotionId }); } if (shoppingCart.IsFreightFree) { this.hlkFeeFreight.Text = string.Format("({0})", shoppingCart.FreightFreePromotionName); this.hlkFeeFreight.NavigateUrl = Globals.GetSiteUrls().UrlData.FormatUrl("FavourableDetails", new object[] { shoppingCart.FreightFreePromotionId }); } this.lblTotalPrice.Money = shoppingCart.GetTotal(); this.lblOrderTotal.Money = shoppingCart.GetTotal(); this.litPoint.Text = shoppingCart.GetPoint().ToString(); if (this.isBundling) { BundlingInfo bundlingInfo = ProductBrowser.GetBundlingInfo(this.bundlingid); this.lblTotalPrice.Money = bundlingInfo.Price; this.lblOrderTotal.Money = bundlingInfo.Price; this.litPoint.Text = shoppingCart.GetPoint(bundlingInfo.Price).ToString(); this.litProductBundling.Text = "(捆绑价)"; } this.litAllWeight.Text = shoppingCart.Weight.ToString(); if (shoppingCart.IsSendTimesPoint) { this.hlkSentTimesPoint.Text = string.Format("({0};送{1}倍)", shoppingCart.SentTimesPointPromotionName, shoppingCart.TimesPoint.ToString("F2")); this.hlkSentTimesPoint.NavigateUrl = Globals.GetSiteUrls().UrlData.FormatUrl("FavourableDetails", new object[] { shoppingCart.SentTimesPointPromotionId }); } }