You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.9 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. using Sevomin.Models.Helpers;
  2. using Sevomin.Models.Repositories;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.ComponentModel.DataAnnotations;
  7. using System.Linq;
  8. namespace Sevomin.Models
  9. {
  10. public class DovominViewModel
  11. {
  12. [Required]
  13. [StringLength(128)]
  14. public string Id { get; set; }
  15. [DisplayName("نام و نام خانوادگی")]
  16. public string DisplayName
  17. {
  18. get
  19. {
  20. return string.Format("{0} {1}", FirstName, LastName);
  21. }
  22. }
  23. [DisplayName("نام")]
  24. public string FirstName { get; set; }
  25. [DisplayName("نام خانوادگی")]
  26. public string LastName { get; set; }
  27. [DisplayName("تاریخ تولد")]
  28. [DataType(DataType.Date)]
  29. public DateTime? BirthDate { get; set; }
  30. [DisplayName("تاریخ تولد")]
  31. [DataType(DataType.Date)]
  32. public string JalaliBirthDate
  33. {
  34. get
  35. {
  36. if (BirthDate.HasValue)
  37. return DateAssist.ToShamsi(BirthDate.Value);
  38. else
  39. return string.Empty;
  40. }
  41. set
  42. {
  43. BirthDate = DateAssist.ValidateAndSetToMiladi(value) ?? null;
  44. }
  45. }
  46. [DisplayName("دوره‌های آموزشی")]
  47. public string Description { get; set; }
  48. [DisplayName("رزومه انگلیسی")]
  49. public string EnglishResume { get; set; }
  50. [DisplayName("رزومه فارسی")]
  51. public string PersianResume { get; set; }
  52. [DisplayName("تمام وقت")]
  53. public bool IsFullTime { get; set; }
  54. [DisplayName("پاره وقت")]
  55. public bool IsPartTime { get; set; }
  56. [DefaultValue(false)]
  57. [DisplayName("دریافت ایمیل")]
  58. public bool OptOutEmail { get; set; }
  59. public IList<DovominParameterViewModel> Parameters;
  60. public DovominViewModel(Dovomin dovomin)
  61. {
  62. Id = dovomin.Id;
  63. FirstName = dovomin.FirstName;
  64. LastName = dovomin.LastName;
  65. IsFullTime = dovomin.IsFulltime;
  66. IsPartTime = dovomin.IsPartTime;
  67. BirthDate = dovomin.BirthDate;
  68. Description = dovomin.Description;
  69. EnglishResume = dovomin.EnglishResume;
  70. PersianResume = dovomin.PersianResume;
  71. ParameterRepository.Current.AddParametersToDovomin(dovomin);
  72. Parameters = new List<DovominParameterViewModel>();
  73. foreach (var jp in dovomin.DovominParameters)
  74. {
  75. Parameters.Add(new DovominParameterViewModel(jp));
  76. }
  77. Parameters = Parameters.OrderBy(x => x.GroupName).ToList();
  78. }
  79. }
  80. }