コード例 #1
0
        public ScheduleViewModel(WebScheduleBasic schedule)
        {
            Id = schedule.Id;
            Title = schedule.ProgramName;
            StartTime = schedule.StartTime;
            EndTime = schedule.EndTime;

            switch (schedule.ScheduleType)
            {
                case WebScheduleType.Daily:
                case WebScheduleType.Weekends:
                case WebScheduleType.WorkingDays:
                    StartTimeFormatted = schedule.StartTime.ToString("t");
                    EndTimeFormatted = schedule.EndTime.ToString("t");
                    break;
                case WebScheduleType.Weekly:
                    StartTimeFormatted = schedule.StartTime.ToString("dddd") + " " + schedule.StartTime.ToString("t");
                    EndTimeFormatted = schedule.EndTime.ToString("dddd") + " " + schedule.EndTime.ToString("t");
                    break;
                case WebScheduleType.Once:
                default:
                    StartTimeFormatted = schedule.StartTime.ToString("g");
                    EndTimeFormatted = schedule.EndTime.ToString("g");
                    break;
                case WebScheduleType.EveryTimeOnEveryChannel:
                case WebScheduleType.EveryTimeOnThisChannel:
                case WebScheduleType.WeeklyEveryTimeOnThisChannel:
                    // they don't have a time associated with them
                    break;
            }

            Type = ScheduleTypeNames[schedule.ScheduleType];
        }
コード例 #2
0
 public ScheduleViewModel(WebScheduleBasic schedule)
 {
     Id = schedule.Id;
     Title = schedule.ProgramName;
     StartTime = schedule.StartTime;
     EndTime = schedule.EndTime;
     Type = ScheduleTypeNames[schedule.ScheduleType];
 }
コード例 #3
0
        public ScheduleViewModel(WebScheduleBasic schedule)
            : this(schedule.StartTime, schedule.EndTime, schedule.Title, schedule.ChannelId)
        {
            Id = schedule.Id;
            ScheduleType = schedule.ScheduleType;

            switch (ScheduleType)
            {
                case WebScheduleType.Daily:
                case WebScheduleType.EveryTimeOnThisChannel:
                case WebScheduleType.Once:
                case WebScheduleType.Weekends:
                case WebScheduleType.Weekly:
                case WebScheduleType.WeeklyEveryTimeOnThisChannel:
                case WebScheduleType.WorkingDays:
                    ChannelName = Connections.Current.TAS.GetChannelDetailedById(schedule.ChannelId).Title;
                    break;
                case WebScheduleType.EveryTimeOnEveryChannel:
                    ChannelName = "";
                    break;
            }

            switch (ScheduleType)
            {
                case WebScheduleType.Daily:
                case WebScheduleType.Weekends:
                case WebScheduleType.WorkingDays:
                    StartTimeFormatted = StartTime.Value.ToString("t");
                    EndTimeFormatted = EndTime.Value.ToString("t");
                    break;
                case WebScheduleType.Weekly:
                    StartTimeFormatted = StartTime.Value.ToString("dddd") + " " + StartTime.Value.ToString("t");
                    EndTimeFormatted = EndTime.Value.ToString("dddd") + " " + EndTime.Value.ToString("t");
                    break;
                case WebScheduleType.Once:
                default:
                    StartTimeFormatted = StartTime.Value.ToString("g");
                    EndTimeFormatted = EndTime.Value.ToString("g");
                    break;
                case WebScheduleType.WeeklyEveryTimeOnThisChannel:
                    StartTimeFormatted = StartTime.Value.ToString("dddd");
                    break;
                case WebScheduleType.EveryTimeOnEveryChannel:
                case WebScheduleType.EveryTimeOnThisChannel:
                    // they don't have a time associated with them
                    break;
            }
        }
コード例 #4
0
ファイル: Schedule.cs プロジェクト: davinx/MediaPortal-2
 public Schedule(WebScheduleBasic webSchedule, int serverIndex)
 {
   ServerIndex = serverIndex;
   ScheduleId = webSchedule.Id;
   ParentScheduleId = webSchedule.ParentScheduleId;
   ChannelId = webSchedule.ChannelId;
   Name = webSchedule.Title;
   StartTime = webSchedule.StartTime;
   EndTime = webSchedule.EndTime;
   RecordingType = (ScheduleRecordingType)webSchedule.ScheduleType;
   Priority = (PriorityType)webSchedule.Priority;
   PreRecordInterval = TimeSpan.FromMinutes(webSchedule.PreRecordInterval);
   PostRecordInterval = TimeSpan.FromMinutes(webSchedule.PostRecordInterval);
   KeepMethod = (KeepMethodType)webSchedule.KeepMethod;
   KeepDate = webSchedule.KeepDate;
 }
コード例 #5
0
        public ScheduleViewModel(WebScheduleBasic schedule)
            : this(schedule.StartTime, schedule.EndTime, schedule.ProgramName, schedule.IdChannel)
        {
            Id = schedule.Id;
            ScheduleType = schedule.ScheduleType;

            switch (ScheduleType)
            {
                case WebScheduleType.Daily:
                case WebScheduleType.EveryTimeOnThisChannel:
                case WebScheduleType.Once:
                case WebScheduleType.Weekends:
                case WebScheduleType.Weekly:
                case WebScheduleType.WeeklyEveryTimeOnThisChannel:
                case WebScheduleType.WorkingDays:
                    ChannelName = MPEServices.TAS.GetChannelBasicById(schedule.IdChannel).DisplayName;
                    break;
                case WebScheduleType.EveryTimeOnEveryChannel:
                    ChannelName = "";
                    break;
            }

            switch (ScheduleType)
            {
                case WebScheduleType.Daily:
                case WebScheduleType.Weekends:
                case WebScheduleType.WorkingDays:
                    StartTimeFormatted = StartTime.Value.ToString("t");
                    EndTimeFormatted = EndTime.Value.ToString("t");
                    break;
                case WebScheduleType.Weekly:
                    StartTimeFormatted = StartTime.Value.ToString("dddd") + " " + StartTime.Value.ToString("t");
                    EndTimeFormatted = EndTime.Value.ToString("dddd") + " " + EndTime.Value.ToString("t");
                    break;
                case WebScheduleType.Once:
                default:
                    StartTimeFormatted = StartTime.Value.ToString("g");
                    EndTimeFormatted = EndTime.Value.ToString("g");
                    break;
                case WebScheduleType.EveryTimeOnEveryChannel:
                case WebScheduleType.EveryTimeOnThisChannel:
                case WebScheduleType.WeeklyEveryTimeOnThisChannel:
                    // they don't have a time associated with them
                    break;
            }
        }
コード例 #6
0
ファイル: HomeController.cs プロジェクト: aredon/MPExtended
 private bool CheckScheduleIsOnDate(WebScheduleBasic schedule, DateTime date)
 {
     switch (schedule.ScheduleType)
     {
         case WebScheduleType.Daily:
             return true;
         case WebScheduleType.Weekends:
             return date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday;
         case WebScheduleType.WorkingDays:
             return date.DayOfWeek != DayOfWeek.Saturday && date.DayOfWeek != DayOfWeek.Sunday;
         case WebScheduleType.Weekly:
             return schedule.StartTime.DayOfWeek == date.DayOfWeek;
         case WebScheduleType.Once:
         // I'm not really sure about these three below, but it seems to work
         case WebScheduleType.WeeklyEveryTimeOnThisChannel:
         case WebScheduleType.EveryTimeOnThisChannel:
         case WebScheduleType.EveryTimeOnEveryChannel:
             return schedule.StartTime.Date == date.Date;
         default:
             return false;
     }
 }