Esempio n. 1
0
        public void DeleteBandFromVenue(Band newBand)
        {
            MySqlConnection conn = DB.Connection();

            conn.Open();

            var cmd = conn.CreateCommand() as MySqlCommand;

            cmd.CommandText = @"DELETE FROM bands_venues WHERE band_id = @BandId AND venue_id = @VenueId;";

            MySqlParameter venueId = new MySqlParameter();

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

            MySqlParameter bandId = new MySqlParameter();

            bandId.ParameterName = "@BandId";
            bandId.Value         = newBand.GetId();
            cmd.Parameters.Add(bandId);

            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Esempio n. 2
0
        public void AddBandToVenueJoinTable(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);";

            MySqlParameter bandId = new MySqlParameter();

            bandId.ParameterName = "@BandId";
            bandId.Value         = newBand.GetId();
            cmd.Parameters.Add(bandId);

            MySqlParameter venueId = new MySqlParameter();

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

            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
 public override bool Equals(System.Object otherBand)
 {
     if (!(otherBand is Band))
     {
         return(false);
     }
     else
     {
         Band newBand = (Band)otherBand;
         return(this.GetId().Equals(newBand.GetId()));
     }
 }
Esempio n. 4
0
 public override bool Equals(System.Object otherBand)
 {
     if (!(otherBand is Band))
     {
         return(false);
     }
     else
     {
         Band newBand      = (Band)otherBand;
         bool idEquality   = (this.GetId() == newBand.GetId());
         bool nameEquality = (this.GetName() == newBand.GetName());
         return(idEquality && nameEquality);
     }
 }
Esempio n. 5
0
 public override bool Equals(Object otherBand)
 {
     if (!(otherBand is Band))
     {
         return(false);
     }
     else
     {
         Band band         = (Band)otherBand;
         bool idEquality   = _id == band.GetId();
         bool nameEquality = _name == band.GetName();
         return(idEquality && nameEquality);
     }
 }
Esempio n. 6
0
 public override bool Equals(System.Object otherBand)
 {
     if (!(otherBand is Band))
     {
         return(false);
     }
     else
     {
         Band newBand                 = (Band)otherBand;
         bool idEquality              = this.GetId() == newBand.GetId();
         bool descriptionEquality     = this.GetDescription() == newBand.GetDescription();
         bool performancedateEquality = this.GetPerformanceDate() == newBand.GetPerformanceDate();
         return(idEquality && descriptionEquality && performancedateEquality);
     }
 }
Esempio n. 7
0
 public override bool Equals(Object otherBand)
 {
     if (!(otherBand is Band))
     {
         return(false);
     }
     else
     {
         Band newBand                 = (Band)otherBand;
         bool idEquality              = newBand.GetId() == this._id;
         bool nameEquality            = newBand.GetName() == this._name;
         bool numberOfPlayersEquality = newBand.GetNumberOfPlayers() == this._numberOfPlayers;
         return(idEquality && nameEquality && numberOfPlayersEquality);
     }
 }
Esempio n. 8
0
 public override bool Equals(System.Object otherBand)
 {
     if (!(otherBand is Band))
     {
         return(false);
     }
     else
     {
         Band newBand             = (Band)otherBand;
         bool idEquality          = this.GetId() == newBand.GetId();
         bool descriptionEquality = this.GetDescription() == newBand.GetDescription();
         //  bool dueDateEquality = this.GetDate() == newItem.GetDate();
         // We no longer compare Items' categoryIds in a categoryEquality bool here.
         return(idEquality && descriptionEquality);
     }
 }
        public void AddBand(Band newBand)
        {
            MySqlConnection conn = DB.Connection();

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

            cmd.CommandText = "INSERT INTO gigs (band_id, venue_id) VALUES (@BandId, @VenueId);";
            cmd.Parameters.Add(new MySqlParameter("@BandId", newBand.GetId()));
            cmd.Parameters.Add(new MySqlParameter("@VenueId", this.GetId()));
            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }