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;
        }
Beispiel #2
0
 public static void ConvertShoppingCartToDataBase(ShoppingCartInfo shoppingCart)
 {
     ShoppingProvider provider = ShoppingProvider.Instance();
     Member user = HiContext.Current.User as Member;
     if (user != null)
     {
         if (shoppingCart.LineItems.Count > 0)
         {
             foreach (ShoppingCartItemInfo info in shoppingCart.LineItems.Values)
             {
                 provider.AddLineItem(user, info.ProductId, info.SkuId, info.Quantity);
             }
         }
         if (shoppingCart.LineGifts.Count > 0)
         {
             foreach (ShoppingCartGiftInfo info2 in shoppingCart.LineGifts)
             {
                 provider.AddGiftItem(info2.GiftId, info2.Quantity);
             }
         }
     }
 }
Beispiel #3
0
 public override ShoppingCartInfo GetShoppingCart()
 {
     XmlDocument shoppingCartData = this.GetShoppingCartData();
     ShoppingCartInfo cartInfo = null;
     XmlNodeList list = shoppingCartData.SelectNodes("//sc/lis/l");
     XmlNodeList list2 = shoppingCartData.SelectNodes("//sc/gf/l");
     if (((list != null) && (list.Count > 0)) || ((list2 != null) && (list2.Count > 0)))
     {
         cartInfo = new ShoppingCartInfo();
     }
     if ((list != null) && (list.Count > 0))
     {
         IList<string> skuIds = new List<string>();
         Dictionary<string, int> productQuantityList = new Dictionary<string, int>();
         Dictionary<string, int> productIdList = new Dictionary<string, int>();
         foreach (XmlNode node in list)
         {
             skuIds.Add(node.Attributes["s"].Value);
             productQuantityList.Add(node.Attributes["s"].Value, int.Parse(node.Attributes["q"].Value));
             productIdList.Add(node.Attributes["s"].Value, int.Parse(node.Attributes["p"].Value));
         }
         this.LoadCartProduct(cartInfo, productQuantityList, skuIds, productIdList);
     }
     if ((list2 != null) && (list2.Count > 0))
     {
         StringBuilder builder = new StringBuilder();
         Dictionary<int, int> giftIdList = new Dictionary<int, int>();
         Dictionary<int, int> giftQuantityList = new Dictionary<int, int>();
         foreach (XmlNode node2 in list2)
         {
             builder.AppendFormat("{0},", int.Parse(node2.Attributes["g"].Value));
             giftIdList.Add(int.Parse(node2.Attributes["g"].Value), int.Parse(node2.Attributes["g"].Value));
             giftQuantityList.Add(int.Parse(node2.Attributes["g"].Value), int.Parse(node2.Attributes["q"].Value));
         }
         this.LoadCartGift(cartInfo, giftIdList, giftQuantityList, builder.ToString());
     }
     return cartInfo;
 }
Beispiel #4
0
        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;
            }
        }
Beispiel #5
0
 OrderInfo GetOrderInfo(ShoppingCartInfo shoppingCartInfo)
 {
     OrderInfo orderInfo = ShoppingProcessor.ConvertShoppingCartToOrder(shoppingCartInfo, isGroupBuy, isCountDown, isSignBuy);
     if (orderInfo == null)
     {
         return null;
     }
     if (isGroupBuy)
     {
         GroupBuyInfo productGroupBuyInfo = ProductBrowser.GetProductGroupBuyInfo(shoppingCartInfo.LineItems[productSku].ProductId);
         orderInfo.GroupBuyId = productGroupBuyInfo.GroupBuyId;
         orderInfo.NeedPrice = productGroupBuyInfo.NeedPrice;
     }
     orderInfo.OrderId = 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(txtMessage.Text);
     orderInfo.OrderStatus = OrderStatus.WaitBuyerPay;
     orderInfo.RefundStatus = RefundStatus.None;
     FillOrderCoupon(orderInfo);
     FillOrderShippingMode(orderInfo, shoppingCartInfo);
     FillOrderOptions(orderInfo);
     FillOrderPaymentMode(orderInfo);
     return orderInfo;
 }
Beispiel #6
0
 void FillOrderShippingMode(OrderInfo orderInfo, ShoppingCartInfo shoppingCartInfo)
 {
     orderInfo.ShippingRegion = dropRegions.SelectedRegions;
     orderInfo.Address = Globals.HtmlEncode(txtAddress.Text);
     orderInfo.ZipCode = txtZipcode.Text;
     orderInfo.ShipTo = Globals.HtmlEncode(txtShipTo.Text);
     orderInfo.TelPhone = txtTelPhone.Text;
     orderInfo.CellPhone = txtCellPhone.Text;
     if (!string.IsNullOrEmpty(inputShippingModeId.Value))
     {
         orderInfo.ShippingModeId = int.Parse(inputShippingModeId.Value, NumberStyles.None);
     }
     if (dropRegions.GetSelectedRegionId().HasValue)
     {
         orderInfo.RegionId = dropRegions.GetSelectedRegionId().Value;
     }
     ShippingModeInfo shippingMode = ShoppingProcessor.GetShippingMode(orderInfo.ShippingModeId, true);
     if (shippingMode != null)
     {
         orderInfo.ModeName = shippingMode.Name;
         orderInfo.Freight = ShoppingProcessor.CalcFreight(orderInfo.RegionId, shoppingCartInfo.Weight, shippingMode);
         orderInfo.AdjustedFreight = orderInfo.Freight;
     }
 }
Beispiel #7
0
 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();
 }
Beispiel #8
0
 public override ShoppingCartInfo GetShoppingCart(int userId)
 {
     ShoppingCartInfo info = new ShoppingCartInfo();
     DbCommand sqlStringCommand = database.GetSqlStringCommand("SELECT * FROM Hishop_ShoppingCarts WHERE UserId = @UserId and ProductId in (select ProductId from Hishop_Products where SaleStatus=@SaleStatus); SELECT * FROM Hishop_GiftShoppingCarts gc JOIN Hishop_Gifts g ON gc.GiftId = g.GiftId WHERE gc.UserId = @UserId");
     database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, userId);
     database.AddInParameter(sqlStringCommand, "@SaleStatus", DbType.Int32, ProductSaleStatus.OnSale);
     using (IDataReader reader = database.ExecuteReader(sqlStringCommand))
     {
         Hidistro.Membership.Context.Member user = HiContext.Current.User as Hidistro.Membership.Context.Member;
         while (reader.Read())
         {
             ShoppingCartItemInfo info2 = GetCartItemInfo(user, (int)reader["ProductId"], (string)reader["SkuId"], (int)reader["Quantity"]);
             if (info2 != null)
             {
                 info.LineItems.Add((string)reader["SkuId"], info2);
             }
         }
         reader.NextResult();
         while (reader.Read())
         {
             ShoppingCartGiftInfo item = DataMapper.PopulateGiftCartItem(reader);
             item.Quantity = (int)reader["Quantity"];
             info.LineGifts.Add(item);
         }
     }
     return info;
 }
Beispiel #9
0
 public override ShoppingCartInfo GetShoppingCart(int userId)
 {
     ShoppingCartInfo info = new ShoppingCartInfo();
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM distro_ShoppingCarts WHERE UserId = @UserId AND DistributorUserId = @DistributorUserId and ProductId in (select ProductId from distro_Products where SaleStatus=@SaleStatus AND DistributorUserId=@DistributorUserId);SELECT gc.UserId,gc.Quantity,gc.AddTime,g.*,hg.Unit,hg.LongDescription,hg.CostPrice,hg.ImageUrl,hg.ThumbnailUrl40,hg.ThumbnailUrl60,hg.ThumbnailUrl100,hg.PurchasePrice,hg.MarketPrice,hg.IsDownLoad FROM distro_GiftShopingCarts gc JOIN distro_Gifts g ON gc.GiftId = g.GiftId join Hishop_Gifts hg on hg.GiftId=g.GiftId WHERE gc.UserId =@UserId AND g.DistributorUserId=@DistributorUserId");
     this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, userId);
     this.database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.SiteSettings.UserId);
     this.database.AddInParameter(sqlStringCommand, "@SaleStatus", DbType.Int32, ProductSaleStatus.OnSale);
     using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
     {
         Member user = HiContext.Current.User as Member;
         while (reader.Read())
         {
             ShoppingCartItemInfo info2 = this.GetCartItemInfo(user, (int) reader["ProductId"], (string) reader["SkuId"], (int) reader["Quantity"]);
             if (info2 != null)
             {
                 info.LineItems.Add((string) reader["SkuId"], info2);
             }
         }
         reader.NextResult();
         while (reader.Read())
         {
             ShoppingCartGiftInfo item = DataMapper.PopulateGiftCartItem(reader);
             item.Quantity = (int) reader["Quantity"];
             info.LineGifts.Add(item);
         }
     }
     return info;
 }
Beispiel #10
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;
 }
Beispiel #11
0
 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 GetShoppingCart(string productSkuId, int buyAmount)
 {
     ShoppingCartInfo info = new ShoppingCartInfo();
     MemberInfo currentMember = MemberProcessor.GetCurrentMember();
     ShoppingCartItemInfo item = new ShoppingCartDao().GetCartItemInfo(currentMember, productSkuId, buyAmount);
     if (item == null)
     {
         return null;
     }
     info.LineItems.Add(item);
     return info;
 }
 public static OrderInfo ConvertShoppingCartToOrder(ShoppingCartInfo shoppingCart, bool isCountDown, bool isSignBuy)
 {
     if (shoppingCart.LineItems.Count == 0)
     {
         return null;
     }
     OrderInfo info = new OrderInfo {
         Points = shoppingCart.GetPoint(),
         ReducedPromotionId = shoppingCart.ReducedPromotionId,
         ReducedPromotionName = shoppingCart.ReducedPromotionName,
         ReducedPromotionAmount = shoppingCart.ReducedPromotionAmount,
         IsReduced = shoppingCart.IsReduced,
         SentTimesPointPromotionId = shoppingCart.SentTimesPointPromotionId,
         SentTimesPointPromotionName = shoppingCart.SentTimesPointPromotionName,
         IsSendTimesPoint = shoppingCart.IsSendTimesPoint,
         TimesPoint = shoppingCart.TimesPoint,
         FreightFreePromotionId = shoppingCart.FreightFreePromotionId,
         FreightFreePromotionName = shoppingCart.FreightFreePromotionName,
         IsFreightFree = shoppingCart.IsFreightFree
     };
     string str = string.Empty;
     if (shoppingCart.LineItems.Count > 0)
     {
         foreach (ShoppingCartItemInfo info2 in shoppingCart.LineItems)
         {
             str = str + string.Format("'{0}',", info2.SkuId);
         }
     }
     if (shoppingCart.LineItems.Count > 0)
     {
         foreach (ShoppingCartItemInfo info2 in shoppingCart.LineItems)
         {
             LineItemInfo info3 = new LineItemInfo {
                 SkuId = info2.SkuId,
                 ProductId = info2.ProductId,
                 SKU = info2.SKU,
                 Quantity = info2.Quantity,
                 ShipmentQuantity = info2.ShippQuantity,
                 ItemCostPrice = new SkuDao().GetSkuItem(info2.SkuId).CostPrice,
                 ItemListPrice = info2.MemberPrice,
                 ItemAdjustedPrice = info2.AdjustedPrice,
                 ItemDescription = info2.Name,
                 ThumbnailsUrl = info2.ThumbnailUrl40,
                 ItemWeight = info2.Weight,
                 SKUContent = info2.SkuContent,
                 PromotionId = info2.PromotionId,
                 PromotionName = info2.PromotionName
             };
             info.LineItems.Add(info3.SkuId, info3);
         }
     }
     info.Tax = 0.00M;
     info.InvoiceTitle = "";
     return info;
 }
Beispiel #14
0
        public static OrderInfo ConvertShoppingCartToOrder(ShoppingCartInfo shoppingCart, bool isGroupBuy, bool isCountDown, bool isSignBuy)
        {
            if ((shoppingCart.LineItems.Count == 0) && (shoppingCart.LineGifts.Count == 0))
            {
                return null;
            }
            OrderInfo info = new OrderInfo();
            info.ActivityId = shoppingCart.FeeFreeActivityId;
            info.ActivityName = shoppingCart.FeeFreeName;
            info.OrderOptionFree = shoppingCart.OrderOptionFree;
            info.ProcedureFeeFree = shoppingCart.ProcedureFeeFree;
            info.EightFree = shoppingCart.EightFree;
            info.DiscountId = shoppingCart.DiscountActivityId;
            info.DiscountName = shoppingCart.DiscountName;
            info.DiscountValue = shoppingCart.DiscountValue;
            info.DiscountValueType = shoppingCart.DiscountValueType;
            //OrderInfo info = info6;

            string skuIds = string.Empty;
            if (shoppingCart.LineItems.Values.Count > 0)
            {
                foreach (ShoppingCartItemInfo item in shoppingCart.LineItems.Values)
                {
                    skuIds = skuIds + string.Format("'{0}',", item.SkuId);
                }
            }

            Dictionary<string, decimal> costPriceForItems = new Dictionary<string, decimal>();
            if (!string.IsNullOrEmpty(skuIds))
            {
                skuIds = skuIds.Substring(0, skuIds.Length - 1);
                costPriceForItems = ShoppingProvider.Instance().GetCostPriceForItems(skuIds);
            }

            if (shoppingCart.LineItems.Values.Count > 0)
            {
                foreach (ShoppingCartItemInfo info2 in shoppingCart.LineItems.Values)
                {
                    decimal memberPrice = info2.MemberPrice;
                    decimal costPrice = 0M;
                    if (((info2.WholesaleDiscountId > 0) && !string.IsNullOrEmpty(info2.WholesaleDiscountName)) && info2.DiscountRate.HasValue)
                    {
                        memberPrice = info2.MemberPrice * (info2.DiscountRate.Value / 100M);
                    }
                    if ((isGroupBuy || isCountDown) || isSignBuy)
                    {
                        costPrice = ShoppingProvider.Instance().GetCostPrice(info2.SkuId);
                    }
                    else if (costPriceForItems.ContainsKey(info2.SkuId))
                    {
                        costPrice = costPriceForItems[info2.SkuId];
                    }
                    LineItemInfo info3 = new LineItemInfo(info2.SkuId, info2.ProductId, info2.SKU, info2.Quantity, info2.Quantity + info2.GiveQuantity, costPrice, info2.MemberPrice, memberPrice, info2.Name, info2.ThumbnailUrl40, info2.Weight, info2.PurchaseGiftId, info2.PurchaseGiftName, info2.WholesaleDiscountId, info2.WholesaleDiscountName, info2.SkuContent);
                    info.LineItems.Add(info3.SkuId, info3);
                }
            }
            if (shoppingCart.LineGifts.Count > 0)
            {
                foreach (ShoppingCartGiftInfo info4 in shoppingCart.LineGifts)
                {
                    OrderGiftInfo item = new OrderGiftInfo();
                    item.GiftId = info4.GiftId;
                    item.GiftName = info4.Name;
                    item.Quantity = info4.Quantity;
                    item.ThumbnailsUrl = info4.ThumbnailUrl40;
                    if (HiContext.Current.SiteSettings.IsDistributorSettings)
                    {
                        item.CostPrice = info4.PurchasePrice;
                    }
                    else
                    {
                        item.CostPrice = info4.CostPrice;
                    }
                    info.Gifts.Add(item);
                }
            }
            return info;
        }
Beispiel #15
0
 void LoadCartGift(ShoppingCartInfo cartInfo, Dictionary<int, int> giftIdList, Dictionary<int, int> giftQuantityList, string giftIds)
 {
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand(string.Format("SELECT * FROM Hishop_Gifts WHERE GiftId in {0}", giftIds.TrimEnd(new char[] { ',' })));
     using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
     {
         while (reader.Read())
         {
             ShoppingCartGiftInfo item = DataMapper.PopulateGiftCartItem(reader);
             item.Quantity = giftQuantityList[item.GiftId];
             cartInfo.LineGifts.Add(item);
         }
     }
 }
Beispiel #16
0
 protected override void OnInit(EventArgs e)
 {
     if ((int.TryParse(Page.Request.QueryString["buyAmount"], out buyAmount) && !string.IsNullOrEmpty(Page.Request.QueryString["productSku"])) && (!string.IsNullOrEmpty(Page.Request.QueryString["from"]) && (Page.Request.QueryString["from"] == "groupBuy")))
     {
         productSku = Page.Request.QueryString["productSku"];
         isGroupBuy = true;
         shoppingCart = ShoppingCartProcessor.GetGroupBuyShoppingCart(productSku, buyAmount);
         buytype = "GroupBuy";
     }
     else if ((int.TryParse(Page.Request.QueryString["buyAmount"], out buyAmount) && !string.IsNullOrEmpty(Page.Request.QueryString["productSku"])) && (!string.IsNullOrEmpty(Page.Request.QueryString["from"]) && (Page.Request.QueryString["from"] == "countDown")))
     {
         productSku = Page.Request.QueryString["productSku"];
         isCountDown = true;
         shoppingCart = ShoppingCartProcessor.GetCountDownShoppingCart(productSku, buyAmount);
         buytype = "CountDown";
     }
     else if ((int.TryParse(Page.Request.QueryString["buyAmount"], out buyAmount) && !string.IsNullOrEmpty(Page.Request.QueryString["productSku"])) && (!string.IsNullOrEmpty(Page.Request.QueryString["from"]) && (Page.Request.QueryString["from"] == "signBuy")))
     {
         productSku = Page.Request.QueryString["productSku"];
         isSignBuy = true;
         shoppingCart = ShoppingCartProcessor.GetShoppingCart(productSku, buyAmount);
     }
     else
     {
         shoppingCart = ShoppingCartProcessor.GetShoppingCart();
         if ((shoppingCart != null) && (shoppingCart.Quantity == 0))
         {
             buytype = "0";
         }
     }
     if (shoppingCart == null)
     {
         Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该件商品已经被管理员删除"));
     }
     else
     {
         if (SkinName == null)
         {
             SkinName = "Skin-SubmmitOrder.html";
         }
         base.OnInit(e);
     }
 }
Beispiel #17
0
 void LoadCartProduct(ShoppingCartInfo cartInfo, Dictionary<string, int> productQuantityList, IList<string> skuIds, Dictionary<string, int> productIdList)
 {
     foreach (string str in skuIds)
     {
         ShoppingCartItemInfo info = this.GetCartItemInfo(productIdList[str], str, productQuantityList[str]);
         if (info != null)
         {
             cartInfo.LineItems.Add(str, info);
         }
     }
 }
Beispiel #18
0
        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 = "暂无";
            //    }
        }
Beispiel #19
0
 public ShoppingCartInfo GetShoppingCart(MemberInfo member)
 {
     ShoppingCartInfo info = new ShoppingCartInfo();
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_ShoppingCarts WHERE UserId = @UserId");
     this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, member.UserId);
     using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
     {
         while (reader.Read())
         {
             ShoppingCartItemInfo item = this.GetCartItemInfo(member, (string) reader["SkuId"], (int) reader["Quantity"]);
             if (item != null)
             {
                 info.LineItems.Add(item);
             }
         }
     }
     return info;
 }
Beispiel #20
0
 void LoadCartGift(ShoppingCartInfo cartInfo, Dictionary<int, int> giftIdList, Dictionary<int, int> giftQuantityList, string giftIds)
 {
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand(string.Format("SELECT g.*,hg.Unit,hg.LongDescription,hg.CostPrice,hg.ImageUrl,hg.ThumbnailUrl40,hg.ThumbnailUrl60,hg.ThumbnailUrl100,hg.PurchasePrice,hg.MarketPrice,hg.IsDownLoad FROM distro_Gifts g ON gc.GiftId = g.GiftId join Hishop_Gifts hg on hg.GiftId=g.GiftId WHERE g.GiftId IN ({0}) g.DistributorUserId={1}", giftIds.TrimEnd(new char[] { ',' }), HiContext.Current.SiteSettings.UserId.Value));
     using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
     {
         while (reader.Read())
         {
             ShoppingCartGiftInfo item = DataMapper.PopulateGiftCartItem(reader);
             item.Quantity = giftQuantityList[item.GiftId];
             cartInfo.LineGifts.Add(item);
         }
     }
 }