예제 #1
0
        /// <summary>
        /// Display
        /// =======
        ///
        /// Displays the audit history for this asset within this tab view.
        ///
        /// </summary>
        /// <param name="displayNode">UltraTreeNode holding the asset for which history is to be displayed</param>
        public void Display(UltraTreeNode displayedNode)
        {
            _displayedNode = displayedNode;
            Asset displayedAsset = _displayedNode.Tag as Asset;

            //	Call BeginUpdate to prevent drawing while we are populating the control
            this.historyGridView.BeginUpdate();
            this.Cursor = Cursors.WaitCursor;

            // Delete all entries from the current data set being displayed
            historyDataSet.Tables[0].Rows.Clear();

            // Recover the asset audit history records for this asset
            AuditTrailDAO lwDataAccess = new AuditTrailDAO();
            DataTable     historyTable = lwDataAccess.GetAssetAuditHistory(displayedAsset, new DateTime(0), new DateTime(0));

            // Add the entries in the data table as ATE records to our DataSet
            foreach (DataRow row in historyTable.Rows)
            {
                AuditTrailEntry ate = new AuditTrailEntry(row);
                historyDataSet.Tables[0].Rows.Add(new object[] { ate, ate.Date, ate.GetTypeDescription(), ate.Username });
            }

            //	Restore the cursor
            this.Cursor = Cursors.Default;

            //	Call EndUpdate to resume drawing operations
            this.historyGridView.EndUpdate(true);
        }
예제 #2
0
        public void DeleteEntries()
        {
            if (MessageBox.Show("You are about to delete " + auditTrailGridView.Selected.Rows.Count.ToString() + " entries from the database, are you sure that you want to continue?", "Confirm Delete") == DialogResult.OK)
            {
                AuditTrailDAO lwDataAccess = new AuditTrailDAO();
                foreach (UltraGridRow selectedRow in auditTrailGridView.Selected.Rows)
                {
                    lwDataAccess.AuditTrailDelete(selectedRow.Cells[0].Value as AuditTrailEntry);
                }

                RefreshView();
            }
        }
예제 #3
0
        /// <summary>
        /// Called when we are to purge the database of audit trail entries
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void purgeControl_PurgeRequested(object sender, AuditTrailPurgeEventArgs e)
        {
            AuditTrailDAO lwDataAccess = new AuditTrailDAO();
            int           purgeCount   = lwDataAccess.AuditTrailPurge(e.PurgeDate);

            if (purgeCount == 0)
            {
                MessageBox.Show("No audit trail entries were purged", "No Items Purged");
            }
            else if (purgeCount == 1)
            {
                MessageBox.Show("1 audit trail entry was", "Item Purged");
            }
            else
            {
                MessageBox.Show(String.Format("{0} audit trail entries were purged", purgeCount), "Items Purged");
            }
        }
예제 #4
0
        /// <summary>
        /// This report will contain information on asset history records dated between the specified start
        /// and end dates
        /// </summary>
        protected void GenerateChangesBetweenReportData()
        {
            // Create a string representation of the publisher filter list passed to us
            // We need to get the entire licensing information at this point
            AuditTrailDAO lwDataAccess = new AuditTrailDAO();
            DataTable     historyTable = lwDataAccess.GetAssetAuditHistory(new Asset(), _startDate, _endDate);

            // For each row in the returned table we need to first see if we need to filter it based on
            // and locations/assets specified
            foreach (DataRow row in historyTable.Rows)
            {
                // Create the object for this History record
                AuditTrailEntry entry = new AuditTrailEntry(row);

                // Check for this being filtered by location/asset
                if (FilterRecord(entry.Location, entry.AssetName))
                {
                    AddChangesRecord(entry);
                }
            }
        }
예제 #5
0
        /// <summary>
        /// generate the most recent history records for each asset
        /// </summary>
        protected void GenerateMostRecentReportData()
        {
            // Get a complete list of groups and assets and then apply our filters to this list
            LocationsDAO lwDataAccess = new LocationsDAO();

            AssetGroup.GROUPTYPE displayType = AssetGroup.GROUPTYPE.userlocation;
            DataTable            table       = lwDataAccess.GetGroups(new AssetGroup(displayType));
            AssetGroup           assetGroups = new AssetGroup(table.Rows[0], displayType);

            assetGroups.Populate(true, false, true);

            // Now apply the filter to these groups
            assetGroups.ApplyFilters(_selectedGroups, _selectedAssets, _ignoreChildAssets);

            // Now that we have a definitive list of the assets (as objects) which we want to include in the
            // report we could really do with expanding this list so that ALL of the assets are in a single list
            // and not distributed among the publishers
            AssetList listAssets = assetGroups.GetAllAssets();

            // OK - get the last audit trail records for these assets - the last audit date is stored in the
            // Asset object so we don't need to get that again
            foreach (Asset asset in listAssets)
            {
                // Skip any assets not audited yet
                if (asset.LastAudit.Ticks == 0)
                {
                    continue;
                }

                // Get the audit trail records for this asset
                DataTable historyTable = new AuditTrailDAO().GetAssetAuditHistory(asset, asset.LastAudit, DateTime.Now);

                // Add the entries in the data table as ATE records to our DataSet
                foreach (DataRow row in historyTable.Rows)
                {
                    AuditTrailEntry ate = new AuditTrailEntry(row);
                    AddChangesRecord(ate);
                }
            }
        }
예제 #6
0
        private void backgroundWorker_ImportHistoryLine(string[] fields)
        {
            // Does the Asset exist?
            Asset newAsset = new Asset();

            newAsset.Name = fields[0];
            //
            AssetDAO lwDataAccess = new AssetDAO();

            newAsset.AssetID = lwDataAccess.AssetFind(newAsset);

            // If the asset exists then add the history record for it
            if (newAsset.AssetID != 0)
            {
                // Create an Audit Trail Entry record based on the data passed in to us.
                try
                {
                    AuditTrailDAO auditTrailDAO = new AuditTrailDAO();

                    AuditTrailEntry ate = new AuditTrailEntry();
                    //ate.Date = DateTime.ParseExact(fields[1], "yyyy-MM-dd HH:mm:ss", null);
                    ate.Date      = Convert.ToDateTime(fields[1]);
                    ate.Class     = AuditTrailEntry.CLASS.asset;
                    ate.AssetID   = newAsset.AssetID;
                    ate.AssetName = newAsset.Name;
                    ate.Type      = AuditTrailEntry.TranslateV7Type((AuditTrailEntry.V7_HIST_OPS)Convert.ToInt32(fields[2]));
                    ate.Key       = fields[3];
                    ate.OldValue  = fields[4];
                    ate.NewValue  = fields[5];
                    ate.Username  = fields[6];
                    auditTrailDAO.AuditTrailAdd(ate);
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            }
        }
예제 #7
0
 public AuditTrail()
 {
     lAuditTrailDAO = new AuditTrailDAO();
 }
예제 #8
0
        public void InsertComputer(string assetName, string groupName, string ipAddress, string macAddress)
        {
            LocationsDAO lwDataAccess = new LocationsDAO();
            SettingsDAO  lSettingsDao = new SettingsDAO();

            // We need to get the root item as all of the domains need to be parented to this
            System.Data.DataTable table     = lwDataAccess.GetGroups(new AssetGroup(AssetGroup.GROUPTYPE.domain));
            AssetGroup            rootGroup = new AssetGroup(table.Rows[0], AssetGroup.GROUPTYPE.domain);

            // Get the child domains - as domains are single level we do not need to recurse
            rootGroup.Populate(false, false, true);

            // We'll loop through the domains first and add then to the database recovering their ids so that
            // we only have to do this once.
            // Does this domain already exist?

            AssetGroup childGroup;

            lock (this)
            {
                childGroup = rootGroup.IsChildGroup(groupName);

                // No - add it as a new group both to the database and to the parent
                if (childGroup == null)
                {
                    childGroup          = new AssetGroup(AssetGroup.GROUPTYPE.domain);
                    childGroup.Name     = groupName;
                    childGroup.ParentID = rootGroup.GroupID;
                    childGroup.GroupID  = lwDataAccess.GroupAdd(childGroup);
                    rootGroup.Groups.Add(childGroup);
                }
            }
            string vendor = String.Empty;

            try
            {
                if (macAddress != String.Empty)
                {
//
// CMD IMPORTANT UNCOMMENT THESE LINES
//                    using (System.IO.StreamReader sr = new System.IO.StreamReader(System.IO.Path.Combine(Application.StartupPath, "oui.txt")))
//                    {
//                        string line;
//                        while ((line = sr.ReadLine()) != null)
//                        {
//                            if (line.StartsWith(macAddress.Substring(0, 8)))
//                            {
//                                if (line.Substring(18).ToUpper().StartsWith("APPLE"))
//                                {
//                                   vendor = line.Substring(18);
//                                    break;
//                                }
//                           }
//                        }
//                    }
                }
            }
            catch (FormatException)
            {
            }

            // Now that we have the ID of the group (even if we just added the group) we can now
            // add the asset to the database also.
            Asset newAsset = new Asset();

            newAsset.Name       = assetName;
            newAsset.MACAddress = macAddress.Replace('-', ':');
            newAsset.Make       = vendor;

            if (vendor.ToUpper().StartsWith("APPLE"))
            {
                // add as an Apple Device
                assetTypes.Populate();
                AssetType parentAssetType = assetTypes.FindByName("Apple Devices");
                if (parentAssetType == null)
                {
                    // Now create a child of this asset type
                    parentAssetType           = new AssetType();
                    parentAssetType.Name      = "Apple Devices";
                    parentAssetType.Auditable = false;
                    parentAssetType.Icon      = "apple.png";
                    parentAssetType.ParentID  = 0;
                    parentAssetType.Add();

                    // Update the internal list
                    assetTypes.Add(parentAssetType);
                }

                assetTypes.Populate();
                parentAssetType = assetTypes.FindByName("Apple Devices");

                AssetType childAssetType = assetTypes.FindByName("Apple Device");
                if (childAssetType == null)
                {
                    // Now create a child of this asset type
                    childAssetType           = new AssetType();
                    childAssetType.Name      = "Apple Device";
                    childAssetType.Auditable = false;
                    childAssetType.Icon      = parentAssetType.Icon;
                    childAssetType.ParentID  = parentAssetType.AssetTypeID;
                    childAssetType.Add();

                    // Update the internal list
                    assetTypes.Add(childAssetType);
                }

                assetTypes.Populate();
                childAssetType       = assetTypes.FindByName("Apple Device");
                newAsset.AssetTypeID = childAssetType.AssetTypeID;
            }

            AssetList assetList             = new AssetList(new AssetDAO().GetAssets(0, AssetGroup.GROUPTYPE.userlocation, false), true);
            bool      bUpdateAsset          = true;
            bool      bSNMPAsset            = false;
            bool      bExistingAuditedAsset = false;

            foreach (Asset existingAsset in assetList)
            {
                if ((existingAsset.AgentVersion == "SNMP") && (existingAsset.IPAddress == ipAddress))
                {
                    bSNMPAsset = true;
                    break;
                }

                if ((assetName == existingAsset.Name) && (groupName == existingAsset.Domain))
                {
                    // this asset already exists - only need to check if domain or IP have changed
                    // if they have, send it away to be updated
                    if (existingAsset.IPAddress != ipAddress || existingAsset.DomainID != childGroup.GroupID)
                    {
                        newAsset           = existingAsset;
                        newAsset.IPAddress = newAsset.IPAddress != ipAddress ? ipAddress : newAsset.IPAddress;
                        newAsset.DomainID  = newAsset.DomainID != childGroup.GroupID ? childGroup.GroupID : newAsset.DomainID;
                    }
                    else
                    {
                        // asset exists, nothing has changed so don't process
                        bUpdateAsset = false;
                    }
                    break;
                }
                if (!bSNMPAsset && existingAsset.IPAddress == ipAddress && existingAsset.Domain != newAsset.Domain)
                {
                    bExistingAuditedAsset = true;
                    //check for any asset name change if so update asset with audittrail entry
                    if (existingAsset.Name != assetName)
                    {
                        string strOldValue = existingAsset.Name;
                        newAsset      = existingAsset;
                        newAsset.Name = assetName;
                        newAsset.Update();
                        AuditTrailDAO objAuditTrailDAO = new AuditTrailDAO();
                        // Build a blank AuditTrailEntry
                        AuditTrailEntry ate = CreateAteForAssetNameChange(newAsset);
                        ate.Key      = ate.Key + "|" + "Computer Name";
                        ate.OldValue = strOldValue;
                        ate.NewValue = assetName;
                        objAuditTrailDAO.AuditTrailAdd(ate);
                    }
                }
            }

            if (bUpdateAsset && !bSNMPAsset && !bExistingAuditedAsset)
            {
                newAsset.Domain    = childGroup.Name;
                newAsset.DomainID  = childGroup.GroupID;
                newAsset.IPAddress = ipAddress;

                // Add the asset
                newAsset.Add();

                if (lSettingsDao.GetSettingAsBoolean("AutoScanNetwork", false) && lSettingsDao.GetSettingAsBoolean("AutoScanDeployAgent", false))
                {
                    string scannerPath = System.IO.Path.Combine(Application.StartupPath, "scanners") + "\\auditagent\\default.xml";
                    System.IO.File.Copy(scannerPath, "AuditAgent\\AuditAgent.xml", true);
                    Operation newOperation = new Operation(newAsset.AssetID, Operation.OPERATION.deployagent);
                    newOperation.Add();
                }
            }

            if (!bSNMPAsset)
            {
                Interlocked.Increment(ref _foundCounter);
                FireNetworkDiscoveryUpdate(new DiscoveryUpdateEventArgs(_foundCounter.ToString(), "Computer", _maximumCount, 0));
            }
        }
예제 #9
0
        public void RefreshView()
        {
            base.Refresh();

            // Clear any existing data
            auditTrailDataSet.Tables[0].Rows.Clear();
            _listDisplayedRows.Clear();

            // Initialize the columns to be displayed based on what we are displaying
            if (_auditTrailFilterEventArgs.RequiredClass == AuditTrailEntry.CLASS.license)
            {
                HeaderText = "Audit Trail - Application License Changes";
                auditTrailGridView.DisplayLayout.Bands[0].Columns["computer"].Hidden    = true;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["username"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["oldvalue"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["newvalue"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["licensetype"].Hidden = false;
            }

            else if (_auditTrailFilterEventArgs.RequiredClass == AuditTrailEntry.CLASS.application_changes)
            {
                HeaderText = "Audit Trail - Application Property Changes";
                auditTrailGridView.DisplayLayout.Bands[0].Columns["computer"].Hidden    = true;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["username"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["oldvalue"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["newvalue"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["licensetype"].Hidden = false;
            }

            else if (_auditTrailFilterEventArgs.RequiredClass == AuditTrailEntry.CLASS.action)
            {
                HeaderText = "Audit Trail - Action Changes";
                auditTrailGridView.DisplayLayout.Bands[0].Columns["computer"].Hidden = true;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["username"].Hidden = false;
                //auditTrailGridView.DisplayLayout.Bands[0].Columns["oldvalue"].Hidden = false;
                //auditTrailGridView.DisplayLayout.Bands[0].Columns["newvalue"].Hidden = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["licensetype"].Hidden = false;
            }

            else if (_auditTrailFilterEventArgs.RequiredClass == AuditTrailEntry.CLASS.supplier)
            {
                HeaderText = "Audit Trail - Supplier Changes";
                auditTrailGridView.DisplayLayout.Bands[0].Columns["computer"].Hidden    = true;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["username"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["oldvalue"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["newvalue"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["licensetype"].Hidden = false;
            }

            else if (_auditTrailFilterEventArgs.RequiredClass == AuditTrailEntry.CLASS.user)
            {
                HeaderText = "Audit Trail - User Changes";
                auditTrailGridView.DisplayLayout.Bands[0].Columns["computer"].Hidden    = true;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["username"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["oldvalue"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["newvalue"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["licensetype"].Hidden = false;
            }

            else if (_auditTrailFilterEventArgs.RequiredClass == AuditTrailEntry.CLASS.asset)
            {
                HeaderText = "Audit Trail - Asset Changes";
                auditTrailGridView.DisplayLayout.Bands[0].Columns["computer"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["username"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["oldvalue"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["newvalue"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["licensetype"].Hidden = true;
            }

            else if (_auditTrailFilterEventArgs.RequiredClass == AuditTrailEntry.CLASS.all)
            {
                HeaderText = "Audit Trail - All Entries";
                auditTrailGridView.DisplayLayout.Bands[0].Columns["computer"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["username"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["oldvalue"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["newvalue"].Hidden    = false;
                auditTrailGridView.DisplayLayout.Bands[0].Columns["licensetype"].Hidden = false;
            }

            // Call database function to return list of Audit Trail Entries
            AuditTrailDAO lwDataAccess = new AuditTrailDAO();
            DataTable     ateTable     = lwDataAccess.GetAuditTrailEntries((int)_auditTrailFilterEventArgs.RequiredClass);

            // We cannot use this table directly as we do not require some of the columns and others
            // need formatting before display.  We therefore will re-construct the ATE entries from
            // the recovered data table.
            // ...and add these to the tab view
            foreach (DataRow row in ateTable.Rows)
            {
                AuditTrailEntry ate = new AuditTrailEntry(row);
                AddAuditTrailEntry(ate);
            }
        }
예제 #10
0
        /// <summary>
        /// Refreshes the list of values in the 'Filter by Users', 'Filter by Computers'
        /// and 'Filter by Application' comboboxes.
        /// </summary>
        public void RefreshData(AuditTrailFilterEventArgs e)
        {
            if (e != null)
            {
                // If neither the date, time or class has changed then we can ignore this refresh request
                if ((_auditTrailFilterEventArgs.StartDate == e.StartDate) &&
                    (_auditTrailFilterEventArgs.EndDate == e.EndDate) &&
                    (_auditTrailFilterEventArgs.RequiredClass == e.RequiredClass))
                {
                    return;
                }

                _auditTrailFilterEventArgs = e;
            }

            // As this is a filter we need to pickup the entire list of audit trail entries from which
            // we can build the filter lists
            AuditTrailDAO lwDataAccess = new AuditTrailDAO();
            DataTable     ateTable     = lwDataAccess.GetAuditTrailEntries((int)_auditTrailFilterEventArgs.RequiredClass);

            // Get any filter dates
            DateTime startDate = _auditTrailFilterEventArgs.StartDate;
            DateTime endDate   = _auditTrailFilterEventArgs.EndDate;

            // Now iterate through the rows returned and add data for these entries to our filter combos
            // assuming that they are within date range
            applicationComboBox.BeginUpdate();
            computerComboBox.BeginUpdate();
            userComboBox.BeginUpdate();

            // Get (any) currently selected item so that we can try and restore the selection after the refresh
            string selectedApplication = "";
            string selectedComputer    = "";
            string selectedUser        = "";

            if (applicationComboBox.SelectedItem != null)
            {
                selectedApplication = applicationComboBox.SelectedItem.DisplayText;
            }
            if (computerComboBox.SelectedItem != null)
            {
                selectedComputer = computerComboBox.SelectedItem.DisplayText;
            }
            if (userComboBox.SelectedItem != null)
            {
                selectedUser = userComboBox.SelectedItem.DisplayText;
            }

            // Now clear the current contents
            applicationComboBox.Items.Clear();
            computerComboBox.Items.Clear();
            userComboBox.Items.Clear();

            // Add a 'blank' ie no filter entry to each combo
            applicationComboBox.Items.Add(MiscStrings.NoFilter);
            computerComboBox.Items.Add(MiscStrings.NoFilter);
            userComboBox.Items.Add(MiscStrings.NoFilter);

            // ...then add the real filters
            foreach (DataRow row in ateTable.Rows)
            {
                // ...and check date in range first
                AuditTrailEntry ate = new AuditTrailEntry(row);
                if (ate.Date.Date < startDate.Date || ate.Date.Date > endDate.Date)
                {
                    continue;
                }

                // Add the Application to the applications combo if not already there
                if ((ate.Class == AuditTrailEntry.CLASS.application_installs) ||
                    (ate.Class == AuditTrailEntry.CLASS.action) ||
                    (ate.Class == AuditTrailEntry.CLASS.license))
                {
                    // The application name may have a '|' delimiter to split it off from an attribute (such as
                    // notes) of the application which changed.  We need to split that off now to leave just
                    // the application
                    String application;
                    if (ate.Key.Contains("|"))
                    {
                        application = ate.Key.Substring(0, ate.Key.IndexOf("|"));
                    }
                    else
                    {
                        application = ate.Key;
                    }

                    if (applicationComboBox.Items.ValueList.FindByDataValue(application) == null)
                    {
                        applicationComboBox.Items.Add(application, application);
                    }
                }

                // Add the computer to the combo box if not already there
                if ((ate.AssetName != "") && computerComboBox.Items.ValueList.FindByDataValue(ate.AssetName) == null)
                {
                    computerComboBox.Items.Add(ate.AssetName, ate.AssetName);
                }

                // Add the user to the combo box if not already there
                if ((ate.Username != "") && (userComboBox.Items.ValueList.FindByDataValue(ate.Username) == null))
                {
                    userComboBox.Items.Add(ate.Username, ate.Username);
                }
            }

            // Restore (any) selection or select the 'No Filter'
            if ((selectedUser == "") || (userComboBox.FindStringExact(selectedUser) == -1))
            {
                userComboBox.SelectedIndex = 0;
            }
            else
            {
                userComboBox.SelectedIndex = (userComboBox.FindStringExact(selectedUser));
            }
            //
            if ((selectedComputer == "") || (computerComboBox.FindStringExact(selectedComputer) == -1))
            {
                computerComboBox.SelectedIndex = 0;
            }
            else
            {
                computerComboBox.SelectedIndex = (computerComboBox.FindStringExact(selectedComputer));
            }
            //
            if ((selectedApplication == "") || (applicationComboBox.FindStringExact(selectedApplication) == -1))
            {
                applicationComboBox.SelectedIndex = 0;
            }
            else
            {
                applicationComboBox.SelectedIndex = (applicationComboBox.FindStringExact(selectedApplication));
            }

            // End update of the combo boxes
            userComboBox.EndUpdate();
            computerComboBox.EndUpdate();
            applicationComboBox.EndUpdate();
        }
예제 #11
0
        /// <summary>
        /// This report is called to identify those assets which have (or have not) been audited
        /// within the specified period.
        /// </summary>
        protected void GenerateLastAuditDateReportData(bool hasBeenAudited)
        {
            try
            {
                // Get the Table from the DataSet
                DataTable historyTable = _reportDataSet.Tables["History"];

                // Create a string representation of the publisher filter list passed to us
                // We need to get the entire licensing information at this point
                AuditTrailDAO lwDataAccess = new AuditTrailDAO();
                DataTable     dataTable    = lwDataAccess.GetAssetLastAuditDate(new Asset(), _days, hasBeenAudited);

                // For each row in the returned table we need to first see if we need to filter it based on
                // and locations/assets specified
                foreach (DataRow row in dataTable.Rows)
                {
                    // We don't have an explict record for this type so just unpack the fields
                    string assetName = (string)row["ASSETNAME"];
                    string location  = (string)row["FULLLOCATIONNAME"];

                    DateTime date;
                    int      elapsedDays;
                    string   displayDate;

                    if (row["_DATE"].GetType() == typeof(DBNull))
                    {
                        displayDate = String.Empty;
                        elapsedDays = 0;
                    }
                    else
                    {
                        date        = (DateTime)row["_DATE"];
                        displayDate = date.ToShortDateString() + " " + date.ToLongTimeString();
                        elapsedDays = ((TimeSpan)(DateTime.Now - date)).Days;
                    }

                    // Check for this being filtered by location/asset
                    if (FilterRecord(location, assetName))
                    {
                        // Add the row to the data set
                        try
                        {
                            historyTable.Rows.Add(new object[]
                                                  { null
                                                    , location
                                                    , assetName
                                                    , displayDate
                                                    , elapsedDays
                                                    , "n/a"
                                                    , "n/a" });
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show(e.Message);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error in GenerateLastAuditDateReportData()", ex);
                Utility.DisplayApplicationErrorMessage("There has been an error creating the report." + Environment.NewLine + Environment.NewLine +
                                                       "Please see the log file for further information.");
            }
        }