Exemplo n.º 1
0
    public List <_Client> GetClient()
    {
        List <_Client> output = new List <_Client>();

        SqlConnection con = new SqlConnection(connectionString);

        con.Open();
        SqlCommand cmd = new SqlCommand();

        cmd.Connection = con;

        cmd.CommandText = "SELECT * FROM tblClientSettings WHERE isActive =1 ";
        SqlDataReader dr;

        dr = cmd.ExecuteReader();
        while (dr.Read())
        {
            _Client c = new _Client();
            c.ClientName          = Convert.ToString(dr["ClientName"]);
            c.client_market_value = Convert.ToInt32(dr["client_market_value"]);
            c.Campaigns           = Convert.ToString(dr["Campaigns"]);
            output.Add(c);
        }
        con.Close();
        return(output);
    }
Exemplo n.º 2
0
        private void _ListenThread()
        {
            try
            {
                var isListening = _isListening;
                while (isListening.Value)
                {
                    var clientSocket = _socket.Accept();
                    var clientIPEP   = (IPEndPoint)clientSocket.RemoteEndPoint;

                    var client = new _Client(isListening, clientSocket, BufferSize, _ReceiveThread, (c) =>
                    {
                        if (!c.IsListening)
                        {
                            return;
                        }

                        lock (_connections)
                        {
                            _connections.Remove(c.RemoteIPEP);
                            _connectionsCached.Remove(c.RemoteIPEP);
                        }
                    });

                    lock (_connections)
                    {
                        if (_connections.ContainsKey(clientIPEP))
                        {
                            continue;
                        }

                        _connections.Add(clientIPEP, client);
                        _connectionsCached.Add(clientIPEP, client);
                    }

                    OnConnect?.Invoke(clientIPEP);
                }
            }
            catch (ThreadAbortException)
            {
            }
            catch (Exception ex)
            {
                _Cleanup();
                OnStop?.Invoke(ex);
            }
        }
Exemplo n.º 3
0
 private void Form1_Load(object sender, EventArgs e)
 {
     client          = new _Client(Microsoft.VisualBasic.Interaction.InputBox("Enter the server address", "Server Details"));
     execute.Enabled = false;
 }