private void BookQuantityForm_Load(object sender, EventArgs e) { book = bookService.findBook(_sale.title_id); foreach (bookViewModel bk in book) { bookTitle = bk.Title; } bookToEditTextBox.Text = _sale.title_id + " - " + bookTitle; editQuantityUpDown.Value = _sale.qty; }
private void BookQuantityForm_Load(object sender, EventArgs e) { try { book = bookService.findBook(_sale.title_id); bookToEditTextBox.Text = _sale.title_id + " - " + book.title; editQuantityUpDown.Value = _sale.qty; } catch { return; } }
private void addBooksButton_Click(object sender, EventArgs e) { book book; if (payTermsDropDown.Text == "") { MessageBox.Show("Select Pay Term.", "Error", MessageBoxButtons.OK); return; } else { try { _sales = new sales { stor_id = _bookOverview._storeName.stor_id, ord_num = orderNum, ord_date = date, payterms = payTermsDropDown.Text, qty = new short(), title_id = "" }; _bookList = new BookList(this, _sales) { Enabled = true }; _bookList.ShowDialog(); if (_sales.qty == 0) { return; } //existing books in order wont show. This was kept for a backup /*foreach(sales sale in transaction) * //{ * // if(sale.title_id == _sales.title_id) * // { * // MessageBox.Show("Book is already in order.", "Error", MessageBoxButtons.OK); * // return; * // } * //} */ //try catch for when cancel in booklist form is pressed try { book = placeOrderService.findBook(_sales.title_id); } catch { return; } ListViewItem lvi = new ListViewItem(_sales.title_id); lvi.SubItems.Add(book.title); lvi.SubItems.Add(_sales.qty.ToString()); bookOrderListViewPOF.Items.Add(lvi); if (bookOrderListViewPOF.Items.Count != 0) { removeBookButton.Enabled = true; submitOrderButton.Enabled = true; payTermsDropDown.Enabled = false; //if list count is not zero, payterms is disabled } transaction.Add(_sales); bookOrderColumnHead(); } catch { MessageBox.Show("Could not add book to order.", "Error", MessageBoxButtons.OK); return; } } }