FIO, Phone and Experience.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace AvaloniaBaseTeacher.Models
  7. {
  8. public partial class Teacher
  9. {
  10. public string FIO
  11. {
  12. get
  13. {
  14. return Surname + " " + Name + " " + Patronymic;
  15. }
  16. }
  17. public string Exp
  18. {
  19. get
  20. {
  21. long? month = Experience % 12;
  22. long? year = (Experience - month) / 12;
  23. if (year == 0)
  24. {
  25. return $"{month} {(month == 1 ? "месяц" : (month >= 2 && month <= 4 ? "месяца" : "месяцев"))}";
  26. }
  27. else if (month == 0)
  28. {
  29. return $"{year} {(year % 10 == 1 && year % 100 != 11 ? "год" : (year % 10 >= 2 && year % 10 <= 4 && (year % 100 < 10 || year % 100 >= 20) ? "года" : "лет"))}";
  30. }
  31. else
  32. {
  33. return $"{year} {(year % 10 == 1 && year % 100 != 11 ? "год" : (year % 10 >= 2 && year % 10 <= 4 && (year % 100 < 10 || year % 100 >= 20) ? "года" : "лет"))} " +
  34. $"{month} {(month == 1 ? "месяц" : (month >= 2 && month <= 4 ? "месяца" : "месяцев"))}";
  35. }
  36. }
  37. }
  38. public string Phonee
  39. {
  40. get
  41. {
  42. if (Phone == "")
  43. {
  44. return "не указан";
  45. }
  46. else
  47. {
  48. return Phone;
  49. }
  50. }
  51. }
  52. }
  53. }