JobDocumentSetLink.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using System.Linq;
  3. using InABox.Core;
  4. namespace Comal.Classes
  5. {
  6. public class JobDocumentSetLink : EntityLink<JobDocumentSet>, IJobDocumentSet
  7. {
  8. [LookupEditor(typeof(JobDocumentSet))]
  9. public override Guid ID { get; set; }
  10. [NullEditor]
  11. public JobLink Job { get; set; }
  12. [NullEditor]
  13. public JobDocumentSetFolderLink Folder { get; set; }
  14. [CodeEditor(Editable = Editable.Hidden)]
  15. [EditorSequence(1)]
  16. public string Code { get; set; }
  17. [TextBoxEditor(Editable = Editable.Hidden)]
  18. [EditorSequence(2)]
  19. public string Description { get; set; }
  20. public JobDocumentSetDisciplineLink Discipline { get; set; }
  21. public JobDocumentSetTypeLink Type { get; set; }
  22. public JobDocumentSetCategoryLink Category { get; set; }
  23. public JobITPLink Area { get; set; }
  24. public LightJobDocumentSetMileStoneLink CurrentMileStone { get; set; }
  25. }
  26. public class JobDocumentSetLookups : EntityLookup<JobDocumentSet>, ILookupDefinition<JobDocumentSet,Job>
  27. {
  28. public override Filter<JobDocumentSet>? DefineFilter()
  29. {
  30. return null;
  31. }
  32. public override SortOrder<JobDocumentSet> DefineSortOrder()
  33. {
  34. return new SortOrder<JobDocumentSet>(x=>x.Code);
  35. }
  36. public override Columns<JobDocumentSet> DefineColumns()
  37. {
  38. return new Columns<JobDocumentSet>(x => x.ID)
  39. .Add(x => x.Code)
  40. .Add(x => x.Description);
  41. }
  42. public Filter<JobDocumentSet>? DefineFilter(Job[] items)
  43. {
  44. var ids = items.Select(x => x.ID).Distinct().ToArray();
  45. return ids.Any()
  46. ? new Filter<JobDocumentSet>(x => x.Job.ID).InList(ids)
  47. : new Filter<JobDocumentSet>().None();
  48. }
  49. public Columns<Job> DefineFilterColumns()
  50. {
  51. return new Columns<Job>(x => x.ID)
  52. .Add(x => x.JobNumber)
  53. .Add(x => x.Name);
  54. }
  55. }
  56. }