123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using System;
- using System.Linq;
- using Comal.Classes;
- using InABox.Mobile;
- using Xamarin.Forms;
- namespace PRS.Mobile
- {
-
- public class JobShell : Shell<JobModel, Job>, ILookupShell
- {
- protected override void ConfigureColumns(ShellColumns<JobModel, Job> columns)
- {
- columns
- .Map(nameof(JobNumber), x => x.JobNumber)
- .Map(nameof(Name), x => x.Name)
- .Map(nameof(Status), x => x.JobStatus.Description)
- .Map(nameof(Active), x=>x.JobStatus.Active)
- .Map(nameof(_color), x => x.Color)
- .Map(nameof(_latitude), x => x.SiteAddress.Location.Latitude)
- .Map(nameof(_longitude), x => x.SiteAddress.Location.Longitude)
- .Map(nameof(Notes), x => x.Notes)
- .Map(nameof(OpenAssignments), x => x.OpenAssignments)
- .Map(nameof(Street), x=>x.SiteAddress.Street)
- .Map(nameof(City), x=>x.SiteAddress.City)
- .Map(nameof(PostCode), x=>x.SiteAddress.PostCode)
- .Map(nameof(ContactID), x=>x.Contact.ID)
- .Map(nameof(ContactName), x=>x.Contact.Name);
- }
- public string Name => Get<String>();
- public string JobNumber => Get<String>();
-
- public string[] Notes => Get<String[]>();
-
- public Guid ContactID => Get<Guid>();
- public String ContactName => Get<String>();
-
- public string Street => Get<String>();
- public string City => Get<String>();
- public string PostCode => Get<String>();
-
- private double _latitude => Get<double>();
- private double _longitude => Get<double>();
- public InABox.Core.Location Location => new InABox.Core.Location()
- {
- Latitude = _latitude,
- Longitude = _longitude
- };
- public int OpenAssignments => Get<int>();
-
- public String Status => Get<String>();
- public bool Active => Get<bool>();
-
- private String _color => Get<String>();
-
- public Color Color => Color.FromHex(_color);
- // Calculated Fields
- public string DisplayName => ID.Equals(Guid.Empty) ? "" : $"{JobNumber}: {Name}";
-
- // ILookupShell Wrapper
- public String LookupCode => JobNumber;
- public String LookupDescription => Name;
- public bool LookupSelected { get; set; }
-
- }
- }
|