コード例 #1
0
        } //LoadManagerMenuItemList

        private void DeleteLoyaltyAccount_Click(object sender, EventArgs e)
        {
            // Get the currently selected item in the ListBox.
            try
            {
                string curItem = ((BoxFormat)AccountsFound_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 Accounts Found List
                nsadb.ManagerDeleteLoyaltyAccount(curItem);
                AccountsFound_Listbox.DataSource = null;
                AccountsFound_Listbox.Items.Clear();

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