/// <summary> /// Return a list of all of the audit trail entries /// </summary> /// <returns></returns> public DataTable GetAuditTrailEntries(int requiredClass) { if (isDebugEnabled) { logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " in"); } DataTable ateTable = new DataTable(TableNames.AUDITTRAIL); if (compactDatabaseType) { try { using (SqlCeConnection conn = DatabaseConnection.CreateOpenCEConnection()) { string commandText = "SELECT AUDITTRAIL.* ,ASSETS._NAME AS ASSETNAME ,LOCATIONS._FULLNAME AS FULLLOCATIONNAME " + "FROM AUDITTRAIL " + "LEFT JOIN ASSETS ON (AUDITTRAIL._ASSETID = ASSETS._ASSETID) " + "LEFT JOIN LOCATIONS ON (ASSETS._LOCATIONID = LOCATIONS._LOCATIONID) " + "WHERE AUDITTRAIL._CLASS "; if (requiredClass != -1) { commandText += " = @nClass ORDER BY _AUDITTRAILID"; } else { commandText += " >= 100 ORDER BY _AUDITTRAILID"; } using (SqlCeCommand command = new SqlCeCommand(commandText, conn)) { if (requiredClass != -1) { command.Parameters.AddWithValue("@nClass", requiredClass); } new SqlCeDataAdapter(command).Fill(ateTable); } } } 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(); ateTable = lAuditWizardDataAccess.GetAuditTrailEntries(requiredClass); } if (isDebugEnabled) { logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " out"); } return(ateTable); }