Exemple #1
0
        public WebBoolResult CancelSchedule(int programId)
        {
            try
            {
                Log.Debug("Canceling schedule for programId {0}", programId);
                var program = Program.Retrieve(programId);
                foreach (Schedule schedule in Schedule.ListAll().Where(schedule => schedule.IsRecordingProgram(program, true)))
                {
                    switch (schedule.ScheduleType)
                    {
                        case (int)ScheduleRecordingType.Once:
                            schedule.Delete();
                            _tvControl.OnNewSchedule();
                            break;
                        default:
                            CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, schedule.IdChannel, schedule.StartTime);
                            canceledSchedule.Persist();
                            _tvControl.OnNewSchedule();
                            break;
                    }
                }

                return true;
            }
            catch (Exception ex)
            {
                Log.Warn(String.Format("Failed to cancel schedule for programId {0}", programId), ex);
                return false;
            }
        }
    public static void CreateProgram(Program program, int scheduleType, int dialogId)
    {
      Log.Debug("TVProgramInfo.CreateProgram: program = {0}", program.ToString());
      Schedule schedule;
      Schedule saveSchedule = null;
      TvBusinessLayer layer = new TvBusinessLayer();
      if (IsRecordingProgram(program, out schedule, false)) // check if schedule is already existing
      {
        Log.Debug("TVProgramInfo.CreateProgram - series schedule found ID={0}, Type={1}", schedule.IdSchedule,
                  schedule.ScheduleType);
        Log.Debug("                            - schedule= {0}", schedule.ToString());
        //schedule = Schedule.Retrieve(schedule.IdSchedule); // get the correct informations
        if (schedule.IsSerieIsCanceled(schedule.GetSchedStartTimeForProg(program), program.IdChannel))
        {
          //lets delete the cancelled schedule.

          saveSchedule = schedule;
          schedule = new Schedule(program.IdChannel, program.Title, program.StartTime, program.EndTime);

          schedule.PreRecordInterval = saveSchedule.PreRecordInterval;
          schedule.PostRecordInterval = saveSchedule.PostRecordInterval;
          schedule.ScheduleType = (int)ScheduleRecordingType.Once; // needed for layer.GetConflictingSchedules(...)
        }
      }
      else
      {
        Log.Debug("TVProgramInfo.CreateProgram - no series schedule");
        // no series schedule => create it
        schedule = new Schedule(program.IdChannel, program.Title, program.StartTime, program.EndTime);
        schedule.PreRecordInterval = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value);
        schedule.PostRecordInterval = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value);
        schedule.ScheduleType = scheduleType;
      }

      // check if this program is conflicting with any other already scheduled recording
      IList conflicts = layer.GetConflictingSchedules(schedule);
      Log.Debug("TVProgramInfo.CreateProgram - conflicts.Count = {0}", conflicts.Count);
      TvServer server = new TvServer();
      bool skipConflictingEpisodes = false;
      if (conflicts.Count > 0)
      {
        TVConflictDialog dlg =
          (TVConflictDialog)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_TVCONFLICT);
        if (dlg != null)
        {
          dlg.Reset();
          dlg.SetHeading(GUILocalizeStrings.Get(879)); // "recording conflict"
          foreach (Schedule conflict in conflicts)
          {
            Log.Debug("TVProgramInfo.CreateProgram: Conflicts = " + conflict);

            GUIListItem item = new GUIListItem(conflict.ProgramName);
            item.Label2 = GetRecordingDateTime(conflict);
            Channel channel = Channel.Retrieve(conflict.IdChannel);
            if (channel != null && !string.IsNullOrEmpty(channel.DisplayName))
            {
              item.Label3 = channel.DisplayName;
            }
            else
            {
              item.Label3 = conflict.IdChannel.ToString();
            }
            item.TVTag = conflict;
            dlg.AddConflictRecording(item);
          }
          dlg.ConflictingEpisodes = (scheduleType != (int)ScheduleRecordingType.Once);
          dlg.DoModal(dialogId);
          switch (dlg.SelectedLabel)
          {
            case 0: // Skip new Recording
              {
                Log.Debug("TVProgramInfo.CreateProgram: Skip new recording");
                return;
              }
            case 1: // Don't record the already scheduled one(s)
              {
                Log.Debug("TVProgramInfo.CreateProgram: Skip old recording(s)");
                foreach (Schedule conflict in conflicts)
                {
                  Program prog =
                    new Program(conflict.IdChannel, conflict.StartTime, conflict.EndTime, conflict.ProgramName, "-", "-",
                                Program.ProgramState.None,
                                DateTime.MinValue, string.Empty, string.Empty, string.Empty, string.Empty, -1,
                                string.Empty, -1);
                  CancelProgram(prog, Schedule.Retrieve(conflict.IdSchedule), dialogId);
                }
                break;
              }
            case 2: // keep conflict
              {
                Log.Debug("TVProgramInfo.CreateProgram: Keep Conflict");
                break;
              }
            case 3: // Skip for conflicting episodes
              {
                Log.Debug("TVProgramInfo.CreateProgram: Skip conflicting episode(s)");
                skipConflictingEpisodes = true;
                break;
              }
            default: // Skipping new Recording
              {
                Log.Debug("TVProgramInfo.CreateProgram: Default => Skip new recording");
                return;
              }
          }
        }
      }

      if (saveSchedule != null)
      {
        Log.Debug("TVProgramInfo.CreateProgram - UnCancleSerie at {0}", program.StartTime);
        saveSchedule.UnCancelSerie(program.StartTime, program.IdChannel);
        //saveSchedule.UnCancelSerie();
        saveSchedule.Persist();
        currentSchedule = saveSchedule;
      }
      else
      {
        Log.Debug("TVProgramInfo.CreateProgram - create schedule = {0}", schedule.ToString());
        schedule.Persist();

        if (currentSchedule == null || (currentSchedule.ScheduleType > 0 && schedule.ScheduleType != (int)ScheduleRecordingType.Once))
        {
          currentSchedule = schedule;
        }
      }
      if (skipConflictingEpisodes)
      {
        List<Schedule> episodes = layer.GetRecordingTimes(schedule);
        foreach (Schedule episode in episodes)
        {
          if (DateTime.Now > episode.EndTime)
          {
            continue;
          }
          if (episode.IsSerieIsCanceled(episode.StartTime, program.IdChannel))
          {
            continue;
          }
          foreach (Schedule conflict in conflicts)
          {
            if (episode.IsOverlapping(conflict))
            {
              Log.Debug("TVProgramInfo.CreateProgram - skip episode = {0}", episode.ToString());
              CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, program.IdChannel, episode.StartTime);
              canceledSchedule.Persist();
            }
          }
        }
      }
      server.OnNewSchedule();
    }
        public void DeleteSchedule(int scheduleId)
        {
            Schedule schedule = Schedule.Retrieve(scheduleId);

            // first cancel all of the episodes of this program for this schedule
            foreach (Program program in Program.ListAll().Where(program => program.Title == schedule.ProgramName))
            {
                if (schedule.IsRecordingProgram(program, true))
                {
                    CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, program.IdChannel, program.StartTime);
                    canceledSchedule.Persist();
                    _tvControl.OnNewSchedule();
                }
            }

            // now remove existing CanceledSchedule for this schedule
            foreach (CanceledSchedule canceled in CanceledSchedule.ListAll().Where(canceled => canceled.IdSchedule == schedule.IdSchedule))
            {
                canceled.Remove();
            }
            schedule.Remove();
            _tvControl.OnNewSchedule();
        }
Exemple #4
0
    private static bool CancelEpisode(DateTime cancelStartTime, Schedule scheduleToCancel, int idChannel)
    {
      bool episodeCanceled = false;

      if (scheduleToCancel != null)
      {
        //create the canceled schedule to prevent the schedule from restarting again.
        // we only create cancelled recordings on series type schedules      
        Schedule sched2cancel = Schedule.Retrieve(scheduleToCancel.IdSchedule);
        bool isOnce = IsScheduleTypeOnce(scheduleToCancel.IdSchedule);
        if (!isOnce)
        {
          DateTime cancel = cancelStartTime;
          int IdForScheduleToCancel = scheduleToCancel.IdSchedule;
          CanceledSchedule canceledSchedule = new CanceledSchedule(IdForScheduleToCancel, idChannel, cancel);
          canceledSchedule.Persist();
          episodeCanceled = true;
        }
      }
      return episodeCanceled;
    }          
Exemple #5
0
    private void OnClick(int iItem)
    {
      m_iSelectedItem = GetSelectedItemNo();
      GUIListItem item = GetItem(iItem);
      if (item == null)
      {
        return;
      }
      if (item.IsFolder)
      {
        if (item.Label == "..")
        {
          if (selectedItem != null)
          {
            selectedItem = null;
          }
          LoadDirectory();
          return;
        }
        if (selectedItem == null)
        {
          selectedItem = item;
        }
        LoadDirectory();
        return;
      }

      Schedule schedule = item.TVTag as Schedule;
      if (schedule == null)
      {
        return;
      }

      if (schedule.ScheduleType == (int)ScheduleRecordingType.Once)
      {
        GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO);
        if (null != dlgYesNo)
        {
          dlgYesNo.SetHeading(GUILocalizeStrings.Get(653)); //Delete this recording?
          dlgYesNo.SetLine(1, schedule.ReferencedChannel().DisplayName);
          dlgYesNo.SetLine(2, schedule.ProgramName);
          dlgYesNo.SetLine(3, GUILocalizeStrings.Get(732)); //are you sure
          dlgYesNo.DoModal(GUIWindowManager.ActiveWindow);

          if (dlgYesNo.IsConfirmed)
          {
            if (schedule.ScheduleType == (int)ScheduleRecordingType.Once)
            {
              schedule.Delete();
              selectedItem = null;
            }
          }
        }
      }
      else // advanced recording
      {
        GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
        if (dlg != null)
        {
          dlg.Reset();
          dlg.SetHeading(schedule.ProgramName);
          dlg.AddLocalizedString(981); //Delete this recording
          dlg.AddLocalizedString(982); //Delete series recording
          dlg.DoModal(GetID);
          if (dlg.SelectedLabel == -1)
          {
            return;
          }
          switch (dlg.SelectedId)
          {
            case 981: //delete specific series
              CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, schedule.IdChannel, schedule.StartTime);
              canceledSchedule.Persist();
              selectedItem = null;
              TvServer server = new TvServer();
              server.OnNewSchedule();
              break;
            case 982: //Delete entire recording
              schedule.Delete();
              selectedItem = null;
              break;
          }
        }
      }
      LoadDirectory();
    }
        public void CancelSchedule(int programId)
        {
            Program p = Program.Retrieve(programId);

            foreach (Schedule schedule in Schedule.ListAll().Where(schedule => schedule.IsRecordingProgram(p, true)))
            {
                switch (schedule.ScheduleType)
                {
                    case (int)ScheduleRecordingType.Once:
                        schedule.Delete();
                        _tvControl.OnNewSchedule();
                        break;
                    default:
                        CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, schedule.IdChannel, schedule.StartTime);
                        canceledSchedule.Persist();
                        _tvControl.OnNewSchedule();
                        break;
                }
            }
        }
    private void OnClick(int iItem)
    {
      m_iSelectedItem = GetSelectedItemNo();
      GUIListItem item = GetItem(iItem);
      if (item == null)
      {
        return;
      }
      Schedule rec = (Schedule)item.TVTag;

      GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
      if (dlg == null)
      {
        return;
      }

      dlg.Reset();
      dlg.SetHeading(rec.ProgramName);

      if (rec.Series == false)
      {
        dlg.AddLocalizedString(618); //delete
      }
      else
      {
        dlg.AddLocalizedString(981); //Delete this recording
        dlg.AddLocalizedString(982); //Delete series recording
        dlg.AddLocalizedString(888); //Episodes management
      }
      VirtualCard card;
      TvServer server = new TvServer();
      if (server.IsRecordingSchedule(rec.IdSchedule, out card))
      {
        dlg.AddLocalizedString(979); //Play recording from beginning
        dlg.AddLocalizedString(980); //Play recording from live point
      }
      else
      {
        IList<TuningDetail> details = Channel.Retrieve(rec.IdChannel).ReferringTuningDetail();
        foreach (TuningDetail detail in details)
        {
          if (detail.ChannelType == 0)
          {
            dlg.AddLocalizedString(882); //Quality settings
            break;
          }
        }
      }

      dlg.DoModal(GetID);
      if (dlg.SelectedLabel == -1)
      {
        return;
      }
      switch (dlg.SelectedId)
      {
        case 888: ////Episodes management
          OnSetEpisodesToKeep(rec);
          break;
        case 882:
          OnSetQuality(rec);
          break;

        case 981: //Delete this recording only
          {
            if (server.IsRecordingSchedule(rec.IdSchedule, out card))
            {
              GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO);
              if (null != dlgYesNo)
              {
                dlgYesNo.SetHeading(GUILocalizeStrings.Get(653)); //Delete this recording?
                dlgYesNo.SetLine(1, GUILocalizeStrings.Get(730)); //This schedule is recording. If you delete
                dlgYesNo.SetLine(2, GUILocalizeStrings.Get(731)); //the schedule then the recording is stopped.
                dlgYesNo.SetLine(3, GUILocalizeStrings.Get(732)); //are you sure
                dlgYesNo.DoModal(GUIWindowManager.ActiveWindow);

                if (dlgYesNo.IsConfirmed)
                {
                  server.StopRecordingSchedule(rec.IdSchedule);
                  CanceledSchedule schedule = new CanceledSchedule(rec.IdSchedule, rec.IdChannel, rec.StartTime);
                  rec.Persist();
                  server.OnNewSchedule();
                }
              }
            }
            else
            {
              server.StopRecordingSchedule(rec.IdSchedule);
              CanceledSchedule schedule = new CanceledSchedule(rec.IdSchedule, rec.IdChannel, rec.StartTime);
              rec.Persist();
              server.OnNewSchedule();
            }
            LoadDirectory();
          }
          break;

        case 982: //Delete series recording
          goto case 618;

        case 618: // delete entire recording
          {
            if (server.IsRecordingSchedule(rec.IdSchedule, out card))
            {
              GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO);
              if (null != dlgYesNo)
              {
                dlgYesNo.SetHeading(GUILocalizeStrings.Get(653)); //Delete this recording?
                dlgYesNo.SetLine(1, GUILocalizeStrings.Get(730)); //This schedule is recording. If you delete
                dlgYesNo.SetLine(2, GUILocalizeStrings.Get(731)); //the schedule then the recording is stopped.
                dlgYesNo.SetLine(3, GUILocalizeStrings.Get(732)); //are you sure
                dlgYesNo.DoModal(GUIWindowManager.ActiveWindow);

                if (dlgYesNo.IsConfirmed)
                {
                  server.StopRecordingSchedule(rec.IdSchedule);
                  rec.Delete();
                  server.OnNewSchedule();
                }
              }
            }
            else
            {
              rec.Delete();
              server.OnNewSchedule();
            }
            LoadDirectory();
          }
          break;

        case 979: // Play recording from beginning
          if (g_Player.Playing && g_Player.IsTVRecording)
          {
            g_Player.Stop(true);
          }
          //TVHome.IsTVOn = true;
          TVHome.ViewChannel(rec.ReferencedChannel());
          g_Player.SeekAbsolute(0);
          if (TVHome.Card.IsTimeShifting)
          {
            g_Player.ShowFullScreenWindow();
            return;
          }
          break;

        case 980: // Play recording from live point
          //TVHome.IsTVOn = true;
          TVHome.ViewChannel(rec.ReferencedChannel());
          if (TVHome.Card.IsTimeShifting)
          {
            if (g_Player.Playing)
            {
              g_Player.SeekAsolutePercentage(99);
            }
            g_Player.ShowFullScreenWindow();
            return;
          }
          break;
      }
      while (m_iSelectedItem >= GetItemCount() && m_iSelectedItem > 0)
      {
        m_iSelectedItem--;
      }
      GUIControl.SelectItemControl(GetID, listPriorities.GetID, m_iSelectedItem);
    }
        public WebBoolResult DeleteSchedule(int scheduleId)
        {
            // TODO: the workflow in this method doesn't make any sense at all
            try
            {
                Schedule schedule = Schedule.Retrieve(scheduleId);

                // first cancel all of the episodes of this program for this schedule
                foreach (Program program in Program.ListAll().Where(program => program.Title == schedule.ProgramName))
                {
                    if (schedule.IsRecordingProgram(program, true))
                    {
                        CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, program.IdChannel, program.StartTime);
                        canceledSchedule.Persist();
                        _tvControl.OnNewSchedule();
                    }
                }

                // now remove existing CanceledSchedule for this schedule
                foreach (CanceledSchedule canceled in CanceledSchedule.ListAll().Where(canceled => canceled.IdSchedule == schedule.IdSchedule))
                {
                    canceled.Remove();
                }
                schedule.Remove();
                _tvControl.OnNewSchedule();
                return true;
            }
            catch (Exception ex)
            {
                Log.Warn(String.Format("Failed to delete schedule {0}", scheduleId), ex);
                return false;
            }
        }
 public override bool RemoveScheduleForProgram(IProgram program, ScheduleRecordingType recordingType)
 {
   var canceledProgram = TvDatabase.Program.Retrieve(program.ProgramId);
   if (canceledProgram == null)
     return false;
   foreach (TvDatabase.Schedule schedule in TvDatabase.Schedule.ListAll().Where(schedule => schedule.IsRecordingProgram(canceledProgram, true)))
   {
     switch (schedule.ScheduleType)
     {
       case (int)ScheduleRecordingType.Once:
         schedule.Delete();
         _tvControl.OnNewSchedule();
         break;
       default:
         CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, schedule.IdChannel, program.StartTime);
         canceledSchedule.Persist();
         _tvControl.OnNewSchedule();
         break;
     }
   }
   return true;
 }
 private void CancelSchedule(RecordingDetail newRecording, int scheduleId)
 {
   CanceledSchedule canceled = new CanceledSchedule(scheduleId,
                                                    newRecording.Program.IdChannel,
                                                    newRecording.Program.StartTime);
   canceled.Persist();
   _episodeManagement.OnScheduleEnded(newRecording.FileName, newRecording.Schedule,
                                      newRecording.Program);
 }
        public bool UpdateSchedule(int scheduleindex, int channelId, int active, String programName, DateTime startTime, DateTime endTime, int scheduleType, Int32 priority, Int32 keepmethod, DateTime keepdate, Int32 preRecordInterval, Int32 postRecordInterval, Int32 programId)
        {
            try
            {
                TvBusinessLayer layer = new TvBusinessLayer();
                Schedule updatedSchedule = Schedule.Retrieve(scheduleindex);
                DateTime defaultCanceled = new DateTime(2000, 01, 01, 0, 0, 0); //Active

                // Note that Kodi 16.x returns once for a program below a series schedule...
                if ((programId != -1) && (scheduleType != (int)TvDatabase.ScheduleRecordingType.Once || updatedSchedule.ScheduleType != (int)TvDatabase.ScheduleRecordingType.Once))
                {
                  // Series schedule, retrieve the canceled programs list
                  Program program = Program.Retrieve(programId);

                  //program.

                  IList<CanceledSchedule> canceledSched = updatedSchedule.ReferringCanceledSchedule();

                  if (active == 1)
                  {
                    // Check if this schedule is deactivated and remove it from the CanceledSchedule list
                    foreach (CanceledSchedule cs in canceledSched)
                    {
                      if (cs.CancelDateTime == program.StartTime)
                      {
                        cs.Remove();
                        break;
                      }
                    }
                  }
                  else
                  {
                    Boolean found = false;
                    // Add this schedule to the CanceledSchedule list if not already in the list
                    foreach (CanceledSchedule cs in canceledSched)
                    {
                      if (cs.CancelDateTime == program.StartTime)
                      {
                        found = true;
                        break;
                      }
                    }

                    if (!found)
                    {
                      CanceledSchedule newCs = new CanceledSchedule(scheduleindex, program.IdChannel, program.StartTime);
                      newCs.Persist();
                    }
                  }

                  //  if (!found)
                  //  {
                  //    Program.ProgramState
                  //  }
                  //}
                  return true;
                }

                updatedSchedule.ProgramName = programName;
                updatedSchedule.StartTime = startTime;
                updatedSchedule.EndTime = endTime;
                if ((active == 0) && (updatedSchedule.Canceled.Equals(defaultCanceled)))
                {   // Canceled from XBMC
                    updatedSchedule.Canceled = DateTime.Now;
                }
                else if ((active == 1) && (!updatedSchedule.Canceled.Equals(defaultCanceled)))
                {   // Re-activated
                    updatedSchedule.Canceled = defaultCanceled;
                }

                if (scheduleType < 0)
                {   //Unknown, record once
                    updatedSchedule.ScheduleType = (int)TvDatabase.ScheduleRecordingType.Once;
                }
                else
                {   //Use the given value
                    updatedSchedule.ScheduleType = scheduleType;
                }

                if (priority != -1)
                {
                    updatedSchedule.Priority = priority;
                }

                if (keepmethod != -1)
                {
                    updatedSchedule.KeepMethod = keepmethod;
                    updatedSchedule.KeepDate = keepdate;
                }

                if ((preRecordInterval < 0) && (postRecordInterval < 0))
                {   //Use the settings from Mediaportal
                    updatedSchedule.PreRecordInterval = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value);
                    updatedSchedule.PostRecordInterval = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value);
                }
                else
                {   // Use the settings from XBMC
                    updatedSchedule.PreRecordInterval = preRecordInterval;
                    updatedSchedule.PostRecordInterval = postRecordInterval;
                }
                updatedSchedule.Persist();
                RemoteControl.Instance.OnNewSchedule();

                return true;
            }
            catch
            {
                return false;
            }
        }
    public bool RemoveScheduleForProgram(IProgram program, ScheduleRecordingType recordingType)
    {
#if TVE3
      var canceledProgram = TvDatabase.Program.Retrieve(program.ProgramId);
      if (canceledProgram == null)
        return false;
      foreach (TvDatabase.Schedule schedule in TvDatabase.Schedule.ListAll().Where(schedule => schedule.IsRecordingProgram(canceledProgram, true)))
      {
        switch (schedule.ScheduleType)
        {
          case (int)ScheduleRecordingType.Once:
            schedule.Delete();
            _tvControl.OnNewSchedule();
            break;
          default:
            CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, schedule.IdChannel, schedule.StartTime);
            canceledSchedule.Persist();
            _tvControl.OnNewSchedule();
            break;
        }
      }
      return true;
#else
      IScheduleService scheduleService = GlobalServiceProvider.Instance.Get<IScheduleService>();
      IProgramService programService = GlobalServiceProvider.Instance.Get<IProgramService>();
      var canceledProgram = programService.GetProgram(program.ProgramId);
      if (canceledProgram == null)
        return false;

      foreach (Schedule schedule in scheduleService.ListAllSchedules().Where(schedule => new ScheduleBLL(schedule).IsRecordingProgram(canceledProgram, true)))
      {
        switch (schedule.ScheduleType)
        {
          case (int)ScheduleRecordingType.Once:
            scheduleService.DeleteSchedule(schedule.IdSchedule);
            break;
          default:
            // If only single program should be canceled
            if (recordingType == ScheduleRecordingType.Once)
            {
              CancelSingleSchedule(schedule, canceledProgram);
            }
            // Full schedule is canceled, including all programs
            else
            {
              CancelFullSchedule(schedule);
            }
            break;
        }
      }
      return true;
#endif
    }
 public void DontRecord(int id, bool cancelEntire)
 {
     UpdateTvServer();
   Program program = Program.Retrieve(id);
   bool isSeries;
   Schedule schedule;
   if (IsRecording(program, out schedule, out isSeries))
   {
     TvBusinessLayer layer = new TvBusinessLayer();
     if (cancelEntire)
     {
       RemoteControl.Instance.StopRecordingSchedule(schedule.IdSchedule);
       schedule.Delete();
     }
     else
     {
       CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, program.StartTime);
       canceledSchedule.Persist();
     }
     RemoteControl.Instance.OnNewSchedule();
   }
 }