/// <summary>
        /// This function is called to (re)initialize the network explorer view
        /// this is a tree control defined within NetworkExplorerView
        /// </summary>
        private void InitializeNetworkView()
        {
            // clear the existing view
            explorerView.Clear();

            // Are we displaying the computers grouped into domains or user locations - this is held as a flag
            // in the work item controller
            NetworkWorkItemController wiController = explorerView.WorkItem.Controller as NetworkWorkItemController;
            bool showByDomain = wiController.DomainViewStyle;

            // First of all we need to create the root group (domain or location)
            LocationsDAO lwDataAccess = new LocationsDAO();

            AssetGroup.GROUPTYPE displayType = (showByDomain) ? AssetGroup.GROUPTYPE.domain : AssetGroup.GROUPTYPE.userlocation;
            DataTable            table       = lwDataAccess.GetGroups(new AssetGroup(displayType));

            _rootAssetGroup = new AssetGroup(table.Rows[0], displayType);

            // Add the root node to the tree first
            UltraTreeNode rootNode  = new UltraTreeNode("root|" + _rootAssetGroup.FullName, _rootAssetGroup.Name);
            Bitmap        rootImage = (showByDomain) ? Properties.Resources.domain16 : Properties.Resources.location_16;

            rootNode.Override.NodeAppearance.Image         = rootImage;
            rootNode.Override.ExpandedNodeAppearance.Image = rootImage;
            rootNode.Tag = _rootAssetGroup;

            // Set the root node in the Explorer view - note that this will automatically expand the node which will
            // cause it to be populated
            explorerView.RootNode = rootNode;
        }
Beispiel #2
0
 /// <summary>
 /// This constructor takes a data table with a list of asset groups which will be added
 /// </summary>
 /// <param name="locations"></param>
 public AssetGroupList(DataTable groups, AssetGroup.GROUPTYPE groupType)
 {
     foreach (DataRow row in groups.Rows)
     {
         this.Add(new AssetGroup(row, groupType));
     }
 }
        /// <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();
        }
Beispiel #4
0
        public void Populate(bool showByDomain, bool ignoreTopAssets, bool ignoreChildAssets)                                                   // CMD 8.4.2 Include additional parameter
        {
            LocationsDAO lwDataAccess = new LocationsDAO();

            AssetGroup.GROUPTYPE displayType = (_showByDomain) ? AssetGroup.GROUPTYPE.domain : AssetGroup.GROUPTYPE.userlocation;
            DataTable            table       = lwDataAccess.GetGroups(new AssetGroup(displayType));

            _rootAssetGroup = new AssetGroup(table.Rows[0], displayType);

            // +CMD 8.4.1 - Changes required to prevent performance issues with large databases.  We can now elect to not display assets and also
            // the tree is load on demand if we do require assets so that we only load them if required.
            //
            // If we need to show assets at the root then populate this now
            if (!ignoreTopAssets)
            {
                _rootAssetGroup.Populate(false, false, true);
            }

            // Populate all levels for this group beneath this group again optionally including assets
            _rootAssetGroup.Populate(true, true, true);

            // Load on demand is active if we are displaying child assets
            locationsTree.Override.ShowExpansionIndicator = (ignoreChildAssets) ? ShowExpansionIndicator.CheckOnDisplay : ShowExpansionIndicator.CheckOnExpand;

            // -CMD 8.4.1
            // begin updating the tree
            locationsTree.BeginUpdate();

            // Add the root node to the tree first
            try
            {
                UltraTreeNode rootNode  = new UltraTreeNode(null, _rootAssetGroup.Name);
                Bitmap        rootImage = (_showByDomain) ? Properties.Resources.domain16 : Properties.Resources.location_16;
                rootNode.Override.NodeAppearance.Image         = rootImage;
                rootNode.Override.ExpandedNodeAppearance.Image = rootImage;
                rootNode.Tag          = _rootAssetGroup;
                rootNode.CheckedState = CheckState.Unchecked;

                // ...add the children to the tree beneath it now
                AddChildNodes(rootNode, _rootAssetGroup);

                // Set the root node in the Explore view
                locationsTree.Nodes.Add(rootNode);

                // Expand the root node
                rootNode.Expanded = true;
            }
            catch (Exception ex)
            {
                //MessageBox.Show("Exception adding tree nodes in [SelectLocationsControl::AddApplicationNode], the exception text was " + ex.Message);
                logger.Error(ex.Message);
            }

            // Finished updating the tree
            locationsTree.EndUpdate();
        }
        /// <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;
            }
        }
Beispiel #6
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
            FileSystemDAO lwDataAccess = new FileSystemDAO();
            DataTable     dataTable    = lwDataAccess.EnumerateFileSystemFiles(_filterFile);

            // 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);

            _selectedAssets = new AssetDAO().ConvertIdListToNames(new AssetDAO().GetSelectedAssets(), ',');

            ResetSelectedAssets();

            // ...then create InternetReportEntry objects for each returned and add to the view
            foreach (DataRow row in dataTable.Rows)
            {
                FileSystemFile file = new FileSystemFile(row);

                // Check for this being filtered by location/asset
                if (FilterRecord(file))
                {
                    AddRecord(file);
                }
            }
        }
        /// <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);
                }
            }
        }