Advertisement
Guest User

UC_Sales

a guest
Mar 26th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. private void button_IncreaseAmount_Click(object sender, EventArgs e)
  2. {
  3. if (listViewCart.SelectedItems.Count == 0)
  4. {
  5. MessageBox.Show("Select row...");
  6. return;
  7. }
  8.  
  9. int quantity = bs.GetBookByBarcode(int.Parse(textBox_Barcode.Text)).Number;
  10. if (quantity <= 0)
  11. {
  12. MessageBox.Show("There are no books left...");
  13. return;
  14. }
  15. else if (listViewCart.FindItemWithText(textBox_BookTitle.Text) != null)
  16. {
  17. if (int.Parse(listViewCart.FindItemWithText(textBox_BookTitle.Text).SubItems[1].Text) == quantity)
  18. {
  19. MessageBox.Show("Can't add more than available!");
  20. return;
  21. }
  22. }
  23.  
  24. if (listViewCart.SelectedItems.Count > 0)
  25. {
  26. ListViewItem item = listViewCart.SelectedItems[0];
  27. amount = 0;
  28. item.SubItems[1].Text = int.Parse(item.SubItems[1].Text) + 1 + "";
  29. CalculateAmount();
  30. }
  31. else
  32. {
  33. MessageBox.Show("Select row...");
  34. return;
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement