示例#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();
        }
示例#2
0
        public void SetUp(IActivateItems activator, IAggregateBuilderOptions options, AggregateConfiguration aggregate)
        {
            //record new states so we don't accidentally erase names of stuff
            SetItemActivator(activator);
            _options = options;
            _countColumnRequirement = _options.GetCountColumnRequirement(aggregate);
            _aggregate = aggregate;

            _availableColumns.Clear();
            _includedColumns.Clear();
            olvSelectColumns.ClearObjects();

            _availableColumns.AddRange(_options.GetAvailableSELECTColumns(_aggregate));
            _includedColumns.AddRange(_aggregate.AggregateDimensions);

            //add count option unless it cannot have one
            if (_options.GetCountColumnRequirement(_aggregate) != CountColumnRequirement.CannotHaveOne)
            {
                AggregateCountColumn countCol;

                if (!string.IsNullOrEmpty(_aggregate.CountSQL))
                {
                    countCol = new AggregateCountColumn(_aggregate.CountSQL);
                    _includedColumns.Add(countCol);
                }
                else
                {
                    countCol = new AggregateCountColumn("count(*) as CountColumn");
                    _availableColumns.Add(countCol);
                }
                countCol.SetQuerySyntaxHelper(_querySyntaxHelper, true);
            }

            olvSelectColumns.AddObjects(_includedColumns);
            olvSelectColumns.AddObjects(_availableColumns);
        }
示例#3
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;
        }