BaseKanbanShell.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Comal.Classes;
  5. using InABox.Mobile;
  6. namespace PRS.Mobile
  7. {
  8. public abstract class BaseKanbanShell<TModel> : Shell<TModel, Kanban>, IKanbanShell
  9. where TModel : IKanbanModel
  10. {
  11. protected override void ConfigureColumns(ShellColumns<TModel, Kanban> columns)
  12. {
  13. columns
  14. .Map(nameof(Number), x => x.Number)
  15. .Map(nameof(Title), x => x.Title)
  16. .Map(nameof(TypeID), x => x.Type.ID)
  17. .Map(nameof(TypeName), x => x.Type.Description)
  18. .Map(nameof(Status), x => x.Status)
  19. .Map(nameof(DueDate), x => x.DueDate)
  20. .Map(nameof(Completed), x => x.Completed)
  21. .Map(nameof(Description), x => x.Description)
  22. .Map(nameof(Summary), x => x.Summary)
  23. .Map(nameof(Notes), x=>x.Notes)
  24. .Map(nameof(EmployeeID), x => x.EmployeeLink.ID)
  25. .Map(nameof(EmployeeName), x => x.EmployeeLink.Name)
  26. .Map(nameof(ManagerID), x => x.ManagerLink.ID)
  27. .Map(nameof(ManagerName), x => x.ManagerLink.Name)
  28. .Map(nameof(Attachments), x => x.Attachments)
  29. .Map(nameof(Locked), x => x.Locked)
  30. .Map(nameof(JobID), x => x.JobLink.ID)
  31. .Map(nameof(JobNumber), x => x.JobLink.JobNumber)
  32. .Map(nameof(JobName), x => x.JobLink.Name)
  33. .Map(nameof(EquipmentID), x => x.Equipment.ID)
  34. .Map(nameof(EquipmentDescription), x => x.Equipment.Description);
  35. }
  36. public int Number => Get<int>();
  37. public string Title
  38. {
  39. get => Get<string>();
  40. set => Set(value);
  41. }
  42. public Guid TypeID
  43. {
  44. get => Get<Guid>();
  45. set => Set(value);
  46. }
  47. public String TypeName
  48. {
  49. get => Get<string>();
  50. set => Set(value);
  51. }
  52. public KanbanStatus Status {
  53. get => Get<KanbanStatus>();
  54. set => Set(value);
  55. }
  56. public DateTime Completed
  57. {
  58. get => Get<DateTime>();
  59. set => Set(value);
  60. }
  61. public DateTime DueDate
  62. {
  63. get => Get<DateTime>();
  64. set => Set(value);
  65. }
  66. public String Description
  67. {
  68. get => Get<String>();
  69. set => Set(value);
  70. }
  71. public String Summary
  72. {
  73. get => Get<String>();
  74. set => Set(value);
  75. }
  76. public IList<String> Notes
  77. {
  78. get => Get<String[]>();
  79. set => Set(value);
  80. }
  81. public Guid EmployeeID
  82. {
  83. get => Get<Guid>();
  84. set => Set(value);
  85. }
  86. public String EmployeeName
  87. {
  88. get => Get<String>();
  89. set => Set(value);
  90. }
  91. public Guid ManagerID
  92. {
  93. get => Get<Guid>();
  94. set => Set(value);
  95. }
  96. public String ManagerName
  97. {
  98. get => Get<String>();
  99. set => Set(value);
  100. }
  101. public int Attachments => Get<int>();
  102. public bool Locked => Get<bool>();
  103. public Guid JobID
  104. {
  105. get => Get<Guid>();
  106. set => Set(value);
  107. }
  108. public String JobNumber
  109. {
  110. get => Get<String>();
  111. set => Set(value);
  112. }
  113. public String JobName
  114. {
  115. get => Get<String>();
  116. set => Set(value);
  117. }
  118. public Guid EquipmentID
  119. {
  120. get => Get<Guid>();
  121. set => Set(value);
  122. }
  123. public String EquipmentDescription
  124. {
  125. get => Get<String>();
  126. set => Set(value);
  127. }
  128. public String LookupCode => Number.ToString();
  129. public String LookupDescription => Title;
  130. public bool LookupSelected { get; set; }
  131. public override void Save(string auditmessage)
  132. {
  133. base.Save(auditmessage);
  134. var subscribers = new ClientKanbanSubscriberSet(new Guid[] { ID });
  135. subscribers.EnsureAssignee(ID, EmployeeID);
  136. subscribers.EnsureManager(ID,ManagerID);
  137. subscribers.Save(false);
  138. }
  139. }
  140. }