private ParameterCollectionUIOptions Create(CohortIdentificationConfiguration cohortIdentificationConfiguration, ICoreChildProvider coreChildProvider)
        {
            var builder = new CohortQueryBuilder(cohortIdentificationConfiguration, coreChildProvider);

            builder.RegenerateSQL();

            var paramManager = builder.ParameterManager;

            return(new ParameterCollectionUIOptions(UseCaseCohortIdentificationConfiguration, cohortIdentificationConfiguration, ParameterLevel.Global, paramManager));
        }
        public IDataAccessPoint GetDataAccessPoint()
        {
            var cache = GetCacheServer();

            if (UseQueryCache && cache != null)
            {
                return(cache);
            }
            else
            {
                var builder = new CohortQueryBuilder(CohortIdentificationConfiguration, null);
                builder.RegenerateSQL();
                return(new SelfCertifyingDataAccessPoint(builder.Results.TargetServer));
            }
        }
        private ParameterCollectionUIOptions Create(CohortIdentificationConfiguration cohortIdentificationConfiguration)
        {
            var builder = new CohortQueryBuilder(cohortIdentificationConfiguration);

            try
            {
                builder.RegenerateSQL();
            }
            catch (QueryBuildingException ex)
            {
                ExceptionViewer.Show("There was a problem resolving all the underlying parameters in all your various Aggregates, the following dialogue is reliable only for the Globals", ex);
            }

            var paramManager = builder.ParameterManager;

            return(new ParameterCollectionUIOptions(UseCaseCohortIdentificationConfiguration, cohortIdentificationConfiguration, ParameterLevel.Global, paramManager));
        }
        public ParameterCollectionUIOptions Create(AggregateConfiguration aggregateConfiguration)
        {
            ParameterManager pm;

            if (aggregateConfiguration.IsCohortIdentificationAggregate)
            {
                //Add the globals if it is part of a CohortIdentificationConfiguration
                var cic = aggregateConfiguration.GetCohortIdentificationConfigurationIfAny();

                var globals = cic != null?cic.GetAllParameters() : new ISqlParameter[0];

                var builder = new CohortQueryBuilder(aggregateConfiguration, globals);
                pm = builder.ParameterManager;

                try
                {
                    //Generate the SQL which will make it find all the other parameters
                    builder.RegenerateSQL();
                }
                catch (QueryBuildingException)
                {
                    //if theres a problem with parameters or anything else, it is okay this diaog might let the user fix that
                }
            }
            else
            {
                var builder = aggregateConfiguration.GetQueryBuilder();
                pm = builder.ParameterManager;

                try
                {
                    //Generate the SQL which will make it find all the other parameters
                    builder.RegenerateSQL();
                }
                catch (QueryBuildingException)
                {
                    //if theres a problem with parameters or anything else, it is okay this diaog might let the user fix that
                }
            }


            return(new ParameterCollectionUIOptions(UseCaseAggregateConfiguration, aggregateConfiguration, ParameterLevel.CompositeQueryLevel, pm));
        }