示例#1
0
 public bool HasSamePropertiesAs(Venue other)
 {
     return(
         this.Id == other.Id &&
         this.Name == other.Name);
 }
示例#2
0
        public List <Venue> GetVenues()
        {
            MySqlConnection conn = DB.Connection();

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

            cmd.CommandText = @"SELECT venues.* FROM bands
        JOIN tracker_info ON (band_id = tracker_info.band_id)
        JOIN venues ON(tracker_info.venue_id = venue_id)
        WHERE band_id = @bandId";

            MySqlParameter bandIdParameter = new MySqlParameter();

            bandIdParameter.ParameterName = "@bandId";
            bandIdParameter.Value         = _band_id;
            cmd.Parameters.Add(bandIdParameter);

            var rdr = cmd.ExecuteReader() as MySqlDataReader;

            List <int> venueIds = new List <int> {
            };

            while (rdr.Read())
            {
                int venueId = rdr.GetInt32(0);
                venueIds.Add(venueId);
            }
            rdr.Dispose();

            List <Venue> venues = new List <Venue> {
            };

            foreach (int venueId in venueIds)
            {
                var venueQuery = conn.CreateCommand() as MySqlCommand;
                venueQuery.CommandText = @"SELECT * FROM venues WHERE id = @VenueId;";

                MySqlParameter venueIdParameter = new MySqlParameter();
                venueIdParameter.ParameterName = "@VenueId";
                venueIdParameter.Value         = venueId;
                venueQuery.Parameters.Add(venueIdParameter);

                var venueQueryRdr = venueQuery.ExecuteReader() as MySqlDataReader;
                while (venueQueryRdr.Read())
                {
                    int    thisVenueId   = venueQueryRdr.GetInt32(0);
                    string venueName     = venueQueryRdr.GetString(1);
                    string venueLocation = venueQueryRdr.GetString(2);
                    Venue  foundVenue    = new Venue(venueName, venueLocation, thisVenueId);
                    venues.Add(foundVenue);
                }
                venueQueryRdr.Dispose();
            }
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
            return(venues);
        }
示例#3
0
 public VenueBand(Venue v)
 {
     _venues.Add(v);
     SetBands(v.GetSchedule());
 }
示例#4
0
 public VenueBand(Venue v, Band b)
 {
     _venues.Add(v);
     _bands.Add(b);
 }
示例#5
0
 public VenueBand()
 {
     SetVenues(Venue.GetAll());
     SetBands(Band.GetAll());
 }