You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.9 KiB

10 years ago
  1. using System;
  2. using System.Collections.Generic;
  3. using Sevomin.Models.Enums;
  4. namespace Sevomin.Models
  5. {
  6. public class JobParameterViewModel
  7. {
  8. public string StringValue { get; private set; }
  9. public byte MoscowValue { get; set; }
  10. public long Id { get; set; }
  11. public long ParameterId { get; set; }
  12. public long JobId { get; set; }
  13. public string AvalinId { get; set; }
  14. public string ParameterName { get; set; }
  15. public bool HasMoscow { get; set; }
  16. public byte DisplayMethod { get; set; }
  17. public string DisplayFormat { get; set; }
  18. public string GroupName { get; set; }
  19. public string CommentAvalin { get; set; }
  20. public string CommentDovomin { get; set; }
  21. public ParameterType ParameterType { get; set; }
  22. public IList<Tuple<decimal, string>> ParameterValues { get; set; }
  23. public JobParameterViewModel(JobParameter jp)
  24. {
  25. StringValue = jp.StringValue;
  26. MoscowValue = jp.Moscow;
  27. Id = jp.Id;
  28. ParameterId = jp.Parameter.Id;
  29. JobId = jp.Job.Id;
  30. AvalinId = jp.Job.Avalin.Id;
  31. ParameterName = jp.Parameter.Name;
  32. HasMoscow = jp.Parameter.Moscow;
  33. DisplayMethod = jp.Parameter.DisplayMethod;
  34. DisplayFormat = jp.Parameter.DisplayFormat;
  35. GroupName = jp.Parameter.GroupName;
  36. CommentAvalin = jp.Parameter.CommentAvalin;
  37. CommentDovomin = jp.Parameter.CommentDovomin;
  38. ParameterType = jp.Parameter.ParameterType;
  39. ParameterValues = new List<Tuple<decimal, string>>();
  40. foreach (var val in jp.Parameter.ParameterValues)
  41. {
  42. ParameterValues.Add(new Tuple<decimal, string>(val.NumbericValue, val.Value));
  43. }
  44. }
  45. }
  46. }