private static AssetInventoryConfiguration BuildAssetInventoryConfig() { AssetInventoryConfiguration configuration = new AssetInventoryConfiguration(); if (GlobalSettings.Items != null && GlobalSettings.Items.ContainsKey(Setting.AssetInventoryPools)) { foreach (string pool in GlobalSettings.Items[Setting.AssetInventoryPools].Split(",".ToArray(), StringSplitOptions.RemoveEmptyEntries)) { configuration.AssetPools.Add(pool); } } return(configuration); }
/// <summary> /// Initializes a new instance of the <see cref="AssetSelectionForm"/> class. /// </summary> /// <param name="capabilities">The capabilities.</param> public AssetSelectionForm(AssetAttributes capabilities) : this() { // Get the pools from SystemSettings string poolString = GlobalSettings.Items[Setting.AssetInventoryPools]; List <string> pools = poolString.Split(',').ToList(); AssetInventoryConfiguration configuration = new AssetInventoryConfiguration(); pools.ForEach(n => configuration.AssetPools.Add(n)); AssetInventoryController controller = new AssetInventoryController(DbConnect.AssetInventoryConnectionString, configuration); foreach (AssetInfo asset in controller.GetAssets(capabilities)) { _assetList.Add(asset); } assets_GridView.DataSource = _assetList; }