public static DateTime CalculateDateTime(this DateTime datetime, DOWEnum dayOfWeek, bool IsEOD) => (IsEOD) ? datetime.Date.AddDays((int)dayOfWeek).AddHours(23).AddMinutes(59).AddSeconds(59) : datetime.Date.AddDays((int)dayOfWeek).AddHours(0).AddMinutes(0).AddSeconds(0);
private DateTime CalcDateTime(int week, DOWEnum dow, bool eod = false) => (eod ? ClassStartDay.Date.AddHours(23).AddMinutes(59).AddSeconds(59) : ClassStartDay.Date.AddHours(0).AddMinutes(0).AddSeconds(0)) .AddDays((week - 1) * 7) .AddDays(((int)dow < 0) ? 0 : (int)dow);