protected void Page_Load(object sender, EventArgs e) { a1 = new connection(); if (IsPostBack == false) { Panel2.Visible = false; String s; s = "select * from companyapproval where Admappstatus='Y'"; dr = a1.disp(s); while (dr.Read()) { DropDownList1.Items.Add(dr.GetValue(0).ToString()); } if (DropDownList1.Items.Count > 0) { DropDownList1_SelectedIndexChanged(sender, e); } s = "select * from productreg where ImpoStatus='import'"; dr = a1.disp(s); while (dr.Read()) { DropDownList2.Items.Add(dr.GetValue(0).ToString()); } } }
private void list_funcionalidades_Load(object sender, EventArgs e) { if (this.rol_nomb_mod != null) //evaluamos si esta seteada la var rol_nombre { //esta seteada si ya se selecciono un rol a modificar this.rol_select_tbox.Text = this.rol_nomb_mod; //this.rol_select_tbox.ReadOnly = true; this.select_boton.Enabled = false; //cargamos lista segun corresponde string query = "SELECT func_id, func_nombre FROM DATACENTER.Funcionalidad"; connection connect = new connection(); DataTable tabla_todas_func = connect.execute_query(query); list_funcionalidades.DataSource = tabla_todas_func; list_funcionalidades.DisplayMember = "func_nombre"; list_funcionalidades.ValueMember = "func_id"; //tildamos las funciones que ya tiene el rol int i; funciones func = new funciones(); for (i = 0; i < (this.list_funcionalidades.Items.Count); i++) { this.list_funcionalidades.SelectedIndex = i; if (func.check_func_activa(this.id_rol_a_mod, this.list_funcionalidades.SelectedValue.ToString())) { this.list_funcionalidades.SetItemChecked(i, true); } } } else { this.rol_select_tbox.Enabled = false; } }
private void button1_Click(object sender, EventArgs e) { rieltor.setF(tbF.Text); rieltor.setI(tbI.Text); rieltor.setO(tbO.Text); rieltor.setNumber(tbNumber.Text); rieltor.setComment(tbComment.Text); connection conFlat = new connection(); switch (button1.Text) { case "Добавить": conFlat.insert("Риэлтор ([Фамилия],[Имя],[Отчество],[Номер телефона],[Доп. Информация])", "'" + rieltor.getF() + "', '" + rieltor.getI() +"', '" + rieltor.getO()+"', " + rieltor.getNumber()+ ",'"+rieltor.getComment()+ "'"); MessageBox.Show("Новый риэлтор успешно добавлен!"); break; case "Изменить": conFlat.update("Участок", "[Фамилия] = " + rieltor.getF() + "[Имя] = " + rieltor.getF() + "[Отчество] = " + rieltor.getF() + "[Номер телефона] = " + rieltor.getF() + "[Доп. Информация] = " + rieltor.getF(), "ID_риэлтор = " + rieltor.getID()); MessageBox.Show("Риэлтор под номером " + rieltor.getID() + " успешно изменен!"); break; } this.Close(); }
public msl_item() { InitializeComponent(); connection con = new connection(); connection.ConnectionString = con.ConnectionString; }
public pfledgerall() { cn = new connection(); lConnect = cn.OpenConnetion(); cmd = new SqlCommand("", lConnect); cmd.CommandType = CommandType.StoredProcedure; }
public SA_Contribution() { cn = new connection(); lConnect = cn.OpenConnetion(); cmd = new SqlCommand("", lConnect); cmd.CommandType = CommandType.StoredProcedure; }
public payment_due_export() { InitializeComponent(); connection con = new connection(); connection.ConnectionString = con.ConnectionString; }
public Sales_person() { InitializeComponent(); connection con = new connection(); connection.ConnectionString = con.ConnectionString; }
private void button1_Click(object sender, EventArgs e) { flat.setKomnat(Convert.ToInt32(textBox1.Text)); flat.setSObj(Convert.ToDouble(textBox2.Text)); flat.setSKuh(Convert.ToDouble(textBox3.Text)); flat.setSLive(Convert.ToDouble(textBox4.Text)); flat.setFloor(Convert.ToInt32(textBox6.Text)); flat.setStoimost(Convert.ToInt32(textBox5.Text)); flat.setOpisanie(textBox7.Text); connection conFlat = new connection(); switch (button1.Text) { case "Добавить": conFlat.insert("Объект (Описание, Стоимость)", "'" + flat.getOpisanie() + "', " + flat.getStoimost() + ""); string ID = conFlat.select1String("ID_Объекта", "Объект", "Описание LIKE '" + flat.getOpisanie() + "'"); flat.setID(Convert.ToInt32(ID)); conFlat.insert("Квартира", flat.getID() + "," + flat.getKomnat() + "," + flat.getSObj() + "," + flat.getSKuh() + "," + flat.getSLive() + "," + flat.getFloor()); MessageBox.Show("Квартира под номером " + ID + " успешно добавлена!"); break; case "Изменить": conFlat.update("Квартира","[Количество комнат] =" +flat.getKomnat() +", [Площадь общая] = "+flat.getSObj()+", [Площадь кухни] = " +flat.getSKuh()+", [Площадь жилая] = "+flat.getSLive() +", Этаж ="+flat.getFloor(),"ID_объекта = "+flat.getID()); conFlat.update("Объект","Описание = '"+flat.getOpisanie()+"', Стоимость ="+flat.getStoimost(),"ID_объекта = " + flat.getID()); MessageBox.Show("Квартира под номером " + flat.getID() + " успешно изменена!"); break; } this.Close(); }
private void SubmitButton_Click(object sender, RoutedEventArgs e) { thisConnection = new connection(serverTextBox.Text); //save the connection to settings. var connection = thisConnection.connectionString; DbContextOptionsBuilder <COMP4952PROJECTContext> builder = new DbContextOptionsBuilder <COMP4952PROJECTContext>(); builder.UseSqlServer(connection); COMP4952PROJECTContext db = new COMP4952PROJECTContext(builder.Options); if (db.Database.CanConnect()) { SettingsFile.Default.ConnectionString = thisConnection.connectionString; SettingsFile.Default.Save(); if (!db.Wall.Any()) { thisWindow.frame.Source = new Uri("FloorBuilder.xaml", UriKind.Relative); } else { thisWindow.frame.Source = new Uri("Home.xaml", UriKind.Relative); } this.Close(); } else { MessageBox.Show("Unable to connect to server, try again.", "Alert"); } }
public DataTable RankingDetails(string userID) { connection conClass = new connection(); string conString; DataTable dt = new DataTable(); try { conClass.ReadConnection(); conClass.Con.Open(); SqlCommand cmd = new SqlCommand("Ranking", conClass.Con); cmd.Parameters.Add("@SesID", SqlDbType.VarChar).Value = userID; cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter adp = new SqlDataAdapter(cmd); adp.Fill(dt); cmd.ExecuteNonQuery(); return(dt); } catch { return(dt); } finally { conClass.Con.Close(); } }
public static async Task CreateDatabase(string connectionString, string db) { await using (NpgsqlConnection connection = new(connectionString)) { await connection.OpenAsync(); var command = @$ "create database {db} with owner = postgres encoding = 'UTF8' connection limit = -1;"; await using (var c = new NpgsqlCommand(command, connection)) await c.ExecuteNonQueryAsync(); } connectionString += $"Database={db}"; await using (NpgsqlConnection connection = new(connectionString)) { await connection.OpenAsync(); var command = @"create table animals( id serial PRIMARY KEY, name text, type text)"; await using (var c = new NpgsqlCommand(command, connection)) await c.ExecuteNonQueryAsync(); } }
public company() { InitializeComponent(); connection con = new connection(); connection.ConnectionString = con.ConnectionString; }
public stock_in_hand_() { InitializeComponent(); connection con = new connection(); connection.ConnectionString = con.ConnectionString; }
/// <summary> /// Sends data on all users currently logged in /// </summary> /// <param name="con">The connection this data should be sent to</param> public static void refreshBuddyList(connection con) { lock (buddyStates.SyncRoot) foreach (SDCSCommon.Network.BuddyListData bld in buddyStates.Values) lock (con.watchingClass.BuddyListData.SyncRoot) con.watchingClass.BuddyListData.Add(bld); }
public flat(int ID) { this.ID=ID; connection ConnectuonFlat = new connection(); SqlDataReader myReader = ConnectuonFlat.select("[Количество комнат],[Площадь общая],[Площадь кухни] ,[Площадь жилая],[Этаж]", "Квартира", "ID_объекта=" + ID); while (myReader.Read()) { this.komnat = Convert.ToInt32(myReader[0]); this.sObj = Convert.ToInt32(myReader[1]); this.sKuh = Convert.ToInt32(myReader[2]); this.sLive = Convert.ToInt32(myReader[3]); this.floor = Convert.ToInt32(myReader[4]); } myReader.Close(); ConnectuonFlat.Close(); ConnectuonFlat = new connection(); myReader = ConnectuonFlat.select("[Описание],[Стоимость]", "Объект", "ID_объекта=" + ID); while (myReader.Read()) { this.opisanie = myReader[0].ToString(); this.stoimost = Convert.ToInt32(myReader[1]); } ConnectuonFlat.Close(); }
public bool ExecutePCPlayer() { connection conClass = new connection(); string conString; DataTable dt = new DataTable(); try { conClass.ReadConnection(); conClass.Con.Open(); SqlCommand cmd = new SqlCommand("PCPlayerSp", conClass.Con); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter adp = new SqlDataAdapter(cmd); adp.Fill(dt); cmd.ExecuteNonQuery(); return(true); } catch { return(false); } finally { conClass.Con.Close(); } }
public DataTable CheckEventOccurSector(string roundID) { connection conClass = new connection(); string conString; DataTable dt = new DataTable(); try { conClass.ReadConnection(); conClass.Con.Open(); SqlCommand cmd = new SqlCommand("CheckEventOccurSectorRound", conClass.Con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@RoundID", SqlDbType.VarChar).Value = roundID; SqlDataAdapter adp = new SqlDataAdapter(cmd); adp.Fill(dt); cmd.ExecuteNonQuery(); return(dt); } catch { return(dt); } finally { conClass.Con.Close(); } }
public DataTable MarketPricePageLoad(string userID) { connection conClass = new connection(); string conString; DataTable dt = new DataTable(); try { conClass.ReadConnection(); conClass.Con.Open(); SqlCommand cmd = new SqlCommand("CalPageLoadPricePerShare", conClass.Con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@UserID", SqlDbType.VarChar).Value = userID; SqlDataAdapter adp = new SqlDataAdapter(cmd); adp.Fill(dt); cmd.ExecuteNonQuery(); return(dt); } catch { return(dt); } finally { conClass.Con.Close(); } }
protected void Page_Load(object sender, EventArgs e) { connection con = new connection(); Tables t = con.query("select * from UserMaster"); t.print(); }
public Boolean SellShare(string share, double value, String UserID, string sectorID, string companyID) { connection conClass = new connection(); try { conClass.ReadConnection(); conClass.Con.Open(); SqlCommand cmd = new SqlCommand("SellShare", conClass.Con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Share", SqlDbType.VarChar).Value = share; cmd.Parameters.Add("@Value", SqlDbType.VarChar).Value = value; cmd.Parameters.Add("@UserID", SqlDbType.VarChar).Value = UserID; cmd.Parameters.Add("@SectorID", SqlDbType.VarChar).Value = sectorID; cmd.Parameters.Add("@ComapnyID", SqlDbType.VarChar).Value = companyID; cmd.ExecuteNonQuery(); conClass.Con.Close(); return(true); } catch { return(false); } finally { } }
public Boolean SignOut(String UserID) { connection conClass = new connection(); try { conClass.ReadConnection(); conClass.Con.Open(); SqlCommand cmd = new SqlCommand("SignOut", conClass.Con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@UserID", SqlDbType.VarChar).Value = UserID; cmd.ExecuteNonQuery(); conClass.Con.Close(); return(true); } catch { return(false); } finally { } }
public DataTable CheckShare(String UserID, string sectorID, string companyID) { connection conClass = new connection(); DataTable dt = new DataTable(); try { conClass.ReadConnection(); conClass.Con.Open(); SqlCommand cmd = new SqlCommand("SelectShare", conClass.Con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@UserID", SqlDbType.VarChar).Value = UserID; cmd.Parameters.Add("@SectorID", SqlDbType.VarChar).Value = sectorID; cmd.Parameters.Add("@ComapnyID", SqlDbType.VarChar).Value = companyID; SqlDataAdapter adp = new SqlDataAdapter(cmd); adp.Fill(dt); cmd.ExecuteNonQuery(); return(dt); } catch { return(dt); } finally { } }
public DataTable GetChartDetails() { connection conClass = new connection(); string conString; DataTable dt = new DataTable(); try { conClass.ReadConnection(); conClass.Con.Open(); SqlCommand cmd = new SqlCommand("ChartController", conClass.Con); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter adp = new SqlDataAdapter(cmd); adp.Fill(dt); cmd.ExecuteNonQuery(); return(dt); } catch { return(dt); } finally { conClass.Con.Close(); } }
public SA_Opening_Balance() { cn = new connection(); lConnect = cn.OpenConnetion(); cmd = new SqlCommand("", lConnect); cmd.CommandType = CommandType.StoredProcedure; }
private void FormCompra_Load(object sender, EventArgs e) { string query = "SELECT ciu_nombre FROM DATACENTER.Ciudad"; connection conexion = new connection(); DataTable table_ciu_orig = conexion.execute_query(query); DataTable table_ciu_dest = conexion.execute_query(query); //Cargo ciudades de Origen this.ciu_orig_list.DataSource = table_ciu_orig; this.ciu_orig_list.DisplayMember = "ciu_nombre"; this.ciu_orig_list.ValueMember = "ciu_nombre"; //Cargo ciudades Destino this.ciu_dest_list.DataSource = table_ciu_dest; this.ciu_dest_list.DisplayMember = "ciu_nombre"; this.ciu_dest_list.ValueMember = "ciu_nombre"; this.total_tbox.Text = total_compra.ToString(); this.cant_totKg_tbox.Text = "0"; this.sub_tot_encom_tbox.Text = "0"; this.sub_total_pasaj_tbox.Text = "0"; this.total_tbox.Text = "0"; this.fechaViajeDateTimeP.Value = fechaDelSistema; }
public DataTable CheckLogin(string Uname, string pwd) { connection conClass = new connection(); string conString; DataTable dt = new DataTable(); try { conClass.ReadConnection(); conClass.Con.Open(); SqlCommand cmd = new SqlCommand("CheckLogin", conClass.Con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Uname", SqlDbType.VarChar).Value = Uname; cmd.Parameters.Add("@Pwd", SqlDbType.VarChar).Value = pwd; SqlDataAdapter adp = new SqlDataAdapter(cmd); adp.Fill(dt); cmd.ExecuteNonQuery(); return(dt); } catch { return(dt); } finally { conClass.Con.Close(); } }
private void UpdateStops() { bool DirAB = cbAB.Checked; connection currentStopRef = null; if (DirAB && currentStop == lines[ListLines.SelectedIndex].stops.Length) { currentStopRef = lines[ListLines.SelectedIndex].stops[currentStop - 1]; LabelCurrentStop.Text = getStopName(currentStopRef.b); LabelNextStop.Text = "-"; LabelEstimatedDuration.Text = "0 min"; return; } if (!DirAB && currentStop < 0) { currentStopRef = lines[ListLines.SelectedIndex].stops[0]; LabelCurrentStop.Text = getStopName(currentStopRef.a); LabelNextStop.Text = "-"; LabelEstimatedDuration.Text = "0 min"; return; } currentStopRef = lines[ListLines.SelectedIndex].stops[currentStop]; LabelCurrentStop.Text = DirAB ? getStopName(currentStopRef.a) : getStopName(currentStopRef.b); LabelNextStop.Text = DirAB ? getStopName(currentStopRef.b) : getStopName(currentStopRef.a); LabelEstimatedDuration.Text = string.Format("{0} min", (DirAB ? currentStopRef.timeAB : currentStopRef.timeBA)); }
public GrNomimast() { cn = new connection(); lConnect = cn.OpenConnetion(); cmd = new SqlCommand("", lConnect); cmd.CommandType = CommandType.StoredProcedure; }
private void Abm_Reco_Seleccion_Load(object sender, EventArgs e) { connection conexion = new connection(); string query1 = "SELECT serv_tipo, serv_id FROM DATACENTER.Servicio"; DataTable tabla_servicios = conexion.execute_query(query1); comboBoxTipoServ.DataSource = tabla_servicios; comboBoxTipoServ.DisplayMember = "serv_tipo"; comboBoxTipoServ.ValueMember = "serv_id"; string query2 = "SELECT ciu_nombre FROM DATACENTER.Ciudad"; DataTable tabla_origenes = conexion.execute_query(query2); comboBoxOrigen.DataSource = tabla_origenes; comboBoxOrigen.DisplayMember = "ciu_nombre"; comboBoxOrigen.ValueMember = "ciu_nombre"; string query3 = "SELECT ciu_nombre FROM DATACENTER.Ciudad"; DataTable tabla_destinos = conexion.execute_query(query3); comboBoxDestino.DataSource = tabla_destinos; comboBoxDestino.DisplayMember = "ciu_nombre"; comboBoxDestino.ValueMember = "ciu_nombre"; limpiar(); }
public Boolean BasicValueChange() { connection conClass = new connection(); try { conClass.ReadConnection(); conClass.Con.Open(); SqlCommand cmd = new SqlCommand("BasicValueChangeAlgorithm", conClass.Con); cmd.CommandType = CommandType.StoredProcedure; cmd.ExecuteNonQuery(); conClass.Con.Close(); return(true); } catch { return(false); } finally { } }
public supplier() { InitializeComponent(); connection con = new connection(); connection.ConnectionString = con.ConnectionString; }
public Boolean ExecuteEventOccurSector(string SectorID, string RoundID) { connection conClass = new connection(); try { conClass.ReadConnection(); conClass.Con.Open(); SqlCommand cmd = new SqlCommand("ExecuteEventSectorOccur", conClass.Con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@SectorID", SqlDbType.VarChar).Value = SectorID; cmd.Parameters.Add("@RoundID", SqlDbType.VarChar).Value = RoundID; cmd.ExecuteNonQuery(); conClass.Con.Close(); return(true); } catch { return(false); } finally { } }
public DataTable MarketPriceAndOthers(string Sector, string Company, string userID) { connection conClass = new connection(); string conString; DataTable dt = new DataTable(); try { conClass.ReadConnection(); conClass.Con.Open(); SqlCommand cmd = new SqlCommand("MarketPriceDetails", conClass.Con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Sector", SqlDbType.VarChar).Value = Sector; cmd.Parameters.Add("@Company", SqlDbType.VarChar).Value = Company; cmd.Parameters.Add("@UserID", SqlDbType.VarChar).Value = userID; SqlDataAdapter adp = new SqlDataAdapter(cmd); adp.Fill(dt); cmd.ExecuteNonQuery(); return(dt); } catch { return(dt); } finally { conClass.Con.Close(); } }
public rieltor(int ID) { this.ID = ID; connection ConnectuonRieltor = new connection(); SqlDataReader myReader = ConnectuonRieltor.select("[Фамилия],[Имя],[Отчество],[Номер телефона],[Доп. Информация]", "Риэлтор", "ID_риэлтор=" + ID); while (myReader.Read()) { this.f = myReader[0].ToString(); this.i = myReader[1].ToString(); this.o = myReader[2].ToString(); this.number = myReader[3].ToString(); this.comment = myReader[4].ToString(); } myReader.Close(); ConnectuonRieltor.Close(); }
public sector(int ID) { this.ID = ID; connection ConnectuonSector = new connection(); SqlDataReader myReader = ConnectuonSector.select("[Площадь]", "Участок", "ID_объекта=" + ID); while (myReader.Read()) { this.s = Convert.ToInt32(myReader[0]); } myReader.Close(); ConnectuonSector.Close(); ConnectuonSector = new connection(); myReader = ConnectuonSector.select("[Описание],[Стоимость]", "Объект", "ID_объекта=" + ID); while (myReader.Read()) { this.opisanie = myReader[0].ToString(); this.stoimost = Convert.ToInt32(myReader[1]); } ConnectuonSector.Close(); }
public house(int ID) { this.ID = ID; connection ConnectuonHouse = new connection(); SqlDataReader myReader = ConnectuonHouse.select("[Площадь участка],[Количество комнат],[Количество этажей]", "Дом", "ID_объекта=" + ID); while (myReader.Read()) { this.s = Convert.ToInt32(myReader[0]); this.komnat = Convert.ToInt32(myReader[1]); this.floor = Convert.ToInt32(myReader[2]); } myReader.Close(); ConnectuonHouse.Close(); ConnectuonHouse = new connection(); myReader = ConnectuonHouse.select("[Описание],[Стоимость]", "Объект", "ID_объекта=" + ID); while (myReader.Read()) { this.opisanie = myReader[0].ToString(); this.stoimost = Convert.ToInt32(myReader[1]); } ConnectuonHouse.Close(); }
private void button1_Click(object sender, EventArgs e) { sector.setS(Convert.ToInt32(textBox2.Text)); sector.setStoimost(Convert.ToInt32(textBox5.Text)); sector.setOpisanie(textBox7.Text); connection conFlat = new connection(); switch (button1.Text) { case "Добавить": conFlat.insert("Объект (Описание, Стоимость)", "'" + sector.getOpisanie() + "', " + sector.getStoimost() + ""); string ID = conFlat.select1String("ID_Объекта", "Объект", "Описание LIKE '" + sector.getOpisanie() + "'"); sector.setID(Convert.ToInt32(ID)); conFlat.insert("Участок", sector.getID() + "," + sector.getS()); MessageBox.Show("Участок под номером " + ID + " успешно добавлен!"); break; case "Изменить": conFlat.update("Участок", "[Площадь] = " + sector.getS(), "ID_объекта = " + sector.getID()); conFlat.update("Объект", "Описание = '" + sector.getOpisanie() + "', Стоимость =" + sector.getStoimost(), "ID_объекта = " + sector.getID()); MessageBox.Show("Участок под номером " + sector.getID() + " успешно изменен!"); break; } this.Close(); }
/// <summary> /// SQL Server2008客户端 /// </summary> /// <param name="connection">SQL连接信息</param> public sql2008(connection connection) : base(connection) { }
public void Databind() { connection gp = new connection(); GridView1.DataSource = gp.GradeChangePoint(); GridView1.DataBind(); }
public TorProxy(string target_host, int target_port, string proxy_host, int proxy_port, ProxyType type) { if (InputProxyMessage != null) InputProxyMessage.Invoke("Socket allocated."); proxy_connection = new connection(); proxy_connection.proxy_config(target_host, target_port, proxy_host, proxy_port, type); ProxyClientFactory factory = new ProxyClientFactory(); proxy_connection.Proxy = factory.CreateProxyClient(type, proxy_host, proxy_port); proxy_connection.Proxy.CreateConnectionAsyncCompleted += new EventHandler<CreateConnectionAsyncCompletedEventArgs>(proxy_connected); }
public LoginResult login(LoginRequest loginRequest) { try { user user1 = (from u in _entity.users where u.email == loginRequest.username && u.password == loginRequest.password select u).FirstOrDefault(); if (user1 == null || loginRequest.connectionId == null) { return new LoginResult() { code = 0 }; } else { foreach (var id1 in _entity.connections) { if (id1.user_id == user1.id) _entity.connections.Remove(id1); } connection c = new connection() { created = DateTime.Now, connection_id = loginRequest.connectionId, user_id = user1.id, status = 1 }; _entity.connections.Add(c); _entity.SaveChanges(); return new LoginResult() { code = 1, email = user1.email, name = user1.name }; } } catch (Exception ex) { return new LoginResult() { code = 0 }; } }
/// <summary> /// Function for the listening thread to live in /// </summary> private static void listeningThreadFunc() { TcpListener listener = new TcpListener(IPAddress.Any, listeningPort); listener.Start(); while(true) { while (listener.Pending() == false) {if (ShuttingDown) return; Thread.Sleep(100);} TcpClient client = listener.AcceptTcpClient(); connection conn = new connection(); conn.userID = 0; conn.stream = client.GetStream(); lock (netStreams.SyncRoot) netStreams.Add(conn); conn.watchingClass = new ConnectionWatcher(conn); } }