public static ShoppingCartInfo GetGroupBuyShoppingCart(int groupbuyId, string productSkuId, int buyAmount)
        {
            ShoppingCartItemInfo info5;
            ShoppingCartInfo info = new ShoppingCartInfo();
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();
            ShoppingCartItemInfo info3 = new ShoppingCartDao().GetCartItemInfo(currentMember, productSkuId, buyAmount);
            if (info3 == null)
            {
                return null;
            }
            GroupBuyInfo groupBuy = GroupBuyBrowser.GetGroupBuy(groupbuyId);
            if (((groupBuy == null) || (groupBuy.StartDate > DateTime.Now)) || (groupBuy.Status != GroupBuyStatus.UnderWay))
            {
                return null;
            }
            int count = groupBuy.Count;
            decimal price = groupBuy.Price;

            //info5 = new ShoppingCartItemInfo {
            //    SkuId = info3.SkuId,
            //    ProductId = info3.ProductId,
            //    SKU = info3.SKU,
            //    Name = info3.Name,
            //    MemberPrice = info5.AdjustedPrice = price,
            //    SkuContent = info3.SkuContent,
            //    Quantity = info5.ShippQuantity = buyAmount,
            //    Weight = info3.Weight,
            //    ThumbnailUrl40 = info3.ThumbnailUrl40,
            //    ThumbnailUrl60 = info3.ThumbnailUrl60,
            //    ThumbnailUrl100 = info3.ThumbnailUrl100
            //};
            info5 = new ShoppingCartItemInfo();

                info5.SkuId = info3.SkuId;
                info5.ProductId = info3.ProductId;
                info5.SKU = info3.SKU;
                info5.Name = info3.Name;
                info5.MemberPrice = info5.AdjustedPrice = price;
               info5. SkuContent = info3.SkuContent;
               info5.Quantity = info5.ShippQuantity = buyAmount;
               info5. Weight = info3.Weight;
               info5. ThumbnailUrl40 = info3.ThumbnailUrl40;
                info5.ThumbnailUrl60 = info3.ThumbnailUrl60;
                info5.ThumbnailUrl100 = info3.ThumbnailUrl100;

            info.LineItems.Add(info5);
            return info;
        }
Esempio n. 2
0
 public ShoppingCartItemInfo GetCartItemInfo(MemberInfo member, string skuId, int quantity)
 {
     ShoppingCartItemInfo info = null;
     DbCommand storedProcCommand = this.database.GetStoredProcCommand("ss_ShoppingCart_GetItemInfo");
     this.database.AddInParameter(storedProcCommand, "Quantity", DbType.Int32, quantity);
     this.database.AddInParameter(storedProcCommand, "UserId", DbType.Int32, (member != null) ? member.UserId : 0);
     this.database.AddInParameter(storedProcCommand, "SkuId", DbType.String, skuId);
     this.database.AddInParameter(storedProcCommand, "GradeId", DbType.Int32, (member != null) ? member.GradeId : 0);
     using (IDataReader reader = this.database.ExecuteReader(storedProcCommand))
     {
         if (!reader.Read())
         {
             return info;
         }
         info = new ShoppingCartItemInfo {
             SkuId = skuId,
             Quantity = info.ShippQuantity = quantity,
             ProductId = (int) reader["ProductId"]
         };
         if (reader["SKU"] != DBNull.Value)
         {
             info.SKU = (string) reader["SKU"];
         }
         info.Name = (string) reader["ProductName"];
         if (DBNull.Value != reader["Weight"])
         {
             info.Weight = (int) reader["Weight"];
         }
         info.MemberPrice = info.AdjustedPrice = (decimal) reader["SalePrice"];
         if (DBNull.Value != reader["ThumbnailUrl40"])
         {
             info.ThumbnailUrl40 = reader["ThumbnailUrl40"].ToString();
         }
         if (DBNull.Value != reader["ThumbnailUrl60"])
         {
             info.ThumbnailUrl60 = reader["ThumbnailUrl60"].ToString();
         }
         if (DBNull.Value != reader["ThumbnailUrl100"])
         {
             info.ThumbnailUrl100 = reader["ThumbnailUrl100"].ToString();
         }
         if (DBNull.Value != reader["IsfreeShipping"])
         {
             info.IsfreeShipping = Convert.ToBoolean(reader["IsfreeShipping"]);
         }
         string str = string.Empty;
         if (reader.NextResult())
         {
             while (reader.Read())
             {
                 if (!((((reader["AttributeName"] == DBNull.Value) || string.IsNullOrEmpty((string) reader["AttributeName"])) || (reader["ValueStr"] == DBNull.Value)) || string.IsNullOrEmpty((string) reader["ValueStr"])))
                 {
                     object obj2 = str;
                     str = string.Concat(new object[] { obj2, reader["AttributeName"], ":", reader["ValueStr"], "; " });
                 }
             }
         }
         info.SkuContent = str;
     }
     return info;
 }
Esempio n. 3
0
 public static ShoppingCartInfo GetCountDownShoppingCart(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;
     }
     CountDownInfo countDownInfo = ProductBrowser.GetCountDownInfo((int) productInfoBySku.Rows[0]["ProductId"]);
     if (countDownInfo == null)
     {
         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"], "; " });
         }
     }
     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 num, out num2);
     if ((((info3 == null) || (status != ProductSaleStatus.OnSale)) || (num <= 0)) || (num < num2))
     {
         return null;
     }
     ShoppingCartItemInfo info4 = new ShoppingCartItemInfo(info3.SkuId, info3.ProductId, info3.SKU, info3.Name, countDownInfo.CountDownPrice, 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;
 }