private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (_canUpdate) { int id = comboBox1.SelectedIndex; if (id >= 0) { comboBox1.SelectedIndex = -1; if (chooseTable != null && chooseTable.Table.TableStatus == true) { InputNumber form = new InputNumber(); //chooseTable.ListFood.Add(listFood[id]); int num = 1; if (form.ShowDialog(this) == DialogResult.OK) { num = form.getNum(); } chooseTable.addFood(listFood[id], num); updateListChoose(); } else { MessageBox.Show("Chưa chọn hoặc bàn còn trống!"); } } } else { _canUpdate = true; } }
private void listView1_DoubleClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { int id = listView1.Items.IndexOf(listView1.SelectedItems[0]); if (chooseTable != null && chooseTable.Table.TableStatus == true) { InputNumber form = new InputNumber(); //chooseTable.ListFood.Add(listFood[id]); int num = 1; if (form.ShowDialog(this) == DialogResult.OK) { num = form.getNum(); chooseTable.addFood(listFoodCategory[id], num); updateListChoose(); } } else { MessageBox.Show("Chưa chọn hoặc bàn còn trống!"); } } }