|
|
- using Sevomin.Models.Helpers;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.ComponentModel.DataAnnotations;
- using System.Linq;
-
- namespace Sevomin.Models
- {
- public class JobViewModel
- {
- [Key]
- public long Id { get; set; }
-
- [Required]
- [StringLength(128)]
- public string AvalinId { get; set; }
-
- [DisplayName("تاریخ انقضا")]
- [DataType(DataType.Date)]
- public DateTime ExpireDate { get; set; }
-
- [DisplayName("تاریخ انقضا")]
- [DataType(DataType.Date)]
- public string JalaliExpireDate
- {
- get
- {
- return DateAssist.ToShamsi(this.ExpireDate);
- }
- set
- {
- ExpireDate = DateAssist.ValidateAndSetToMiladi(value) ?? DateTime.MinValue;
- }
- }
-
- [DisplayName("تاریخ ایجاد")]
- [DataType(DataType.Date)]
- public DateTime CreateDate { get; set; }
-
- [DisplayName("تاریخ ایجاد")]
- [DataType(DataType.Date)]
- public string JalaliCreateDate
- {
- get
- {
- return DateAssist.ToShamsi(this.CreateDate);
- }
- set
- {
- CreateDate = DateAssist.ValidateAndSetToMiladi(value) ?? DateTime.MinValue;
- }
- }
-
- [DisplayName("سایر مشخصات")]
- public string Description { get; set; }
-
- [DisplayName("نوع رزومه")]
- public byte ResumeType { get; set; }
-
- [DisplayName("نام رابط/نماینده شرکت")]
- public string ContactPersonName { get; set; }
-
- [DisplayName("تلفن رابط/نماینده شرکت")]
- public string ContactPersonPhone { get; set; }
-
- [EmailValidation]
- [DisplayName("ایمیل رابط/نماینده شرکت")]
- public string ContactPersonEMail { get; set; }
-
- [DisplayName("نمایش نام شرکت")]
- public bool ShowCompanyName { get; set; }
-
- [DisplayName("نمایش لوگوی شرکت")]
- public bool ShowCompanyLogo { get; set; }
-
- [DisplayName("کار تمام وقت")]
- public bool IsFullTime { get; set; }
-
- public IList<JobParameterViewModel> Parameters;
-
- public JobViewModel(Job job)
- {
- this.Id = job.Id;
- this.AvalinId = job.AvalinId;
- this.ExpireDate = job.ExpireDate == DateTime.MinValue ? DateTime.UtcNow.AddDays(14) : job.ExpireDate;
- this.CreateDate = job.CreateDate == DateTime.MinValue ? DateTime.UtcNow : job.CreateDate;
- this.Description = job.Description;
- this.ResumeType = job.ResumeType;
- this.ContactPersonEMail = job.ContactPersonEMail;
- this.ContactPersonName = job.ContactPersonName;
- this.ContactPersonPhone = job.ContactPersonPhone;
- this.ShowCompanyLogo = job.ShowCompanyLogo;
- this.ShowCompanyName = job.ShowCompanyName;
- this.IsFullTime = job.IsFullTime;
-
- if (job.JobParameters == null)
- return;
-
- Parameters = new List<JobParameterViewModel>();
- foreach (var jp in job.JobParameters)
- {
- Parameters.Add(new JobParameterViewModel(jp));
- }
- Parameters = Parameters.OrderBy(x => x.GroupName).ToList();
- }
- }
- }
|