/// <summary> /// Return a table of any suppoprt contracts for which alerts should be generated /// </summary> /// <param name="applicationID"></param> /// <returns></returns> public DataTable EnumerateSupportContractAssetAlerts() { if (isDebugEnabled) { logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " in"); } DataTable alertsTable = new DataTable(TableNames.SUPPORT_STATISTICS); if (compactDatabaseType) { try { using (SqlCeConnection conn = DatabaseConnection.CreateOpenCEConnection()) { string commandText = "SELECT ASSET_SUPPORTCONTRACT._SUPPORT_EXPIRY, ASSET_SUPPORTCONTRACT._NOOFDAYS, ASSET_SUPPORTCONTRACT._ALERTBYEMAIL,ASSETS._NAME " + "FROM ASSET_SUPPORTCONTRACT INNER JOIN ASSETS ON ASSET_SUPPORTCONTRACT._ASSETID = ASSETS._ASSETID " + "WHERE (_ALERTFLAG = 1) AND (ASSET_SUPPORTCONTRACT._NOOFDAYS <> - 1) AND (ASSET_SUPPORTCONTRACT._SUPPORT_EXPIRY - ASSET_SUPPORTCONTRACT._NOOFDAYS <= GETDATE())"; using (SqlCeCommand command = new SqlCeCommand(commandText, conn)) { new SqlCeDataAdapter(command).Fill(alertsTable); } } } 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(); alertsTable = lAuditWizardDataAccess.EnumerateSupportContractAssetAlerts(); } if (isDebugEnabled) { logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " out"); } return(alertsTable); }