private List <SeatSection> getSeatMapForVenueInternal(int venueId) { var seatMapList = new List <SeatSection>(); using (var conn = new SqlConnection(ConstructVenuesConnectString())) { var seatMapQuery = String.Format(@"SELECT seatSection.SeatSectionId as seatSectionId, seatSection.Description as seatDescription, seatSection.VenueId as venueId, seatSection.SeatCount as seatCount FROM SeatSection as seatSection WHERE seatSection.VenueId={0}", venueId); conn.Open(); using (var cmd = new SqlCommand(seatMapQuery, conn)) { using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { var seatMapToAdd = new SeatSection { SeatSectionId = reader.GetInt32(reader.GetOrdinal(@"seatSectionId")), Description = (reader.IsDBNull(reader.GetOrdinal(@"seatDescription"))) ? "" : reader.GetString(reader.GetOrdinal(@"seatDescription")), VenueId = reader.GetInt32(reader.GetOrdinal(@"venueId")), SeatCount = reader.GetInt32(reader.GetOrdinal(@"seatCount")), TicketLevelId = 1, TicketPrice = 55 }; seatMapList.Add(seatMapToAdd); } } } } return(seatMapList); }
private List<SeatSection> getSeatMapForVenueInternal(int VenueId) { List<SeatSection> seatMapList = new List<SeatSection>(); try { using (var conn = new SqlConnection(constructVenuesConnectString())) { String seatMapQuery = String.Format(@"SELECT seatSection.SeatSectionId as seatSectionId, seatSection.Description as seatDescription, seatSection.VenueId as venueId, seatSection.SeatCount as seatCount FROM SeatSection as seatSection WHERE seatSection.VenueId={0}", VenueId); conn.Open(); using (var cmd = new SqlCommand(seatMapQuery, conn)) using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { SeatSection seatMapToAdd = new SeatSection { SeatSectionId = reader.GetInt32(reader.GetOrdinal(@"seatSectionId")), Description = (reader.IsDBNull(reader.GetOrdinal(@"seatDescription"))) ? "" : reader.GetString(reader.GetOrdinal(@"seatDescription")), VenueId = reader.GetInt32(reader.GetOrdinal(@"venueId")), SeatCount = reader.GetInt32(reader.GetOrdinal(@"seatCount")), //TODO: Remove the hardcoded ticketlevel and tickePrice TicketLevelId = 1, TicketPrice = 55 }; seatMapList.Add(seatMapToAdd); } } } } catch { } return seatMapList; }