public override void Execute()
        {
            base.Execute();

            var availableColumns = _loadMetadata.GetDistinctTableInfoList(true).SelectMany(t => t.ColumnInfos).ToArray();

            if (_explicitChoiceMade)
            {
                var ignore = _columnsToIgnore ?? new ColumnInfo[0];

                foreach (var c in availableColumns)
                {
                    c.IgnoreInLoads = ignore.Contains(c);
                    c.SaveToDatabase();
                }
            }
            else
            {
                var chosen = BasicActivator.SelectMany("Ignore Columns (choice will replace old set)", typeof(ColumnInfo), availableColumns);

                if (chosen != null)
                {
                    foreach (var c in availableColumns)
                    {
                        c.IgnoreInLoads = chosen.Contains(c);
                        c.SaveToDatabase();
                    }
                }
            }

            Publish(_loadMetadata);
        }
Example #2
0
        public void DeleteTask()
        {
            _task.DeleteInDatabase();

            _lmd.GetDistinctTableInfoList(true).ForEach(t => t.DeleteInDatabase());
            _lmd.GetAllCatalogues().Cast <IDeleteable>().Single().DeleteInDatabase();

            _lmd.DeleteInDatabase();

            _dir.Delete(true);
        }
Example #3
0
        public void RefreshUIFromDatabase()
        {
            tlvLoadedTables.ClearObjects();

            if (_loadMetadata == null)
            {
                return;
            }

            TableInfo[] allTables;
            HICDatabaseConfiguration config;

            try
            {
                if (!_loadMetadata.GetAllCatalogues().Any())
                {
                    throw new Exception("There are no Catalogues (Datasets) associated with this LoadMetadata, choose one or more Catalogues by clicking 'Edit..' in LoadMetadataUI ");
                }

                allTables = _loadMetadata.GetDistinctTableInfoList(true).ToArray();
                config    = new HICDatabaseConfiguration(_loadMetadata);
            }
            catch (Exception e)
            {
                CommonFunctionality.Fatal("Could not fetch data", e);
                tlvLoadedTables.Visible = false;
                return;
            }
            tlvLoadedTables.Visible = true;

            _raw = new LoadDiagramServerNode(LoadBubble.Raw, config.DeployInfo[LoadBubble.Raw], allTables, config);
            var staging = new LoadDiagramServerNode(LoadBubble.Staging, config.DeployInfo[LoadBubble.Staging], allTables, config);
            var live    = new LoadDiagramServerNode(LoadBubble.Live, config.DeployInfo[LoadBubble.Live], allTables, config);

            tlvLoadedTables.AddObject(_raw);
            tlvLoadedTables.AddObject(staging);
            tlvLoadedTables.AddObject(live);

            //expand the servers
            foreach (var rootObject in tlvLoadedTables.Objects)
            {
                ExpandToDepth(2, rootObject);
            }

            loadStateUI1.SetStatus(LoadStateUI.LoadState.Unknown);
        }
Example #4
0
        private void treeView1_ColumnRightClick(object sender, CellRightClickEventArgs e)
        {
            var RightClickMenu = new ContextMenuStrip();

            var tli      = e.Model as ArchivalTableLoadInfo;
            var category = e.Model as LoadEventsTreeView_Category;

            if (category != null)
            {
                var cmd = new ExecuteCommandViewLoggedData(Activator, new LogViewerFilter(category.AssociatedTable)
                {
                    Run = category.RunId
                });
                RightClickMenu.Items.Add(new AtomicCommandMenuItem(cmd, Activator));
            }

            if (tli != null && _loadMetadata != null)
            {
                //if it is not a freaky temp table
                if (!tli.TargetTable.EndsWith("_STAGING") && !tli.TargetTable.EndsWith("_RAW"))
                {
                    var mi = new ToolStripMenuItem("View Inserts/Updates", null, (a, b) => new ViewInsertsAndUpdatesDialog(tli, _loadMetadata.GetDistinctTableInfoList(true)).Show());

                    //if there are inserts/updates
                    if (tli.Inserts > 0 || tli.Updates > 0)
                    {
                        mi.Enabled = true;
                    }
                    else
                    {
                        mi.Enabled     = false;
                        mi.ToolTipText = "No records were changed by this load";
                    }

                    RightClickMenu.Items.Add(mi);
                }
            }

            var fatalError = e.Model as ArchivalFatalError;

            if (fatalError != null && _logManager != null)
            {
                var toResolve = treeView1.SelectedObjects.OfType <ArchivalFatalError>().ToArray();
                RightClickMenu.Items.Add("Resolve Fatal Error(s)", null, (a, b) =>
                {
                    var resolve = new ResolveFatalErrors(Activator, _logManager, toResolve);
                    resolve.ShowDialog();
                    treeView1.RefreshObjects(toResolve);
                });
            }

            if (RightClickMenu.Items.Count > 0)
            {
                e.MenuStrip = RightClickMenu;
            }
        }