|
|
@ -1,8 +1,11 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.ComponentModel; |
|
|
|
using System.ComponentModel.DataAnnotations; |
|
|
|
using System.Linq; |
|
|
|
using System.Text; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Sevomin.Models.Helpers; |
|
|
|
//استخدام نیروی «کنترل پروژه» با ×× سال سابقه ×× دارای ×مدرک× ×× برای کار در ×کشور×شهر×
|
|
|
|
|
|
|
|
namespace Sevomin.Models |
|
|
@ -10,9 +13,66 @@ namespace Sevomin.Models |
|
|
|
|
|
|
|
public class JobMiniViewModel |
|
|
|
{ |
|
|
|
public string JobTitle { get; set; } |
|
|
|
public string Country { get; set; } |
|
|
|
public string City { get; set; } |
|
|
|
public Tuple<string,string> Experience { get; set; } |
|
|
|
private const int MaxNumberOfMiniParams = 6; |
|
|
|
[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("کار تمام وقت")] |
|
|
|
public bool IsFullTime { get; set; } |
|
|
|
|
|
|
|
public IList<Tuple<string, string>> Parameters; |
|
|
|
|
|
|
|
public JobMiniViewModel(Job job) |
|
|
|
{ |
|
|
|
this.Id = job.Id; |
|
|
|
this.AvalinId = job.AvalinId; |
|
|
|
this.ExpireDate = job.ExpireDate == DateTime.MinValue ? DateTime.Now.AddDays(14) : job.ExpireDate; |
|
|
|
this.IsFullTime = job.IsFullTime; |
|
|
|
|
|
|
|
if (job.JobParameters == null) |
|
|
|
return; |
|
|
|
|
|
|
|
Parameters = new List<Tuple<string,string>>(); |
|
|
|
|
|
|
|
var jpz = job.JobParameters.Where(x=>x.NumericValue != null).OrderByDescending(x=>x.Moscow).Take(Math.Min(MaxNumberOfMiniParams * 3, job.JobParameters.Count())) |
|
|
|
.OrderBy(x => x.Parameter.GroupName).ThenByDescending(x => x.Moscow).Take((int)(MaxNumberOfMiniParams*1.5)).ToList(); |
|
|
|
|
|
|
|
for (int i = 0; i < jpz.Count(); i++) |
|
|
|
{ |
|
|
|
string format = jpz[i].Parameter.DisplayFormat; |
|
|
|
format = format.Replace("$", jpz[i].Parameter.Name); |
|
|
|
|
|
|
|
string value = jpz[i].StringValue; |
|
|
|
if (jpz[i].Parameter.DisplayMethod == 4) |
|
|
|
{ |
|
|
|
|
|
|
|
value = jpz[i].Parameter.ParameterValues.ToList().Where(x =>x.NumbericValue == jpz[i].NumericValue).Select(x => x.Value) |
|
|
|
.FirstOrDefault(); |
|
|
|
} |
|
|
|
Parameters.Add(new Tuple<string,string>(format, value)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |