|
|
- using Sevomin.Models.Helpers;
- using Sevomin.Models.Repositories;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.ComponentModel.DataAnnotations;
- using System.Linq;
-
- namespace Sevomin.Models
- {
- public class DovominViewModel
- {
- [Required]
- [StringLength(128)]
- public string Id { get; set; }
-
- [DisplayName("نام و نام خانوادگی")]
- public string DisplayName
- {
- get
- {
- return string.Format("{0} {1}", FirstName, LastName);
- }
- }
-
- [DisplayName("نام")]
- public string FirstName { get; set; }
-
- [DisplayName("نام خانوادگی")]
- public string LastName { get; set; }
-
- [DisplayName("تاریخ تولد")]
- [DataType(DataType.Date)]
- public DateTime? BirthDate { get; set; }
-
- [DisplayName("تاریخ تولد")]
- [DataType(DataType.Date)]
- public string JalaliBirthDate
- {
- get
- {
- if (BirthDate.HasValue)
- return DateAssist.ToShamsi(BirthDate.Value);
- else
- return string.Empty;
- }
- set
- {
- BirthDate = DateAssist.ValidateAndSetToMiladi(value) ?? null;
- }
- }
-
- [DisplayName("دورههای آموزشی")]
- public string Description { get; set; }
-
- [DisplayName("رزومه انگلیسی")]
- public string EnglishResume { get; set; }
-
- [DisplayName("رزومه فارسی")]
- public string PersianResume { get; set; }
-
- [DisplayName("تمام وقت")]
- public bool IsFullTime { get; set; }
-
- [DisplayName("پاره وقت")]
- public bool IsPartTime { get; set; }
-
- [DefaultValue(false)]
- [DisplayName("دریافت ایمیل")]
- public bool OptOutEmail { get; set; }
-
- public IList<DovominParameterViewModel> Parameters;
-
- public DovominViewModel(Dovomin dovomin)
- {
- Id = dovomin.Id;
- FirstName = dovomin.FirstName;
- LastName = dovomin.LastName;
- IsFullTime = dovomin.IsFulltime;
- IsPartTime = dovomin.IsPartTime;
- BirthDate = dovomin.BirthDate;
- Description = dovomin.Description;
- EnglishResume = dovomin.EnglishResume;
- PersianResume = dovomin.PersianResume;
-
- ParameterRepository.Current.AddParametersToDovomin(dovomin);
-
- Parameters = new List<DovominParameterViewModel>();
- foreach (var jp in dovomin.DovominParameters)
- {
- Parameters.Add(new DovominParameterViewModel(jp));
- }
- Parameters = Parameters.OrderBy(x => x.GroupName).ToList();
- }
- }
- }
|