private void buttonBuy_Click(object sender, EventArgs e) { BookWithAuthorsAndCategories currentBook = guiManager.getSelectedBook(); if (currentBook == null) { MessageBox.Show("Select book"); return; } string msg = ""; if (currentBook != null) { int quantity = 0; try { quantity = Convert.ToInt32(textBoxQuantity.Text); msg = searchFunctions.buyBook(currentBook, quantity); } catch (Exception) { } if (msg == searchFunctions.operationSuccesful()) { currentBook.Quantity -= quantity; } else { MessageBox.Show(msg); } } }
private void buttonSaveInToBuy_Click(object sender, EventArgs e) { BookWithAuthorsAndCategories currentBook = guiManager.getSelectedBook(); if (currentBook != null) { searchFunctions.saveBookInToBuy(currentBook); } }
private void buttonViewBook_Click(object sender, EventArgs e) { BookWithAuthorsAndCategories currentBook = guiManager.getSelectedBook(); if (currentBook != null) { searchFunctions.viewBook(currentBook); FormViewBook f = new FormViewBook(currentBook); f.Show(); } }
private int calculateScoreForBook(BookWithAuthorsAndCategories bookWithAuthors, CurrentUser user) { int score = 0; foreach (ScoreGeneratingModule s in scoreModules) { string descriptor = s.getDescriptor(); ScoreModuleInfo mInfo = recommendationsFunctions.fetchMultiplicatorsData(descriptor); s.ModuleInfo = mInfo; score += s.calculateScore(recommendationsFunctions, bookWithAuthors, user); } return(score); }
public BookWithAuthorsAndCategories getSelectedBook() { if (cellSelectedAndContainsValue()) { try { BookWithAuthorsAndCategories toReturn = (dgv.CurrentCell.Value as BookInfoContainer).book; return(toReturn); } catch (Exception e) { return(null); } } return(null); }
public BookContainerAuthors(BookWithAuthorsAndCategories b) : base(b) { LinkedList <Author> authors = b.Authors; string authorsConcated = ""; int i = 0; foreach (Author a in authors) { string singleAuthor = a.FirstName + " " + a.LastName; authorsConcated += singleAuthor; if (i < authors.Count - 1) { authorsConcated += ", "; } i++; } this.authors = authorsConcated; }
public FormViewBook(BookWithAuthorsAndCategories book) { InitializeComponent(); labelTitle.Text = book.title; labelPrice.Text = book.price.ToString(); labelDiscount.Text = book.priceMinusDiscountInProcent.ToString(); labelQuantity.Text = book.Quantity.ToString(); labelStartSell.Text = book.StartSellingDate.Date.ToString(); labelAvailable.Text = "yes"; if (book.Deleted) { labelAvailable.Text = "no"; } foreach (Author a in book.Authors) { listBoxAuthors.Items.Add(a); } foreach (string c in book.Categories) { listBoxCategories.Items.Add(c); } }
public BookContainerScore(int bookScore, BookWithAuthorsAndCategories b) : base(b) { score = bookScore; }
public BookContainerId(BookWithAuthorsAndCategories b) : base(b) { }
public BookInfoContainer(BookWithAuthorsAndCategories b) { book = b; }