public Cart(UserData u) { InitializeComponent(); this.user = u; bookCart = new BookCart(); dsBookCar = bookCart.loadCart(user.UserID); this.DataContext = dsBookCar.Tables["Cart"]; cart_val.Text = "" + bookCart.cartItems(user.UserID); }
public Store(UserData u) { InitializeComponent(); this.user = u; bookCatalog = new BookCatalog(); bookCart = new BookCart(); dsBookCat = bookCatalog.GetBookInfo(); this.DataContext = dsBookCat.Tables["Category"]; cart_val.Text = "" + bookCart.cartItems(user.UserID); }
public Item(UserData u, string i) { InitializeComponent(); this.user = u; this.isbn = i; bookItem = new BookCatalog(); bookCart = new BookCart(); dsBookItem = bookItem.load_Item(isbn); this.DataContext = dsBookItem.Tables["Item"]; cart_val.Text = "" + bookCart.cartItems(user.UserID); }
public Dashboard(UserData u) { InitializeComponent(); this.user = u; bookHistory = new BookCatalog(); bookCart = new BookCart(); dsBookHistory = bookHistory.load_History(user.UserID); this.DataContext = dsBookHistory.Tables["History"]; cart_val.Content = "" + bookCart.cartItems(user.UserID); total_books.Content = "" + bookCart.totalBooks(user.UserID); total_money.Content = "$" + bookCart.totalPrice(user.UserID); }
private void removeButton_Click(object sender, RoutedEventArgs e) { try { DataRowView selectedRow; selectedRow = (DataRowView)this.ProductsDataGrid.SelectedItems[0]; bookCart.RemoveBook(user.UserID, selectedRow.Row.ItemArray[0].ToString()); dsBookCar = bookCart.loadCart(user.UserID); this.DataContext = dsBookCar.Tables["Cart"]; cart_val.Text = "" + bookCart.cartItems(user.UserID); } catch (Exception ex) { } }
private void addToCart_Click(object sender, RoutedEventArgs e) { try { string isbn = isbnTextBox.Text; short quantity = short.Parse(item_q.Text); bookCart.AddBook(user.UserID, isbn, quantity); cart_val.Text = "" + bookCart.cartItems(user.UserID); MessageBox.Show("You Have added " + book_name.Text + " to your Cart."); } catch (Exception ex) { MessageBox.Show("Invalid input"); } }