コード例 #1
0
ファイル: AccessSchedule.cs プロジェクト: ypid/jellyfin
 /// <summary>
 /// Initializes a new instance of the <see cref="AccessSchedule"/> class.
 /// </summary>
 /// <param name="dayOfWeek">The day of the week.</param>
 /// <param name="startHour">The start hour.</param>
 /// <param name="endHour">The end hour.</param>
 /// <param name="userId">The associated user's id.</param>
 public AccessSchedule(DynamicDayOfWeek dayOfWeek, double startHour, double endHour, Guid userId)
 {
     UserId    = userId;
     DayOfWeek = dayOfWeek;
     StartHour = startHour;
     EndHour   = endHour;
 }
コード例 #2
0
 public static DayOfWeek[] GetDaysOfWeek(DynamicDayOfWeek day)
 {
     return(day switch
     {
         DynamicDayOfWeek.Everyday => new[] { DayOfWeek.Sunday, DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Saturday },
         DynamicDayOfWeek.Weekday => new[] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday },
         DynamicDayOfWeek.Weekend => new[] { DayOfWeek.Sunday, DayOfWeek.Saturday },
         _ => new[] { (DayOfWeek)day }
     });
コード例 #3
0
        public static List <DayOfWeek> GetDaysOfWeek(DynamicDayOfWeek day)
        {
            var days = new List <DayOfWeek>(7);

            if (day == DynamicDayOfWeek.Sunday ||
                day == DynamicDayOfWeek.Weekend ||
                day == DynamicDayOfWeek.Everyday)
            {
                days.Add(DayOfWeek.Sunday);
            }

            if (day == DynamicDayOfWeek.Monday ||
                day == DynamicDayOfWeek.Weekday ||
                day == DynamicDayOfWeek.Everyday)
            {
                days.Add(DayOfWeek.Monday);
            }

            if (day == DynamicDayOfWeek.Tuesday ||
                day == DynamicDayOfWeek.Weekday ||
                day == DynamicDayOfWeek.Everyday)
            {
                days.Add(DayOfWeek.Tuesday);
            }

            if (day == DynamicDayOfWeek.Wednesday ||
                day == DynamicDayOfWeek.Weekday ||
                day == DynamicDayOfWeek.Everyday)
            {
                days.Add(DayOfWeek.Wednesday);
            }

            if (day == DynamicDayOfWeek.Thursday ||
                day == DynamicDayOfWeek.Weekday ||
                day == DynamicDayOfWeek.Everyday)
            {
                days.Add(DayOfWeek.Thursday);
            }

            if (day == DynamicDayOfWeek.Friday ||
                day == DynamicDayOfWeek.Weekday ||
                day == DynamicDayOfWeek.Everyday)
            {
                days.Add(DayOfWeek.Friday);
            }

            if (day == DynamicDayOfWeek.Saturday ||
                day == DynamicDayOfWeek.Weekend ||
                day == DynamicDayOfWeek.Everyday)
            {
                days.Add(DayOfWeek.Saturday);
            }

            return(days);
        }
コード例 #4
0
 public static List <DayOfWeek> GetDaysOfWeek(DynamicDayOfWeek day)
 {
     return(GetDaysOfWeek(new List <DynamicDayOfWeek> {
         day
     }));
 }
コード例 #5
0
 public static List<DayOfWeek> GetDaysOfWeek(DynamicDayOfWeek day)
 {
     return GetDaysOfWeek(new List<DynamicDayOfWeek> { day });
 }
コード例 #6
0
 /// <summary>
 /// Static create function (for use in LINQ queries, etc.)
 /// </summary>
 /// <param name="dayOfWeek">The day of the week.</param>
 /// <param name="startHour">The start hour.</param>
 /// <param name="endHour">The end hour.</param>
 /// <param name="userId">The associated user's id.</param>
 /// <returns>The newly created instance.</returns>
 public static AccessSchedule Create(DynamicDayOfWeek dayOfWeek, double startHour, double endHour, Guid userId)
 {
     return(new AccessSchedule(dayOfWeek, startHour, endHour, userId));
 }