AssignmentDetailShell.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. using System;
  2. using Comal.Classes;
  3. namespace comal.timesheets
  4. {
  5. public class AssignmentDetailShell : DetailShell<AssignmentDetailModel, Assignment>
  6. {
  7. static AssignmentDetailShell()
  8. {
  9. Columns
  10. .Map(nameof(ID), c => c.ID)
  11. .Map(nameof(EmployeeID), x => x.EmployeeLink.ID)
  12. .Map(nameof(Number), x => x.Number)
  13. .Map(nameof(Subject), x => x.Title)
  14. .Map(nameof(Description), x => x.Description)
  15. .Map(nameof(Date), x => x.Date)
  16. .Map(nameof(ActualStart), x => x.Actual.Start)
  17. .Map(nameof(ActualDuration), x => x.Actual.Duration)
  18. .Map(nameof(ActualFinish), x => x.Actual.Finish)
  19. .Map(nameof(BookedStart), x => x.Booked.Start)
  20. .Map(nameof(BookedDuration), x => x.Booked.Duration)
  21. .Map(nameof(BookedFinish), x => x.Booked.Finish)
  22. .Map(nameof(JobID), x => x.JobLink.ID)
  23. .Map(nameof(JobNumber), x => x.JobLink.JobNumber)
  24. .Map(nameof(JobName), x => x.JobLink.Name)
  25. .Map(nameof(Latitude), x => x.JobLink.SiteAddress.Location.Latitude)
  26. .Map(nameof(Longitude), x => x.JobLink.SiteAddress.Location.Longitude)
  27. .Map(nameof(TaskID), x => x.Task.ID)
  28. .Map(nameof(TaskNumber), x => x.Task.Number)
  29. .Map(nameof(TaskName), x => x.Task.Title)
  30. .Map(nameof(ActivityID), x => x.ActivityLink.ID)
  31. .Map(nameof(ActivityCode), x => x.ActivityLink.Code)
  32. .Map(nameof(ActivityDescription), x => x.ActivityLink.Description)
  33. .Map(nameof(ActivityColor), x => x.ActivityLink.Color)
  34. .Map(nameof(Completed), x => x.Completed);
  35. }
  36. public Guid ID => Get<Guid>();
  37. public Guid EmployeeID
  38. {
  39. get => Get<Guid>();
  40. set => Set(value);
  41. }
  42. public int Number
  43. {
  44. get => Get<int>();
  45. set => Set(value);
  46. }
  47. public String Subject
  48. {
  49. get => Get<String>();
  50. set => Set(value);
  51. }
  52. public String Description
  53. {
  54. get => Get<String>();
  55. set => Set(value);
  56. }
  57. public DateTime Date
  58. {
  59. get => Get<DateTime>();
  60. set => Set(value);
  61. }
  62. public TimeSpan ActualStart
  63. {
  64. get => Get<TimeSpan>();
  65. set => Set(value);
  66. }
  67. public TimeSpan ActualDuration
  68. {
  69. get => Get<TimeSpan>();
  70. set => Set(value);
  71. }
  72. public TimeSpan ActualFinish
  73. {
  74. get => Get<TimeSpan>();
  75. set => Set(value);
  76. }
  77. public TimeSpan BookedStart
  78. {
  79. get => Get<TimeSpan>();
  80. set => Set(value);
  81. }
  82. public TimeSpan BookedDuration
  83. {
  84. get => Get<TimeSpan>();
  85. set => Set(value);
  86. }
  87. public TimeSpan BookedFinish
  88. {
  89. get => Get<TimeSpan>();
  90. set => Set(value);
  91. }
  92. public Guid JobID
  93. {
  94. get => Get<Guid>();
  95. set => Set(value);
  96. }
  97. public String JobNumber
  98. {
  99. get => Get<String>();
  100. set
  101. {
  102. Set(value,false);
  103. DoPropertyChanged(nameof(JobDisplay));
  104. }
  105. }
  106. public String JobName
  107. {
  108. get => Get<String>();
  109. set
  110. {
  111. Set(value,false);
  112. DoPropertyChanged(nameof(JobDisplay));
  113. }
  114. }
  115. public String JobDisplay => JobID != Guid.Empty
  116. ? String.Format("{0}: {1}", JobNumber, JobName )
  117. : "(No Job Selected)";
  118. public double Latitude
  119. {
  120. get => Get<double>();
  121. set => Set(value);
  122. }
  123. public double Longitude
  124. {
  125. get => Get<double>();
  126. set => Set(value);
  127. }
  128. public Guid TaskID
  129. {
  130. get => Get<Guid>();
  131. set => Set(value);
  132. }
  133. public int TaskNumber
  134. {
  135. get => Get<int>();
  136. set
  137. {
  138. Set(value,false);
  139. DoPropertyChanged(nameof(TaskDisplay));
  140. }
  141. }
  142. public String TaskName
  143. {
  144. get => Get<String>();
  145. set
  146. {
  147. Set(value,false);
  148. DoPropertyChanged(nameof(TaskDisplay));
  149. }
  150. }
  151. public String TaskDisplay => TaskID != Guid.Empty
  152. ? String.Format("{0}: {1}", TaskNumber, TaskName )
  153. : "(No Task Selected)";
  154. public Guid ActivityID
  155. {
  156. get => Get<Guid>();
  157. set => Set(value);
  158. }
  159. public String ActivityCode
  160. {
  161. get => Get<String>();
  162. set
  163. {
  164. Set(value,false);
  165. DoPropertyChanged(nameof(ActivityDisplay));
  166. }
  167. }
  168. public String ActivityDescription
  169. {
  170. get => Get<String>();
  171. set
  172. {
  173. Set(value,false);
  174. DoPropertyChanged(nameof(TaskDisplay));
  175. }
  176. }
  177. public String ActivityColor
  178. {
  179. get => Get<String>();
  180. set => Set(value);
  181. }
  182. public String ActivityDisplay => ActivityID != Guid.Empty
  183. ? String.Format("{0}: {1}", ActivityCode, ActivityDescription)
  184. : "(No Activity Selected)";
  185. public DateTime Completed
  186. {
  187. get => Get<DateTime>();
  188. set => Set(value);
  189. }
  190. }
  191. }