Ejemplo n.º 1
0
        private void AddCatalogues()
        {
            SelectIMapsDirectlyToDatabaseTableDialog dialog = new SelectIMapsDirectlyToDatabaseTableDialog(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 CatalogueCommand(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));
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void AddAggregates(AggregateConfiguration[] userCanPickFrom)
        {
            SelectIMapsDirectlyToDatabaseTableDialog dialog = new SelectIMapsDirectlyToDatabaseTableDialog(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 AggregateConfigurationCommand(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));
                    }
                }
            }
        }