protected void placeOrderButton_Click(object sender, EventArgs e) { // Store the total amount decimal amount = ShoppingCartDao.GetTotalAmount(); // Get shipping ID or default to 0 int shippingId = 0; int.TryParse(shippingSelection.SelectedValue, out shippingId); // Get tax ID or default to "No tax" string shippingRegion = (HttpContext.Current.Profile as ProfileCommon).ShippingRegion; int taxId; switch (shippingRegion) { case "2": taxId = 1; break; default: taxId = 2; break; } // Create the order and store the order ID string orderId = ShoppingCartDao.CreateCommerceLibOrder(shippingId, taxId); // Process order OrderProcessor processor = new OrderProcessor(orderId); processor.Process(); // Redirect to the conformation page Response.Redirect("OrderPlaced.aspx"); }
public static ShoppingCartInfo GetGroupBuyShoppingCart(int groupbuyId, string productSkuId, int buyAmount) { ShoppingCartItemInfo info5 = new ShoppingCartItemInfo(); ShoppingCartInfo info = new ShoppingCartInfo(); MemberInfo currentMember = MemberProcessor.GetCurrentMember(); ShoppingCartItemInfo info3 = new ShoppingCartDao().GetCartItemInfo(currentMember, productSkuId, buyAmount, 0); 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.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); }
// fill shopping cart controls with data private void PopulateControls() { // Display product recommendations recommendations.LoadCartRecommendations(); // get the items in the shopping cart DataTable dt = ShoppingCartDao.GetItems(); // if the shopping cart is empty... if (dt.Rows.Count == 0) { titleLabel.Text = "Вашата количка е празна!"; grid.Visible = false; updateButton.Enabled = false; checkoutButton.Enabled = false; totalAmountLabel.Text = String.Format("{0:c}", 0); } else // if the shopping cart is not empty... { // populate the list with the shopping cart contents grid.DataSource = dt; grid.DataBind(); // setup controls titleLabel.Text = "Това са продуктите във вашата кошница:"; grid.Visible = true; updateButton.Enabled = true; checkoutButton.Enabled = true; // display the total amount decimal amount = ShoppingCartDao.GetTotalAmount(); totalAmountLabel.Text = String.Format("{0:c}", amount); } }
protected void deleteButton_Click(object sender, EventArgs e) { byte days = byte.Parse(daysList.SelectedItem.Value); ShoppingCartDao.DeleteOldCarts(days); countLabel.Text = "Старите колички са успешно прамахнати от базата данни."; }
// fill the controls with data private void PopulateControls() { // get the items in the shopping cart System.Data.DataTable dt = ShoppingCartDao.GetItems(); // if the shopping cart is empty... if (dt.Rows.Count == 0) { cartSummaryLabel.Text = "Вашата количка е празна."; totalAmountLabel.Text = String.Format("{0:c}", 0); viewCartLink.Visible = false; list.Visible = false; } else // if the shopping cart is not empty... { // populate the list with the shopping cart contents list.Visible = true; list.DataSource = dt; list.DataBind(); // set up controls cartSummaryLabel.Text = "Вашата количка "; viewCartLink.Visible = true; // display the total amount decimal amount = ShoppingCartDao.GetTotalAmount(); totalAmountLabel.Text = String.Format("{0:c}", amount); } }
public static ShoppingCartInfo GetShoppingCart(Member member, string productSkuId, int buyAmount, int storeId) { ShoppingCartInfo shoppingCartInfo = new ShoppingCartInfo(); //Member member = HiContext.Current.User as Member; ShoppingCartItemInfo cartItemInfo = new ShoppingCartDao().GetCartItemInfo(member, productSkuId, buyAmount, storeId); ShoppingCartInfo result; if (cartItemInfo == null) { result = null; } else { shoppingCartInfo.LineItems.Add(cartItemInfo); if (member != null) { decimal reducedPromotionAmount = 0m; PromotionInfo reducedPromotion = new PromotionDao().GetReducedPromotion(member, shoppingCartInfo.GetAmount(), shoppingCartInfo.GetQuantity(), out reducedPromotionAmount); if (reducedPromotion != null) { shoppingCartInfo.ReducedPromotionId = reducedPromotion.ActivityId; shoppingCartInfo.ReducedPromotionName = reducedPromotion.Name; shoppingCartInfo.ReducedPromotionAmount = reducedPromotionAmount; shoppingCartInfo.IsReduced = true; } PromotionInfo sendPromotion = new PromotionDao().GetSendPromotion(member, shoppingCartInfo.GetTotal(), PromoteType.FullAmountSentGift); if (sendPromotion != null) { shoppingCartInfo.SendGiftPromotionId = sendPromotion.ActivityId; shoppingCartInfo.SendGiftPromotionName = sendPromotion.Name; shoppingCartInfo.IsSendGift = true; } PromotionInfo sendPromotion2 = new PromotionDao().GetSendPromotion(member, shoppingCartInfo.GetTotal(), PromoteType.FullAmountSentTimesPoint); if (sendPromotion2 != null) { shoppingCartInfo.SentTimesPointPromotionId = sendPromotion2.ActivityId; shoppingCartInfo.SentTimesPointPromotionName = sendPromotion2.Name; shoppingCartInfo.IsSendTimesPoint = true; shoppingCartInfo.TimesPoint = sendPromotion2.DiscountValue; } PromotionInfo sendPromotion3 = new PromotionDao().GetSendPromotion(member, shoppingCartInfo.GetTotal(), PromoteType.FullAmountSentFreight); if (sendPromotion3 != null) { shoppingCartInfo.FreightFreePromotionId = sendPromotion3.ActivityId; shoppingCartInfo.FreightFreePromotionName = sendPromotion3.Name; shoppingCartInfo.IsFreightFree = true; } } // 促销活动(商品)中的赠送商品 if (cartItemInfo.LinePresentPro != null && cartItemInfo.LinePresentPro.Count > 0) { shoppingCartInfo.LinePresentPro = cartItemInfo.LinePresentPro; } result = shoppingCartInfo; } return(result); }
public static ShoppingCartInfo GetShoppingCart(Member member) { // 支持 App api //Member member = HiContext.Current.User as Member; ShoppingCartInfo result; if (member != null) { ShoppingCartInfo shoppingCart = new ShoppingCartDao().GetShoppingCart(member); if (shoppingCart.LineItems.Count == 0 && shoppingCart.LineGifts.Count == 0) { result = null; } else { decimal reducedPromotionAmount = 0m; PromotionInfo reducedPromotion = new PromotionDao().GetReducedPromotion(member, shoppingCart.GetAmount(), shoppingCart.GetQuantity(), out reducedPromotionAmount); if (reducedPromotion != null) { shoppingCart.ReducedPromotionId = reducedPromotion.ActivityId; shoppingCart.ReducedPromotionName = reducedPromotion.Name; shoppingCart.ReducedPromotionAmount = reducedPromotionAmount; shoppingCart.IsReduced = true; } PromotionInfo sendPromotion = new PromotionDao().GetSendPromotion(member, shoppingCart.GetTotal(), PromoteType.FullAmountSentGift); if (sendPromotion != null) { shoppingCart.SendGiftPromotionId = sendPromotion.ActivityId; shoppingCart.SendGiftPromotionName = sendPromotion.Name; shoppingCart.IsSendGift = true; } PromotionInfo sendPromotion2 = new PromotionDao().GetSendPromotion(member, shoppingCart.GetTotal(), PromoteType.FullAmountSentTimesPoint); if (sendPromotion2 != null) { shoppingCart.SentTimesPointPromotionId = sendPromotion2.ActivityId; shoppingCart.SentTimesPointPromotionName = sendPromotion2.Name; shoppingCart.IsSendTimesPoint = true; shoppingCart.TimesPoint = sendPromotion2.DiscountValue; } PromotionInfo sendPromotion3 = new PromotionDao().GetSendPromotion(member, shoppingCart.GetTotal(), PromoteType.FullAmountSentFreight); if (sendPromotion3 != null) { shoppingCart.FreightFreePromotionId = sendPromotion3.ActivityId; shoppingCart.FreightFreePromotionName = sendPromotion3.Name; shoppingCart.IsFreightFree = true; } result = shoppingCart; } } else { result = new CookieShoppingDao().GetShoppingCart(); } return(result); }
public void LoadCartRecommendations() { // display product recommendations DataTable table = ShoppingCartDao.GetRecommendations(); if (table.Rows.Count > 0) { list.ShowHeader = true; list.DataSource = table; list.DataBind(); } }
public static List <ShoppingCartInfo> GetListShoppingCart(string productSkuId, int buyAmount, int bargainDetialId = 0, int limitedTimeDiscountId = 0) { List <ShoppingCartInfo> list = new List <ShoppingCartInfo>(); ShoppingCartInfo shoppingCartInfo = new ShoppingCartInfo(); MemberInfo currentMember = MemberProcessor.GetCurrentMember(); List <ShoppingCartInfo> result; if (bargainDetialId > 0) { ShoppingCartItemInfo cartItemInfo = new ShoppingCartDao().GetCartItemInfo(currentMember, productSkuId, buyAmount, 0, bargainDetialId, 0); if (cartItemInfo == null) { result = null; return(result); } BargainDetialInfo bargainDetialInfo = new BargainDao().GetBargainDetialInfo(bargainDetialId); if (bargainDetialInfo == null) { result = null; return(result); } shoppingCartInfo.TemplateId = cartItemInfo.FreightTemplateId.ToString(); shoppingCartInfo.Amount = decimal.Round(bargainDetialInfo.Number * bargainDetialInfo.Price, 2); shoppingCartInfo.Total = shoppingCartInfo.Amount; shoppingCartInfo.Exemption = 0m; shoppingCartInfo.ShipCost = 0m; shoppingCartInfo.GetPointNumber = cartItemInfo.PointNumber * cartItemInfo.Quantity; shoppingCartInfo.MemberPointNumber = currentMember.Points; shoppingCartInfo.LineItems.Add(cartItemInfo); list.Add(shoppingCartInfo); } else { ShoppingCartItemInfo cartItemInfo = new ShoppingCartDao().GetCartItemInfo(currentMember, productSkuId, buyAmount, 0, 0, limitedTimeDiscountId); if (cartItemInfo == null) { result = null; return(result); } shoppingCartInfo.TemplateId = cartItemInfo.FreightTemplateId.ToString(); shoppingCartInfo.Amount = decimal.Round(cartItemInfo.SubTotal, 2); shoppingCartInfo.Total = shoppingCartInfo.Amount; shoppingCartInfo.Exemption = 0m; shoppingCartInfo.ShipCost = 0m; shoppingCartInfo.GetPointNumber = cartItemInfo.PointNumber * cartItemInfo.Quantity; shoppingCartInfo.MemberPointNumber = currentMember.Points; shoppingCartInfo.LineItems.Add(cartItemInfo); list.Add(shoppingCartInfo); } result = list; return(result); }
public static ShoppingCartInfo GetShoppingCart(string productSkuId, int buyAmount) { ShoppingCartInfo info = new ShoppingCartInfo(); MemberInfo currentMember = MemberProcessor.GetCurrentMember(); ShoppingCartItemInfo item = new ShoppingCartDao().GetCartItemInfo(currentMember, productSkuId, buyAmount, 0, 0, 0); if (item == null) { return(null); } info.LineItems.Add(item); return(info); }
protected void grid_RowDeleting(object sender, GridViewDeleteEventArgs e) { // Index of the row being deleted int rowIndex = e.RowIndex; // The ID of the product being deleted string productId = grid.DataKeys[rowIndex].Value.ToString(); // Remove the product from the shopping cart bool success = ShoppingCartDao.RemoveItem(productId); // Display status statusLabel.Text = success ? "Продуктът е успешно премахнат!" : "Имаше проблем с премахването на продукта! "; // Repopulate the control PopulateControls(); }
public static bool AddGiftItem(int giftId, int quantity, PromoteType promotype) { bool result; if (HiContext.Current.User.IsAnonymous) { result = new CookieShoppingDao().AddGiftItem(giftId, quantity); } else { result = new ShoppingCartDao().AddGiftItem(giftId, quantity, promotype); } return(result); }
public static List <ShoppingCartInfo> GetShoppingCartAviti([Optional, DefaultParameterValue(0)] int type)// { MemberInfo currentMember = MemberProcessor.GetCurrentMember(); if (currentMember == null) { return(null); } List <ShoppingCartInfo> shoppingCartAviti = new ShoppingCartDao().GetShoppingCartAviti(currentMember, type); if (shoppingCartAviti.Count == 0) { return(null); } return(shoppingCartAviti); }
public static ShoppingCartInfo GetShoppingCart(int Templateid) { MemberInfo currentMember = MemberProcessor.GetCurrentMember(); if (currentMember == null) { return(null); } ShoppingCartInfo shoppingCart = new ShoppingCartDao().GetShoppingCart(currentMember, Templateid); if (shoppingCart.LineItems.Count == 0) { return(null); } return(shoppingCart); }
public static List <ShoppingCartInfo> GetShoppingCartAviti(int type = 0) { MemberInfo currentMember = MemberProcessor.GetCurrentMember(); if (currentMember == null) { return(null); } List <ShoppingCartInfo> shoppingCartAviti = new ShoppingCartDao().GetShoppingCartAviti(currentMember, type); if (shoppingCartAviti.Count == 0) { return(null); } return(shoppingCartAviti); }
public static List <ShoppingCartInfo> GetOrderSummitCart() { MemberInfo currentMember = MemberProcessor.GetCurrentMember(); if (currentMember == null) { return(null); } List <ShoppingCartInfo> orderSummitCart = new ShoppingCartDao().GetOrderSummitCart(currentMember); if (orderSummitCart.Count == 0) { return(null); } return(orderSummitCart); }
public static List <ShoppingCartInfo> GetListShoppingCart(string productSkuId, int buyAmount, int bargainDetialId = 0, int limitedTimeDiscountId = 0) { List <ShoppingCartInfo> list = new List <ShoppingCartInfo>(); ShoppingCartInfo item = new ShoppingCartInfo(); MemberInfo currentMember = MemberProcessor.GetCurrentMember(); ShoppingCartItemInfo info3 = null; if (bargainDetialId > 0) { info3 = new ShoppingCartDao().GetCartItemInfo(currentMember, productSkuId, buyAmount, 0, bargainDetialId, 0); if (info3 == null) { return(null); } BargainDetialInfo bargainDetialInfo = new BargainDao().GetBargainDetialInfo(bargainDetialId); if (bargainDetialInfo == null) { return(null); } item.TemplateId = info3.FreightTemplateId.ToString(); item.Amount = decimal.Round(bargainDetialInfo.Number * bargainDetialInfo.Price, 2); item.Total = item.Amount; item.Exemption = 0M; item.ShipCost = 0M; item.GetPointNumber = info3.PointNumber * info3.Quantity; item.MemberPointNumber = currentMember.Points; item.LineItems.Add(info3); list.Add(item); return(list); } info3 = new ShoppingCartDao().GetCartItemInfo(currentMember, productSkuId, buyAmount, 0, 0, limitedTimeDiscountId); if (info3 == null) { return(null); } item.TemplateId = info3.FreightTemplateId.ToString(); item.Amount = decimal.Round(info3.SubTotal, 2); item.Total = item.Amount; item.Exemption = 0M; item.ShipCost = 0M; item.GetPointNumber = info3.PointNumber * info3.Quantity; item.MemberPointNumber = currentMember.Points; item.LineItems.Add(info3); list.Add(item); return(list); }
public static ShoppingCartInfo GetShoppingCart(int Boundlingid, int buyAmount) { ShoppingCartInfo shoppingCartInfo = new ShoppingCartInfo(); List <BundlingItemInfo> bundlingItemsByID = ProductBrowser.GetBundlingItemsByID(Boundlingid); Member member = HiContext.Current.User as Member; ShoppingCartDao shoppingCartDao = new ShoppingCartDao(); foreach (BundlingItemInfo current in bundlingItemsByID) { ShoppingCartItemInfo cartItemInfo = shoppingCartDao.GetCartItemInfo(member, current.SkuId, buyAmount * current.ProductNum, 0); //未添加门店id if (cartItemInfo != null) { shoppingCartInfo.LineItems.Add(cartItemInfo); } } return(shoppingCartInfo); }
public static ShoppingCartInfo GetShoppingCart(string productSkuId, int buyAmount) { ShoppingCartInfo shoppingCartInfo = new ShoppingCartInfo(); MemberInfo currentMember = MemberProcessor.GetCurrentMember(); ShoppingCartItemInfo cartItemInfo = new ShoppingCartDao().GetCartItemInfo(currentMember, productSkuId, buyAmount, 0, 0, 0); ShoppingCartInfo result; if (cartItemInfo == null) { result = null; } else { shoppingCartInfo.LineItems.Add(cartItemInfo); result = shoppingCartInfo; } return(result); }
protected void countButton_Click(object sender, EventArgs e) { byte days = byte.Parse(daysList.SelectedItem.Value); int oldItems = ShoppingCartDao.CountOldCarts(days); if (oldItems == -1) { countLabel.Text = "Неуспешно преброяване на старите колички!"; } else if (oldItems == 0) { countLabel.Text = "Няма намерени стари колички."; } else { countLabel.Text = "Намерени са " + oldItems.ToString() + " стари колички."; } }
public static AddCartItemStatus AddLineItem(Member member, string skuId, int quantity, int storeId) { //Member member = HiContext.Current.User as Member; if (quantity <= 0) { quantity = 1; } AddCartItemStatus result; if (member != null) { result = new ShoppingCartDao().AddLineItem(member, skuId, quantity, storeId); } else { result = new CookieShoppingDao().AddLineItem(skuId, quantity, storeId); } return(result); }
public static ShoppingCartInfo GetShoppingCart(int pcUserid = 0) { MemberInfo currentMember = MemberProcessor.GetCurrentMember(); if (currentMember == null && pcUserid == 0) { return(null); } if (pcUserid > 0) { currentMember = null; } ShoppingCartInfo shoppingCart = new ShoppingCartDao().GetShoppingCart(currentMember, pcUserid); if (shoppingCart.LineItems.Count == 0 && shoppingCart.LineGifts.Count == 0) { return(null); } return(shoppingCart); }
/* * public static ShoppingCartInfo GetShoppingCart(string currentBuyProductckIds = null, bool JoinPromotion = true) * { * MemberInfo currentMember = MemberProcessor.GetCurrentMember(); * if (currentMember == null) * { * return new CookieShoppingDao().GetShoppingCart(currentBuyProductckIds); * } * ShoppingCartInfo shoppingCart = new ShoppingCartDao().GetShoppingCart(HiContext.Current.User.UserId); * if ((shoppingCart.LineItems.Count == 0) && (shoppingCart.LineGifts.Count == 0)) * { * return null; * } * if (!string.IsNullOrEmpty(currentBuyProductckIds)) * { * string[] source = currentBuyProductckIds.Split(new char[] { ',' }); * for (int i = 0; i < shoppingCart.LineItems.Count; i++) * { * ShoppingCartItemInfo item = shoppingCart.LineItems[i]; * if (!source.Contains<string>(item.SkuId)) * { * shoppingCart.LineItems.Remove(item); * i = -1; * } * } * } * if (currentBuyProductckIds == string.Empty) * { * shoppingCart.LineItems.Clear(); * } * if (JoinPromotion) * { * decimal reducedAmount = 0M; * PromotionInfo info3 = new PromotionDao().GetReducedPromotion(user, shoppingCart.GetAmount(), shoppingCart.GetQuantity(), out reducedAmount); * if (info3 != null) * { * shoppingCart.ReducedPromotionId = info3.ActivityId; * shoppingCart.ReducedPromotionName = info3.Name; * shoppingCart.ReducedPromotionAmount = reducedAmount; * shoppingCart.IsReduced = true; * } * PromotionInfo info4 = new PromotionDao().GetSendPromotion(user, shoppingCart.GetTotal(), PromoteType.FullAmountSentGift); * if (info4 != null) * { * shoppingCart.SendGiftPromotionId = info4.ActivityId; * shoppingCart.SendGiftPromotionName = info4.Name; * shoppingCart.IsSendGift = true; * } * PromotionInfo info5 = new PromotionDao().GetSendPromotion(user, shoppingCart.GetTotal(), PromoteType.FullAmountSentTimesPoint); * if (info5 != null) * { * shoppingCart.SentTimesPointPromotionId = info5.ActivityId; * shoppingCart.SentTimesPointPromotionName = info5.Name; * shoppingCart.IsSendTimesPoint = true; * shoppingCart.TimesPoint = info5.DiscountValue; * } * PromotionInfo info6 = new PromotionDao().GetSendPromotion(user, shoppingCart.GetTotal(), PromoteType.FullAmountSentFreight); * if (info6 != null) * { * shoppingCart.FreightFreePromotionId = info6.ActivityId; * shoppingCart.FreightFreePromotionName = info6.Name; * shoppingCart.IsFreightFree = true; * } * return shoppingCart; * } * shoppingCart.IsReduced = false; * shoppingCart.IsSendGift = false; * shoppingCart.IsSendTimesPoint = false; * shoppingCart.IsFreightFree = false; * return shoppingCart; * } */ public static List <ShoppingCartInfo> GetShoppingCartAviti(int pcUserid = 0) { MemberInfo currentMember = MemberProcessor.GetCurrentMember(); if (currentMember == null && pcUserid == 0) { return(null); } if (pcUserid > 0) { currentMember = null; } List <ShoppingCartInfo> shoppingCartAviti = new ShoppingCartDao().GetShoppingCartAviti(currentMember, pcUserid); if (shoppingCartAviti.Count == 0) { return(null); } return(shoppingCartAviti); }
public static ShoppingCartInfo GetGroupBuyShoppingCart(Member member, string productSkuId, int buyAmount, int storeId) { ShoppingCartInfo shoppingCartInfo = new ShoppingCartInfo(); ShoppingCartItemInfo cartItemInfo = new ShoppingCartDao().GetCartItemInfo(member, productSkuId, buyAmount, storeId); ShoppingCartInfo result; if (cartItemInfo == null) { result = null; } else { GroupBuyInfo productGroupBuyInfo = ProductBrowser.GetProductGroupBuyInfo(cartItemInfo.ProductId); if (productGroupBuyInfo == null || productGroupBuyInfo.StartDate > DateTime.Now || productGroupBuyInfo.Status != GroupBuyStatus.UnderWay) { result = null; } else { ShoppingCartItemInfo shoppingCartItemInfo = new ShoppingCartItemInfo(); shoppingCartItemInfo.SkuId = cartItemInfo.SkuId; shoppingCartItemInfo.ProductId = cartItemInfo.ProductId; shoppingCartItemInfo.SKU = cartItemInfo.SKU; shoppingCartItemInfo.Name = cartItemInfo.Name; shoppingCartItemInfo.MemberPrice = (shoppingCartItemInfo.AdjustedPrice = productGroupBuyInfo.GroupBuyConditions[0].Price); shoppingCartItemInfo.SkuContent = cartItemInfo.SkuContent; ShoppingCartItemInfo arg_ED_0 = shoppingCartItemInfo; shoppingCartItemInfo.ShippQuantity = buyAmount; arg_ED_0.Quantity = buyAmount; shoppingCartItemInfo.Weight = cartItemInfo.Weight; shoppingCartItemInfo.ThumbnailUrl40 = cartItemInfo.ThumbnailUrl40; shoppingCartItemInfo.ThumbnailUrl60 = cartItemInfo.ThumbnailUrl60; shoppingCartItemInfo.ThumbnailUrl100 = cartItemInfo.ThumbnailUrl100; shoppingCartItemInfo.IsfreeShipping = cartItemInfo.IsfreeShipping; shoppingCartInfo.LineItems.Add(shoppingCartItemInfo); result = shoppingCartInfo; } } return(result); }
protected void updateButton_Click(object sender, EventArgs e) { // Number of rows in the GridView int rowsCount = grid.Rows.Count; // Will store a row of the GridView GridViewRow gridRow; // Will reference a quantity TextBox in the GridView TextBox quantityTextBox; // Variables to store product ID and quantity string productId; int quantity; // Was the update successful? bool success = true; // Go through the rows of the GridView for (int i = 0; i < rowsCount; i++) { // Get a row gridRow = grid.Rows[i]; // The ID of the product being deleted productId = grid.DataKeys[i].Value.ToString(); // Get the quantity TextBox in the Row quantityTextBox = (TextBox)gridRow.FindControl("editQuantity"); // Get the quantity, guarding against bogus values if (Int32.TryParse(quantityTextBox.Text, out quantity)) { success = success && ShoppingCartDao.UpdateItem(productId, quantity); } else { success = false; } // Display status message statusLabel.Text = success ? "Вашата кошница бе успешно обновена!" : "Обновяването на някои количества беше неуспешно! Моля проверете вашата кошница!"; } PopulateControls(); }
public static List <ShoppingCartInfo> GetListShoppingCart(string productSkuId, int buyAmount) { List <ShoppingCartInfo> list = new List <ShoppingCartInfo>(); ShoppingCartInfo item = new ShoppingCartInfo(); MemberInfo currentMember = MemberProcessor.GetCurrentMember(); ShoppingCartItemInfo info3 = new ShoppingCartDao().GetCartItemInfo(currentMember, productSkuId, buyAmount, 0); if (info3 == null) { return(null); } item.TemplateId = info3.FreightTemplateId.ToString(); item.Amount = info3.SubTotal; item.Total = item.Amount; item.Exemption = 0M; item.ShipCost = 0M; item.GetPointNumber = info3.PointNumber * info3.Quantity; item.MemberPointNumber = currentMember.Points; item.LineItems.Add(info3); list.Add(item); return(list); }
public static ShoppingCartInfo GetCountDownShoppingCart(string productSkuId, int buyAmount) { ShoppingCartItemInfo info4; ShoppingCartInfo info = new ShoppingCartInfo(); ShoppingCartItemInfo info2 = new ShoppingCartDao().GetCartItemInfo(MemberProcessor.GetCurrentMember(), productSkuId, buyAmount); if (info2 == null) { return(null); } CountDownInfo countDownInfo = ProductBrowser.GetCountDownInfo(info2.ProductId); if (countDownInfo == null) { return(null); } info4 = new ShoppingCartItemInfo { SkuId = info2.SkuId, ProductId = info2.ProductId, SKU = info2.SKU, Name = info2.Name, SkuContent = info2.SkuContent, Weight = info2.Weight, ThumbnailUrl40 = info2.ThumbnailUrl40, ThumbnailUrl60 = info2.ThumbnailUrl60, ThumbnailUrl100 = info2.ThumbnailUrl100, IsfreeShipping = info2.IsfreeShipping, MainCategoryPath = info2.MainCategoryPath, }; info4.MemberPrice = info4.AdjustedPrice = countDownInfo.CountDownPrice; info4.Quantity = info4.ShippQuantity = buyAmount; info.LineItems.Add(info4); return(info); }
public static ShoppingCartInfo GetCutDownShoppingCart(string productSkuId, int buyAmount, int cutDownId) { ShoppingCartItemInfo info5; ShoppingCartInfo info = new ShoppingCartInfo(); ShoppingCartItemInfo info2 = new ShoppingCartDao().GetCartItemInfo(MemberProcessor.GetCurrentMember(), productSkuId, buyAmount); if (info2 == null) { return(null); } CutDownInfo cutDownInfo = Hidistro.ControlPanel.Promotions.PromoteHelper.GetCutDown(cutDownId);; if (cutDownInfo == null) { return(null); } info5 = new ShoppingCartItemInfo { SkuId = info2.SkuId, ProductId = info2.ProductId, SKU = info2.SKU, Name = info2.Name, SkuContent = info2.SkuContent, Weight = info2.Weight, ThumbnailUrl40 = info2.ThumbnailUrl40, ThumbnailUrl60 = info2.ThumbnailUrl60, ThumbnailUrl100 = info2.ThumbnailUrl100, IsfreeShipping = info2.IsfreeShipping, MainCategoryPath = info2.MainCategoryPath, }; info5.MemberPrice = info5.AdjustedPrice = cutDownInfo.CurrentPrice; info5.Quantity = info5.ShippQuantity = buyAmount; info.LineItems.Add(info5); return(info); }
public static List <ShoppingCartInfo> GetOrderSummitCart() { MemberInfo currentMember = MemberProcessor.GetCurrentMember(); List <ShoppingCartInfo> result; if (currentMember == null) { result = null; } else { List <ShoppingCartInfo> orderSummitCart = new ShoppingCartDao().GetOrderSummitCart(currentMember); if (orderSummitCart.Count == 0) { result = null; } else { result = orderSummitCart; } } return(result); }
public static List <ShoppingCartInfo> GetShoppingCartAviti(int type = 0) { MemberInfo currentMember = MemberProcessor.GetCurrentMember(); List <ShoppingCartInfo> result; if (currentMember == null) { result = null; } else { List <ShoppingCartInfo> shoppingCartAviti = new ShoppingCartDao().GetShoppingCartAviti(currentMember, type); if (shoppingCartAviti.Count == 0) { result = null; } else { result = shoppingCartAviti; } } return(result); }