private void AddCatalogues() { SelectIMapsDirectlyToDatabaseTableDialog dialog = new SelectIMapsDirectlyToDatabaseTableDialog(_activator, RepositoryLocator.CatalogueRepository.GetAllObjects <Catalogue>(), false, false); dialog.AllowMultiSelect = true; if (dialog.ShowDialog() == DialogResult.OK) { if (!dialog.MultiSelected.Any()) { return; } PopupChecksUI checks = new PopupChecksUI("Adding Catalogues", true); foreach (Catalogue catalogue in dialog.MultiSelected) { try { var cmd = new CatalogueCombineable(catalogue); var cmdExecution = new ExecuteCommandAddCatalogueToCohortIdentificationSetContainer(_activator, cmd, _container); if (cmdExecution.IsImpossible) { checks.OnCheckPerformed( new CheckEventArgs( "Could not add Catalogue " + catalogue + " because of Reason:" + cmdExecution.ReasonCommandImpossible, CheckResult.Fail)); } else { cmdExecution.Execute(); checks.OnCheckPerformed(new CheckEventArgs("Successfully added Catalogue " + catalogue, CheckResult.Success)); } } catch (Exception e) { checks.OnCheckPerformed(new CheckEventArgs("Failed to add Catalogue " + catalogue + "(see Exception for details)", CheckResult.Fail, e)); } } } }
private void AddAggregates(AggregateConfiguration[] userCanPickFrom) { SelectIMapsDirectlyToDatabaseTableDialog dialog = new SelectIMapsDirectlyToDatabaseTableDialog(_activator, userCanPickFrom, false, false); dialog.AllowMultiSelect = true; if (dialog.ShowDialog() == DialogResult.OK) { if (!dialog.MultiSelected.Any()) { return; } PopupChecksUI checks = new PopupChecksUI("Adding Aggregate(s)", true); foreach (AggregateConfiguration aggregateConfiguration in dialog.MultiSelected) { try { var cmd = new AggregateConfigurationCombineable(aggregateConfiguration); var cmdExecution = new ExecuteCommandAddAggregateConfigurationToCohortIdentificationSetContainer(_activator, cmd, _container); if (cmdExecution.IsImpossible) { checks.OnCheckPerformed( new CheckEventArgs( "Could not add AggregateConfiguration " + aggregateConfiguration + " because of Reason:" + cmdExecution.ReasonCommandImpossible, CheckResult.Fail)); } else { cmdExecution.Execute(); checks.OnCheckPerformed(new CheckEventArgs("Successfully added AggregateConfiguration " + aggregateConfiguration, CheckResult.Success)); } } catch (Exception e) { checks.OnCheckPerformed(new CheckEventArgs("Failed to add AggregateConfiguration " + aggregateConfiguration + "(see Exception for details)", CheckResult.Fail, e)); } } } }