void BindDiscountName(ShoppingCartInfo cartInfo) { if (!string.IsNullOrEmpty(cartInfo.DiscountName)) { this.hlkDiscountName.NavigateUrl = string.Format(Globals.GetSiteUrls().UrlData.FormatUrl("FavourableDetails"), cartInfo.DiscountActivityId); this.hlkDiscountName.Text = cartInfo.DiscountName; switch (cartInfo.DiscountValueType) { case DiscountValueType.Amount: this.litlDiscountPrice.Text = "-" + Globals.FormatMoney(cartInfo.DiscountValue); return; case DiscountValueType.Percent: this.litlDiscountPrice.Text = "-" + Globals.FormatMoney(cartInfo.GetAmount() - ((cartInfo.DiscountValue / 100M) * cartInfo.GetAmount())); return; } } else { this.litlDiscountPrice.Text = "-" + Globals.FormatMoney(0M); this.hlkDiscountName.Text = string.Empty; } }
void BindPromote(ShoppingCartInfo shoppingCart) { if (!string.IsNullOrEmpty(shoppingCart.DiscountName)) { hlkDiscountName.NavigateUrl = string.Format(Globals.GetSiteUrls().UrlData.FormatUrl("FavourableDetails"), shoppingCart.DiscountActivityId); hlkDiscountName.Text = shoppingCart.DiscountName; switch (shoppingCart.DiscountValueType) { case DiscountValueType.Amount: { litDiscountPrice.Text = "-" + Globals.FormatMoney(shoppingCart.DiscountValue); break;//增加的 //goto Label_00F0; } case DiscountValueType.Percent: { litDiscountPrice.Text = "-" + Globals.FormatMoney(shoppingCart.GetAmount() - ((shoppingCart.DiscountValue / 100M) * shoppingCart.GetAmount())); break;//增加的 //goto Label_00F0; } } //以下是从Label_00F0复制过来 if (!string.IsNullOrEmpty(shoppingCart.FeeFreeName)) { hlkFeeFreeName.NavigateUrl = string.Format(Globals.GetSiteUrls().UrlData.FormatUrl("FavourableDetails"), shoppingCart.FeeFreeActivityId); hlkFeeFreeName.Text = shoppingCart.FeeFreeName; if (shoppingCart.EightFree) { lblShipChargeFee.Text = "免运费 -"; } if (shoppingCart.OrderOptionFree) { lblPackingChargeFree.Text = "免订单可选项费 -"; } if (shoppingCart.ProcedureFeeFree) { lblServiceChargeFree.Text = "免支付手续费 -"; //return; } } else { hlkFeeFreeName.Text = "暂无"; } } else { hlkDiscountName.Text = "暂无"; litDiscountPrice.Text = string.Empty; } //Label_00F0: // if (!string.IsNullOrEmpty(shoppingCart.FeeFreeName)) // { // hlkFeeFreeName.NavigateUrl = string.Format(Globals.GetSiteUrls().UrlData.FormatUrl("FavourableDetails"), shoppingCart.FeeFreeActivityId); // hlkFeeFreeName.Text = shoppingCart.FeeFreeName; // if (shoppingCart.EightFree) // { // lblShipChargeFee.Text = "免运费 -"; // } // if (shoppingCart.OrderOptionFree) // { // lblPackingChargeFree.Text = "免订单可选项费 -"; // } // if (shoppingCart.ProcedureFeeFree) // { // lblServiceChargeFree.Text = "免支付手续费 -"; // return; // } // } // else // { // hlkFeeFreeName.Text = "暂无"; // } }
void BindShoppingCartInfo(ShoppingCartInfo shoppingCart) { if (shoppingCart.LineItems.Values.Count > 0) { cartProductList.DataSource = shoppingCart.LineItems.Values; cartProductList.DataBind(); cartProductList.ShowProductCart(); } if (shoppingCart.LineGifts.Count > 0) { cartGiftList.DataSource = shoppingCart.LineGifts; cartGiftList.DataBind(); cartGiftList.ShowGiftCart(); } litProductAmount.Text = Globals.FormatMoney(shoppingCart.GetAmount()); lblCartTotalPrice.Value = new decimal?(shoppingCart.GetTotal()); lblOrderTotal.Value = new decimal?(shoppingCart.GetTotal()); litAllWeight.Text = shoppingCart.Weight.ToString(); decimal num = 0M; SiteSettings masterSettings = SettingsManager.GetMasterSettings(true); if ((shoppingCart.GetTotal() / masterSettings.PointsRate) > 2147483647M) { num = 2147483647M; } else if (masterSettings.PointsRate != 0M) { num = Math.Round((decimal)(shoppingCart.GetTotal() / masterSettings.PointsRate), 0); } litPoint.Text = num.ToString(); }
public static ShoppingCartInfo GetShoppingCart(string productSkuId, int buyAmount) { int num; int num2; string str2; ProductSaleStatus status; ShoppingCartInfo info = new ShoppingCartInfo(); DataTable productInfoBySku = ShoppingProcessor.GetProductInfoBySku(productSkuId); if ((productInfoBySku == null) || (productInfoBySku.Rows.Count <= 0)) { return null; } string skuContent = string.Empty; foreach (DataRow row in productInfoBySku.Rows) { if (!((((row["AttributeName"] == DBNull.Value) || string.IsNullOrEmpty((string) row["AttributeName"])) || (row["ValueStr"] == DBNull.Value)) || string.IsNullOrEmpty((string) row["ValueStr"]))) { object obj2 = skuContent; skuContent = string.Concat(new object[] { obj2, row["AttributeName"], ":", row["ValueStr"], "; " }); } } ShoppingCartItemInfo info2 = ShoppingProvider.Instance().GetCartItemInfo(HiContext.Current.User as Member, (int) productInfoBySku.Rows[0]["ProductId"], productSkuId, skuContent, buyAmount, out status, out str2, out num, out num2); if ((((info2 == null) || (status != ProductSaleStatus.OnSale)) || (num <= 0)) || (num < num2)) { return null; } info.LineItems.Add(productSkuId, info2); if (!HiContext.Current.User.IsAnonymous) { int num3; int num4; string str3; string str4; decimal num5; DiscountValueType type; bool flag; bool flag2; bool flag3; ShoppingProvider.Instance().GetPromotionsWithAmount(info.GetAmount(), out num3, out str3, out num5, out type, out num4, out str4, out flag, out flag2, out flag3); if (!((num3 <= 0) || string.IsNullOrEmpty(str3))) { info.DiscountActivityId = num3; info.DiscountName = str3; info.DiscountValue = num5; info.DiscountValueType = type; } if (!((num4 <= 0) || string.IsNullOrEmpty(str4))) { info.FeeFreeActivityId = num4; info.FeeFreeName = str4; info.EightFree = flag; info.ProcedureFeeFree = flag3; info.OrderOptionFree = flag2; } } return info; }