示例#1
0
        public override void SetDatabaseObject(IActivateItems activator, Catalogue databaseObject)
        {
            base.SetDatabaseObject(activator, databaseObject);

            CommonFunctionality.AddToMenu(new ExecuteCommandRunDQEOnCatalogue(activator).SetTarget(databaseObject));
            CommonFunctionality.AddToMenu(new ExecuteCommandViewDQEResultsForCatalogue(activator)
            {
                OverrideCommandName = "View Results..."
            }.SetTarget(databaseObject));

            AddPluginCommandsToMenu();

            _catalogue = databaseObject;

            SetupComboBoxes(databaseObject);

            //get the validation XML
            if (string.IsNullOrWhiteSpace(databaseObject.ValidatorXML))
            {
                Validator = new Validator();
            }
            else
            {
                Validator = Validator.LoadFromXml(databaseObject.ValidatorXML);
            }

            var extractionInformations = databaseObject.GetAllExtractionInformation(ExtractionCategory.Any).ToArray();

            Array.Sort(extractionInformations);

            //Update the objects in case the publish is because the user added new columns etc
            var oldSelection = olvColumns.SelectedObject;

            olvColumns.ClearObjects();
            olvColumns.AddObjects(extractionInformations);
            olvColumns.SelectedObject = oldSelection;

            ValidateConfiguration();
        }
示例#2
0
        public override void SetDatabaseObject(IActivateItems activator, LoadMetadata databaseObject)
        {
            base.SetDatabaseObject(activator, databaseObject);
            _loadMetadata = databaseObject;

            checkAndExecuteUI1.SetItemActivator(activator);

            SetButtonStates(null, null);

            SetLoadProgressGroupBoxState();


            CommonFunctionality.Add(new ExecuteCommandViewLoadDiagram(activator, _loadMetadata));

            CommonFunctionality.AddToMenu(new ExecuteCommandEditLoadMetadataDescription(activator, _loadMetadata));

            CommonFunctionality.Add(new ExecuteCommandViewLoadMetadataLogs(activator, (LoadMetadata)databaseObject));

            CommonFunctionality.Add(dd_DebugOptions);

            AddPluginCommands();
        }
示例#3
0
        public ExecuteCommandOpenExtractionDirectory(IActivateItems activator, IExtractionConfiguration configuration) : base(activator)
        {
            var cumulativeExtractionResults = configuration.SelectedDataSets.Select(s => s.GetCumulativeExtractionResultsIfAny()).Where(c => c != null).ToArray();

            try
            {
                if (cumulativeExtractionResults.Length == 0)
                {
                    SetImpossible("No datasets have ever been extracted");
                }
                else
                if (!cumulativeExtractionResults.All(c => c.DestinationType != null && c.DestinationType.EndsWith("FlatFileDestination")))
                {
                    SetImpossible("Extraction destinations were not to disk");
                }
                else
                {
                    // all datasets have been extracted to disk

                    // but do they have a shared parent dir?
                    var files = cumulativeExtractionResults.Select(c => new FileInfo(c.DestinationDescription)).ToArray();

                    var parents = files.Select(f => f.Directory?.Parent?.FullName).Where(d => d != null).Distinct().ToArray();

                    if (parents.Length != 1)
                    {
                        SetImpossible($"Extracted files do not share a common extraction directory");
                    }
                    else
                    {
                        _dir = new DirectoryInfo(parents[0]);
                    }
                }
            }
            catch (Exception)
            {
                SetImpossible("Could not determine file location");
            }
        }
示例#4
0
        public SetDumpServerMenuItem(IActivateItems activator, ITableInfo tableInfo) : base(activator, "Add Dump Server")
        {
            _tableInfo = tableInfo;

            //cannot set server if we already have one
            Enabled = tableInfo.IdentifierDumpServer_ID == null;
            Image   = activator.CoreIconProvider.GetImage(RDMPConcept.ExternalDatabaseServer, OverlayKind.Add);

            var img     = CatalogueIcons.ExternalDatabaseServer_IdentifierDump;
            var overlay = new IconOverlayProvider();

            var cataRepo = activator.RepositoryLocator.CatalogueRepository;

            _availableServers = cataRepo.GetAllDatabases <IdentifierDumpDatabasePatcher>();

            var miUseExisting = new ToolStripMenuItem("Use Existing...", overlay.GetOverlayNoCache(img, OverlayKind.Link), UseExisting);

            miUseExisting.Enabled = _availableServers.Any();

            DropDownItems.Add(miUseExisting);
            DropDownItems.Add("Create New...", overlay.GetOverlayNoCache(img, OverlayKind.Add), CreateNewIdentifierDumpServer);
        }
示例#5
0
        public RDMPSingleControlTabMenu(IActivateItems activator, RDMPSingleControlTab tab, WindowManager windowManager)
        {
            _tab = tab;
            Items.Add("Close Tab", null, (s, e) => tab.Close());
            Items.Add("Close All Tabs", null, (s, e) => windowManager.CloseAllWindows(tab));
            Items.Add("Close All But This", null, (s, e) => windowManager.CloseAllButThis(tab));

            Items.Add("Show", null, (s, e) => tab.HandleUserRequestingEmphasis(activator));

            if (tab is PersistableSingleDatabaseObjectDockContent single)
            {
                var builder = new GoToMenuBuilder(activator);
                Items.Add(builder.GetMenu(single.DatabaseObject));
            }

            Items.Add("Refresh", FamFamFamIcons.arrow_refresh, (s, e) => _tab.HandleUserRequestingTabRefresh(activator));

            var help = new ToolStripMenuItem("Help", FamFamFamIcons.help, (s, e) => _tab.ShowHelp(activator));

            help.ShortcutKeys = Keys.F1;
            Items.Add(help);
        }
示例#6
0
        public void ApplyToTree(IActivateItems activator,TreeListView tree, IMapsDirectlyToDatabaseTable objectToEmphasise, DescendancyList descendancy)
        {
            _activator = activator;

            if (_tree != null)
                throw new Exception("Scope filter is already applied to a tree");

            _toPin = null;

            if (IsPinnableType(objectToEmphasise))
                _toPin = objectToEmphasise;
            else if (descendancy != null)
                _toPin = descendancy.Parents.FirstOrDefault(IsPinnableType);

            if (_toPin == null)
                return;
            
            _tree = tree;

            lblFilter.Text = _toPin.ToString();
            
            //add the filter to the tree
            Dock = DockStyle.Top;

            if (_tree.Dock != DockStyle.Fill)
            {
               //tree is not docked, make some room for us
                _tree.Height -= 19;
                _tree.Top += 19;
            }

            _tree.Parent.Controls.Add(this);

            _beforeModelFilter = _tree.ModelFilter;
            _beforeUseFiltering = _tree.UseFiltering;

            RefreshWhiteList(_activator.CoreChildProvider,descendancy);
        }
        public void SetCollection(IActivateItems activator, IPersistableObjectCollection collection)
        {
            _collection = (IViewSQLAndResultsCollection)collection;

            CommonFunctionality.ClearToolStrip();

            btnExecuteSql.Image = activator.CoreIconProvider.GetImage(RDMPConcept.SQL, OverlayKind.Execute);

            var overlayer = new IconOverlayProvider();

            btnResetSql.Image = overlayer.GetOverlay(FamFamFamIcons.text_align_left, OverlayKind.Problem);

            if (_autoComplete == null)
            {
                _autoComplete = new AutoCompleteProviderFactory(activator).Create(_collection.GetQuerySyntaxHelper());

                _collection.AdjustAutocomplete(_autoComplete);

                _autoComplete.RegisterForEvents(_scintilla);
            }

            SetItemActivator(activator);

            CommonFunctionality.Add(btnExecuteSql);
            CommonFunctionality.Add(btnResetSql);

            foreach (var c in _timeoutControls.GetControls())
            {
                CommonFunctionality.Add(c);
            }

            foreach (DatabaseEntity d in _collection.GetToolStripObjects())
            {
                CommonFunctionality.AddToMenu(new ExecuteCommandShow(activator, d, 0, true));
            }

            RefreshUIFromDatabase();
        }
示例#8
0
        public override void SetDatabaseObject(IActivateItems activator, ConcreteFilter databaseObject)
        {
            base.SetDatabaseObject(activator, databaseObject);
            Catalogue         = databaseObject.GetCatalogue();
            _extractionFilter = databaseObject;

            ParameterCollectionUIOptionsFactory factory = null;
            ParameterCollectionUIOptions        options = null;

            try
            {
                factory = new ParameterCollectionUIOptionsFactory();
                options = factory.Create(databaseObject);
            }
            catch (Exception e)
            {
                Activator.KillForm(ParentForm, e);
                return;
            }

            //collapse panel 1 unless there are parameters
            splitContainer1.Panel1Collapsed = !options.ParameterManager.ParametersFoundSoFarInQueryGeneration.Values.Any(v => v.Any());

            parameterCollectionUI1.SetUp(options);

            CommonFunctionality.AddToMenu(new ExecuteCommandViewFilterMatchData(Activator, databaseObject, ViewType.TOP_100));
            CommonFunctionality.AddToMenu(new ExecuteCommandViewFilterMatchData(Activator, databaseObject, ViewType.Aggregate));
            CommonFunctionality.AddToMenu(new ExecuteCommandViewFilterMatchGraph(Activator, databaseObject));
            CommonFunctionality.AddToMenu(new ExecuteCommandBrowseLookup(Activator, databaseObject));
            CommonFunctionality.AddToMenu(new ExecuteCommandPublishFilter(Activator, databaseObject, databaseObject.GetCatalogue()));

            FigureOutGlobalsAndAutoComplete();

            QueryEditor.Text = _extractionFilter.WhereSQL;

            CommonFunctionality.AddChecks(databaseObject);
            CommonFunctionality.StartChecking();
        }
示例#9
0
        public ExecuteCommandAddNewSupportingDocument(IActivateItems activator, FileCollectionCommand fileCollectionCommand, Catalogue targetCatalogue) : base(activator)
        {
            _fileCollectionCommand = fileCollectionCommand;
            _targetCatalogue       = targetCatalogue;
            var allExisting = targetCatalogue.GetAllSupportingDocuments(FetchOptions.AllGlobalsAndAllLocals);

            foreach (var doc in allExisting)
            {
                FileInfo filename = doc.GetFileName();

                if (filename == null)
                {
                    continue;
                }

                var collisions = _fileCollectionCommand.Files.FirstOrDefault(f => f.FullName.Equals(filename.FullName, StringComparison.CurrentCultureIgnoreCase));

                if (collisions != null)
                {
                    SetImpossible("File '" + collisions.Name + "' is already a SupportingDocument (ID=" + doc.ID + " - '" + doc.Name + "')");
                }
            }
        }
示例#10
0
        public override void SetDatabaseObject(IActivateItems activator, Catalogue databaseObject)
        {
            if (_scintillaDescription == null)
            {
                var f = new ScintillaTextEditorFactory();
                _scintillaDescription      = f.Create(null, null, null, true, false, activator.CurrentDirectory);
                _scintillaDescription.Font = System.Drawing.SystemFonts.DefaultFont;
                panel1.Controls.Add(_scintillaDescription);
            }

            base.SetDatabaseObject(activator, databaseObject);

            _catalogue = databaseObject;

            CommonFunctionality.AddHelp(tbFolder, "CatalogueFolder");

            CommonFunctionality.AddHelp(cbDeprecated, "IMightBeDeprecated.IsDeprecated");
            CommonFunctionality.AddHelp(cbColdStorage, "ICatalogue.IsColdStorageDataset");
            CommonFunctionality.AddHelp(cbInternal, "ICatalogue.IsInternalDataset");


            RefreshUIFromDatabase();
        }
示例#11
0
        public ExecuteCommandAlterTableAddArchiveTrigger(IActivateItems activator, TableInfo tableInfo) : base(activator, tableInfo)
        {
            if (IsImpossible)
            {
                return;
            }

            if (!Table.DiscoverColumns().Any(c => c.IsPrimaryKey))
            {
                SetImpossible(GlobalStrings.TableHasNoPrimaryKey);
                return;
            }

            var factory = new TriggerImplementerFactory(TableInfo.DatabaseType);

            _triggerImplementer = factory.Create(Table);
            var currentStatus = _triggerImplementer.GetTriggerStatus();

            if (currentStatus != TriggerStatus.Missing)
            {
                SetImpossible(GlobalStrings.TriggerStatusIsCurrently, currentStatus.S());
            }
        }
示例#12
0
        public override void SetDatabaseObject(IActivateItems activator, TableInfo databaseObject)
        {
            base.SetDatabaseObject(activator, databaseObject);

            olvLeftColumnNames.ImageGetter  = (o) => activator.CoreIconProvider.GetImage(o);
            olvRightColumnNames.ImageGetter = (o) => activator.CoreIconProvider.GetImage(o);

            _leftTableInfo       = databaseObject;
            tbLeftTableInfo.Text = _leftTableInfo.ToString();

            btnChooseRightTableInfo.Image = activator.CoreIconProvider.GetImage(RDMPConcept.TableInfo, OverlayKind.Add);
            UpdateValidityAssesment();

            olvLeftColumns.ClearObjects();
            olvLeftColumns.AddObjects(_leftTableInfo.ColumnInfos);

            if (pk1.IsValidGetter == null)
            {
                pk1.IsValidGetter = c => c.TableInfo_ID == databaseObject.ID;
                pk2.IsValidGetter = c => c.TableInfo_ID == databaseObject.ID;
                pk3.IsValidGetter = c => c.TableInfo_ID == databaseObject.ID;
            }
        }
示例#13
0
        public ExecuteCommandViewFilterMatchGraph(IActivateItems activator, IFilter filter) : base(activator)
        {
            _filter = filter;
            var cata = filter.GetCatalogue();

            if (cata == null)
            {
                SetImpossible("No Catalogue found for filter");
                return;
            }


            //compatible graphs are those that are not part of a cic (i.e. they are proper aggregate graphs)
            var compatibleGraphs = cata.AggregateConfigurations.Where(a => !a.IsCohortIdentificationAggregate).ToArray();

            if (!compatibleGraphs.Any())
            {
                SetImpossible("No graphs defined in Catalogue '" + cata + "'");
                return;
            }

            _compatibleGraphs = compatibleGraphs;
        }
示例#14
0
        public ResolveFatalErrors(IActivateItems activator, LogManager logManager, ArchivalFatalError[] toResolve) : base(activator)
        {
            _logManager = logManager;
            _toResolve  = toResolve;
            InitializeComponent();

            if (VisualStudioDesignMode || logManager == null) //dont add the QueryEditor if we are in design time (visual studio) because it breaks
            {
                return;
            }

            Explanation          = new ScintillaTextEditorFactory().Create(new RDMPCommandFactory());
            Explanation.ReadOnly = false;

            //if there is only 1 explanation already recorded then we should populate the explanation textbox with thsi
            if (toResolve.Select(e => e.Explanation).Distinct().Count() == 1)
            {
                Explanation.Text = toResolve.First().Explanation;
            }

            tbFatalErrorIDs.Text = string.Join(",", toResolve.Select(f => f.ID));
            pbExplanation.Controls.Add(Explanation);
        }
示例#15
0
        public CreateNewDataExtractionProjectUI(IActivateItems activator) : base(activator)
        {
            InitializeComponent();

            _existingProjects = activator.RepositoryLocator.DataExportRepository.GetAllObjects <Project>();
            var highestNumber = _existingProjects.Max(p => p.ProjectNumber);

            tbProjectNumber.Text = highestNumber == null ? "1" : (highestNumber.Value + 1).ToString();

            pbCohort.Image        = activator.CoreIconProvider.GetImage(RDMPConcept.CohortIdentificationConfiguration);
            pbCohortFile.Image    = activator.CoreIconProvider.GetImage(RDMPConcept.File);
            pbCohortSources.Image = activator.CoreIconProvider.GetImage(RDMPConcept.ExternalCohortTable);

            IdentifyCompatiblePipelines();

            IdentifyCompatibleCohortSources();

            olvDatasets.AddObjects(activator.RepositoryLocator.DataExportRepository.GetAllObjects <ExtractableDataSet>());

            cbxCohort.DataSource       = activator.RepositoryLocator.CatalogueRepository.GetAllObjects <CohortIdentificationConfiguration>();
            cbxCohort.PropertySelector = collection => collection.Cast <CohortIdentificationConfiguration>().Select(c => c.ToString());
            ClearCic();
        }
示例#16
0
        public ArgumentValueComboBoxUI(IActivateItems activator, object[] objectsForComboBox)
        {
            _activator          = activator;
            _objectsForComboBox = objectsForComboBox;
            InitializeComponent();

            if (objectsForComboBox == null || objectsForComboBox.Length == 0)
            {
                return;
            }

            btnPick.Enabled = objectsForComboBox.All(o => o is IMapsDirectlyToDatabaseTable);

            //If it is a dropdown of Types
            if (objectsForComboBox.All(o => o is Type))
            {
                //add only the names (not the full namespace)
                types = new HashSet <Type>(objectsForComboBox.Cast <Type>());

                cbxValue.DropDownStyle = ComboBoxStyle.DropDownList;
                cbxValue.Items.AddRange(types.Select(t => t.Name).ToArray());
                cbxValue.Items.Add(ClearSelection);
            }
            else
            if (objectsForComboBox.All(t => t is Enum)) //don't offer "ClearSelection" if it is an Enum list
            {
                _isEnum                = true;
                cbxValue.DataSource    = objectsForComboBox;
                cbxValue.DropDownStyle = ComboBoxStyle.DropDownList;
            }
            else
            {
                cbxValue.DropDownStyle = ComboBoxStyle.DropDownList;
                cbxValue.Items.AddRange(objectsForComboBox);
                cbxValue.Items.Add(ClearSelection);
            }
        }
示例#17
0
        public ExecuteCommandAddCohortToExtractionConfiguration(IActivateItems activator, ExtractableCohortCommand sourceExtractableCohortComand, ExtractionConfiguration targetExtractionConfiguration) : base(activator)
        {
            _sourceExtractableCohortComand = sourceExtractableCohortComand;
            _targetExtractionConfiguration = targetExtractionConfiguration;

            if (_sourceExtractableCohortComand.ErrorGettingCohortData != null)
            {
                SetImpossible("Could not fetch Cohort data:" + _sourceExtractableCohortComand.ErrorGettingCohortData.Message);
                return;
            }

            if (_targetExtractionConfiguration.IsReleased)
            {
                SetImpossible("Extraction is Frozen because it has been released and is readonly, try cloning it instead");
                return;
            }

            if (!sourceExtractableCohortComand.CompatibleExtractionConfigurations.Contains(_targetExtractionConfiguration))
            {
                SetImpossible("Cohort has project number " + sourceExtractableCohortComand.ExternalProjectNumber + " so can only be added to ExtractionConfigurations belonging to Projects with that same number");
                return;
            }

            if (_targetExtractionConfiguration.Cohort_ID != null)
            {
                if (_targetExtractionConfiguration.Cohort_ID == sourceExtractableCohortComand.Cohort.ID)
                {
                    SetImpossible("ExtractionConfiguration already uses this cohort");
                }
                else
                {
                    SetImpossible("ExtractionConfiguration already uses a different cohort (delete the relationship to the old cohort first)");
                }

                return;
            }
        }
        public IPipelineSelectionUI Create(IActivateItems activator, string text = null, DockStyle dock = DockStyle.None, Control containerControl = null)
        {
            //setup getter as an event handler for the selection ui
            _pipelineSelectionUIInstance = new PipelineSelectionUI(activator, _useCase, _repository);

            if (_user != null)
            {
                _pipelineSelectionUIInstance.Pipeline = _user.Getter();

                _pipelineSelectionUIInstance.PipelineChanged +=
                    (sender, args) =>
                    _user.Setter(((IPipelineSelectionUI)sender).Pipeline as Pipeline);
            }

            var c = (Control)_pipelineSelectionUIInstance;

            if (dock == DockStyle.None)
            {
                c.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            }
            else
            {
                c.Dock = dock;
            }

            if (text != null)
            {
                c.Text = text;
            }

            if (containerControl != null)
            {
                containerControl.Controls.Add(c);
            }

            return(_pipelineSelectionUIInstance);
        }
示例#19
0
        public void SetUp(IActivateItems activator, ArgumentValueUIArgs args)
        {
            _bLoading = true;
            _args     = args;

            object currentValue = null;

            try
            {
                if (_isEnum && _args.InitialValue == null)
                {
                    args.Setter(cbxValue.SelectedItem);
                }
                else
                {
                    currentValue = _args.InitialValue;
                }
            }
            catch (Exception e)
            {
                _args.Fatal(e);
            }

            if (currentValue != null)
            {
                if (types != null)
                {
                    cbxValue.Text = ((Type)currentValue).Name;
                }
                else
                {
                    cbxValue.Text = currentValue.ToString();
                }
            }

            _bLoading = false;
        }
示例#20
0
        public override void SetItemActivator(IActivateItems activator)
        {
            _activator = activator;

            _activator.Emphasise += _activator_Emphasise;

            //important to register the setup before the lifetime subscription so it gets priority on events
            CommonTreeFunctionality.SetUp(
                RDMPCollection.Catalogue,
                tlvCatalogues,
                _activator,
                olvColumn1, //the icon column
                //we have our own custom filter logic so no need to pass tbFilter
                olvColumn1  //also the renameable column
                );

            CommonTreeFunctionality.MaintainRootObjects = new[]
            {
                typeof(AllGovernanceNode)
            };

            //Things that are always visible regardless
            CommonTreeFunctionality.WhitespaceRightClickMenuCommandsGetter = (a) => new IAtomicCommand[]
            {
                new ExecuteCommandCreateNewCatalogueByImportingFile(a),
                new ExecuteCommandCreateNewCatalogueByImportingExistingDataTable(a),
                new ExecuteCommandCreateNewEmptyCatalogue(a)
            };

            _activator.RefreshBus.EstablishLifetimeSubscription(this);

            tlvCatalogues.AddObject(activator.CoreChildProvider.AllGovernanceNode);
            tlvCatalogues.AddObject(CatalogueFolder.Root);
            ApplyFilters();

            RefreshUIFromDatabase(CatalogueFolder.Root);
        }
示例#21
0
        public ExecuteCommandImportNewCopyOfFilterIntoContainer(IActivateItems activator, FilterCombineable filterCombineable, IContainer targetContainer) : base(activator)
        {
            _filterCombineable = filterCombineable;
            _targetContainer   = targetContainer;

            //if source catalogue is known
            if (_filterCombineable.SourceCatalogueIfAny != null)
            {
                var targetCatalogue = targetContainer.GetCatalogueIfAny();

                if (targetCatalogue != null)
                {
                    if (!_filterCombineable.SourceCatalogueIfAny.Equals(targetCatalogue))
                    {
                        SetImpossible("Cannot Import Filter from '" + _filterCombineable.SourceCatalogueIfAny + "' into '" + targetCatalogue + "'");
                    }
                }
            }

            if (targetContainer.ShouldBeReadOnly(out string reason))
            {
                SetImpossible(reason);
            }
        }
        public CreateNewCatalogueByImportingFileUI_Advanced(IActivateItems activator, DiscoveredDatabase database, FileInfo file, bool alsoForwardEngineerCatalogue, Project projectSpecific)
        {
            _repositoryLocator            = activator.RepositoryLocator;
            _activator                    = activator;
            _database                     = database;
            _alsoForwardEngineerCatalogue = alsoForwardEngineerCatalogue;
            _projectSpecific              = projectSpecific;

            InitializeComponent();

            configureAndExecutePipeline1 = new ConfigureAndExecutePipelineUI(new UploadFileUseCase(file, database), activator);
            _file = file;
            //
            // configureAndExecutePipeline1
            //
            configureAndExecutePipeline1.Dock     = System.Windows.Forms.DockStyle.Fill;
            configureAndExecutePipeline1.Location = new System.Drawing.Point(0, 0);
            configureAndExecutePipeline1.Name     = "configureAndExecutePipeline1";
            configureAndExecutePipeline1.Size     = new System.Drawing.Size(979, 894);
            configureAndExecutePipeline1.TabIndex = 14;
            Controls.Add(this.configureAndExecutePipeline1);

            configureAndExecutePipeline1.PipelineExecutionFinishedsuccessfully += ConfigureAndExecutePipeline1OnPipelineExecutionFinishedsuccessfully;
        }
        public override void SetDatabaseObject(IActivateItems activator, ExternalDatabaseServer databaseObject)
        {
            base.SetDatabaseObject(activator, databaseObject);
            _server = databaseObject;

            bloading = true;

            try
            {
                SetupDropdownItems();

                tbPassword.Text             = _server.GetDecryptedPassword();
                ddDatabaseType.SelectedItem = _server.DatabaseType;
                pbDatabaseProvider.Image    = Activator.CoreIconProvider.GetImage(_server.DatabaseType);

                pbServer.Image = Activator.CoreIconProvider.GetImage(_server);

                CommonFunctionality.AddChecks(databaseObject);
            }
            finally
            {
                bloading = false;
            }
        }
示例#24
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);
        }
示例#25
0
        public RDMPContextMenuStrip(RDMPContextMenuStripArgs args, object o)
        {
            _o    = o;
            _args = args;

            _activator = _args.ItemActivator;

            _activator.Theme.ApplyTo(this);

            AtomicCommandUIFactory = new AtomicCommandUIFactory(_activator);

            RepositoryLocator = _activator.RepositoryLocator;

            if (o != null && !(o is RDMPCollection))
            {
                ActivateCommandMenuItem = Add(new ExecuteCommandActivate(_activator, args.Masquerader ?? o));
            }

            if (o is DatabaseEntity e)
            {
                var gotoMenuBuilder = new GoToMenuBuilder(_activator);
                Items.Add(gotoMenuBuilder.GetMenu(e));
            }
        }
示例#26
0
        public override void SetDatabaseObject(IActivateItems activator, SelectedDataSets databaseObject)
        {
            base.SetDatabaseObject(activator, databaseObject);

            activator.RefreshBus.EstablishLifetimeSubscription(this);

            SelectedDataSet = databaseObject;
            _dataSet        = SelectedDataSet.ExtractableDataSet;
            _config         = (ExtractionConfiguration)SelectedDataSet.ExtractionConfiguration;

            SetupUserInterface();

            SortSelectedByOrder();

            CommonFunctionality.AddToMenu(new ExecuteCommandShow(activator, databaseObject.ExtractableDataSet.Catalogue, 0, true), "Show Catalogue");
            CommonFunctionality.Add(new ExecuteCommandExecuteExtractionConfiguration(activator, databaseObject));

            CommonFunctionality.AddChecks(new SelectedDataSetsChecker(SelectedDataSet));

            btnExclude.Enabled    = !ReadOnly;
            btnExcludeAll.Enabled = !ReadOnly;
            btnInclude.Enabled    = !ReadOnly;
            olvJoin.Enabled       = !ReadOnly;
        }
示例#27
0
        public override void SetDatabaseObject(IActivateItems activator, AggregateConfiguration databaseObject)
        {
            if (!menuInitialized)
            {
                base.SetDatabaseObject(activator, databaseObject);
                menuInitialized = true;

                CommonFunctionality.AddToMenu(new ExecuteCommandActivate(activator, databaseObject));
                CommonFunctionality.AddToMenu(new ToolStripSeparator());

                CommonFunctionality.AddToMenu(miSaveImages);
                CommonFunctionality.AddToMenu(miCopyToClipboard);
                CommonFunctionality.AddToMenu(btnCache);

                CommonFunctionality.Add(btnResendQuery);

                foreach (var c in _timeoutControls.GetControls())
                {
                    CommonFunctionality.Add(c);
                }
            }

            SetAggregate(activator, databaseObject);
        }
示例#28
0
        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);
            }
        }
示例#29
0
        public override void SetItemActivator(IActivateItems activator)
        {
            base.SetItemActivator(activator);

            CommonTreeFunctionality.SetUp(RDMPCollection.Favourites, tlvFavourites, Activator, olvName, olvName, new RDMPCollectionCommonFunctionalitySettings {
                AllowPinning = false
            });
            CommonTreeFunctionality.AxeChildren = new Type[] { typeof(CohortIdentificationConfiguration) };
            CommonTreeFunctionality.WhitespaceRightClickMenuCommandsGetter =
                (a) => new IAtomicCommand[]
            {
                new ExecuteCommandAddFavourite(a),
                new ExecuteCommandClearFavourites(a)
            };
            Activator.RefreshBus.EstablishLifetimeSubscription(this);

            RefreshFavourites();

            if (_firstTime)
            {
                CommonTreeFunctionality.SetupColumnTracking(olvName, new Guid("f8b0481e-378c-4996-9400-cb039c2efc5c"));
                _firstTime = false;
            }
        }
示例#30
0
        public RunUI(IActivateItems activator) : base(activator)
        {
            InitializeComponent();

            _commandsDictionary = new Dictionary <string, Type>(StringComparer.CurrentCultureIgnoreCase);

            _commandCaller = new CommandInvoker(activator);
            _commandCaller.CommandImpossible += (s, e) => MessageBox.Show(e.Command.ReasonCommandImpossible);
            _commandCaller.CommandCompleted  += (s, e) => this.Close();

            var commands = _commandCaller.GetSupportedCommands();

            foreach (var c in commands)
            {
                var name = BasicCommandExecution.GetCommandName(c.Name);

                if (!_commandsDictionary.ContainsKey(name))
                {
                    _commandsDictionary.Add(name, c);
                }
            }

            comboBox1.Items.AddRange(_commandsDictionary.Keys.ToArray());
        }