/// <summary> /// Delete the current Alert from the database /// </summary> public void Delete() { // Delete from the database AuditWizardDataAccess lwDataAccess = new AuditWizardDataAccess(); lwDataAccess.AlertDelete(this); }
/// <summary> /// Delete the specified Alert from the database /// </summary> /// <param name="licenseID"></param> /// <returns></returns> public int AlertDelete(Alert aAlert) { if (isDebugEnabled) { logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " in"); } if (compactDatabaseType) { if (aAlert.AlertID != 0) { try { using (SqlCeConnection conn = DatabaseConnection.CreateOpenCEConnection()) { string commandText = "DELETE FROM ALERTS WHERE _ALERTID = @nAlertID"; SqlCeParameter[] spParams = new SqlCeParameter[1]; spParams[0] = new SqlCeParameter("@nAlertID", aAlert.AlertID); using (SqlCeCommand command = new SqlCeCommand(commandText, conn)) { command.Parameters.AddRange(spParams); command.ExecuteNonQuery(); } } } catch (SqlCeException ex) { Utility.DisplayErrorMessage("A database error has occurred in AuditWizard." + Environment.NewLine + Environment.NewLine + "Please see the log file for further details."); logger.Error("Exception in " + System.Reflection.MethodBase.GetCurrentMethod().Name, ex); } catch (Exception ex) { Utility.DisplayErrorMessage("A database error has occurred in AuditWizard." + Environment.NewLine + Environment.NewLine + "Please see the log file for further details."); logger.Error("Exception in " + System.Reflection.MethodBase.GetCurrentMethod().Name, ex); } } } else { AuditWizardDataAccess lAuditWizardDataAccess = new AuditWizardDataAccess(); lAuditWizardDataAccess.AlertDelete(aAlert); } if (isDebugEnabled) { logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " out"); } return(0); }