public override bool GetProgramsForSchedule(ISchedule schedule, out IList <IProgram> programs) { programs = new List <IProgram>(); Schedule scheduleEntity = ScheduleManagement.GetSchedule(schedule.ScheduleId); if (scheduleEntity == null) { return(false); } IList <Program> programEntities = ProgramManagement.GetProgramsForSchedule(scheduleEntity); programs = programEntities.Select(p => p.ToProgram()).Distinct(ProgramComparer.Instance).ToList(); return(true); }
public override Task <AsyncResult <IList <IProgram> > > GetProgramsForScheduleAsync(ISchedule schedule) { var programs = new List <IProgram>(); Schedule scheduleEntity = ScheduleManagement.GetSchedule(schedule.ScheduleId); if (scheduleEntity == null) { return(Task.FromResult(new AsyncResult <IList <IProgram> >(false, null))); } IList <Program> programEntities = ProgramManagement.GetProgramsForSchedule(scheduleEntity); programs = programEntities.Select(p => GetProgram(p)).Distinct(ProgramComparer.Instance).ToList(); var success = programs.Count > 0; return(Task.FromResult(new AsyncResult <IList <IProgram> >(success, programs))); }
public bool GetProgramsForSchedule(ISchedule schedule, out IList <IProgram> programs) { programs = new List <IProgram>(); #if TVE3 var tvSchedule = TvDatabase.Schedule.Retrieve(schedule.ScheduleId); if (tvSchedule == null) { return(false); } programs = TvDatabase.Schedule.GetProgramsForSchedule(tvSchedule).Select(p => p.ToProgram()).ToList(); return(programs.Count > 0); #else Schedule scheduleEntity = ScheduleManagement.GetSchedule(schedule.ScheduleId); if (scheduleEntity == null) { return(false); } IList <Program> programEntities = ProgramManagement.GetProgramsForSchedule(scheduleEntity); programs = programEntities.Select(p => p.ToProgram()).Distinct(ProgramComparer.Instance).ToList(); return(true); #endif }