public void Load(string key) { if (! _isLoaded){ _key = key; Connection connection; _qed = new Connection(new ConnectionString(ConfigurationSettings.AppSettings["QED_DB"].Trim())); _qed.BusinessCollection = this; _qed.Protocol = Protocol.MYSQL; _qed.Port = 3306; _qed.Transport = Transport.TCP; _qed.SystemName = "QED_DB"; _qed.PrivateDB = true; using(MySqlConnection conn = _qed.MySqlConnection){ using(MySqlDataReader dr = MySqlDBLayer.LoadAll(conn, _table)){ while(dr.Read()) { connection = new Connection(); connection.BusinessCollection = this; connection .Load(dr); List.Add(connection); } conn.Close(); } } _isLoaded = true; } }
public bool Contains(Connection obj) { foreach(Connection child in List) { if (obj.Equals(child)){ return true; } } return false; }
private void mnuItemGenListBoxAdd_Click(object sender, System.EventArgs e) { InputModal im = new InputModal("", "Connection Name"); if (im.ShowDialog(this) == DialogResult.OK) { _conn = new Connection(); _conn.SystemName = im.Answer("Connection Name"); _conns.Add(_conn); this.lstConns.Items.Add(_conn); this.UpdateScreen(); this.lstConns.SelectedItem = _conn; } }
public Connection Add(Connection obj) { obj.BusinessCollection = this; List.Add(obj); return obj; }
private void lstConns_SelectedIndexChanged(object sender, System.EventArgs e) { Connection conn = (Connection)this.lstConns.SelectedItem; if (conn != null){ _conn = conn; this.UpdateScreen(); } }