public VariablesMove(Package package, string selectedContainerId, int selectedVariablesCount) { // Set target version on PackageHelper to ensure any ComponentInfos is for the correct info. PackageHelper.SetTargetServerVersion(package); this.selectedContainerId = selectedContainerId; InitializeComponent(); IterateContainers(package, this.treeView.Nodes, selectedContainerId); // Expand root node, the package this.treeView.Nodes[0].Expand(); this.Icon = BIDSHelper.Resources.Common.Copy; // Change caption based on count of selected variables, // makes form less clutered and easier to read. if (selectedVariablesCount > 1) { this.radCopy.Text = "Copy variables to..."; this.radMove.Text = "Move variables to..."; } else { this.radCopy.Text = "Copy variable to..."; this.radMove.Text = "Move variable to..."; } }
private void expressionListWindow_RefreshExpressions(object sender, EventArgs e) { expressionListWindow.ClearResults(); if (win == null) { return; } try { Package package = GetCurrentPackage(); if (package == null) { return; } expressionListWindow.StartProgressBar(); // Set target version on PackageHelper to ensure any ComponentInfos is for the correct info. PackageHelper.SetTargetServerVersion(package); IDTSSequence sequence = (IDTSSequence)package; processPackage.RunWorkerAsync(sequence); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void FindReferences(Package package, Variable[] variables, TreeView treeView) { // Reset cancel pending flag this.CancellationPending = false; List <string> expressions = new List <string>(); List <string> properties = new List <string>(); // Set target version on PackageHelper to ensure any ComponentInfos is for the correct info. PackageHelper.SetTargetServerVersion(package); foreach (Variable variable in variables) { // Variable formats in an expression - @Variable, @[Variable], @[Namespace::Variable] expressions.Add(string.Format("@{0}", variable.Name)); expressions.Add(string.Format("@[{0}]", variable.Name)); expressions.Add(string.Format("@[{0}]", variable.QualifiedName)); // Clean qualified name for property match properties.Add(variable.QualifiedName); } // Convert interim lists to arrays expressionCandidateMatches = expressions.ToArray(); properytCandidateMatches = properties.ToArray(); this.treeView = treeView; if (treeView != null) { SetupImageList(); // Create package node, the top level node int imageIndex = GetControlFlowImageIndex(PackageHelper.PackageCreationName); TreeNode packageNode = new TreeNode(package.Name, imageIndex, imageIndex); packageNode.Tag = package; ProcessObject(package, packageNode); // Hide nodes that don't have any matches PruneNodes(packageNode); // Add node graph to tree view AddRootNode(packageNode); } else { ProcessObject(package, null); } // Reset cancel pending in case we have cancelled, as about to exit, so no longer pending this.CancellationPending = false; }
public override void Exec() { try { UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer; if (((System.Array)solExplorer.SelectedItems).Length != 1) { return; } UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0)); ProjectItem pi = (ProjectItem)hierItem.Object; Window w = pi.Open(BIDSViewKinds.Designer); //opens the designer w.Activate(); IDesignerHost designer = w.Object as IDesignerHost; if (designer == null) { return; } EditorWindow win = (EditorWindow)designer.GetService(typeof(Microsoft.DataWarehouse.ComponentModel.IComponentNavigator)); Package package = win.PropertiesLinkComponent as Package; if (package == null) { return; } PackageHelper.SetTargetServerVersion(package); //set the TargetServerVersion variable so that we can retrieve it later Results results = new Results(); foreach (DesignPractice practice in _practices) { if (!practice.Enabled) { continue; } practice.Check(package, pi); results.AddRange(practice.Results); } AddErrorsToVSErrorList(w, results); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public override void Exec() { ProjectItem piCurrent = null; try { listPackageProperties = new List <PackageProperties>(); UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer; UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0)); SolutionClass solution = hierItem.Object as SolutionClass; EnvDTE.Project proj = GetSelectedProjectReference(); if (proj != null) { Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt projExt = (Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt)proj; this.DatabaseName = "Project: " + proj.Name; PackageHelper.SetTargetServerVersion(proj); //sets the target version try { using (WaitCursor cursor1 = new WaitCursor()) { int iProgress = 0; ApplicationObject.StatusBar.Animate(true, vsStatusAnimation.vsStatusAnimationGeneral); foreach (ProjectItem pi in proj.ProjectItems) { ApplicationObject.StatusBar.Progress(true, "Scanning package " + pi.Name, iProgress++, proj.ProjectItems.Count); string sFileName = pi.Name.ToLower(); if (!sFileName.EndsWith(".dtsx")) { continue; } piCurrent = pi; this.PackagePathPrefix = pi.Name; PackageProperties props = GetPackageProperties(pi); if (props == null) { continue; } listPackageProperties.Add(props); } } } finally { try { ApplicationObject.StatusBar.Animate(false, vsStatusAnimation.vsStatusAnimationGeneral); ApplicationObject.StatusBar.Progress(false, "", 1, 1); } catch { } } } else if (solution != null) { this.DatabaseName = "Solution: " + System.IO.Path.GetFileNameWithoutExtension(solution.FullName); try { this.DatabaseName = "Solution: " + solution.Properties.Item("Name").Value; } catch { } try { using (WaitCursor cursor1 = new WaitCursor()) { ApplicationObject.StatusBar.Animate(true, vsStatusAnimation.vsStatusAnimationGeneral); foreach (EnvDTE.Project p in solution.Projects) { Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt projExt = (Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt)p; if (projExt.Kind == BIDSProjectKinds.SSIS) { int iProgress = 0; foreach (ProjectItem pi in p.ProjectItems) { ApplicationObject.StatusBar.Progress(true, "Scanning project " + p.Name + " package " + pi.Name, iProgress++, p.ProjectItems.Count); string sFileName = pi.Name.ToLower(); if (!sFileName.EndsWith(".dtsx")) { continue; } piCurrent = pi; this.PackagePathPrefix = p.Name + "\\" + pi.Name; PackageProperties props = GetPackageProperties(pi); if (props == null) { continue; } listPackageProperties.Add(props); } } } } } finally { try { ApplicationObject.StatusBar.Animate(false, vsStatusAnimation.vsStatusAnimationGeneral); ApplicationObject.StatusBar.Progress(false, "", 1, 1); } catch { } } } ReportViewerForm frm = new ReportViewerForm(); frm.ReportBindingSource.DataSource = this.listPackageProperties; frm.Report = "SSIS.SortablePackageProperties.rdlc"; Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "BIDSHelper_PackageProperties"; reportDataSource1.Value = frm.ReportBindingSource; frm.ReportViewerControl.LocalReport.DataSources.Add(reportDataSource1); frm.ReportViewerControl.LocalReport.ReportEmbeddedResource = frm.Report; frm.Caption = "Sortable Package Properties Report"; frm.WindowState = FormWindowState.Maximized; frm.Show(); } catch (DtsRuntimeException ex) { if (ex.ErrorCode == -1073659849L) { MessageBox.Show((piCurrent == null ? "This package" : piCurrent.Name) + " has a package password. Please open the package designer, specify the password when the dialog prompts you, then rerun the Sortable Package Properties report.\r\n\r\nDetailed error was:\r\n" + ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Password Not Specified"); } else { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error" + (piCurrent == null ? string.Empty : " scanning " + piCurrent.Name)); } } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error" + (piCurrent == null ? string.Empty : " scanning " + piCurrent.Name)); } }
internal static void ExecutePackage(ProjectItem pi, string DataFlowGUID) { try { if (pi.DTE.Mode == vsIDEMode.vsIDEModeDebug) { MessageBox.Show("Please stop the debugger first."); return; } Window w = pi.Open(BIDSViewKinds.Designer); //opens the designer w.Activate(); IDesignerHost designer = w.Object as IDesignerHost; if (designer == null) { return; } EditorWindow win = (EditorWindow)designer.GetService(typeof(Microsoft.DataWarehouse.ComponentModel.IComponentNavigator)); if (win == null || (win.PropertiesLinkComponent as Package) == null) { MessageBox.Show("Package designer is not open yet. Try again in a moment."); return; } Package package = (Package)win.PropertiesLinkComponent; PackageHelper.SetTargetServerVersion(package); EditorWindow.EditorView view = null; if (PerformanceEditorViews.ContainsKey(win)) { PerformanceTab tab = PerformanceEditorViews[win]; view = tab.ParentEditorView; if (tab.IsExecuting) { MessageBox.Show("You may not execute the package until the previous execution of the package completes."); } else { if (DataFlowGUID == null) { tab.ExecutePackage(); } else { tab.BreakdownPipelinePerformance(DataFlowGUID); } } } else { win.ActiveViewChanged += new EventHandler(win_ActiveViewChanged); PerformanceTabControlDelegateContainer delegateContainer = new PerformanceTabControlDelegateContainer(); view = new EditorWindow.EditorView(new EditorViewLoadDelegate(delegateContainer.CreatePerformanceTabControl), "Performance", "Visualize SSIS package execution performance (BIDS Helper)", 0, BIDSHelper.Resources.Common.Performance); delegateContainer.win = win; delegateContainer.view = view; delegateContainer.projectItem = pi; delegateContainer.DataFlowGUID = DataFlowGUID; win.Views.Add(view); win.EnsureViewIsLoaded(view); //delegate will be called here } win.SelectedView = view; } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }