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.

91 lines
2.7 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 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. public string DisplayName
  16. {
  17. get
  18. {
  19. return string.Format("{0} {1}", this.FirstName, this.LastName);
  20. }
  21. }
  22. [DisplayName("نام")]
  23. public string FirstName { get; set; }
  24. [DisplayName("نام خانوادگی")]
  25. public string LastName { get; set; }
  26. [DisplayName("تاریخ تولد")]
  27. [DataType(DataType.Date)]
  28. public DateTime? BirthDate { get; set; }
  29. [DisplayName("تاریخ تولد")]
  30. [DataType(DataType.Date)]
  31. public string JalaliBirthDate
  32. {
  33. get
  34. {
  35. if (this.BirthDate.HasValue)
  36. return DateAssist.ToShamsi(this.BirthDate.Value);
  37. else
  38. return string.Empty;
  39. }
  40. set
  41. {
  42. BirthDate = DateAssist.ValidateAndSetToMiladi(value) ?? null;
  43. }
  44. }
  45. [DisplayName("دوره‌های آموزشی")]
  46. public string Description { get; set; }
  47. [DisplayName("رزومه انگلیسی")]
  48. public string EnglishResume { get; set; }
  49. [DisplayName("رزومه فارسی")]
  50. public string PersianResume { get; set; }
  51. [DisplayName("تمام وقت")]
  52. public bool IsFullTime { get; set; }
  53. [DisplayName("پاره وقت")]
  54. public bool IsPartTime { get; set; }
  55. public IList<DovominParameterViewModel> Parameters;
  56. public DovominViewModel(Dovomin dovomin)
  57. {
  58. this.Id = dovomin.Id;
  59. this.FirstName = dovomin.FirstName;
  60. this.LastName = dovomin.LastName;
  61. this.IsFullTime = dovomin.IsFulltime;
  62. this.IsPartTime = dovomin.IsPartTime;
  63. this.BirthDate = dovomin.BirthDate;
  64. this.Description = dovomin.Description;
  65. this.EnglishResume = dovomin.EnglishResume;
  66. this.PersianResume = dovomin.PersianResume;
  67. ParameterRepository.Current.AddParametersToDovomin(dovomin);
  68. Parameters = new List<DovominParameterViewModel>();
  69. foreach (var jp in dovomin.DovominParameters)
  70. {
  71. Parameters.Add(new DovominParameterViewModel(jp));
  72. }
  73. Parameters = Parameters.OrderBy(x => x.GroupName).ToList();
  74. }
  75. }
  76. }