/// <summary> /// Checks the available VM Platforms in the database to make sure that /// the number of VMs needed for the test does not exceed the available. /// </summary> /// <param name="scenario"></param> /// <param name="platform"></param> /// <param name="holdId"></param> /// <returns>true if enough VM Platforms are available, false otherwise.</returns> private static bool CheckPlatformsAvailable(EnterpriseScenario scenario, FrameworkClientPlatform platform, string holdId) { ScenarioPlatformUsageSet usages = new ScenarioPlatformUsageSet(scenario); if (platform != null) { usages.Load(UserManager.CurrentUser, platform); } else if (string.IsNullOrEmpty(holdId) == false) { usages.Load(UserManager.CurrentUser, holdId); } else { usages.Load(UserManager.CurrentUser); } if (!usages.PlatformsAvailable) { using (InsufficientPlatformsErrorForm form = new InsufficientPlatformsErrorForm(usages)) { form.ShowDialog(); return(false); } } return(true); }
public ScenarioPlatformUsageForm(ScenarioPlatformUsageSet usages) { InitializeComponent(); _scenario = usages.Scenario; _platformUsage = new SortableBindingList <ScenarioPlatformUsage>(); foreach (var usage in usages) { _platformUsage.Add(usage); } }
public InsufficientPlatformsErrorForm(ScenarioPlatformUsageSet usages) { InitializeComponent(); _scenarioName = usages.Scenario.Name; _platformUsage = new SortableBindingList <ScenarioPlatformUsage>(); foreach (var usage in usages) { _platformUsage.Add(usage); } }
/// <summary> /// Displays the platform usage /// </summary> public void DisplayPlatformUsage() { ScenarioPlatformUsageSet usages = new ScenarioPlatformUsageSet(_scenario); usages.Load(UserManager.CurrentUser); using (ScenarioPlatformUsageForm form = new ScenarioPlatformUsageForm(usages)) { form.ShowDialog(); } }