Esempio n. 1
0
 public VenueVM(Venue venue)
 {
     this.venue = venue;
 }
Esempio n. 2
0
        public void TestInsert()
        {
            // arrange
            bool expectedValue = true;
            Venue newVenue = new Venue("Z9", "Zentral", 0.0, 0.0);
            bool beforeInsert = vDao.GetAll().Count == 42;

            // act
            vDao.Insert(newVenue);
            bool afterInsert = vDao.GetAll().Count == 43;

            // assert
            bool actualValue = (beforeInsert && afterInsert);
            Assert.AreEqual(expectedValue, actualValue, "Venue has not been inserted successfully.");
        }
Esempio n. 3
0
 public bool Update(Venue v)
 {
     return database.ExecuteNonQuery(CreateUpdateCommand(v.ShortName, v.Description, v.Latitude, v.Longitude)) == 1;
 }
Esempio 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);
        }
Esempio n. 5
0
 public bool DeleteVenue(Venue venue)
 {
     return venueDao.Delete(venue.ShortName);
 }
Esempio n. 6
0
 public bool UpdateVenue(Venue venue)
 {
     return venueDao.Update(venue);
 }
Esempio n. 7
0
 public bool InsertVenue(Venue venue)
 {
     return venueDao.Insert(venue);
 }