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.

90 lines
2.7 KiB

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