Пример #1
0
        private void DeleteMenuItem_Click(object sender, EventArgs e) // DeleteMenuItem_Click
        {
            // Get the currently selected item in the ListBox.
            try
            {
                string curItem = ((BoxFormat)MenuItems_Listbox.SelectedItem).databaseID;

                // connect to DB if it is not connected
                if (!nsadb.Connected())
                {
                    nsadb.OpenConnection();
                }

                // Update the database to mark selected order Refunded and clear Manager Accounts List
                nsadb.ManagerDeleteMenuItem(curItem);
                LoadManagerMenuItemList();

                // Inform User that Account was successfully Deleted.
                MessageBox.Show("Menu Item #" + curItem + " Deleted.", "Delete Menu Item", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch
            {
                MessageBox.Show("Menu Item Not Selected!", "Delete Menu Item", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }