JobShell.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. using System.Linq;
  3. using Comal.Classes;
  4. using Xamarin.Forms;
  5. namespace comal.timesheets
  6. {
  7. public class JobShell : Shell<JobModel, Job>
  8. {
  9. static JobShell()
  10. {
  11. Columns
  12. .Map(nameof(ID), x => x.ID)
  13. .Map(nameof(JobNumber), x => x.JobNumber)
  14. .Map(nameof(Name), x => x.Name)
  15. .Map(nameof(Status), x => x.JobStatus.Description)
  16. .Map(nameof(Active), x=>x.JobStatus.Active)
  17. .Map(nameof(_color), x => x.Color)
  18. .Map(nameof(Latitude), x => x.SiteAddress.Location.Latitude)
  19. .Map(nameof(Longitude), x => x.SiteAddress.Location.Longitude)
  20. .Map(nameof(Notes), x => x.Notes)
  21. .Map(nameof(OpenAssignments), x => x.OpenAssignments);
  22. }
  23. public Guid ID => Get<Guid>();
  24. public string Name => Get<String>();
  25. public string JobNumber => Get<String>();
  26. private String _color => Get<String>();
  27. public Color Color => Color.FromHex(_color);
  28. public String Status => Get<String>();
  29. public bool Active => Get<bool>();
  30. public double Latitude => Get<double>();
  31. public double Longitude => Get<double>();
  32. public String Notes => Get<String>();
  33. public int OpenAssignments => Get<int>();
  34. public string DisplayName => $"{JobNumber}: {Name}";
  35. public InABox.Core.Location Location => new InABox.Core.Location()
  36. {
  37. Latitude = this.Latitude,
  38. Longitude = this.Longitude
  39. };
  40. }
  41. }