/// <summary> /// Return (any) OS Instance which we can find for the specified asset /// </summary> /// <param name="assetID"></param> /// <returns></returns> public OSInstance GetInstanceForAsset(int assetID) { foreach (InstalledOS installedOS in this) { OSInstance foundInstance = installedOS.GetInstanceForAsset(assetID); if (foundInstance != null) { return(foundInstance); } } return(null); }
/// <summary> /// Load instances of this Operating System from the supplied DataTable /// </summary> /// <param name="instancesTable"></param> protected void LoadInstances(DataTable instancesTable) { _listInstances.Clear(); foreach (DataRow row in instancesTable.Rows) { try { OSInstance newInstance = new OSInstance(row); _listInstances.Add(newInstance); } catch (Exception) { // Just skip the instance as this points to an internal database consistency error } } }
/// <summary> /// Populate the Asset Details node of the tree /// </summary> /// <param name="rootNode"></param> protected void PopulateOperatingSystems(UltraTreeNode rootNode) { if (rootNode.Text != AWMiscStrings.OSNode) { return; } string attribute = OSInstance.GetAttributeName(OSInstance.eAttributes.family); UltraTreeNode node = new UltraTreeNode(rootNode.Key + @"|" + attribute, attribute); node.LeftImages.Add(Properties.Resources.os_16); node.Tag = rootNode.Tag; node.Override.NodeStyle = _valueNodeStyle; rootNode.Nodes.Add(node); // attribute = OSInstance.GetAttributeName(OSInstance.eAttributes.fullname); node = new UltraTreeNode(rootNode.Key + @"|" + attribute, attribute); node.LeftImages.Add(Properties.Resources.os_16); node.Tag = rootNode.Tag; node.Override.NodeStyle = _valueNodeStyle; rootNode.Nodes.Add(node); // attribute = OSInstance.GetAttributeName(OSInstance.eAttributes.cdkey); node = new UltraTreeNode(rootNode.Key + @"|" + attribute, attribute); node.LeftImages.Add(Properties.Resources.os_16); node.Tag = rootNode.Tag; node.Override.NodeStyle = _valueNodeStyle; rootNode.Nodes.Add(node); // attribute = OSInstance.GetAttributeName(OSInstance.eAttributes.serial); node = new UltraTreeNode(rootNode.Key + @"|" + attribute, attribute); node.LeftImages.Add(Properties.Resources.os_16); node.Tag = rootNode.Tag; node.Override.NodeStyle = _valueNodeStyle; rootNode.Nodes.Add(node); }