Ejemplo n.º 1
0
        public void TestInsert()
        {
            // arrange
            bool expectedValue = true;
            Artist newArtist = new Artist("Anne & Mitja", "test.jpg", "test2.jpg", "Akrobatik&Tanz", "DE");
            bool beforeInsert = aDao.GetAll().Count == 91;

            // act
            aDao.Insert(newArtist);
            bool afterInsert = aDao.GetAll().Count == 92;

            // assert
            bool actualValue = (beforeInsert && afterInsert);
            Assert.AreEqual(expectedValue, actualValue, "Artist has not been inserted successfully.");
        }
Ejemplo n.º 2
0
 public bool Update(Artist a)
 {
     return database.ExecuteNonQuery(CreateUpdateCommand(a.Name, a.PictureURL, a.PromoVideoURL, a.CategoryName, a.CountryCode)) == 1;
 }
Ejemplo n.º 3
0
 public ArtistVM(Artist artist)
 {
     this.artist = artist;
 }
Ejemplo n.º 4
0
        public ICollection<Performance> FilterPerformances(Artist artist, Venue venue, Category category, int from, int to)
        {
            ICollection<Performance> performances = performanceDao.GetAll();
            ICollection<Artist> artists = artistDao.GetAll();
            HashSet<Performance> pList1 = null;
            HashSet<Performance> pList2 = null;
            HashSet<Performance> pList3 = null;
            HashSet<Performance> pList4 = null;

            // get performances containing artist
            if (artist != null)
            {
                foreach (Performance p in performances)
                {
                    if (p.Artist == artist.Name)
                        pList1.Add(p);
                }
            }

            // get performances at venue
            if (venue != null)
            {
                foreach (Performance p in performances)
                {
                    if (p.Venue == venue.ShortName)
                        pList2.Add(p);
                }
            }

            // get performances containing artists of category
            if (category != null)
            {
                foreach (Artist a in artists)
                {
                    if (a.CategoryName == category.CategoryName)
                    {
                        foreach (Performance p in performances)
                        {
                            if (p.Artist == a.Name)
                                pList3.Add(p);
                        }
                    }
                }
            }

            // get performances from starting with 1400, to approx. 2400
            if ((from >= 14 && from <= 23) && (to <= 24 && to >= 15))
            {
                foreach (Performance p in performances)
                {
                    if (p.Time >= from && p.Time <= to)
                        pList4.Add(p);
                }
            }
            else if (from >= 14 && from <= 23) // only from
            {
                {
                    foreach (Performance p in performances)
                    {
                        if (p.Time >= from)
                            pList4.Add(p);
                    }
                }
            }
            else if (to <= 24 && to >= 15) // only to
            {
                foreach (Performance p in performances)
                {
                    if (p.Time <= to)
                        pList4.Add(p);
                }
            }

            // create result out of partial results
            HashSet<Performance> result = new HashSet<Performance>();
            if (pList1 != null)
                foreach (Performance p in pList1)
                    result.Add(p);
            if (pList2 != null)
                foreach (Performance p in pList2)
                    result.Add(p);
            if (pList3 != null)
                foreach (Performance p in pList3)
                    result.Add(p);
            if (pList4 != null)
                foreach (Performance p in pList4)
                    result.Add(p);

            return new List<Performance>(result);
        }
Ejemplo n.º 5
0
 public bool DeleteArtist(Artist artist)
 {
     return artistDao.Delete(artist.Name);
 }
Ejemplo n.º 6
0
 public bool UpdateArtist(Artist artist)
 {
     return artistDao.Update(artist);
 }
Ejemplo n.º 7
0
 public bool InsertArtist(Artist artist)
 {
     return artistDao.Insert(artist);
 }