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}", this.FirstName, this.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 (this.BirthDate.HasValue)
|
|
return DateAssist.ToShamsi(this.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; }
|
|
|
|
public IList<DovominParameterViewModel> Parameters;
|
|
|
|
public DovominViewModel(Dovomin dovomin)
|
|
{
|
|
this.Id = dovomin.Id;
|
|
this.FirstName = dovomin.FirstName;
|
|
this.LastName = dovomin.LastName;
|
|
this.IsFullTime = dovomin.IsFulltime;
|
|
this.IsPartTime = dovomin.IsPartTime;
|
|
this.BirthDate = dovomin.BirthDate;
|
|
this.Description = dovomin.Description;
|
|
this.EnglishResume = dovomin.EnglishResume;
|
|
this.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();
|
|
}
|
|
}
|
|
}
|