/// <summary> /// Dismiss this alert /// </summary> public void Dismiss() { AuditWizardDataAccess lwDataAccess = new AuditWizardDataAccess(); Status = AlertStatus.dismissed; lwDataAccess.AlertSetStatus(this); }
/// <summary> /// Dismiss the specified Alert - this does not actually delete the alert - just marks it as dismissed /// </summary> /// <param name="licenseID"></param> /// <returns></returns> public int AlertSetStatus(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 = "UPDATE ALERTS SET _STATUS = @nStatus WHERE _ALERTID = @nAlertID"; SqlCeParameter[] spParams = new SqlCeParameter[2]; spParams[0] = new SqlCeParameter("@nAlertID", aAlert.AlertID); spParams[0] = new SqlCeParameter("@nStatus", (int)aAlert.Status); 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.AlertSetStatus(aAlert); } if (isDebugEnabled) { logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " out"); } return(0); }