JobTracker.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using InABox.Core;
  3. namespace Comal.Classes
  4. {
  5. public class JobTrackerLink : EntityLink<JobTracker>
  6. {
  7. public JobTrackerLink()
  8. {
  9. JobLink = new JobLink();
  10. }
  11. [LookupEditor(typeof(JobTracker))]
  12. public override Guid ID { get; set; }
  13. [NullEditor]
  14. public JobLink JobLink { get; set; }
  15. [TextBoxEditor(Editable = Editable.Hidden)]
  16. public string Gate { get; set; }
  17. }
  18. [UserTracking(typeof(GPSTracker))]
  19. public class JobTracker : Entity, IPersistent, IRemotable, IManyToMany<Job, GPSTracker>, ILicense<GPSTrackerLicense>
  20. {
  21. [EntityRelationship(DeleteAction.Cascade)]
  22. public JobLink JobLink { get; set; }
  23. [EntityRelationship(DeleteAction.SetNull)]
  24. public GPSTrackerLink TrackerLink { get; set; }
  25. public string Gate { get; set; }
  26. public bool Active { get; set; }
  27. // If a mobile app finds one of these tiles
  28. // this flag should indicate whether to log them onto
  29. // the associated job or not.
  30. public bool IsJobSite { get; set; }
  31. protected override void Init()
  32. {
  33. base.Init();
  34. TrackerLink = new GPSTrackerLink();
  35. JobLink = new JobLink();
  36. }
  37. }
  38. public class JobTrackerLookups : EntityLookup<JobTracker>
  39. {
  40. public override Columns<JobTracker> DefineColumns()
  41. {
  42. return new Columns<JobTracker>(
  43. x => x.ID,
  44. x => x.JobLink.JobNumber,
  45. x => x.JobLink.Name,
  46. x => x.Gate
  47. );
  48. }
  49. public override Filter<JobTracker> DefineFilter()
  50. {
  51. return null;
  52. }
  53. public override SortOrder<JobTracker> DefineSortOrder()
  54. {
  55. return new SortOrder<JobTracker>(x => x.JobLink.JobNumber).ThenBy(x => x.Gate);
  56. }
  57. }
  58. }