/// <summary>
        /// This function is responsible for the actual generation of the Applications Report
        /// It overrides the abstract definition in the base class and stores it's data in the DataSet
        /// </summary>
        public override void GenerateReport(UltraGrid grid)
        {
            // Delete any cached data as we are re-running the report
            _cachedAssetGroups = null;

            // Begin initialization of the Grid
            grid.BeginUpdate();

            // Save the grid layout to a temporary file
            if (grid.Rows.Count != 0)
            {
                SaveTemporaryLayout(grid);
            }

            // Create a new dataSource
            _reportDataSet  = new DataSet("auditdataDataSet");
            grid.DataSource = _reportDataSet;

            // We will always need the list of assets so we may as well get it now
            LocationsDAO lwDataAccess = new LocationsDAO();

            AssetGroup.GROUPTYPE displayType = AssetGroup.GROUPTYPE.userlocation;
            DataTable            table       = lwDataAccess.GetGroups(new AssetGroup(displayType));

            _cachedAssetGroups = new AssetGroup(table.Rows[0], displayType);
            _cachedAssetGroups.Populate(true, _ignoreChildAssets, true);

            // Now apply the filter to these groups
            _cachedAssetGroups.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
            _cachedAssetList = _cachedAssetGroups.GetAllAssets();

            // Create the list of report columns which will maintain the data for this report
            _auditDataReportColumns.Populate(_listSelectedFields
                                             , _dictionaryLabels
                                             , _publisherFilter
                                             , _showIncluded
                                             , _showIgnored);

            // Create the tables, columns and relationships as these may have changed since we loaded the report
            CreateTables();

            // Clear any existing data out of the dataset
            _reportDataSet.Tables["AuditData"].Rows.Clear();

            // Generate the data for the report
            GenerateReportData();

            // reload the temprary layout saved around the report generation
            //LoadTemporaryLayout(grid);

            // ...and perform any required initialization of the grid
            InitializeGrid(grid);

            grid.EndUpdate();
        }
Пример #2
0
        /// <summary>
        /// This function is responsible for generating the actual data which will be displayed by the report
        /// </summary>
        protected void GenerateReportData()
        {
            // Create a string representation of the publisher filter list passed to us
            // We need to get the entire licensing information at this point
            AssetGroup.GROUPTYPE displayType        = AssetGroup.GROUPTYPE.userlocation;
            DataTable            table              = new LocationsDAO().GetGroups(new AssetGroup(displayType));
            AssetGroup           _cachedAssetGroups = new AssetGroup(table.Rows[0], displayType);

            _cachedAssetGroups.Populate(true, _ignoreChildAssets, true);

            // Now apply the filter to these groups
            _cachedAssetGroups.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 _cachedAssetList = _cachedAssetGroups.GetAllAssets();

            _selectedAssets = String.Empty;

            foreach (Asset asset in _cachedAssetList)
            {
                _selectedAssets += asset.Name + ";";
            }

            char[] charsToTrim = { ';' };
            _selectedAssets.TrimEnd(charsToTrim);

            ResetSelectedAssets();

            // OK different reports require different processing so branch here
            switch (_subtype)
            {
            case eHistoryType.changesbetween:
                GenerateChangesBetweenReportData();
                break;

            case eHistoryType.hasbeenaudited:
                GenerateLastAuditDateReportData(true);
                break;

            case eHistoryType.hasnotbeenaudited:
                GenerateLastAuditDateReportData(false);
                break;

            case eHistoryType.lastaudit:
                GenerateLastAuditDateReportData(true);
                break;

            case eHistoryType.mostrecentchanges:
                GenerateMostRecentReportData();
                break;
            }
        }
Пример #3
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);
                }
            }
        }