private void addButton_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(MenuNameTextBox.Text)) { if (!string.IsNullOrEmpty(TypeComboBox.SelectedIndex.ToString())) { if (!string.IsNullOrEmpty(priceTextBox.Text)) { int result = ms.AddMenu(MenuNameTextBox.Text, Convert.ToInt32(priceTextBox.Text), Convert.ToInt32(QuantityTextBox.Text), TypeComboBox.SelectedItem.ToString()); if (result == 1) { MessageBox.Show("Item successfully added to menu!"); mda = new MenuDataAccess(); dataGridView1.DataSource = mda.GetMenuData(); MenuNameTextBox.Clear(); priceTextBox.Clear(); QuantityTextBox.Clear(); TypeComboBox.SelectedItem = null; } } else { MessageBox.Show("Please Enter a price!"); } } else { MessageBox.Show("Please Enter quantity!"); } } else { MessageBox.Show("Please Enter name!"); } }
public Manager_Menu() { InitializeComponent(); mda = new MenuDataAccess(); ms = new MenuService(); dataGridView1.DataSource = mda.GetMenuData(); }
private void deleteButton_Click(object sender, EventArgs e) { int result = ms.DeleteMenu(Convert.ToInt32(deleteTextBox.Text)); if (result == 1) { MessageBox.Show("Item is deleted from Menu successfully!"); mda = new MenuDataAccess(); dataGridView1.DataSource = mda.GetMenuData(); deleteTextBox.Clear(); } }
private void saveButton_Click(object sender, EventArgs e) { int result = ms.EditMenu(id, MenuNameTextBox.Text, Convert.ToInt32(priceTextBox.Text), Convert.ToInt32(QuantityTextBox.Text), TypeComboBox.SelectedItem.ToString()); mda = new MenuDataAccess(); dataGridView1.DataSource = mda.GetMenuData(); MessageBox.Show("Item details successfully saved!"); MenuNameTextBox.Clear(); priceTextBox.Clear(); QuantityTextBox.Clear(); TypeComboBox.SelectedItem = null; }