public static (int Day, DataWeekType Week) GetDayAndWeek(DateTime data) { DataWeekType todayWeek = GetWeekType(data); var todayDay = (int)data.DayOfWeek; todayDay = (todayDay + 6) % 7; return(todayDay, todayWeek); }
public static string MakeString(this DataWeekType week) { switch (week) { case DataWeekType.Even: return("чётная"); case DataWeekType.Odd: return("нечётная"); default: throw new ArgumentOutOfRangeException(nameof(week), week, null); } }
public static string CreateDailyMessage(string groupName, DataWeekType week, int day) { //List<ScheduleItemModel> localSchedule = LocalStorageRepository.GetLessonList(groupName, day, week); var isuSchedule = ServerApiRepository.GetLessonList(groupName, (DataDayType)day, week); string header = AnswerGeneratorService.GenerateHeader(week, day); return(header); //TODO: fix //return header += string.Join("\n", isuSchedule.Select(AnswerGeneratorService.LessonToString)); //TODO: fix this /* * if (isuSchedule == null) * { * //TODO: isu empty * if (localSchedule == null) * { * //TODO: isu and local empty * } * } * else * { * if (localSchedule == null) * { * //TODO: no local data * } * else * { * if (isuSchedule.Except(localSchedule).Any()) * { * return header + AnswerGeneratorService.DifferentSchedule(isuSchedule, localSchedule); * } * * if (!isuSchedule.Any()) * { * return header += AnswerGeneratorService.NoLessonMessage(); * } * * return header += string.Join("\n", isuSchedule.Select(AnswerGeneratorService.LessonToString)); * } * } * * return header; */ }
public void MondayLessonList(int day, DataWeekType weekType, int count) { var lessons = ServerApiRepository.GetLessonList(GroupName, (DataDayType)day, weekType); Assert.AreEqual(lessons.Count, count); }
public static string GenerateHeader(DataWeekType targetWeekType, int targetDay) { return("🔑 Расписание на завтра!\n 👀 Нас ждёт " + $"{GetDayName(targetDay)}, {targetWeekType.MakeString()} неделя \n"); }
public static List <ScheduleItemModel> GetLessonList(string groupName, DataDayType day, DataWeekType weekType) { List <ScheduleItemModel> lessons = GetLessonList(groupName); return(lessons ?.Where(l => l.DataWeek.Compare(weekType) && l.DataDay == day) .ToList()); }