private void LoadForm() { tbParentLocation.Text = _asset.Location; tbAssetName.Text = _asset.Name; tbSerialNumber.Text = _asset.SerialNumber; tbAssetTag.Text = _asset.AssetTag; cbOverwriteData.Checked = _asset.OverwriteData; _assetTypes.Populate(); // Recover the category of the current asset so that we can select it correctly in the combo AssetType assetType = _assetTypes.FindByName(_asset.TypeAsString); if (assetType == null) { assetType = _assetTypes[0]; } AssetType assetCategory = _assetTypes.GetParent(assetType); // We now need to add the Asset Type categories to the combo box cbAssetCategories.BeginUpdate(); cbAssetCategories.Items.Clear(); AssetTypeList categories = _assetTypes.EnumerateCategories(); foreach (AssetType category in categories) { cbAssetCategories.Items.Add(category); } int index = cbAssetCategories.Items.IndexOf(assetCategory); cbAssetCategories.SelectedIndex = (index != -1) ? index : 0; cbAssetCategories.EndUpdate(); FillAssetTypes(assetCategory); FillStockStatuses(_asset.StockStatus); // ...and select the asset type for the asset index = cbAssetTypes.Items.IndexOf(assetType); cbAssetTypes.SelectedIndex = (index != -1) ? index : 0; FillAssetMakes(assetType.AssetTypeID); FillAssetModels(assetType.AssetTypeID); InitializeNotesTab(); PopulateSuppliers(); InitializeDocumentsTab(); FillUserDefinedData(); //Added by Sojan E John KTS Infotech ClearControlsSupportContract(); FillControlsOnLoad(); FillSupportContractComboBox(); FillSuppliersComboBox(); InitialiseSupportContractTab(); }
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> /// Called as we try an exit from this form - we need to ensure that the category name is unique /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bnOK_Click(object sender, EventArgs e) { // Update the asset type definition with any changes _assetType.Name = tbCategoryName.Text; _assetType.Icon = tbIconFile.Text; // AssetTypeList listAssetTypes = new AssetTypeList(); listAssetTypes.Populate(); // Does this name duplicate an existing item? AssetType existingAsset = listAssetTypes.FindByName(tbCategoryName.Text); if (existingAsset != null) { if (_assetType.AssetTypeID != existingAsset.AssetTypeID) { MessageBox.Show("An Asset Category of this name has already been created, please enter a different name for this category"); tbCategoryName.Focus(); this.DialogResult = DialogResult.None; return; } } // OK the name is fine so either create a new category or update an existing one _assetType.Add(); }
/// <summary> /// Called to refresh the information displayed on this tab /// </summary> protected void RefreshTab() { this.assettypesExplorerBar.Groups[0].Items.Clear(); _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) { UltraExplorerBarItem item = this.assettypesExplorerBar.Groups[0].Items.Add(category.Name, category.Name); item.Settings.AppearancesLarge.Appearance.Image = IconMapping.LoadIcon(category.Icon, IconMapping.Iconsize.Medium); item.Tag = category; } // If nothing is selected in the Explorer View then select the first entry if (this.assettypesExplorerBar.ActiveItem == null) { if ((_activeItem == null) || (!this.assettypesExplorerBar.Groups[0].Items.Contains(_activeItem))) { this.assettypesExplorerBar.ActiveItem = this.assettypesExplorerBar.Groups[0].Items[0]; _activeItem = this.assettypesExplorerBar.Groups[0].Items[0]; } else { this.assettypesExplorerBar.ActiveItem = _activeItem; } } }
private void UpdateInteractiveComputers() { AssetTypeList listAssetTypes = new AssetTypeList(); listAssetTypes.Populate(); AssetType assetType = listAssetTypes.FindByName("Computers"); AssetTypeList computersList = listAssetTypes.EnumerateChildren(assetType.AssetTypeID); auditScannerDefinition.InteractiveCategories = computersList.ToString(); }
public SummaryTabView([ServiceDependency] WorkItem workItem) { this.workItem = workItem as LaytonWorkItem; InitializeComponent(); InitializeUserDefinedCategoryTabs(); _listAssetTypes.Populate(); tree = new UltraTree(); bApply = false; m_objSupportContract = new SupportContract(); //LoadForm(); }
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(); }
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); } }
public TcpipNetworkDiscovery(NameValueCollection ipRanges) { _ipRanges = ipRanges; assetTypes.Populate(); }