private void button_deleteBill_Click(object sender, EventArgs e) { if (bills.Count == 0) { return; } DialogResult dialogResult = MessageBox.Show(DELETE_BILL_MESSAGE, DELETE_BILL_TITLE, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Bill toDelete = bills[currentBillIndex]; if (bills.Count == 1) { SetupForNoBills(); } else { SelectBill(currentBillIndex == 0 ? 1 : currentBillIndex - 1); } bills.Remove(toDelete); WarehouseService.DeleteBill(toDelete); } else if (dialogResult == DialogResult.No) { return; } }