示例#1
0
        public List <Compras> acoesCompradas()
        {
            MySqlConnection connection = ConnetionDB.connection();
            MySqlCommand    query      = connection.CreateCommand();

            query.CommandText = "SELECT * FROM trader_acoes.acoes_compra";

            var results = new List <Compras>();

            connection.Open();

            MySqlDataReader fetch_query = query.ExecuteReader();

            while (fetch_query.Read())
            {
                results.Add(new Compras(fetch_query["company"].ToString(),
                                        fetch_query["code"].ToString(),
                                        fetch_query["date_buy"].ToString(),
                                        fetch_query["value_buy"].ToString(),
                                        fetch_query["cotas"].ToString()));
            }

            connection.Close();

            return(results);
        }
示例#2
0
        public List <Carteira> carteiraUser(string user)
        {
            MySqlConnection connection = ConnetionDB.connection();
            MySqlCommand    query      = connection.CreateCommand();

            query.CommandText = "SELECT * FROM trader_acoes.acoes_compra as ac WHERE ac.`USER` = '" + user + "'";

            var results = new List <Carteira>();

            connection.Open();

            MySqlDataReader fetch_query = query.ExecuteReader();

            while (fetch_query.Read())
            {
                results.Add(new Carteira(fetch_query["user"].ToString(),
                                         fetch_query["code"].ToString(),
                                         fetch_query["cotas"].ToString(),
                                         fetch_query["value_buy"].ToString(),
                                         fetch_query["date_buy"].ToString()));
            }

            connection.Close();

            return(results);
        }