public void ListCart(ref CartDialog cd) { if (!loggedOn) { throw new BookShopException("This operation requires login."); } currentCustomer.showCart(ref cd); cd.AddDisplayItems("====================================================", "Total Price: $" + CurrentCustomer.CurrentCart.Price); }
// XXX You may add overriding constructors (constructors with different set of arguments). // If you do so, make sure to call :this() // public CustomerWindow(XXX xxx): this() { } // Without :this(), InitializeComponent() is not called private void CustomerWindow_Load(object sender, EventArgs e) { customerDialog = new CustomerDialog(); loginDialog = new LoginDialog(); listBooksDialog = new ListBooksDialog(); bookInformationDialog = new BookInformationDialog(); cartDialog = new CartDialog(); wishListDialog = new WishListDialog(); bookInWishListDialog = new BookInWishListDialog(); listTransactionHistoryDialog = new ListTransactionHistoryDialog(); showTransactionDialog = new ShowTransactionDialog(); }
public void showCartInformation(CartDialog cart) { if (!isCustomerLoggedIn) { throw new NullReferenceException("You are not logged in."); } if (LoggedinCustomer.currentCart.subTransactionCount <= 0) { throw new NullReferenceException("There are no items in your cart."); } for (int i = 0; i < LoggedinCustomer.currentCart.subTransactionCount; i++) { cart.AddDisplayItems(LoggedinCustomer.currentCart.itemsPurchased[i].ToString()); } cart.AddDisplayItems("======================================================="); cart.AddDisplayItems("Total Price : $" + LoggedinCustomer.currentCart.totalPrice); }
public void showCart(ref CartDialog cd) { cd.AddDisplayItems(currentCart.Cart.ToArray()); }