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