Exemplo n.º 1
0
        public static List <Buy_Offer> GetAll()
        {
            List <Buy_Offer> allBuy_Offer = new List <Buy_Offer> {
            };
            MySqlConnection conn          = DB.Connection();

            conn.Open();
            MySqlCommand cmd = conn.CreateCommand() as MySqlCommand;

            cmd.CommandText = @"SELECT * FROM buy_offer;";
            MySqlDataReader rdr = cmd.ExecuteReader() as MySqlDataReader;

            while (rdr.Read())
            {
                int      id                  = rdr.GetInt32(0);
                int      offererId           = rdr.GetInt32(1);
                int      wgameId             = rdr.GetInt32(2);
                int      transaction_sell_id = rdr.GetInt32(3);
                DateTime date                = rdr.GetDateTime(4);
                int      ogameId             = rdr.GetInt32(5);
                string   comment             = rdr.GetString(6);

                Buy_Offer newBuy_Offer = new Buy_Offer(wgameId, date, offererId, ogameId, comment, transaction_sell_id, id);
                allBuy_Offer.Add(newBuy_Offer);
            }
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
            return(allBuy_Offer);
        }
Exemplo n.º 2
0
 public override bool Equals(System.Object otherBuy_Offer)
 {
     if (!(otherBuy_Offer is Buy_Offer))
     {
         return(false);
     }
     else
     {
         Buy_Offer newBuy_Offer = (Buy_Offer)otherBuy_Offer;
         return(this.GetId().Equals(newBuy_Offer.GetId()));
     }
 }
Exemplo n.º 3
0
        public static Buy_Offer Find(int id)
        {
            MySqlConnection conn = DB.Connection();

            conn.Open();

            var cmd = conn.CreateCommand() as MySqlCommand;

            cmd.CommandText = @"SELECT * FROM buy_offer WHERE id = @searchId;";
            MySqlParameter searchId = new MySqlParameter();

            searchId.ParameterName = "@searchId";
            searchId.Value         = id;
            cmd.Parameters.Add(searchId);
            var rdr = cmd.ExecuteReader() as MySqlDataReader;

            int      foundid             = 0;
            int      offererId           = 0;
            int      wgameId             = 0;
            int      transaction_sell_id = 0;
            DateTime date    = new DateTime(2000, 1, 1, 1, 0, 0);
            int      ogameId = 0;
            string   comment = "";

            while (rdr.Read())
            {
                foundid             = rdr.GetInt32(0);
                offererId           = rdr.GetInt32(1);
                wgameId             = rdr.GetInt32(2);
                transaction_sell_id = rdr.GetInt32(3);
                date    = rdr.GetDateTime(4);
                ogameId = rdr.GetInt32(5);
                comment = rdr.GetString(6);
            }
            Buy_Offer foundBuy_Offer = new Buy_Offer(wgameId, date, offererId, ogameId, comment, transaction_sell_id, foundid);

            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
            return(foundBuy_Offer);
        }