public ExecuteCommandAddCatalogueToCohortIdentificationAsPatientIndexTable(IActivateItems activator, CatalogueCommand catalogue, CohortIdentificationConfiguration configuration) : this(activator, configuration)
 {
     _catalogue = catalogue;
     if (!_catalogue.ContainsAtLeastOneExtractionIdentifier)
     {
         SetImpossible("Catalogue " + _catalogue.Catalogue + " does not contain any IsExtractionIdentifier columns");
     }
 }
        public ExecuteCommandAddCatalogueToCohortIdentificationSetContainer(IActivateItems activator, CatalogueCommand catalogueCommand, CohortAggregateContainer targetCohortAggregateContainer) : base(activator)
        {
            _catalogueCommand = catalogueCommand;
            _targetCohortAggregateContainer = targetCohortAggregateContainer;

            if (!catalogueCommand.ContainsAtLeastOneExtractionIdentifier)
            {
                SetImpossible("Catalogue " + catalogueCommand.Catalogue + " does not contain any IsExtractionIdentifier columns");
            }
        }
Пример #3
0
        public void CreateCohortSet(CohortIdentificationConfiguration cic, CohortAggregateContainer targetContainer, int order)
        {
            var cata = cbxCatalogues.SelectedItem as Catalogue;

            if (cata == null)
            {
                throw new Exception("Catalogue has not been picked!");
            }

            var cataCommand = new CatalogueCommand(cata);

            //use this one
            cataCommand.ResolveMultipleExtractionIdentifiers = (s, e) => cbxColumns.SelectedItem as ExtractionInformation;

            var cmd = new ExecuteCommandAddCatalogueToCohortIdentificationSetContainer(_activator, cataCommand, targetContainer);

            cmd.SkipMandatoryFilterCreation = true;
            cmd.Execute();

            var aggregate = cmd.AggregateCreatedIfAny;

            var filterOp = (FilterContainerOperation)ddAndOr.SelectedItem;

            AggregateFilterContainer filterContainer;

            if (aggregate.RootFilterContainer_ID != null)
            {
                //this is the case if there are mandatory filters in the dataset
                filterContainer           = aggregate.RootFilterContainer;
                filterContainer.Operation = filterOp;
                filterContainer.SaveToDatabase();
            }
            else
            {
                filterContainer = new AggregateFilterContainer(_activator.RepositoryLocator.CatalogueRepository, filterOp);
            }

            aggregate.Order = order;
            aggregate.RootFilterContainer_ID = filterContainer.ID;
            aggregate.SaveToDatabase();

            List <IFilter> filtersAddedSoFar = new List <IFilter>();

            foreach (var ui in _filterUIs)
            {
                var f = ui.CreateFilter(new AggregateFilterFactory(_activator.RepositoryLocator.CatalogueRepository), filterContainer, filtersAddedSoFar.ToArray());
                filtersAddedSoFar.Add(f);
            }
        }
Пример #4
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));
                    }
                }
            }
        }
        public override void Execute()
        {
            base.Execute();

            if (_catalogue == null)
            {
                Catalogue cata;
                if (!SelectOne(Activator.RepositoryLocator.CatalogueRepository.GetAllObjects <Catalogue>(), out cata))
                {
                    return;
                }

                _catalogue = new CatalogueCommand(cata);
            }

            AggregateConfigurationCommand aggregateCommand = _catalogue.GenerateAggregateConfigurationFor(_configuration);

            var joinableCommandExecution = new ExecuteCommandConvertAggregateConfigurationToPatientIndexTable(Activator, aggregateCommand, _configuration);

            joinableCommandExecution.Execute();
        }
 public ExecuteCommandPutCatalogueIntoCatalogueFolder(IActivateItems activator, CatalogueCommand cmd, CatalogueFolder targetModel)
     : this(activator, new [] { cmd.Catalogue }, targetModel)
 {
 }