TeacherPart.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Prak12
  7. {
  8. public partial class Teacher
  9. {
  10. public string FIO
  11. {
  12. get => TeacherName + " " + TeacherPatronymic + " " + TeacherSurname;
  13. }
  14. public string LabeledGender
  15. {
  16. get
  17. {
  18. if (IdGenderNavigation.GenderName == "м")
  19. {
  20. return "Пол: мужской";
  21. }
  22. else return "Пол: женский";
  23. }
  24. }
  25. public string LabeledBirthDate
  26. {
  27. get => "Дата рождения: " + TeacherBirthdate.ToShortDateString() + " года";
  28. }
  29. public string LabeledEmail
  30. {
  31. get => "Почта: " + TeacherEmail;
  32. }
  33. public string LabeledPhone
  34. {
  35. get => "Телефон: " + TeacherPhoneNumber;
  36. }
  37. public string LabeledWorkTime
  38. {
  39. get
  40. {
  41. if (TeacherWorkTime is null)
  42. {
  43. return "Стаж работы: отсутсвует";
  44. }
  45. string Year = "";
  46. if ((int)TeacherWorkTime / 12 == 0) Year = "";
  47. if ((int)TeacherWorkTime / 12 == 1) Year = " " + (int)TeacherWorkTime / 12 + " год";
  48. if ((int)TeacherWorkTime / 12 >= 2 && (int)TeacherWorkTime / 12 <= 4) Year = " " + (int)TeacherWorkTime / 12 + " года";
  49. else Year = " " + (int)TeacherWorkTime / 12 + " лет";
  50. string Month = "";
  51. if ((int)TeacherWorkTime % 12 == 0) Month = " 0 месяцев";
  52. if ((int)TeacherWorkTime % 12 == 1) Month = " " + (int)TeacherWorkTime % 12 + " месяц";
  53. if ((int)TeacherWorkTime % 12 >= 2 && (int)TeacherWorkTime % 12 <= 4) Month = " " + (int)TeacherWorkTime % 12 + " месяца";
  54. else Month = " " + (int)TeacherWorkTime % 12 + " месяцев";
  55. return "Стаж работы:" + Year + Month;
  56. }
  57. }
  58. public int SummaryVolume
  59. {
  60. get
  61. {
  62. int summaryVolume = 0;
  63. foreach (var item in TeachersCourses)
  64. {
  65. summaryVolume += item.IdCourseNavigation.CourseHoursNumber;
  66. }
  67. return summaryVolume;
  68. }
  69. }
  70. public string LabeledSummaryVolume
  71. {
  72. get => "Курсы в общем объеме " + SummaryVolume + " часов:";
  73. }
  74. }
  75. }