Esempio n. 1
0
        public bool CheckPostponeIsPossible(int performanceId, DateTime date, int venueId)
        {
            IPerformanceDao     dao               = DALFactory.CreatePerformanceDao(database);
            IVenueDao           venueDao          = DALFactory.CreateVenueDao(database);
            Performance         toPostpone        = dao.findById(performanceId);
            IList <Performance> otherPerformances = dao.FindPerormanceByDay(date);

            bool foundConflict = false;

            foreach (Performance p in otherPerformances)
            {
                if (p.Id == toPostpone.Id)
                {
                    continue;
                }


                DateTime postPoneDate = new DateTime(date.Year, date.Month, date.Day, date.Hour, 0, 0);
                DateTime currentDate  = new DateTime(p.StagingTime.Year, p.StagingTime.Month, p.StagingTime.Day, p.StagingTime.Hour, 0, 0);


                if (toPostpone.Artist.Id == p.Artist.Id)
                {
                    if (postPoneDate >= currentDate.AddHours(-2) && postPoneDate <= currentDate.AddHours(2))
                    {
                        foundConflict = true;
                        break;
                    }
                }
                if (p.Venue.Id == venueId && postPoneDate == currentDate)
                {
                    foundConflict = true;
                    break;
                }
            }
            return(!foundConflict);
        }
Esempio n. 2
0
        public IList <Performance> QueryPerfomancesByDay(DateTime day)
        {
            IPerformanceDao dao = DALFactory.CreatePerformanceDao(database);

            return(dao.FindPerormanceByDay(day));
        }