/// <summary> /// disable an artist and set performances after now /// </summary> /// <param name="artist"></param> /// <returns></returns> public bool DeleteArtist(Artist artist) { IArtistDao dao = DALFactory.CreateArtistDao(database); Artist toDelete = dao.findById(artist.Id); if (toDelete == null) { return(false); } toDelete.Deleted = true; bool success = dao.Update(toDelete); if (success) { IPerformanceDao performanceDao = DALFactory.CreatePerformanceDao(database); IList <Performance> performances = performanceDao.FindPerformanceForArtistsAfterDate(toDelete, DateTime.Now); foreach (Performance p in performances) { Console.WriteLine("found performances " + p.Id + "artist " + p.Artist.Name); p.Canceld = true; success = performanceDao.Update(p); } } return(success); }
public bool CanclePerformance(int performanceId) { IPerformanceDao dao = DALFactory.CreatePerformanceDao(database); Performance p = dao.findById(performanceId); p.Canceld = true; return(dao.Update(p)); }
public bool PostponePerformance(int performanceId, DateTime date, int venueId) { IPerformanceDao dao = DALFactory.CreatePerformanceDao(database); IVenueDao venueDao = DALFactory.CreateVenueDao(database); Performance p = dao.findById(performanceId); if (this.CheckPostponeIsPossible(performanceId, date, venueId)) { p.StagingTime = date; Venue v = venueDao.findById(venueId); p.Venue = v; return(dao.Update(p)); } return(false); }
public void TestUpdate() { IPerformanceDao dao = DALFactory.CreatePerformanceDao(DALFactory.CreateDatabase()); Performance performance = dao.findById(1); IArtistDao artistDao = DALFactory.CreateArtistDao(DALFactory.CreateDatabase()); Artist artist = artistDao.findById(2); performance.Artist = artist; performance.StagingTime = DateTime.UtcNow; dao.Update(performance); Performance result = dao.findById(1); //Assert.AreEqual(result.StagingTime, performance.StagingTime); Assert.AreEqual(result.Artist.Id, performance.Artist.Id); }