/// <summary> /// Event fired when the Delete button is pushed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DeleteBtn_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to delete account?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { using (GamespyDatabase Database = new GamespyDatabase()) { if (Database.DeleteUser(AccountId) == 1) Notify.Show("Account deleted successfully!", "Operation Successful", AlertType.Success); else Notify.Show("Failed to remove account from database!", "Operation failed", AlertType.Warning); } this.Close(); } }
/// <summary> /// Delete Account menu item click event /// </summary> private void menuItemDelete_Click(object sender, System.EventArgs e) { int Id = Int32.Parse(DataTable.SelectedRows[0].Cells[0].Value.ToString()); string Name = DataTable.SelectedRows[0].Cells[1].Value.ToString(); if (MessageBox.Show("Are you sure you want to delete account \"" + Name + "\"?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { using (GamespyDatabase Database = new GamespyDatabase()) { if (Database.DeleteUser(Id) == 1) Notify.Show("Account deleted successfully!", "Operation Successful", AlertType.Success); else Notify.Show("Failed to remove account from database!", "Operation Failed", AlertType.Warning); } BuildList(); } }