/// <summary> /// Возвращает расписание на определённый день недели /// </summary> /// <param name="day">День, на который нужно получить расписание</param> /// <param name="shedule">Само расписание</param> /// <param name="bothWeeeks">Расписание на обе недели (верхней и нижней) или только на текущей</param> /// <returns></returns> public static string GetSheduleOn(DateTime day, Shedule shedule, bool bothWeeks) { StringBuilder lower = new StringBuilder(); StringBuilder upper = new StringBuilder(); StringBuilder final = new StringBuilder(); final.AppendLine($"{Converters.DayOfWeekConverter.FromDOWToStr(day.DayOfWeek).ToUpper()}:\n"); if (shedule.IsLower(day)) { lower.AppendLine("НИЖНЯЯ НЕДЕЛЯ:"); upper.AppendLine("Верхняя неделя:"); } else { lower.AppendLine("Нижняя неделя:"); upper.AppendLine("ВЕРХНЯЯ НЕДЕЛЯ:"); } Day loadingDay = null; switch (day.DayOfWeek) { case DayOfWeek.Monday: loadingDay = shedule.Monday; break; case DayOfWeek.Tuesday: loadingDay = shedule.Tuesday; break; case DayOfWeek.Wednesday: loadingDay = shedule.Wednesday; break; case DayOfWeek.Thursday: loadingDay = shedule.Thursday; break; case DayOfWeek.Friday: loadingDay = shedule.Friday; break; case DayOfWeek.Saturday: loadingDay = shedule.Saturday; break; } foreach (Subject subj in loadingDay.Timetable) { if (subj.WeekType == WeekType.Lower) { lower.AppendLine($"{Emoji.Number(subj.SubjectNumber)}: {(subj.GroupNumber != 0 ? $"(группа {subj.GroupNumber})" : "")} {subj.SubjectName.ToUpper()} ({subj.Auditory}) {subj.SubjectType}\n{subj.EducatorName}{(subj.Comment == string.Empty ? "" : $"\n{Emoji.RedCircle()}{subj.Comment}{Emoji.RedCircle()}")}"); } else { upper.AppendLine($"{Emoji.Number(subj.SubjectNumber)}: {(subj.GroupNumber != 0 ? $"(группа {subj.GroupNumber})" : "")} {subj.SubjectName.ToUpper()} ({subj.Auditory}) {subj.SubjectType}\n{subj.EducatorName}{(subj.Comment == string.Empty ? "" : $"\n{Emoji.RedCircle()}{subj.Comment}{Emoji.RedCircle()}")}"); } } if (!bothWeeks) { if (shedule.IsLower(day)) { final.Append(lower); } else { final.Append(upper); } } else { final.Append(lower); final.Append("\n\n"); final.Append(upper); } if (loadingDay.Comments.Count != 0) { foreach (string str in loadingDay.Comments) { final.Append($"{str}\n"); } } return(final.ToString()); }