Exemple #1
0
        public void SetUp(IActivateItems activator, IAggregateBuilderOptions options, AggregateConfiguration aggregate)
        {
            SetItemActivator(activator);

            Enabled    = options.ShouldBeEnabled(AggregateEditorSection.TOPX, aggregate);
            _aggregate = aggregate;
            _topX      = aggregate.GetTopXIfAny();

            //if a TopX exists and control is disabled
            if (!Enabled && _topX != null)
            {
                _topX.DeleteInDatabase();
                _topX = null;
            }

            RefreshUIFromDatabase();
        }
Exemple #2
0
        public override void SetDatabaseObject(IActivateItems activator, AggregateConfiguration databaseObject)
        {
            _aggregate = databaseObject;

            base.SetDatabaseObject(activator, databaseObject);

            try
            {
                _querySyntaxHelper = databaseObject.GetQuerySyntaxHelper();
            }
            catch (AmbiguousDatabaseTypeException e)
            {
                activator.KillForm(ParentForm, e);
                return;
            }
            isRefreshing = true;

            //find out what is legal for the aggregate
            _options = new AggregateBuilderOptionsFactory().Create(_aggregate);

            //set enablednesss based on legality
            cbExtractable.Enabled    = _options.ShouldBeEnabled(AggregateEditorSection.Extractable, _aggregate);
            cbExtractable.Checked    = _aggregate.IsExtractable;
            ddPivotDimension.Enabled = _options.ShouldBeEnabled(AggregateEditorSection.PIVOT, _aggregate);
            gbAxis.Enabled           = _options.ShouldBeEnabled(AggregateEditorSection.AXIS, _aggregate);

            //add included/excluded dimensions
            selectColumnUI1.SetUp(Activator, _options, _aggregate);

            tbID.Text = _aggregate.ID.ToString();

            SetNameText();

            DetermineFromTables();

            PopulateHavingText();

            var axisIfAny           = _aggregate.GetAxisIfAny();
            var _axisDimensionIfAny = axisIfAny != null ? axisIfAny.AggregateDimension : null;
            var _pivotIfAny         = _aggregate.PivotDimension;

            PopulatePivotDropdown(_axisDimensionIfAny, _pivotIfAny);

            PopulateAxis(_axisDimensionIfAny, _pivotIfAny);

            PopulateTopX();

            if (databaseObject.IsCohortIdentificationAggregate)
            {
                var cic = databaseObject.GetCohortIdentificationConfigurationIfAny();
                if (cic != null)
                {
                    CommonFunctionality.AddToMenu(new ExecuteCommandActivate(activator, cic), "Open Cohort Query...");
                }
            }
            else
            {
                CommonFunctionality.AddToMenu(new ExecuteCommandShow(activator, databaseObject.Catalogue, 0, true));
            }

            CommonFunctionality.Add(new ExecuteCommandExecuteAggregateGraph(activator, databaseObject));
            CommonFunctionality.Add(new ExecuteCommandViewSample(activator, databaseObject));

            CommonFunctionality.AddToMenu(new ExecuteCommandViewSqlParameters(activator, databaseObject));

            CommonFunctionality.AddChecks(databaseObject);
            CommonFunctionality.StartChecking();

            //enforcing the naming convention on cic aggregates can result in ObjectSaverButton incorrectly getting enabled
            GetObjectSaverButton()?.Enable(false);

            isRefreshing = false;
        }