コード例 #1
0
 private ArrayList returnConnectionsOfType(ArrayList connections, DTSFileConnectionUsageType?uType)
 {
     if (uType != null)
     {
         for (int i = connections.Count - 1; i >= 0; i--)
         {
             ConnectionManager          conn     = (ConnectionManager)connections[i];
             DTSFileConnectionUsageType tmpUtype =
                 (DTSFileConnectionUsageType)conn.Properties["FileUsageType"].GetValue(conn);
             if (tmpUtype != uType)
             {
                 connections.RemoveAt(i);
             }
         }
     }
     return(connections);
 }
コード例 #2
0
 private ArrayList returnConnectionsOfType(ArrayList connections, DTSFileConnectionUsageType? uType)
 {
     if (uType != null)
     {
         for (int i = connections.Count - 1; i >= 0; i--)
         {
             ConnectionManager conn = (ConnectionManager)connections[i];
             DTSFileConnectionUsageType tmpUtype =
                 (DTSFileConnectionUsageType)conn.Properties["FileUsageType"].GetValue(conn);
             if (tmpUtype != uType) { connections.RemoveAt(i); }
         }
     }
     return connections;
 }
コード例 #3
0
 private void ConnectionsCombo_SelectedIndexChanged(ComboBox comboxBox, 
                                                     ref string connMgrNameVariable, 
                                                     string connMgrType, 
                                                     ConnectionManagerUIArgs connUIargs,
                                                     DTSFileConnectionUsageType? uType)
 {
     // Check for index 0 and <New Item...>
     if (comboxBox.SelectedIndex == 0)
     {
         // Use connection service to create a new connection.
         ArrayList newConns = _dtsConnectionService.CreateConnection(connMgrType, connUIargs);
         if (newConns.Count > 0)
         {
             // A new connection has been created, so populate and select
             ConnectionManager newConn = (ConnectionManager)newConns[0];
             connMgrNameVariable = newConn.Name;
             PopulateConnectionsCombo(comboxBox, connMgrType, newConn.Name, uType);
         }
         else
         {
             // Create connection has been cancelled
             //comboxBox.SelectedIndex = -1;
         }
     }
     else
     {
         connMgrNameVariable = comboxBox.SelectedItem.ToString();
     }
 }
コード例 #4
0
        private void PopulateConnectionsCombo(ComboBox comboBox, 
                                                string connectionType, 
                                                string selectedItem, 
                                                DTSFileConnectionUsageType? uType)
        {
            // Prepare combo box by clearing, and adding the new connection item.
            comboBox.Items.Clear();
            comboBox.Items.Add("<New connection...>");

            // Enumerate connections, but for type supported.
            ArrayList connMgrs = _dtsConnectionService.GetConnectionsOfType(connectionType);
            connMgrs = returnConnectionsOfType(connMgrs, uType);
            foreach (ConnectionManager connectionManager in connMgrs)
            {
                comboBox.Items.Add(connectionManager.Name);
            }

            // Set currently selected connection
            comboBox.SelectedItem = selectedItem;
        }