} // end of method btnAdd_Click private void btnDeleteKey_Click(object sender, EventArgs e) { if (txtKeyName == null || txtKeyName.Text.Length == 0 || txtKeyName.Text.Equals("")) { UtilityMethod.ShowMessage("Please enter a valid key name as given by the provider!", this, WeatherLionMain.PROGRAM_NAME + " - No Key Name", MessageBoxButtons.OK, MessageBoxIcon.Error); txtKeyName.Focus(); }// end of if block else { // confirm that user really wishes to delete the key string prompt = $"Are you sure that you wish to delete the " + $"{txtKeyName.Text}\nkey assinged by {cboAccessProvider.SelectedItem}?\n" + "This cannot be undone!"; DialogResult result = MessageBox.Show(prompt, $"{WeatherLionMain.PROGRAM_NAME} + Delete Key", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { if (UtilityMethod.DeleteSiteKeyFromDatabase(cboAccessProvider.SelectedItem.ToString(), txtKeyName.Text) == 1) { UtilityMethod.ShowMessage($"The {cboAccessProvider.SelectedItem} {txtKeyName.Text} has " + $"been removed from the database.", this, WeatherLionMain.PROGRAM_NAME + " - Success", MessageBoxButtons.OK, MessageBoxIcon.Information); txtKeyName.Focus(); }// end of if block else { UtilityMethod.ShowMessage($"An error occured while removing the {cboAccessProvider.SelectedItem} {txtKeyName.Text}" + $"from the database!.\nPlease check the Key Provider and Key Name specified and try again.", this, WeatherLionMain.PROGRAM_NAME + " - Deletion Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); txtKeyName.Focus(); } // end of else block } // end of if block else { UtilityMethod.ShowMessage("Key deletion aborted!", this, WeatherLionMain.PROGRAM_NAME + " - Deletion Aborted", MessageBoxButtons.OK, MessageBoxIcon.Information); txtKeyName.Focus(); } // end of else block } // end of else block } // end of method btnDeleteKey_Click