Ejemplo n.º 1
0
        //Create method for 'join' table
        public void AddBandsToVenues(Band newBand)
        {
            MySqlConnection conn = DB.Connection();

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

            cmd.CommandText = @"INSERT INTO venues_bands (venue_id, band_id) VALUES (@VenueId, @BandId);";

            MySqlParameter band_id = new MySqlParameter();

            band_id.ParameterName = "@BandId";
            band_id.Value         = newBand.GetBandId();
            cmd.Parameters.Add(band_id);

            MySqlParameter venue_id = new MySqlParameter();

            venue_id.ParameterName = "@VenueId";
            venue_id.Value         = _id;
            cmd.Parameters.Add(venue_id);

            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Ejemplo n.º 2
0
 public override bool Equals(System.Object otherBand)
 {
     if (!(otherBand is Band))
     {
         return(false);
     }
     else
     {
         Band newBand          = (Band)otherBand;
         bool idEquality       = (this.GetBandId() == newBand.GetBandId());
         bool bandNameEquality = (this.GetBandName() == newBand.GetBandName());
         return(idEquality && bandNameEquality);
     }
 }
Ejemplo n.º 3
0
        public void AddBand(Band newBand)
        {
            MySqlConnection conn = DB.Connection();

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

            cmd.CommandText = @"INSERT INTO bands_venues (band_id, venue_id) VALUES (@bandId, @venueId);";

            cmd.Parameters.Add(new MySqlParameter("@bandId", newBand.GetBandId()));
            cmd.Parameters.Add(new MySqlParameter("@venueId", _id));
            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }