public bool CreateScheduleByTime(IChannel channel, DateTime from, DateTime to, out ISchedule schedule) { #if TVE3 TvDatabase.Schedule tvSchedule = _tvBusiness.AddSchedule(channel.ChannelId, "Manual", from, to, (int)ScheduleRecordingType.Once); tvSchedule.PreRecordInterval = Int32.Parse(_tvBusiness.GetSetting("preRecordInterval", "5").Value); tvSchedule.PostRecordInterval = Int32.Parse(_tvBusiness.GetSetting("postRecordInterval", "5").Value); tvSchedule.Persist(); _tvControl.OnNewSchedule(); #else IScheduleService scheduleService = GlobalServiceProvider.Get <IScheduleService>(); Schedule tvSchedule = ScheduleFactory.CreateSchedule(channel.ChannelId, "Manual", from, to); tvSchedule.PreRecordInterval = ServiceAgents.Instance.SettingServiceAgent.GetValue("preRecordInterval", 5); tvSchedule.PostRecordInterval = ServiceAgents.Instance.SettingServiceAgent.GetValue("postRecordInterval", 5); tvSchedule.ScheduleType = (int)ScheduleRecordingType.Once; scheduleService.SaveSchedule(tvSchedule); #endif schedule = tvSchedule.ToSchedule(); return(true); }
public bool CreateSchedule(IProgram program, ScheduleRecordingType recordingType, out ISchedule schedule) { #if TVE3 TvDatabase.Schedule tvSchedule = _tvBusiness.AddSchedule(program.ChannelId, program.Title, program.StartTime, program.EndTime, (int)recordingType); tvSchedule.ScheduleType = (int)recordingType; tvSchedule.PreRecordInterval = Int32.Parse(_tvBusiness.GetSetting("preRecordInterval", "5").Value); tvSchedule.PostRecordInterval = Int32.Parse(_tvBusiness.GetSetting("postRecordInterval", "5").Value); tvSchedule.Persist(); _tvControl.OnNewSchedule(); schedule = tvSchedule.ToSchedule(); return(true); #else IScheduleService scheduleService = GlobalServiceProvider.Instance.Get <IScheduleService>(); Schedule tvschedule = ScheduleFactory.CreateSchedule(program.ChannelId, program.Title, program.StartTime, program.EndTime); tvschedule.PreRecordInterval = ServiceAgents.Instance.SettingServiceAgent.GetValue("preRecordInterval", 5); tvschedule.PostRecordInterval = ServiceAgents.Instance.SettingServiceAgent.GetValue("postRecordInterval", 5); tvschedule.ScheduleType = (int)recordingType; scheduleService.SaveSchedule(tvschedule); schedule = tvschedule.ToSchedule(); return(true); #endif }