Exemple #1
0
        private void FormAddAsset_Load(object sender, EventArgs e)
        {
            AuditWizardConfiguration configuration = new AuditWizardConfiguration();

            this.labelLocation.Text    = (configuration.ShowByDomain) ? "Parent Domain;" : "Parent Location:";
            this.tbAssetName.Text      = _asset.Name;
            this.tbParentLocation.Text = (configuration.ShowByDomain) ? _asset.Domain : _asset.Location;

            // Get Asset Types and load into the combo box
            _listAssetTypes.Populate();

            // Load just the categories
            AssetTypeList categories = _listAssetTypes.EnumerateCategories();

            // ...and add to the combo
            foreach (AssetType assetType in categories)
            {
                // Add categories only if they have children
                if (_listAssetTypes.EnumerateChildren(assetType.AssetTypeID).Count != 0)
                {
                    this.cbAssetCategory.Items.Add(assetType);
                }
            }

            // Select the first asset type
            if (this.cbAssetCategory.Items.Count > 0)
            {
                this.cbAssetCategory.SelectedIndex = 0;
            }

            // Select the asset name as the user will need to change this
            this.tbAssetName.Focus();
            this.tbAssetName.SelectAll();
        }
        /// <summary>
        /// Refresh the list of Asset Types for the currently selected asset type category
        /// </summary>
        /// <param name="categoryID"></param>
        private void RefreshList(int categoryID)
        {
            // Call BeginUpdate and set the wait cursor while we refresh
            this.ulvAssetTypes.BeginUpdate();
            this.Cursor = Cursors.WaitCursor;

            // Clear any existing items from the view
            ulvAssetTypes.Items.Clear();

            // ...Get the children to display
            AssetTypeList listSubTypes = _listAssetTypes.EnumerateChildren(categoryID);

            // ...and add to the list view
            foreach (AssetType assettype in listSubTypes)
            {
                Bitmap            icon = IconMapping.LoadIcon(assettype.Icon, IconMapping.Iconsize.Small);
                UltraListViewItem lvi  = new UltraListViewItem(assettype, null);
                lvi.Appearance.Image = icon;
                lvi.Tag = assettype;
                ulvAssetTypes.Items.Add(lvi);
            }

            // Restore the cursor and end the update
            this.Cursor = Cursors.Default;
            this.ulvAssetTypes.EndUpdate(true);
        }
Exemple #3
0
        private void UpdateInteractiveComputers()
        {
            AssetTypeList listAssetTypes = new AssetTypeList();

            listAssetTypes.Populate();

            AssetType     assetType     = listAssetTypes.FindByName("Computers");
            AssetTypeList computersList = listAssetTypes.EnumerateChildren(assetType.AssetTypeID);

            auditScannerDefinition.InteractiveCategories = computersList.ToString();
        }
Exemple #4
0
        private void FormSelectAssetType_Load(object sender, EventArgs e)
        {
            tvAssetTypes.BeginUpdate();
            this.Cursor = Cursors.WaitCursor;

            // get the currebnt list of asset types
            AssetTypeList listAssetTypes = new AssetTypeList();

            listAssetTypes.Populate();

            // We now need to display the Asset Type categories in the main ExplorerBar
            AssetTypeList categories = listAssetTypes.EnumerateCategories();

            foreach (AssetType category in categories)
            {
                Bitmap        icon         = IconMapping.LoadIcon(category.Icon, IconMapping.Iconsize.Small);
                UltraTreeNode categoryNode = tvAssetTypes.Nodes.Add(category.Name, category.Name);
                categoryNode.LeftImages.Add(icon);
                categoryNode.Tag = category;

                // Is this the selected category?
                if (category.AssetTypeID == _selectedAssetTypeID)
                {
                    this.tbSelectedType.Text = category.Name;
                    this.tbSelectedType.Tag  = category;
                }

                // Add the child asset types to the list also
                // ...Get the children to display
                AssetTypeList listSubTypes = listAssetTypes.EnumerateChildren(category.AssetTypeID);

                // ...and add to the list view
                foreach (AssetType assettype in listSubTypes)
                {
                    UltraTreeNode itemNode = categoryNode.Nodes.Add(category.Name + "|" + assettype.Name, assettype.Name);
                    Bitmap        icon2    = IconMapping.LoadIcon(assettype.Icon, IconMapping.Iconsize.Small);
                    itemNode.LeftImages.Add(icon2);
                    itemNode.Tag = assettype;

                    // Is this the selected category?
                    if (assettype.AssetTypeID == _selectedAssetTypeID)
                    {
                        this.tbSelectedType.Text = assettype.Name;
                        this.tbSelectedType.Tag  = assettype;
                    }
                }
            }

            this.Cursor = Cursors.Default;
            tvAssetTypes.EndUpdate();
        }
Exemple #5
0
        /// <summary>
        /// Populate the asset types combo box for the selected asset category
        /// </summary>
        /// <param name="category"></param>
        private void FillAssetTypes(AssetType category)
        {
            cbAssetTypes.BeginUpdate();
            cbAssetTypes.Items.Clear();
            AssetTypeList subTypes = _assetTypes.EnumerateChildren(category.AssetTypeID);

            //
            foreach (AssetType subType in subTypes)
            {
                cbAssetTypes.Items.Add(subType);
            }
            //
            cbAssetTypes.EndUpdate();
        }
Exemple #6
0
        private void UpdateInteractiveUserDataCategories()
        {
            auditAgentScannerDefinition.InteractiveUserDataCategories.Clear();

            AssetTypeList listAssetTypes = new AssetTypeList();

            listAssetTypes.Populate();

            AssetTypeList computersList = listAssetTypes.EnumerateChildren(listAssetTypes.FindByName("Computers").AssetTypeID);

            UserDataCategoryList listCategories = new UserDataCategoryList(UserDataCategory.SCOPE.Asset);

            listCategories.Populate();

            // Sort the list to put the categories in Tab Order
            listCategories.Sort();

            // Iterate through the categories
            foreach (UserDataCategory category in listCategories)
            {
                if ((category.AppliesToName != "Computers") && (category.AppliesToName != String.Empty))
                {
                    // No - OK is it a type of computer?
                    bool exclude = true;
                    foreach (AssetType assetType in computersList)
                    {
                        if (assetType.Name == category.AppliesToName)
                        {
                            exclude = false;
                            break;
                        }
                    }

                    // If excluded, skip this category
                    if (exclude)
                    {
                        continue;
                    }
                }

                UserDataCategories lUserDataCategory = new UserDataCategories();
                lUserDataCategory.Name       = category.Name;
                lUserDataCategory.UserFields = category;
                auditAgentScannerDefinition.InteractiveUserDataCategories.Add(lUserDataCategory);
            }
        }