コード例 #1
0
        private bool EditCloudDBConnection(IWin32Window parentWindow, Connections connections)
        {
            SsdsConnectionManagerForm form = new SsdsConnectionManagerForm();

            form.Initialize(this._serviceProvider, this.ConnectionManager, this.ErrorCollectionService);

            if (DesignUtils.ShowDialog(form, parentWindow, this._serviceProvider) == DialogResult.OK)
            {
                string cs = form.GetConnectionString(ConnectionStringDisplayOption.IncludePassword);
                ConnectionManager.ConnectionString = cs;

                if (!this.ConnectionManager.Name.Equals(form.ConnectionName, StringComparison.OrdinalIgnoreCase))
                {
                    this.ConnectionManager.Name =
                        ConnectionManagerUtils.GetConnectionName(connections, form.ConnectionName);
                }

                ConnectionManager.Description = form.ConnectionDescription;

                SsdsConnectionManager innerManager = (SsdsConnectionManager)ConnectionManager.InnerObject;

                innerManager.Authority = form.Authority;
                innerManager.UserName  = form.UserName;
                innerManager.Password  = form.Password;

                return(true);
            }

            return(false);
        }
        private bool EditSharePointCredentialConnection(IWin32Window parentWindow, Connections connections)
        {
            using (CredentialConnectionManagerForm form = new CredentialConnectionManagerForm())
            {
                form.Initialize(this._serviceProvider, this.ConnectionManager, this.ErrorCollectionService);

                if (DesignUtils.ShowDialog(form, parentWindow, this._serviceProvider) == DialogResult.OK)
                {
                    if (!this.ConnectionManager.Name.Equals(form.ConnectionName, StringComparison.OrdinalIgnoreCase))
                    {
                        this.ConnectionManager.Name =
                            ConnectionManagerUtils.GetConnectionName(connections, form.ConnectionName);
                    }

                    ConnectionManager.Description = form.ConnectionDescription;

                    CredentialConnectionManager innerManager = (CredentialConnectionManager)ConnectionManager.InnerObject;

                    if (form.CanUseDefaultCredentials)
                    {
                        innerManager.UserName = string.Empty;
                        innerManager.Password = string.Empty;
                    }
                    else
                    {
                        innerManager.UserName = form.UserName;
                        innerManager.Password = form.Password;
                    }

                    return(true);
                }
            }

            return(false);
        }
コード例 #3
0
        //they asked to pop up the Package Configurations dialog, so replace the Microsoft functionality so we can control the popup form
        void cmdEvent_BeforeExecute(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault)
        {
            if (Enabled)
            {
                try
                {
                    if (this.ApplicationObject.ActiveWindow == null || this.ApplicationObject.ActiveWindow.ProjectItem == null)
                    {
                        return;
                    }
                    ProjectItem pi = this.ApplicationObject.ActiveWindow.ProjectItem;
                    if (!pi.Name.ToLower().EndsWith(".dtsx"))
                    {
                        return;
                    }

                    IDesignerHost designer = this.ApplicationObject.ActiveWindow.Object as IDesignerHost;
                    if (designer == null)
                    {
                        return;
                    }
                    EditorWindow win     = (EditorWindow)designer.GetService(typeof(Microsoft.DataWarehouse.ComponentModel.IComponentNavigator));
                    Package      package = (Package)win.PropertiesLinkComponent;
                    this.packageForFixButton        = package;
                    this.pathForPackageForFixButton = pi.get_FileNames(1);

                    DtsConfigurationsForm form = new DtsConfigurationsForm(package);
                    if (win.SelectedIndex == 0)
                    {
                        //control flow
                        EditorWindow.EditorView        view     = win.SelectedView;
                        System.Reflection.BindingFlags getflags = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Instance;
                        Control viewControl = (Control)view.GetType().InvokeMember("ViewControl", getflags, null, view, null);

                        IWin32Window parentWin;
                        #if DENALI || SQL2014
                        parentWin = viewControl;
                        #else
                        DdsDiagramHostControl diagram = viewControl.Controls["panel1"].Controls["ddsDiagramHostControl1"] as DdsDiagramHostControl;
                        if (diagram == null || diagram.DDS == null)
                        {
                            return;
                        }
                        parentWin = diagram.DDS;
                        #endif

                        Button  editSelectedButton = (Button)form.Controls["editSelectedConfiguration"];
                        Control packageConfigurationsGridControl1 = form.Controls["packageConfigurationsGridControl1"];
                        Button  btnRelativePaths = new Button();
                        btnRelativePaths.Text   = "Fix All Relative Paths";
                        btnRelativePaths.Width  = 140;
                        btnRelativePaths.Left   = packageConfigurationsGridControl1.Left;
                        btnRelativePaths.Top    = editSelectedButton.Top;
                        btnRelativePaths.Height = editSelectedButton.Height;
                        btnRelativePaths.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
                        btnRelativePaths.Click += new EventHandler(btnRelativePaths_Click);
                        form.Controls.Add(btnRelativePaths);

                        if (DesignUtils.ShowDialog((Form)form, parentWin, (IServiceProvider)package.Site) == DialogResult.OK)
                        {
                            SSISHelpers.MarkPackageDirty(package);
                        }

                        CancelDefault = true;
                    }
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
                }
            }
        }