Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. public class CreateBatchViewModel
  2. {
  3. private readonly List<GenericIdNameType> lines;
  4.  
  5. public bool IsWizard { get; set; }
  6.  
  7. public int ProductionOrderId { get; set; }
  8.  
  9. public string ProductionOrderName { get; set; }
  10.  
  11. [Display(Name = "BatchLine", ResourceType = typeof(Resources.Resources))]
  12. [Required(ErrorMessageResourceType = typeof(Resources.Resources),
  13. ErrorMessageResourceName = "BatchLineRequired")]
  14. public byte SelectedLineId { get; set; }
  15.  
  16. public IEnumerable<SelectListItem> LineItems
  17. {
  18. get { return new SelectList(lines, "Id", "Name"); }
  19. }
  20.  
  21. public List<Data.Batch> Batches { get; set; }
  22.  
  23. public CreateBatchViewModel(bool isWizard) : this()
  24. {
  25. IsWizard = isWizard;
  26. }
  27.  
  28. public CreateBatchViewModel()
  29. {
  30. lines = new List<GenericIdNameType>();
  31. }
  32.  
  33. public CreateBatchViewModel(List<Data.Line> dataLines, bool isWizard)
  34. {
  35. IsWizard = isWizard;
  36.  
  37. if (dataLines == null)
  38. throw new ArgumentNullException("dataLines");
  39.  
  40. lines = new List<GenericIdNameType>(dataLines.Count);
  41.  
  42. GenericIdNameType genericType = new GenericIdNameType()
  43. {
  44. Id = null,
  45. Name = string.Empty
  46. };
  47.  
  48. lines.Add(genericType);
  49.  
  50. foreach (Data.Line line in dataLines)
  51. {
  52. genericType = new GenericIdNameType()
  53. {
  54. Id = line.LineId.ToString(),
  55. Name = line.Name
  56. };
  57.  
  58. lines.Add(genericType);
  59. }
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement