DeliveryShell.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using Comal.Classes;
  3. using InABox.Core;
  4. namespace comal.timesheets
  5. {
  6. public class DeliveryShell : Shell<DeliveryModel, Delivery>
  7. {
  8. static DeliveryShell()
  9. {
  10. Columns.Map(nameof(ID), x => x.ID)
  11. .Map(nameof(Number), x => x.Number)
  12. .Map(nameof(_jobid), x => x.Job.ID)
  13. .Map(nameof(_jobNumber), x => x.Job.JobNumber)
  14. .Map(nameof(_jobName), x => x.Job.Name)
  15. .Map(nameof(Date), x => x.Date)
  16. .Map(nameof(ContactName), x => x.Contact.Name)
  17. .Map(nameof(_booked), x => x.Assignment.Date)
  18. .Map(nameof(Delivered), x => x.Delivered)
  19. .Map(nameof(_due), x => x.Due)
  20. .Map(nameof(Address), x => x.Location.Address);
  21. }
  22. public Guid ID => Get<Guid>();
  23. public int Number => Get<int>();
  24. public Guid _jobid => Get<Guid>();
  25. private String _jobNumber => Get<String>();
  26. private String _jobName => Get<String>();
  27. public String Job => _jobid != Guid.Empty
  28. ? $"{_jobNumber}: {_jobName}"
  29. : "";
  30. public String Address => Get<String>();
  31. public String ContactName => Get<String>();
  32. private DateTime _booked => Get<DateTime>();
  33. private DateTime _due => Get<DateTime>();
  34. public DateTime Date => _booked.IsEmpty() ? _due : _booked;
  35. public DateTime Delivered => Get<DateTime>();
  36. }
  37. }