public override void SetDatabaseObject(IActivateItems activator, ProcessTask databaseObject) { _processTask = databaseObject; base.SetDatabaseObject(activator, databaseObject); if (_argumentCollection == null) { var repo = databaseObject.CatalogueRepository; _argumentCollection = new ArgumentCollectionUI(); var className = databaseObject.GetClassNameWhoArgumentsAreFor(); if (string.IsNullOrWhiteSpace(className)) { activator.KillForm(ParentForm, new Exception("No class has been specified on ProcessTask '" + databaseObject + "'")); return; } try { _underlyingType = repo.MEF.GetType(className); if (_underlyingType == null) { activator.KillForm(ParentForm, new Exception("Could not find Type '" + className + "' for ProcessTask '" + databaseObject + "'")); } } catch (Exception e) { activator.KillForm(ParentForm, new Exception("MEF crashed while trying to look up Type '" + className + "' for ProcessTask '" + databaseObject + "'", e)); return; } _argumentCollection.Setup(databaseObject, _underlyingType, Activator.RepositoryLocator.CatalogueRepository); _argumentCollection.Dock = DockStyle.Fill; pArguments.Controls.Add(_argumentCollection); } CommonFunctionality.Add(_ragSmiley); CheckComponent(); loadStageIconUI1.Setup(Activator.CoreIconProvider, _processTask.LoadStage); CommonFunctionality.Add(new ToolStripButton("Check", FamFamFamIcons.arrow_refresh, (s, e) => CheckComponent())); }
public override void SetDatabaseObject(IActivateItems activator, ColumnInfo databaseObject) { base.SetDatabaseObject(activator, databaseObject); ColumnInfo = databaseObject; //make sure we can connect to the server if (!ColumnInfo.TableInfo.DiscoverExistence(DataAccessContext.DataLoad, out string reason)) { activator.KillForm(ParentForm, reason); return; } try { try { lblRowcount.Text = ColumnInfo.TableInfo.Discover(DataAccessContext.DataLoad).GetRowCount().ToString(); } catch (Exception e) { checksUI1.OnCheckPerformed( new CheckEventArgs( "Could not get rowcount of table " + ColumnInfo.TableInfo.GetRuntimeName() + " using data access context DataLoad", CheckResult.Fail, e)); } GeneratePreviews(); RefreshServers(); } catch (Exception e) { activator.KillForm(ParentForm, e); } }
public override void SetDatabaseObject(IActivateItems activator, ExternalDatabaseServer databaseObject) { base.SetDatabaseObject(activator, databaseObject); if (_navigationTrack == null) { //what happens when user clicks back/forward _navigationTrack = new NavigationTrack <LogViewerFilter>(f => true, f => { if (f.LoggingTable != LoggingTables.None) { var cmd = new ExecuteCommandViewLoggedData(activator, f); cmd.Execute(); } }); //set the initial filter _navigationTrack.Append(Filter); _back = new ToolStripButton("Back", FamFamFamIcons.Back, (s, e) => _navigationTrack.Back(true)) { DisplayStyle = ToolStripItemDisplayStyle.Image }; } CommonFunctionality.Add(_back); CommonFunctionality.Add(label1); CommonFunctionality.Add(tbContentFilter); CommonFunctionality.Add(label2); CommonFunctionality.Add(tbTop); CommonFunctionality.Add(cbPreferNewer); if (!databaseObject.DiscoverExistence(DataAccessContext.Logging, out string reason)) { activator.KillForm(ParentForm, "Database " + databaseObject + " did not exist:" + reason); return; } LogManager = new LogManager(databaseObject); FetchDataTable(); }
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; }