コード例 #1
0
        public bool Conflicts(ShowtimeGroupEntry other, int movieLength)
        {
            SetInterval();
            other.SetInterval();

            if (Interval.Add(new TimeSpan(0, movieLength, 0)) > other.Interval && RoomID == other.RoomID)
            {
                return(true);
            }
            return(false);
        }
コード例 #2
0
        public void UpdateData(ShowtimeGroupEntry showtimeGroupEntry, int duration)
        {
            if (StartTime == showtimeGroupEntry.StartTime &&
                RoomID == showtimeGroupEntry.RoomID &&
                ExperienceID == showtimeGroupEntry.ExperienceID)
            {
                return;
            }

            StartTime    = showtimeGroupEntry.StartTime;
            RoomID       = showtimeGroupEntry.RoomID;
            ExperienceID = showtimeGroupEntry.ExperienceID;

            foreach (Showtime showtime in Showtimes)
            {
                showtime.StartTime    = showtime.StartTime.Date + TimeSpan.Parse(StartTime);
                showtime.EndTime      = showtime.StartTime.AddMinutes(duration);
                showtime.RoomID       = RoomID;
                showtime.ExperienceID = ExperienceID;
            }
        }
コード例 #3
0
        private void UpdateGroupEntries(ShowtimeGroup updatedGroup)
        {
            List <ShowtimeGroupEntry> entriesToDelete = ShowtimeGroupEntries
                                                        .Where(e => !updatedGroup.ShowtimeGroupEntries.Any(ue => (e.StartTime == ue.StartTime &&
                                                                                                                  e.RoomID == ue.RoomID &&
                                                                                                                  e.ExperienceID == ue.ExperienceID) ||
                                                                                                           (e.ShowtimeGroupEntryID == ue.ShowtimeGroupEntryID)))
                                                        .ToList();
            List <ShowtimeGroupEntry> entriesToCreate = updatedGroup.ShowtimeGroupEntries
                                                        .Where(ue => !ShowtimeGroupEntries.Any(e => (e.StartTime == ue.StartTime &&
                                                                                                     e.RoomID == ue.RoomID &&
                                                                                                     e.ExperienceID == ue.ExperienceID) ||
                                                                                               (e.ShowtimeGroupEntryID == ue.ShowtimeGroupEntryID)))
                                                        .ToList();

            foreach (ShowtimeGroupEntry entry in entriesToDelete)
            {
                ShowtimeGroupEntries.Remove(entry);
            }

            foreach (ShowtimeGroupEntry entry in ShowtimeGroupEntries)
            {
                ShowtimeGroupEntry updatedEntry = updatedGroup.ShowtimeGroupEntries
                                                  .Where(e => e.ShowtimeGroupEntryID == entry.ShowtimeGroupEntryID)
                                                  .SingleOrDefault();
                if (updatedEntry != null)
                {
                    entry.UpdateData(updatedEntry, Movie.Duration);
                }
            }

            foreach (ShowtimeGroupEntry entry in entriesToCreate)
            {
                entry.GenerateShowtimes(Movie, FromDate, ToDate);
                ShowtimeGroupEntries.Add(entry);
            }
        }