Beispiel #1
0
        public bool RemoveSchedule(IProgram program)
        {
            IScheduleService         scheduleService         = GlobalServiceProvider.Get <IScheduleService>();
            ICanceledScheduleService canceledScheduleService = GlobalServiceProvider.Get <ICanceledScheduleService>();
            var allSchedules = scheduleService.ListAllSchedules()
                               .Where(schedule =>
                                      schedule.IdChannel == program.ChannelId &&
                                      schedule.StartTime == program.StartTime &&
                                      schedule.EndTime == program.EndTime);

            foreach (Schedule schedule in allSchedules)
            {
                switch (schedule.ScheduleType)
                {
                case (int)ScheduleRecordingType.Once:
                    scheduleService.DeleteSchedule(schedule.IdSchedule);
                    break;

                default:
                    CanceledSchedule canceledSchedule = CanceledScheduleFactory.CreateCanceledSchedule(schedule.IdSchedule, schedule.IdChannel, schedule.StartTime);
                    canceledScheduleService.SaveCanceledSchedule(canceledSchedule);
                    break;
                }
            }
            return(true);
        }
Beispiel #2
0
        private static void CancelSingleSchedule(Schedule schedule, Program canceledProgram)
        {
            ICanceledScheduleService canceledScheduleService = GlobalServiceProvider.Instance.Get <ICanceledScheduleService>();

            CanceledSchedule canceledSchedule = CanceledScheduleFactory.CreateCanceledSchedule(schedule.IdSchedule, canceledProgram.IdChannel, canceledProgram.StartTime);

            canceledScheduleService.SaveCanceledSchedule(canceledSchedule);
            StopRecording(schedule);
        }