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); }
public static ShoppingCartInfo GetGroupBuyShoppingCart(string productSkuId, int buyAmount) { int num3; int num4; string str2; ProductSaleStatus status; ShoppingCartInfo info = new ShoppingCartInfo(); DataTable productInfoBySku = ShoppingProcessor.GetProductInfoBySku(productSkuId); if ((productInfoBySku == null) || (productInfoBySku.Rows.Count <= 0)) { return(null); } GroupBuyInfo productGroupBuyInfo = ProductBrowser.GetProductGroupBuyInfo((int)productInfoBySku.Rows[0]["ProductId"]); if (productGroupBuyInfo == null) { return(null); } int orderCount = ProductBrowser.GetOrderCount(productGroupBuyInfo.GroupBuyId); decimal currentPrice = ProductBrowser.GetCurrentPrice(productGroupBuyInfo.GroupBuyId, orderCount); 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"], "; " }); } } ShoppingProvider provider = ShoppingProvider.Instance(); Member user = HiContext.Current.User as Member; ShoppingCartItemInfo info3 = provider.GetCartItemInfo(user, (int)productInfoBySku.Rows[0]["ProductId"], productSkuId, skuContent, buyAmount, out status, out str2, out num3, out num4); if ((((info3 == null) || (status != ProductSaleStatus.OnSale)) || (num3 <= 0)) || (num3 < num4)) { return(null); } ShoppingCartItemInfo info4 = new ShoppingCartItemInfo(info3.SkuId, info3.ProductId, info3.SKU, info3.Name, currentPrice, info3.SkuContent, buyAmount, info3.Weight, 0, string.Empty, 0, 0, string.Empty, null, info3.CategoryId, info3.ThumbnailUrl40, info3.ThumbnailUrl60, info3.ThumbnailUrl100); info.LineItems.Add(productSkuId, info4); return(info); }