Exemple #1
0
        ConnectionManager page_GetSelectedConnectionManager(object sender, ConnectionManagerMappingEventArgs args)
        {
            this.ClearErrors();

            try
            {
                ConnectionManagerElement cme = args.ConnectionManagerElement;

                if (cme != null && this.Connections != null)
                {
                    foreach (ConnectionManager cm in this.Connections)
                    {
                        if (cm.ID.Equals(cme.ID, StringComparison.OrdinalIgnoreCase))
                        {
                            args.ConnectionManagerInstance = cm;
                            return(cm);
                        }
                    }
                }

                return(null);
            }
            catch (Exception ex)
            {
                this.ReportErrors(ex);
                return(null);
            }
        }
Exemple #2
0
        void page_GetConnectionAttributes(object sender, ConnectionsEventArgs args)
        {
            Debug.Assert(this.Connections != null, "Connections is not valid!");

            this.ClearErrors();

            try
            {
                args.ConnectionManagers.Clear();

                foreach (ConnectionManager cm in this.Connections)
                {
                    if (cm.InnerObject is SsdsConnectionManager)
                    {
                        ConnectionManagerElement element = new ConnectionManagerElement();

                        element.ID       = cm.ID;
                        element.Name     = cm.Name;
                        element.Selected = element.ID.Equals(this.ComponentMetadata.RuntimeConnectionCollection[0].ConnectionManagerID, StringComparison.OrdinalIgnoreCase);
                        args.ConnectionManagers.Add(element);
                    }
                }
            }
            catch (Exception ex)
            {
                this.ReportErrors(ex);
            }
        }
Exemple #3
0
        private void LoadContainers(ConnectionManagerElement cme)
        {
            this.cmbContainerID.Items.Clear();

            ConnectionManagerMappingEventArgs args = new ConnectionManagerMappingEventArgs();

            args.ConnectionManagerElement = cme;
            ConnectionManager cm = this.GetSelectedConnectionManager(this, args);

            try
            {
                Microsoft.Samples.DataServices.Connectivity.Connection conn = cm.AcquireConnection(null) as Connection;

                if (conn != null)
                {
                    Microsoft.Samples.DataServices.Connectivity.Container[] conts = conn.GetContainers();

                    if (conts != null)
                    {
                        foreach (Microsoft.Samples.DataServices.Connectivity.Container cont in conts)
                        {
                            this.cmbContainerID.Items.Add(cont.Id);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                MessageBoxDefaultButton.Button1);
                this.cmbContainerID.Items.Clear();
                this.btnNewContainer.Enabled = false;
            }
        }
Exemple #4
0
        private void cmbCM_SelectedIndexChanged(object sender, EventArgs e)
        {
            foreach (ConnectionManagerElement element in this.cmbCM.Items)
            {
                element.Selected = false;
            }

            ConnectionManagerElement cme = (ConnectionManagerElement)this.cmbCM.SelectedItem;

            cme.Selected = true;

            if (!this.isLoading)
            {
                this.LoadContainers(cme);
            }
        }
Exemple #5
0
        private void SaveConnections()
        {
            if (this.isLoading)
            {
                return;
            }

            if (this.SetConnectionAttributes != null)
            {
                ConnectionManagerElement args = (ConnectionManagerElement)this.cmbCM.SelectedItem;
                if (args == null)
                {
                    throw new InvalidOperationException("Connection Manager is null.");
                }

                this.SetConnectionAttributes(this, args);
            }
        }
Exemple #6
0
        void page_SetConnectionAttributes(object sender, ConnectionManagerElement args)
        {
            this.ClearErrors();

            try
            {
                foreach (ConnectionManager cm in this.Connections)
                {
                    if (cm.ID.Equals(args.ID, StringComparison.OrdinalIgnoreCase))
                    {
                        this.ComponentMetadata.RuntimeConnectionCollection[0].ConnectionManagerID = args.ID;
                        this.ComponentMetadata.RuntimeConnectionCollection[0].ConnectionManager   =
                            DtsConvert.ToConnectionManager90(cm);

                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                this.ReportErrors(ex);
            }
        }
Exemple #7
0
        void page_GetConnectionAttributes(object sender, ConnectionsEventArgs args)
        {
            Debug.Assert(this.Connections != null, "Connections is not valid!");

            this.ClearErrors();

            try
            {
                args.ConnectionManagers.Clear();

                foreach (ConnectionManager cm in this.Connections)
                {
                    if (cm.InnerObject is SsdsConnectionManager)
                    {
                        ConnectionManagerElement element = new ConnectionManagerElement();

                        element.ID = cm.ID;
                        element.Name = cm.Name;
                        element.Selected = element.ID.Equals(this.ComponentMetadata.RuntimeConnectionCollection[0].ConnectionManagerID, StringComparison.OrdinalIgnoreCase);
                        args.ConnectionManagers.Add(element);
                    }
                }
            }
            catch (Exception ex)
            {
                this.ReportErrors(ex);
            }
        }
Exemple #8
0
        void page_SetConnectionAttributes(object sender, ConnectionManagerElement args)
        {
            this.ClearErrors();

            try
            {
                foreach (ConnectionManager cm in this.Connections)
                {
                    if (cm.ID.Equals(args.ID, StringComparison.OrdinalIgnoreCase))
                    {
                        this.ComponentMetadata.RuntimeConnectionCollection[0].ConnectionManagerID = args.ID;
                        this.ComponentMetadata.RuntimeConnectionCollection[0].ConnectionManager =
                            DtsConvert.ToConnectionManager90(cm);

                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                this.ReportErrors(ex);
            }
        }
 public ConnectionManagerMappingEventArgs()
 {
     this.m_ConnectionManagerElement = new ConnectionManagerElement(true);
 }
        private void LoadContainers(ConnectionManagerElement cme)
        {
            this.cmbContainerID.Items.Clear();

            ConnectionManagerMappingEventArgs args = new ConnectionManagerMappingEventArgs();
            args.ConnectionManagerElement = cme;
            ConnectionManager cm = this.GetSelectedConnectionManager(this, args);

            try
            {
                Microsoft.Samples.DataServices.Connectivity.Connection conn = cm.AcquireConnection(null) as Connection;

                if (conn != null)
                {
                    Microsoft.Samples.DataServices.Connectivity.Container[] conts = conn.GetContainers();

                    if (conts != null)
                    {
                        foreach (Microsoft.Samples.DataServices.Connectivity.Container cont in conts)
                        {
                            this.cmbContainerID.Items.Add(cont.Id);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error,
                    MessageBoxDefaultButton.Button1);
                this.cmbContainerID.Items.Clear();
                this.btnNewContainer.Enabled = false;
            }
        }
Exemple #11
0
 public ConnectionManagerMappingEventArgs()
 {
     this.m_ConnectionManagerElement = new ConnectionManagerElement(true);
 }