using System; using System.Collections.Generic; namespace Sevomin.Models { public class JobParameterViewModel { public string StringValue { get; private set; } public byte MoscowValue { get; set; } public long Id { get; set; } public long ParameterId { get; set; } public long JobId { get; set; } public string AvalinId { get; set; } public string ParameterName { get; set; } public bool HasMoscow { get; set; } public byte DisplayMethod { get; set; } public string DisplayFormat { get; set; } public string GroupName { get; set; } public string CommentAvalin { get; set; } public string CommentDovomin { get; set; } public IList> ParameterValues { get; set; } public JobParameterViewModel(JobParameter jp) { StringValue = jp.StringValue; MoscowValue = jp.Moscow; Id = jp.Id; ParameterId = jp.Parameter.Id; JobId = jp.Job.Id; AvalinId = jp.Job.Avalin.Id; ParameterName = jp.Parameter.Name; HasMoscow = jp.Parameter.Moscow; DisplayMethod = jp.Parameter.DisplayMethod; DisplayFormat = jp.Parameter.DisplayFormat; GroupName = jp.Parameter.GroupName; CommentAvalin = jp.Parameter.CommentAvalin; CommentDovomin = jp.Parameter.CommentDovomin; ParameterValues = new List>(); foreach (var val in jp.Parameter.ParameterValues) { ParameterValues.Add(new Tuple(val.NumbericValue, val.Value)); } } } }