public Venue Create(Venue venue) { var cmd = this.CreateInsertCommand(venue.AreaId, venue.Description, venue.ShortDescription, venue.Latitude, venue.Longitude); db.ExecuteNonQuery(cmd); venue.Id = (int)((MySqlCommand)cmd).LastInsertedId; return venue; }
private void AddVenue(object obj) { var newVenue = new Venue { AreaId = area.Id, Latitude = 48.3057594, Longitude = 14.284544 }; var vm = new VenueViewModel(newVenue, bl); Venues.Add(vm); CurrentVenue = vm; }
public void TestCreate() { var newVenue = new Venue { Id = -1, AreaId = 1, Description = "venue1", ShortDescription = "v1", Latitude = 18.00023020, Longitude = 34.0000023 }; newVenue = dao.Create(newVenue); Assert.True(newVenue.Id != -1); Assert.True(dao.GetById(newVenue.Id).IsEqualTo(newVenue)); }
public void SetUp() { transaction = new TransactionScope(); DALFactory factory = DALFactory.GetInstance(); db = factory.CreateDatabase(); dao = factory.CreateVenueDAO(db); venue1 = new Venue { Id = 1, AreaId = 1, Description = "venue1", ShortDescription = "v1", Latitude = 18.00023020, Longitude = 34.0000023 }; venue2 = new Venue { Id = 2, AreaId = 2, Description = "venue2", ShortDescription = "v2", Latitude = 23.3020, Longitude = 4.0046573 }; IList<string> sqls = new List<string> { "SET FOREIGN_KEY_CHECKS=0", "DELETE FROM `venue`", "INSERT INTO `venue` (`id`, `area_id`, `desc`, `short_desc`, `latitude`, `longitude`) " + "VALUES (1, 1, 'venue1', 'v1', 18.00023020, 34.0000023)", "INSERT INTO `venue` (`id`, `area_id`, `desc`, `short_desc`, `latitude`, `longitude`) " + "VALUES (2, 2, 'venue2', 'v2', 23.3020, 4.0046573)" }; runDbCommands(db, sqls); }
public static bool IsEqualTo(this Venue v1, Venue v2) { return v1.AreaId == v2.AreaId && v1.Description == v2.Description && v1.Id == v2.Id && v1.Latitude == v2.Latitude && v1.Longitude == v2.Longitude && v1.ShortDescription == v2.ShortDescription; }
public void TestUpdateFail() { var venue = new Venue(); Assert.Throws<EntityNotFoundException>(() => dao.Update(venue)); }
public override Venue CreateVenue(Venue venue) { return dalFactory.CreateVenueDAO(db).Create(venue); }
public abstract Venue CreateVenue(Venue venue);
Task<IEnumerable<Performance>> IBusinessLogicAsync.GetPerformancesForVenue(Venue venue) { return Task.Run(() => GetPerformancesForVenue(venue)); }
private static void TestVenue(IDatabase db, DALFactory dalFactory) { Console.WriteLine("*************************************"); Console.WriteLine("VENUE TEST"); IVenueDAO venueDAO = dalFactory.CreateVenueDAO(db); Console.WriteLine("\nAll VENUES:"); foreach (var venue in venueDAO.GetAll()) { Console.WriteLine(venue); } Console.WriteLine("\nVENUE with ID=1:"); Console.WriteLine(venueDAO.GetById(1)); Venue venue1 = new Venue() { AreaId = 1, Description = "TestVenue", ShortDescription = "TV", Latitude = 0.0f, Longitude = 0.0f }; Venue newVenue = venueDAO.Create(venue1); Console.WriteLine("New VENUE: " + newVenue); Console.WriteLine("Inserted VENUE: " + newVenue); venue1.Description = "Winzerhof Wurst"; venueDAO.Update(venue1); Console.WriteLine("Updated VENUE: " + venue1); }
public Venue UpdateVenue(Venue venue) { return bl.UpdateVenue(venue); }
public List<Performance> GetPerformancesForVenue(Venue venue) { return bl.GetPerformancesForVenue(venue).ToList(); }
private void InsertArtistsIntoCells(Venue venue, Row row) { try { int i = 0; foreach (var timeSlot in timeSlots) { i++; SpectacledayTimeSlot daySlot = spectacleDayTimeSlots.Where(s => s.TimeSlotId == timeSlot.Id).FirstOrDefault(); Performance performance = performances.Where(p => p.SpectacledayTimeSlot == daySlot.Id && p.VenueId == venue.Id).FirstOrDefault(); Artist currArtist = null; if (performance != null) { currArtist = artists.Where(a => a.Id == performance.ArtistId).FirstOrDefault(); } if (currArtist == null) { currArtist = new Artist() { Name = "" }; } row.Cells[i].AddParagraph(currArtist.Name); } } catch (Exception e) { throw new BusinessLogicException($"Could not create PDF-File table cell value for artist." + e.Message); } }
public Venue Update(Venue venue) { var cmd = this.CreateUpdateCommand(venue.Id, venue.AreaId, venue.Description, venue.ShortDescription, venue.Latitude, venue.Longitude); if (db.ExecuteNonQuery(cmd) != 1) { throw new EntityNotFoundException(); } return venue; }
public IEnumerable<Performance> GetForVenue(Venue venue) { var result = new List<Performance>(); var cmd = CreateSelectForVenue(venue.Id); using (IDataReader reader = db.ExecuteReader(cmd)) { while (reader.Read()) { result.Add(CreatePerformanceFromReader(reader)); } return result; } }
public Venue CreateVenue(Venue venue) { return bl.CreateVenue(venue); }
public VenueViewModel(Venue venue, IBusinessLogicAsync bl) { this.venue = venue; this.bl = bl; }
public void SetUp() { venue = new Venue(); }
public abstract IEnumerable<Performance> GetPerformancesForVenue(Venue venue);
public ScheduleVenueViewModel(Venue venue, ObservableCollection<PerformanceViewModel> performances) { this.venue = venue; Performances = performances; }
public abstract Venue UpdateVenue(Venue venue);
public void TestUpdate() { Venue v1Tmp = new Venue { Id = venue1.Id, AreaId = venue1.AreaId, Description = venue1.Description, ShortDescription = venue1.ShortDescription, Longitude = venue1.Longitude, Latitude = venue1.Latitude }; Assert.True(venue1.IsEqualTo(v1Tmp)); venue1.AreaId = 3; venue1.Description = "x"; venue1.ShortDescription = "x"; venue1.Longitude = 2.0; venue1.Latitude = 1.0; Assert.False(venue1.IsEqualTo(v1Tmp)); Assert.True(dao.Update(venue1).IsEqualTo(venue1)); Assert.True(dao.GetById(venue1.Id).IsEqualTo(venue1)); }
public Task<Venue> CreateVenueAsync(Venue venue) { return Task.Run(() => CreateVenue(venue)); }
public override IEnumerable<Performance> GetPerformancesForVenue(Venue venue) { return dalFactory.CreatePerformanceDAO(db).GetForVenue(venue); }