private static ResourceUsageTreeItem AddResourceNode(ResourceUsageTreeItem scenario, AssetUsageData item) { var resourceNode = scenario.AddChild(item.ResourceName); resourceNode.EntityId = item.ResourceId; resourceNode.EntityType = item.ResourceType; resourceNode.Creator = item.ResourceCreator; resourceNode.Created = item.ResourceCreated == null ? string.Empty : ((DateTime)item.ResourceCreated).ToString(); resourceNode.LastRun = item.ResourceLastRun == null ? string.Empty : ((DateTime)item.ResourceLastRun).ToString(); return(resourceNode); }
private static void AddMetadataNode(ResourceUsageTreeItem resource, AssetUsageData item) { // Add the metadata information if (item.MetadataId != Guid.Empty) { // Look for the metadata node under the resource node, and if not found, add it. var metadata = resource.Children.Where(e => e.EntityId.Equals(item.MetadataId)).FirstOrDefault(); if (metadata == null) { var metadataNode = resource.AddChild(item.MetadataDescription); metadataNode.EntityId = item.MetadataId; metadataNode.EntityType = item.MetadataType; metadataNode.Creator = item.MetadataCreator; metadataNode.Created = item.ResourceCreated == null ? string.Empty : ((DateTime)item.ResourceCreated).ToString(); metadataNode.LastRun = item.ResourceLastRun == null ? string.Empty : ((DateTime)item.ResourceLastRun).ToString(); } } }