/// <summary> /// This function is called when we have selected a specific 'Operating System Family' node below 'All Assets' /// In this case we need to display a list of assets for which this Operating System has been installed /// </summary> /// <param name="displayedNode"></param> protected void DisplayAllAssets_OS(UltraTreeNode displayedNode) { // Ensure that the tree view is already populated for this branch NetworkExplorerView explorerView = workItem.ExplorerView as NetworkExplorerView; explorerView.ExpandNode(displayedNode); // We are displaying ALL publishers - add in columns for // Application Object and Publisher DataColumn column1 = new DataColumn("ApplicationObject", typeof(object)); DataColumn column2 = new DataColumn("Asset", typeof(string)); DataColumn column3 = new DataColumn("Version", typeof(string)); DataColumn column4 = new DataColumn("Serial Number", typeof(string)); DataColumn column5 = new DataColumn("CD Key", typeof(string)); // Add these columns to the DataSet applicationsDataSet.Tables[0].Columns.AddRange(new System.Data.DataColumn[] { column1, column2, column3, column4, column5 }); // Get a list of assets for which this application has AllAssets allAssets = displayedNode.Tag as AllAssets; InstalledOS thisOS = allAssets.Tag as InstalledOS; // This will give us (any) instances foreach (OSInstance instance in thisOS.Instances) { // Note we save the UltraTreeNode tag with this row as this should relate to the application Asset asset = new Asset(); asset.Name = instance.InstalledOnComputer; asset.AssetID = instance.InstalledOnComputerID; asset.Icon = instance.InstalledOnComputerIcon; applicationsDataSet.Tables[0].Rows.Add(new object[] { asset, asset.Name, instance.Version, instance.Serial.ProductId, instance.Serial.CdKey }); } }
/// <summary> /// Display data pertaining to the specified tree node with no grouping enforced /// </summary> /// <param name="displayedNode"></param> protected void DisplayUngrouped(UltraTreeNode displayedNode, string key, Asset displayedAsset) { // Ensure that the tree view is already populated for this branch NetworkExplorerView explorerView = workItem.ExplorerView as NetworkExplorerView; explorerView.ExpandNode(displayedNode); // Add in columns for Item and Value DataColumn objectColumn = new DataColumn("DataObject", typeof(object)); DataColumn itemColumn = new DataColumn("Item", typeof(string)); DataColumn valueColumn = new DataColumn("Value", typeof(object)); auditDataSet.Tables[0].Columns.AddRange(new System.Data.DataColumn[] { objectColumn, itemColumn, valueColumn }); //displayedNode.Nodes.Override.Sort = SortType.Descending; // First we add the SUB-CATEGORIES to the list foreach (UltraTreeNode node in displayedNode.Nodes) { auditDataSet.Tables[0].Rows.Add(new object[] { node, node.Text, "" }); } string tonerColour = "black"; // Get the ites to display within the category List <AuditedItem> itemsInCategory = displayedAsset.AuditedItems.GetItemsInCategory(key); foreach (AuditedItem item in itemsInCategory) { // we want to try and use the ink colour on the bitmap // get the toner name to see if it contains a value we can use if (item.Name == "Supply Name") { tonerColour = item.Value; } if (item.Name == "Supply Level") { Bitmap flag = CreateLevelBitmap(Convert.ToInt32(item.Value), tonerColour); auditDataSet.Tables[0].Rows.Add(new object[] { displayedNode, item.Name, flag }); } else { auditDataSet.Tables[0].Rows.Add(new object[] { displayedNode, item.Name, item.Value + item.DisplayUnits }); } } }
/// <summary> /// This function is called when we have selected the 'Applications' node immediately below 'All Assets' /// In this case we need to display a list of Publishers defined in the database /// /// Note - technically we should filter this list to only include publishers of applications for which there /// is an instance on one of the PCs below the selected level but for now we shall just display all /// </summary> /// <param name="displayedNode"></param> protected void DisplayAllAssets_Applications(UltraTreeNode displayedNode) { // Ensure that the tree view is already populated for this branch NetworkExplorerView explorerView = workItem.ExplorerView as NetworkExplorerView; explorerView.ExpandNode(displayedNode); // We are displaying applications for a specific publisher - add in columns for // Application Object and Application DataColumn column1 = new DataColumn("ApplicationObject", typeof(object)); DataColumn column2 = new DataColumn("Publisher", typeof(string)); // Add these columns to the DataSet applicationsDataSet.Tables[0].Columns.AddRange(new System.Data.DataColumn[] { column1, column2 }); // get a list of the applications for this publisher from the tree foreach (UltraTreeNode node in displayedNode.Nodes) { applicationsDataSet.Tables[0].Rows.Add(new object[] { node, node.Text }); } }
/// <summary> /// Display the data for this tab where we have selected an 'All Assets' node or child node thereof /// </summary> /// <param name="displayedNode"></param> protected void DisplayForAllAssets(UltraTreeNode displayedNode) { // Determine the key for this displayed item from the key for the tree node remembering that we must // strip off the AllAssets key name which is the first part of the key. string itemKey = displayedNode.Key; int nDelimiter = itemKey.IndexOf(AWMiscStrings.AllAssetsNode); AllAssets allAssets = displayedNode.Tag as AllAssets; // Ensure that the tree view is already populated for this branch NetworkExplorerView explorerView = workItem.ExplorerView as NetworkExplorerView; explorerView.ExpandNode(displayedNode); // Are we displaying a category or value/ if (allAssets.ItemValue == "") { DisplayAllAssetsDataCategories(displayedNode); } else { DisplayAllAssetsDataValues(displayedNode); } }