Exemplo n.º 1
0
        private void Initialize(IActivateItems activator, string initialDescription, Project projectSpecificIfAny)
        {
            CommonFunctionality.SetItemActivator(activator);
            var cols = _tableInfo.ColumnInfos;

            var forwardEngineer = new ForwardEngineerCatalogue(_tableInfo, cols, false);

            ExtractionInformation[] eis;
            forwardEngineer.ExecuteForwardEngineering(out _catalogue, out _catalogueItems, out eis);

            tbDescription.Text = initialDescription + " (" + Environment.UserName + " - " + DateTime.Now + ")";
            tbTableName.Text   = _tableInfo.Name;
            _catalogue.SaveToDatabase();
            objectSaverButton1.SetupFor(this, _catalogue, activator);

            if (_binder == null)
            {
                _binder = new BinderWithErrorProviderFactory(activator);
                _binder.Bind(tbCatalogueName, "Text", _catalogue, "Name", false, DataSourceUpdateMode.OnPropertyChanged, c => c.Name);
                _binder.Bind(tbAcronym, "Text", _catalogue, "Acronym", false, DataSourceUpdateMode.OnPropertyChanged, c => c.Acronym);
                _binder.Bind(tbDescription, "Text", _catalogue, "Description", false, DataSourceUpdateMode.OnPropertyChanged, c => c.Description);
            }

            //Every CatalogueItem is either mapped to a ColumnInfo (not extractable) or a ExtractionInformation (extractable).  To start out with they are not extractable
            foreach (CatalogueItem ci in _catalogueItems)
            {
                olvColumnExtractability.AddObject(new ColPair(ci, cols.Single(col => ci.ColumnInfo_ID == col.ID)));
            }

            _extractionCategories = new object[]
            {
                NotExtractable,
                ExtractionCategory.Core,
                ExtractionCategory.Supplemental,
                ExtractionCategory.SpecialApprovalRequired,
                ExtractionCategory.Internal,
                ExtractionCategory.Deprecated
            };

            ddCategoriseMany.Items.AddRange(_extractionCategories);

            olvExtractionCategory.AspectGetter         += ExtractionCategoryAspectGetter;
            olvColumnExtractability.AlwaysGroupByColumn = olvExtractionCategory;

            olvColumnExtractability.CellEditStarting  += TlvColumnExtractabilityOnCellEditStarting;
            olvColumnExtractability.CellEditFinishing += TlvColumnExtractabilityOnCellEditFinishing;
            olvColumnExtractability.CellEditActivation = ObjectListView.CellEditActivateMode.SingleClick;

            olvIsExtractionIdentifier.AspectPutter += IsExtractionIdentifier_AspectPutter;
            olvIsExtractionIdentifier.AspectGetter += IsExtractionIdentifier_AspectGetter;

            olvColumnInfoName.ImageGetter = ImageGetter;
            olvColumnExtractability.RebuildColumns();

            if (Activator.RepositoryLocator.DataExportRepository == null)
            {
                gbProjectSpecific.Enabled = false;
            }
            else
            {
                SelectProject(projectSpecificIfAny);
                pbProject.Image = activator.CoreIconProvider.GetImage(RDMPConcept.Project);
            }

            ddIsExtractionIdentifier.Items.Add("<<None>>");
            ddIsExtractionIdentifier.Items.AddRange(olvColumnExtractability.Objects.OfType <ColPair>().ToArray());

            CommonFunctionality.AddHelp(btnPickProject, "IExtractableDataSet.Project_ID", "Project Specific Datasets");
            CommonFunctionality.AddHelpString(btnAddToExisting, "Add to existing catalogue", "Use this option if you want to create a Catalogue which extracts from multiple tables (via a JOIN).  Once used you will still need to configure a JoinInfo between column(s) in all the tables the Catalogue draws data from.");
        }
Exemplo n.º 2
0
 public virtual void SetItemActivator(IActivateItems activator)
 {
     Activator = activator;
     CommonFunctionality.SetItemActivator(activator);
 }