Exemplo n.º 1
0
 public void RedrawCartList()
 {
     booksInCartLV.Items.Clear();
     foreach (Book book in Main.BooksInCart)
     {
         BookInCart bookInCart = new BookInCart(book.Name, book.Autor, book.Genre, book.Type, book.PublishingHouse, book.Year, book.Price, book.Number, book);
         booksInCartLV.Items.Add(bookInCart);
         labelItogo.Text = PriceSum().ToString();
     }
 }
Exemplo n.º 2
0
        private void buttonDeleteFromCart_Click(object sender, EventArgs e)
        {
            if (booksInCartLV.SelectedItems.Count == 0)
            {
                MessageBox.Show("Выберите книгу!");
                return;
            }
            BookInCart deletedBook = (BookInCart)booksInCartLV.SelectedItems[0];

            deletedBook.ParentBook.NumberForSale = 0;
            deletedBook.ParentBook.PriceAll      = 0;
            Main.BooksInCart.Remove(deletedBook.ParentBook);
            RedrawCartList();
        }