/// calculate quantity and total price value for each ıtems private void nudQuantity_ValueChanged(object sender, EventArgs e) { var element = ShoppingCartClass.itemsToPurchase.Find(el => el.product.id == id); element.quantity = Convert.ToInt32(nudQuantity.Value); lblTotalPriceValue.Text = (Convert.ToInt32(nudQuantity.Value) * unitPriceValue).ToString(); System.Windows.Forms.Form f = System.Windows.Forms.Application.OpenForms["BookShopForm"]; ((BookShopForm)f).lblTotalPriceValueGeneral.Text = ShoppingCartClass.calculateActualTotalPrice().ToString(); }
public void populateShoppingCartView() { ShoppingCartItemsUserControl[] shoppingCartItemsUserControl = new ShoppingCartItemsUserControl[ShoppingCartClass.itemsToPurchase.Count]; shoppingCartItemsUserControl = ShoppingCartClass.printProducts(); if (flpShoppingCart.Controls.Count > 0) { flpShoppingCart.Controls.Clear(); } int i = 0; foreach (ItemToPurchaseClass item in ShoppingCartClass.itemsToPurchase) { flpShoppingCart.Controls.Add(shoppingCartItemsUserControl[i]); i++; } lblTotalPriceValueGeneral.Text = ShoppingCartClass.calculateActualTotalPrice().ToString(); }
/** @brief makePayment() function * @param PaymentType paymentType * call placeorder from ShoppingCartClass * placeorder() function have customerıd and paymenttype parameters */ private void makePayment(PaymentType paymentType) { ShoppingCartClass.placeOrder(user.customerID, paymentType, ShoppingCartClass.calculateActualTotalPrice()); }
/** * call calculateActualTotalPrice() from ShoppingCartClass * and assign lblPaymentAmountValue and lblPaymentAmountCashValue */ private void PaymentForm_Load(object sender, EventArgs e) { lblPaymentAmountValue.Text = ShoppingCartClass.calculateActualTotalPrice().ToString(); lblPaymentAmountCashValue.Text = ShoppingCartClass.calculateActualTotalPrice().ToString(); }