Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void button_IncreaseAmount_Click(object sender, EventArgs e)
- {
- if (listViewCart.SelectedItems.Count == 0)
- {
- MessageBox.Show("Select row...");
- return;
- }
- int quantity = bs.GetBookByBarcode(int.Parse(textBox_Barcode.Text)).Number;
- if (quantity <= 0)
- {
- MessageBox.Show("There are no books left...");
- return;
- }
- else if (listViewCart.FindItemWithText(textBox_BookTitle.Text) != null)
- {
- if (int.Parse(listViewCart.FindItemWithText(textBox_BookTitle.Text).SubItems[1].Text) == quantity)
- {
- MessageBox.Show("Can't add more than available!");
- return;
- }
- }
- if (listViewCart.SelectedItems.Count > 0)
- {
- ListViewItem item = listViewCart.SelectedItems[0];
- amount = 0;
- item.SubItems[1].Text = int.Parse(item.SubItems[1].Text) + 1 + "";
- CalculateAmount();
- }
- else
- {
- MessageBox.Show("Select row...");
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement