/// <summary> /// Return a table containing all of the Actions that have been defined /// </summary> /// <returns></returns> public DataTable EnumerateActions() { if (isDebugEnabled) { logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " in"); } DataTable actionTable = new DataTable(TableNames.ACTIONS); if (compactDatabaseType) { try { using (SqlCeConnection conn = DatabaseConnection.CreateOpenCEConnection()) { string commandText = "SELECT ACTIONS.[_ACTIONID] " + ", ACTIONS.[_TYPE] " + ", ACTIONS.[_APPLICATIONID] " + ", ACTIONS.[_ASSETS] " + ", ACTIONS.[_STATUS] " + ", ACTIONS.[_NOTES] " + ", APPLICATIONS.[_NAME] " + "FROM dbo.ACTIONS " + "LEFT JOIN dbo.APPLICATIONS ON (ACTIONS._APPLICATIONID = dbo.APPLICATIONS.[_APPLICATIONID]) " + "ORDER BY _ACTIONID"; using (SqlCeCommand command = new SqlCeCommand(commandText, conn)) { new SqlCeDataAdapter(command).Fill(actionTable); } } } 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(); actionTable = lAuditWizardDataAccess.EnumerateActions(); } if (isDebugEnabled) { logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " out"); } return(actionTable); }
public ActionList() { AuditWizardDataAccess lwDataAccess = new AuditWizardDataAccess(); DataTable actionsTable = lwDataAccess.EnumerateActions(); foreach (DataRow row in actionsTable.Rows) { Action action = new Action(row); this.Add(action); } }