Beispiel #1
0
        public void addAirline(Airline_company.Airline_company airline)
        {
            string query = "INSERT INTO AIRLINE_COMPANY (name, country,  address, telephone, email) VALUES ('" + airline.Name + "', '" + airline.Country + "', '" + airline.Address + "', '" + airline.Telephone + "', '" + airline.Email + "')";

            if (this.OpenConnection() == true)
            {
                MySqlCommand cmd = new MySqlCommand(query, connection);
                cmd.ExecuteNonQuery();
                this.CloseConnection();
            }
        }
Beispiel #2
0
        internal void editAirline(Airline_company.Airline_company airline)
        {
            string query = "UPDATE airline_company SET name='" + airline.Name + "', country='" + airline.Country + "', address='" + airline.Address + "', telephone='" + airline.Telephone + "', email='" + airline.Email + "' WHERE id=" + airline.Id;

            if (this.OpenConnection() == true)
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = query;
                cmd.Connection  = connection;
                cmd.ExecuteNonQuery();
                this.CloseConnection();
            }
        }
Beispiel #3
0
        public Airline_company.Airline_company getAirlineDataModification(int id)
        {
            string query = "SELECT * FROM AIRLINE_COMPANY WHERE id='" + id + "'";

            Airline_company.Airline_company airline = null;
            if (this.OpenConnection() == true)
            {
                MySqlCommand    cmd  = new MySqlCommand(query, connection);
                MySqlDataReader data = cmd.ExecuteReader();
                if (data.HasRows)
                {
                    data.Read();
                    airline = new Airline_company.Airline_company(data.GetString(1), data.GetString(2), data.GetString(3), data.GetString(4), data.GetString(5));
                    return(airline);
                }
                data.Close();
                this.CloseConnection();
            }
            return(null);
        }