コード例 #1
0
 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);
 }
コード例 #2
0
 // 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();
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 public void showCart(ref CartDialog cd)
 {
     cd.AddDisplayItems(currentCart.Cart.ToArray());
 }