Exemplo n.º 1
0
        public override bool ShowCohortWizard(out CohortIdentificationConfiguration cic)
        {
            var wizard = new CreateNewCohortIdentificationConfigurationUI(this);

            if (wizard.ShowDialog() == DialogResult.OK)
            {
                cic = wizard.CohortIdentificationCriteriaCreatedIfAny;
            }
            else
            {
                cic = null;
            }

            // Wizard was shown so that's a thing
            return(true);
        }
Exemplo n.º 2
0
        public override void Execute()
        {
            base.Execute();

            CohortIdentificationConfiguration cic;

            if (UserSettings.ShowCohortWizard)
            {
                var wizard = new CreateNewCohortIdentificationConfigurationUI(Activator);

                if (wizard.ShowDialog() == DialogResult.OK)
                {
                    cic = wizard.CohortIdentificationCriteriaCreatedIfAny;
                }
                else
                {
                    return;
                }
            }
            else
            {
                if (TypeText("Cohort Query Name", "Cohort Name", out string name))
                {
                    cic = new CohortIdentificationConfiguration(Activator.RepositoryLocator.CatalogueRepository, name);
                    cic.CreateRootContainerIfNotExists();
                    var exclusion = cic.RootCohortAggregateContainer;
                    exclusion.Name      = "Exclusion Criteria";
                    exclusion.Operation = SetOperation.EXCEPT;
                    exclusion.SaveToDatabase();

                    var inclusion = new CohortAggregateContainer(Activator.RepositoryLocator.CatalogueRepository, SetOperation.UNION);
                    inclusion.Name = "Inclusion Criteria";
                    inclusion.SaveToDatabase();

                    exclusion.AddChild(inclusion);
                }
                else
                {
                    return;
                }
            }

            if (cic == null)
            {
                return;
            }

            if (_associateWithProject != null)
            {
                var assoc = _associateWithProject.AssociateWithCohortIdentification(cic);
                Publish(assoc);
                Emphasise(assoc, int.MaxValue);
            }
            else
            {
                Publish(cic);
                Emphasise(cic, int.MaxValue);
            }

            Activate(cic);
        }