public void GetBuyPrice_first_episode_1_and_second_episode_1_and_third_episode_1_and_fourth_episode_1_and_fifth_episode_1_should_be_375() { double expected = 375; List <ShoppingProduct> shoppingProducts = new List <ShoppingProduct> { new ShoppingProduct { BuyProduct = new Product { Id = 1, ProductName = "harry potter episode 1" }, Price = 100 }, new ShoppingProduct { BuyProduct = new Product { Id = 2, ProductName = "harry potter episode 2" }, Price = 100 }, new ShoppingProduct { BuyProduct = new Product { Id = 3, ProductName = "harry potter episode 3" }, Price = 100 }, new ShoppingProduct { BuyProduct = new Product { Id = 4, ProductName = "harry potter episode 4" }, Price = 100 }, new ShoppingProduct { BuyProduct = new Product { Id = 5, ProductName = "harry potter episode 5" }, Price = 100 } }; ShoppingCartManager manager = new ShoppingCartManager(); double actual = manager.GetBuyPrice(shoppingProducts); Assert.AreEqual(expected, actual); }
protected void btnAddToCart_Click(object sender, CommandEventArgs e) { int productID = Convert.ToInt32(e.CommandArgument); int productVariantID = 0; if (ProductManager.DirectAddToCartAllowed(productID, out productVariantID)) { List<string> addToCartWarnings = ShoppingCartManager.AddToCart(ShoppingCartTypeEnum.ShoppingCart, productVariantID, string.Empty, 1); string productURL = SEOHelper.GetProductURL(productID); Response.Redirect(productURL); } else { string productURL = SEOHelper.GetProductURL(productID); Response.Redirect(productURL); } }
public ActionResult Index() { ShoppingCartManager shoppingCartManager = new ShoppingCartManager(this.sessionManager, this.db); var cartItems = shoppingCartManager.GetCart(); var cartTotalPrice = shoppingCartManager.GetCartTotalPrice(); ViewBag.GenreList = new SelectList(db.Genres, "GenreId", "Name"); ViewBag.ProductId = new SelectList(db.Productus, "ProductId", "ProductTitle"); CartViewModel cartVM = new CartViewModel() { CartItems = cartItems, TotalPrice = cartTotalPrice, }; return(View(cartVM)); }
protected void Page_Load(object sender, EventArgs e) { PaymentMethod googleCheckoutPaymentMethod = PaymentMethodManager.GetPaymentMethodBySystemKeyword("GoogleCheckout"); if (googleCheckoutPaymentMethod == null || !googleCheckoutPaymentMethod.IsActive) { this.Visible = false; return; } NopSolutions.NopCommerce.BusinessLogic.Orders.ShoppingCart Cart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); if (Cart.Count == 0) { this.Visible = false; return; } }
protected void Page_Load(object sender, EventArgs e) { PaymentMethod payPalExpressPaymentMethod = PaymentMethodManager.GetPaymentMethodBySystemKeyword("PayPalExpress"); if (payPalExpressPaymentMethod == null || !payPalExpressPaymentMethod.IsActive) { this.Visible = false; return; } Cart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); if (Cart.Count == 0) { this.Visible = false; return; } }
private void DoCustomizeItems() { try { double totalQuantity = Convert.ToDouble(lblTotalQuantityCustomise.Text.Replace("/", "").Trim().Replace(",", ".")); double customisedQuatity = Convert.ToDouble(txtQuanityCustomise.Text.Trim().Replace(",", ".")); if (customisedQuatity > 0 && ViewState["OrderID"] != null) { ShoppingCartManager cartItem = new ShoppingCartManager(); cartItem.ItemID = hdnItemIDCustomise.Value; cartItem.Description = txtItemDescCustomise.Text.Trim(); cartItem.Quantity = customisedQuatity.ToString(); cartItem.PriceSell = Convert.ToDouble(txtSellPrice.Text.Replace(",", ".")).ToString(); cartItem.PriceCost = Convert.ToDouble(txtCostPrice.Text.Replace(",", ".")).ToString(); cartItem.Unit = txtUnit.Text; cartItem.Remark = txtRemarkCustomise.Text.Trim(); cartItem.ProductNotes = txtProdNodesCustomise.Text.Trim(); cartItem.ToEdm = chkToEdm.Checked ? "1" : "0"; cartItem.ToProduct = chkToProduct.Checked ? "1" : "0"; FacadeManager facade = new FacadeManager(); string item_id = facade.CheckCustomItemExists(cartItem); if (totalQuantity == customisedQuatity) { facade.ConvertItemToCustomized(cartItem); } else if (customisedQuatity < totalQuantity) { facade.CreateNewCustomizedItem(cartItem); facade.ReduceStandardItemQuanity(cartItem); } FillShoppingCartSpecialData(); FillShoppingCartStandardData(); udpShoppingCart.Update(); } } catch (Exception ex) { } }
public ActionResult RemoveFromCart(int gameid) { ShoppingCartManager shoppingCartManager = new ShoppingCartManager(this.sessionManager, this.db); int itemCount = shoppingCartManager.RemoveFromCart(gameid); int cartItemsCount = shoppingCartManager.GetCartItemsCount(); decimal cartTotal = shoppingCartManager.GetCartTotalPrice(); var result = new CartRemoveViewModel { RemoveItemId = gameid, RemovedItemCount = itemCount, CartTotal = cartTotal, CartItemsCount = cartItemsCount }; return(Json(result)); }
protected void Page_Load(object sender, EventArgs e) { if ((NopContext.Current.User == null) || (NopContext.Current.User.IsGuest && !CustomerManager.AnonymousCheckoutAllowed)) { string loginURL = CommonHelper.GetLoginPageURL(true); Response.Redirect(loginURL); } Cart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); IndividualOrderCollection indOrders = IndividualOrderManager.GetCurrentUserIndividualOrders(); if (Cart.Count == 0 && indOrders.Count == 0) { Response.Redirect("~/ShoppingCart.aspx"); } btnNextStep.Attributes.Add("onclick", "this.disabled = true;" + Page.ClientScript.GetPostBackEventReference(this.btnNextStep, "")); }
public void GenerateReceipt_GenerateWithCorrectCartPasrameters_ReturnCorrectText() { const string expectedResult = "Tnx!\r\nName...price...count...summ\r\nbuble...1...10...8,0\r\nTotal: 4,00\r\n"; var cartManager = new ShoppingCartManager(new CommandManager()); var product = new VanilaCandy(1, "buble", 1M, 10); cartManager.AddProduct(product); cartManager.SetProductCupon(product, new DiscountProductCupon(0.8M, 3)); cartManager.SetCartCupon(new DiscountCartCupon(0.5M)); var result = new SomeReceiptGenerator().Generate(cartManager); Assert.IsTrue(result == expectedResult); }
protected void gvCustomerSessions_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { CustomerSession customerSession = (CustomerSession)e.Row.DataItem; GridView gvProductVariants = e.Row.FindControl("gvProductVariants") as GridView; if (gvProductVariants != null) { var cart = ShoppingCartManager.GetShoppingCartByCustomerSessionGuid(ShoppingCartTypeEnum.ShoppingCart, customerSession.CustomerSessionGuid); gvProductVariants.DataSource = cart; gvProductVariants.DataBind(); } } }
public void SetUp() { _cart = new Cart();; _shoppingCart = new ShoppingCartManager(_cart); // -- category _category2 = new Category("HEALTH"); _category1 = new Category("CAR"); // -- product _product1Category1 = new Product("MOTOR01", "Motor Yağı", 200.0, _category1); _product2Category1 = new Product("SILECEK", "Cam Sileceği", 50.0, _category1); _product3Category2 = new Product("BALIKY01", "Balık Yağı", 50.0, _category2); // -- add products _shoppingCart.AddItem(_product1Category1, 10); _shoppingCart.AddItem(_product2Category1, 10); }
protected void Page_Load(object sender, EventArgs e) { if ((NopContext.Current.User == null) || (NopContext.Current.User.IsGuest && !CustomerManager.AnonymousCheckoutAllowed)) { string loginURL = CommonHelper.GetLoginPageURL(true); Response.Redirect(loginURL); } Cart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); IndividualOrderCollection indOrders = IndividualOrderManager.GetCurrentUserIndividualOrders(); if (Cart.Count == 0 && indOrders.Count == 0) { Response.Redirect("~/ShoppingCart.aspx"); } if (!Page.IsPostBack) { CustomerManager.ResetCheckoutData(NopContext.Current.User.CustomerID, false); } bool shoppingCartRequiresShipping = ShippingManager.ShoppingCartRequiresShipping(Cart); if (!shoppingCartRequiresShipping) { SelectAddress(null); Response.Redirect("~/CheckoutBillingAddress.aspx"); } if (!Page.IsPostBack) { AddressCollection addresses = getAllowedShippingAddresses(NopContext.Current.User); if (addresses.Count > 0) { dlAddress.DataSource = addresses; dlAddress.DataBind(); lEnterShippingAddress.Text = GetLocaleResourceString("Checkout.OrEnterNewAddress"); } else { pnlSelectShippingAddress.Visible = false; lEnterShippingAddress.Text = GetLocaleResourceString("Checkout.EnterShippingAddress"); } } }
protected void btnAddToCart_Click(object sender, CommandEventArgs e) { int productId = Convert.ToInt32(e.CommandArgument); int productVariantId = 0; if (ProductManager.DirectAddToCartAllowed(productId, out productVariantId)) { var addToCartWarnings = ShoppingCartManager.AddToCart(ShoppingCartTypeEnum.ShoppingCart, productVariantId, string.Empty, decimal.Zero, 1); if (addToCartWarnings.Count == 0) { bool displayCart = true; if (this.RedirectCartAfterAddingProduct.HasValue) { displayCart = this.RedirectCartAfterAddingProduct.Value; } else { displayCart = SettingManager.GetSettingValueBoolean("Display.Products.DisplayCartAfterAddingProduct"); } if (displayCart) { //redirect to shopping cart page Response.Redirect(SEOHelper.GetShoppingCartUrl()); } else { //display notification message this.DisplayAlertMessage(GetLocaleResourceString("Products.ProductHasBeenAddedToTheCart")); } } else { string productURL = SEOHelper.GetProductUrl(productId); Response.Redirect(productURL); } } else { string productURL = SEOHelper.GetProductUrl(productId); Response.Redirect(productURL); } }
protected override void OnPreRender(EventArgs e) { if (SettingManager.GetSettingValueBoolean("Common.ShowMiniShoppingCart")) { var shoppingCart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); if (shoppingCart.Count == 0) { phCheckoutInfo.Visible = false; lShoppingCart.Text = GetLocaleResourceString("MiniShoppingCartBox.NoItems"); lvCart.Visible = false; } else { phCheckoutInfo.Visible = true; if (shoppingCart.Count == 1) { lShoppingCart.Text = string.Format(GetLocaleResourceString("MiniShoppingCartBox.OneItemText"), string.Format("<a href=\"{0}\" class=\"items\">{1}</a>", SEOHelper.GetShoppingCartUrl(), GetLocaleResourceString("MiniShoppingCartBox.OneItem"))); } else { lShoppingCart.Text = string.Format(GetLocaleResourceString("MiniShoppingCartBox.SeveralItemsText"), string.Format("<a href=\"{0}\" class=\"items\">{1}</a>", SEOHelper.GetShoppingCartUrl(), string.Format(GetLocaleResourceString("MiniShoppingCartBox.SeveralItems"), shoppingCart.Count))); } lblOrderSubtotal.Text = GetLocaleResourceString("MiniShoppingCartBox.OrderSubtotal", GetOrderSubtotal(shoppingCart)); if (SettingManager.GetSettingValueBoolean("Display.ItemsInMiniShoppingCart", false)) { lvCart.Visible = true; lvCart.DataSource = shoppingCart; lvCart.DataBind(); } else { lvCart.Visible = false; } } } else { this.Visible = false; } base.OnPreRender(e); }
protected void btnNewProductVariantAttributeCombination_Click(object sender, EventArgs e) { try { ProductVariant productVariant = ProductManager.GetProductVariantById(this.ProductVariantId); if (productVariant != null) { string attributes = ctrlSelectProductAttributes.SelectedAttributes; int stockQuantity = txtStockQuantity.Value; bool allowOutOfStockOrders = cbAllowOutOfStockOrders.Checked; List <string> warnings = ShoppingCartManager.GetShoppingCartItemAttributeWarnings(ShoppingCartTypeEnum.ShoppingCart, productVariant.ProductVariantId, attributes, 1, false); if (warnings.Count > 0) { StringBuilder warningsSb = new StringBuilder(); for (int i = 0; i < warnings.Count; i++) { warningsSb.Append(Server.HtmlEncode(warnings[i])); if (i != warnings.Count - 1) { warningsSb.Append("<br />"); } } pnlCombinationWarningsr.Visible = true; lCombinationWarnings.Text = warningsSb.ToString(); } else { var combination = ProductAttributeManager.InsertProductVariantAttributeCombination(productVariant.ProductVariantId, attributes, stockQuantity, allowOutOfStockOrders); } BindCombinations(); } } catch (Exception exc) { processAjaxError(exc); } }
// GET: Cart public ActionResult Index() { //sesja i kontekst jako param. ShoppingCartManager shoppingCartManager = new ShoppingCartManager(this.sessionManager, this.db); //CompareManager compareManager = new CompareManager(this.sessionManager, this.db); //zwraca liste cartItem ktora w tym momencie jest zapisana w sesji //pobieramy stan koszyka var cartItems = shoppingCartManager.GetCart(); //pobieramy laczna cene var cartTotalPrice = shoppingCartManager.GetCartTotalPrice(); //ustawiany na to co pobralismy CartViewModel cartVM = new CartViewModel() { CartItems = cartItems, TotalPrice = cartTotalPrice }; return(View(cartVM)); }
protected void Page_Load(object sender, EventArgs e) { if (Session["cart"] == null) { scm = new ShoppingCartManager(); Session["cart"] = scm; } else { scm = Session["cart"] as ShoppingCartManager; } CartView = new DataView(scm.GetCart()); if (!IsPostBack) { BindList(); } }
private RateRequest CreateRateRequest(ShipmentPackage ShipmentPackage) { // Build the RateRequest var request = new RateRequest(); request.WebAuthenticationDetail = new WebAuthenticationDetail(); request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential(); request.WebAuthenticationDetail.UserCredential.Key = SettingManager.GetSettingValue("ShippingRateComputationMethod.FedEx.Key"); // Replace "XXX" with the Key request.WebAuthenticationDetail.UserCredential.Password = SettingManager.GetSettingValue("ShippingRateComputationMethod.FedEx.Password"); // Replace "XXX" with the Password request.ClientDetail = new ClientDetail(); request.ClientDetail.AccountNumber = SettingManager.GetSettingValue("ShippingRateComputationMethod.FedEx.AccountNumber"); // Replace "XXX" with client's account number request.ClientDetail.MeterNumber = SettingManager.GetSettingValue("ShippingRateComputationMethod.FedEx.MeterNumber"); // Replace "XXX" with client's meter number request.TransactionDetail = new TransactionDetail(); request.TransactionDetail.CustomerTransactionId = "***Rate Available Services v7 Request - nopCommerce***"; // This is a reference field for the customer. Any value can be used and will be provided in the response. request.Version = new VersionId(); // WSDL version information, value is automatically set from wsdl request.ReturnTransitAndCommit = true; request.ReturnTransitAndCommitSpecified = true; request.CarrierCodes = new CarrierCodeType[2]; // Insert the Carriers you would like to see the rates for request.CarrierCodes[0] = CarrierCodeType.FDXE; request.CarrierCodes[1] = CarrierCodeType.FDXG; decimal discountAmount = decimal.Zero; Discount appliedDiscount = null; decimal subtotalWithoutPromo = decimal.Zero; decimal subtotalWithPromo = decimal.Zero; ShoppingCartManager.GetShoppingCartSubTotal(ShipmentPackage.Items, ShipmentPackage.Customer, out discountAmount, out appliedDiscount, out subtotalWithoutPromo, out subtotalWithPromo); SetShipmentDetails(request, ShipmentPackage, subtotalWithPromo); SetOrigin(request); SetDestination(request, ShipmentPackage); SetPayment(request, ShipmentPackage); SetIndividualPackageLineItems(request, ShipmentPackage, subtotalWithPromo); return(request); }
private void BindData() { if (customer != null) { ShoppingCart cart = ShoppingCartManager.GetCustomerShoppingCart(customer.CustomerId, ShoppingCartTypeEnum.ShoppingCart); if (cart.Count > 0) { pnlEmptyCart.Visible = false; pnlCart.Visible = true; gvProductVariants.DataSource = cart; gvProductVariants.DataBind(); } else { pnlEmptyCart.Visible = true; pnlCart.Visible = false; } } }
public void BindData() { //min order amount validation int paymentMethodId = 0; if (NopContext.Current.User != null) { paymentMethodId = NopContext.Current.User.LastPaymentMethodId; } decimal discountAmountBase = decimal.Zero; Discount appliedDiscount = null; List <AppliedGiftCard> appliedGiftCards = null; int redeemedRewardPoints = 0; decimal redeemedRewardPointsAmount = decimal.Zero; bool useRewardPoints = false; if (NopContext.Current.User != null) { useRewardPoints = NopContext.Current.User.UseRewardPointsDuringCheckout; } decimal?shoppingCartTotalBase = ShoppingCartManager.GetShoppingCartTotal(this.Cart, paymentMethodId, NopContext.Current.User, out discountAmountBase, out appliedDiscount, out appliedGiftCards, useRewardPoints, out redeemedRewardPoints, out redeemedRewardPointsAmount); if (shoppingCartTotalBase.HasValue) { if (shoppingCartTotalBase.Value < OrderManager.MinOrderAmount) { decimal minOrderAmount = CurrencyManager.ConvertCurrency(OrderManager.MinOrderAmount, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); lMinOrderAmount.Text = string.Format(GetLocaleResourceString("Checkout.MinOrderAmount"), PriceHelper.FormatPrice(minOrderAmount, true, false)); lMinOrderAmount.Visible = true; btnNextStep.Visible = false; } else { lMinOrderAmount.Visible = false; btnNextStep.Visible = true; } } }
public ActionResult RemoveFromCart(int carID) { ShoppingCartManager shoppingCartManager = new ShoppingCartManager(this.sessionManager, this.db); int itemCount = shoppingCartManager.RemoveFromCart(carID); int cartItemsCount = shoppingCartManager.GetCartItemsCount(); decimal cartTotal = shoppingCartManager.GetCartTotalPrice(); // Return JSON to process it in JavaScript var result = new CartRemoveViewModel { RemoveItemId = carID, RemovedItemCount = itemCount, CartTotal = cartTotal, CartItemsCount = cartItemsCount }; return(Json(result)); }
protected void gvSpecial_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int index = Convert.ToInt32(e.RowIndex); string item_id = gvShoppingSpecial.DataKeys[index].Values[1].ToString(); FacadeManager facade = new FacadeManager(); IShoppingCart cart = new ShoppingCartManager { ItemID = item_id }; facade.RemoveShoppingCartItem(cart); FillShoppingCartSpecialData(); PopulateOrderDetail(); udpShoppingCart.Update(); } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { CommonHelper.SetResponseNoCache(Response); if ((NopContext.Current.User == null) || (NopContext.Current.User.IsGuest && !CustomerManager.AnonymousCheckoutAllowed)) { string loginURL = SEOHelper.GetLoginPageUrl(true); Response.Redirect(loginURL); } ShoppingCart cart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); if (cart.Count == 0) { Response.Redirect(SEOHelper.GetShoppingCartUrl()); } this.btnNextStep.Attributes.Add("onclick", "this.disabled = true;" + Page.ClientScript.GetPostBackEventReference(this.btnNextStep, "")); }
public void BindData() { ShoppingCart Cart = ShoppingCartManager.GetShoppingCartByCustomerSessionGUID(ShoppingCartTypeEnum.Wishlist, this.CustomerSessionGuid); if (Cart.Count > 0) { pnlEmptyCart.Visible = false; pnlCart.Visible = true; rptShoppingCart.DataSource = Cart; rptShoppingCart.DataBind(); ValidateWishlist(); } else { pnlEmptyCart.Visible = true; pnlCart.Visible = false; } }
protected void ApplyGiftCardCouponCode() { string couponCode = this.txtGiftCardCouponCode.Text.Trim(); if (String.IsNullOrEmpty(couponCode)) { return; } var cart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); if (!cart.IsRecurring) { bool isGiftCardValid = GiftCardHelper.IsGiftCardValid(couponCode); if (isGiftCardValid) { pnlGiftCardWarnings.Visible = false; lblGiftCardWarning.Visible = false; string couponCodesXML = string.Empty; if (NopContext.Current.User != null) { couponCodesXML = NopContext.Current.User.GiftCardCouponCodes; } couponCodesXML = GiftCardHelper.AddCouponCode(couponCodesXML, couponCode); CustomerManager.ApplyGiftCardCouponCode(couponCodesXML); this.BindData(); } else { pnlGiftCardWarnings.Visible = true; lblGiftCardWarning.Visible = true; lblGiftCardWarning.Text = GetLocaleResourceString("ShoppingCart.GiftCards.WrongGiftCard"); } } else { pnlGiftCardWarnings.Visible = true; lblGiftCardWarning.Visible = true; lblGiftCardWarning.Text = GetLocaleResourceString("ShoppingCart.GiftCards.DontWorkWithAutoshipProducts"); } }
protected string GetOrderSubtotal(ShoppingCart shoppingCart) { decimal subTotalDiscountBase = decimal.Zero; Discount appliedDiscount = null; decimal subtotalBaseWithoutPromo = decimal.Zero; decimal subtotalBaseWithPromo = decimal.Zero; string SubTotalError = ShoppingCartManager.GetShoppingCartSubTotal(shoppingCart, NopContext.Current.User, out subTotalDiscountBase, out appliedDiscount, out subtotalBaseWithoutPromo, out subtotalBaseWithPromo); if (String.IsNullOrEmpty(SubTotalError)) { decimal subTotal = CurrencyManager.ConvertCurrency(subtotalBaseWithoutPromo, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); return(PriceHelper.FormatPrice(subTotal)); } else { return(GetLocaleResourceString("MiniShoppingCartBox.OrderSubtotal.CalculatedDuringCheckout")); } }
public void GetBuyPrice_first_episode_1_should_be_100() { double expected = 100; List <ShoppingProduct> shoppingProducts = new List <ShoppingProduct> { new ShoppingProduct { BuyProduct = new Product { Id = 1, ProductName = "harry potter episode 1" }, Price = 100 } }; ShoppingCartManager manager = new ShoppingCartManager(); double actual = manager.GetBuyPrice(shoppingProducts); Assert.AreEqual(expected, actual); }
public void GetDiscount_Ensure_Campaign_Discount_Applied_Return_True( string productName, string productDesc, double productUnitPrice, int productQuantity, double discount, DiscountType discountType, double minPurchaseAmount, double expectedResult) { var cart = new Cart(); // -- create product var product = new Product(productName, productDesc, productUnitPrice, _categoryTech); _shoppingCart = new ShoppingCartManager(cart); _shoppingCart.AddItem(product, productQuantity); // -- apply coupon var coupon = new Coupon(discount, minPurchaseAmount, discountType); cart.CartCoupons.Add(coupon); cart.CouponDiscount = new CouponManager(cart).ApplyDiscount(); Assert.AreEqual(new CouponManager(cart).GetDiscount(), expectedResult); }
protected void btnUpdate_Click(object sender, EventArgs e) { try { TextBox txtQuantity, txtRemark; string item_id; int index; foreach (GridViewRow row in gvSpCart.Rows) { index = row.RowIndex; txtRemark = row.FindControl("txtRemark") as TextBox; txtQuantity = row.FindControl("txtAantal") as TextBox; item_id = gvSpCart.DataKeys[index].Values[1].ToString(); FacadeManager facade = new FacadeManager(); IShoppingCart cart = new ShoppingCartManager { ItemID = item_id, Quantity = txtQuantity.Text.Replace(",", "."), Remark = txtRemark.Text.Trim() }; facade.UpdateShoppingCart(cart); } foreach (GridViewRow row in gvShoppingSpecial.Rows) { index = row.RowIndex; txtRemark = row.FindControl("txtRemark") as TextBox; txtQuantity = row.FindControl("txtAantalSp") as TextBox; item_id = gvShoppingSpecial.DataKeys[index].Values[1].ToString(); FacadeManager facade = new FacadeManager(); IShoppingCart cart = new ShoppingCartManager { ItemID = item_id, Quantity = txtQuantity.Text.Replace(",", "."), Remark = txtRemark.Text.Trim() }; facade.UpdateShoppingCart(cart); } FillShoppingCartStandardData(); FillShoppingCartSpecialData(); PopulateOrderDetail(); udpShoppingCart.Update(); } catch (Exception ex) { } }
private void RetrieveCart() { if (Session["Cart"] == null) { cart = new ShoppingCart(); PersistCart(cart); } else { using (manager = new ShoppingCartManager()) { cart = (ShoppingCart)Session["Cart"]; if (cart != null) { cart.ITEM_PRICE = manager.CalculateTotal(cart.Items); cart.SalesTax = Math.Round(manager.CalculateSalesTax(cart.ITEM_PRICE), 2); cart.Cost = Math.Round(cart.ITEM_PRICE + cart.SalesTax, 2); } } } }