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.

53 lines
1.6 KiB

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