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); } }
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); } }
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; } }
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); } }
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); } }
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); }