JobStyle.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using InABox.Core;
  2. using System.Linq;
  3. namespace Comal.Classes
  4. {
  5. public class JobStyle : Entity, IRemotable, IPersistent, ILicense<ProjectManagementLicense>
  6. {
  7. [EntityRelationship(DeleteAction.Cascade)]
  8. [Editable(Editable.Hidden)]
  9. public JobLink Job { get; set; }
  10. [EntityRelationship(DeleteAction.SetNull)]
  11. [EditorSequence(2)]
  12. public ProductStyleLink Style { get; set; }
  13. [EditorSequence(3)]
  14. [MemoEditor]
  15. public string Note { get; set; } = "";
  16. private class JobDocumentSetLookup : LookupDefinitionGenerator<JobDocumentSet, JobStyle>
  17. {
  18. public override Filter<JobDocumentSet>? DefineFilter(JobStyle[] items)
  19. {
  20. var ids = items.Select(x => x.Job.ID).Distinct().ToArray();
  21. return ids.Any()
  22. ? new Filter<JobDocumentSet>(x => x.Job.ID).InList(ids)
  23. : new Filter<JobDocumentSet>().None();
  24. }
  25. public override Columns<JobStyle> DefineFilterColumns()
  26. {
  27. return Columns.None<JobStyle>().Add(x => x.ID)
  28. .Add(x=>x.Job.ID)
  29. .Add(x => x.Job.JobNumber)
  30. .Add(x => x.Job.Name);
  31. }
  32. }
  33. [LookupDefinition(typeof(JobDocumentSetLookup))]
  34. [EntityRelationship(DeleteAction.SetNull)]
  35. public JobDocumentSetLink JobDocumentSet { get; set; }
  36. }
  37. }