using Avalonia.Controls.Shapes; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace N11_1.Models { public partial class TbTeacher { public string FullName { get { return LastName + " " + FirstName + " " + Patronymic; } } public string DB { get { return DateOf.ToString("Дата рождения: d MMMM yyyy года"); } } public string Gender { get { switch (IdGenderNavigation.Name) { case "м": { return "Пол: мужской"; } case "ж": { return "Пол: женский"; } } return "пол не определен"; } } public string Working { get { string line = ""; int year = (int)WorkExperience / 12; double month = (double)WorkExperience - year * 12; if (year > 0) { if (year != 11 && year != 12 && year != 13 && year != 14) { switch (year % 10) { case 1: { line += year + " год "; break; } case 2: case 3: case 4: { line += year + " года "; break; } default: { line += year + " лет "; break; } } } else { line += year + " лет "; } } if (month > 0) { switch ((int)month % 12) { case 1: { line += Math.Round(month, 1) + " месяц "; break; } case 2: case 3: case 4: { line += Math.Round(month, 1) + " месяца "; break; } default: { line += Math.Round(month, 1) + " месяцев "; break; } } } line += (line == "") ? "нет опыта работы" : ""; line = "Стаж работы: " + line; return line; } } public string PhoneNumber { get { if (Phone == null || Phone == "NULL") { return "\t Номер телефона не указан"; } else { return "\t Телефон: " + Phone; } } } public string CourseHeader { get { string line = "Курсы в общем объеме "; int hours = 0; foreach (var item in TbTeachersCourses) { hours += item.Hours; } if (hours != 11 && hours != 12 && hours != 13 && hours != 14) { switch (hours % 10) { case 1: { line += hours + " час "; break; } case 2: case 3: case 4: { line += hours + " часа "; break; } default: { line += hours + " часов "; break; } } } else { line += hours + " часов "; } return line; } } public string Course { get { string line = ""; foreach (var item in TbTeachersCourses) { line += "- " + item.IdCoursesNavigation.Name + "\n"; } line += (line == "") ? "Пройденных курсов нет" : ""; return line; } } public string Lesson { get { string line = ""; foreach (var item in TbTeachersLessons) { line += "- " + item.IdLessonNavigation.Name + "\n"; } line += (line == "") ? "Преподаваемых уроков нет" : ""; return line; } } } }