public bool checkSimilarAddedBook(BooksControl addBooksItem) { if (getBooksInBasket().Count != 0) { for (int i = 0; i < getBooksInBasket().Count; i++) { if (getBooksInBasket()[i].Title == addBooksItem.Title) { changeBooksControlsInBasket(addBooksItem, getBooksInBasket()[i]); return(true); } } } return(false); }
public void changeBooksControlsInBasket(BooksControl newBooksItem, BooksControl deleteBooks) { int newQuantityCombo = newBooksItem.infoComboQuantitySelected() + deleteBooks.infoComboQuantitySelected(); if (newQuantityCombo > newBooksItem.infoComboQuantityAmount()) { booksControlsInBasket.Remove(deleteBooks); flowLayoutPanelBasket.Controls.Remove(deleteBooks); // delete from flowlayout old string of data booksControlsInBasket.Add(newBooksItem); } else { newBooksItem.setSelectedQuantity(newQuantityCombo); booksControlsInBasket.Remove(deleteBooks); flowLayoutPanelBasket.Controls.Remove(deleteBooks); // delete from flowlayout old string of data booksControlsInBasket.Add(newBooksItem); } }
public void addBooksItems(BooksControl addBooksItems) { booksControlsInBasket.Add(addBooksItems); }