JobStageLookups.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Linq;
  3. using InABox.Core;
  4. namespace Comal.Classes
  5. {
  6. public class JobStageLookups : EntityLookup<JobStage>, ILookupDefinition<JobStage, Job>, ILookupDefinition<JobStage, Setout>,
  7. ILookupDefinition<JobStage, ManufacturingPacket>, ILookupDefinition<JobStage, JobStage>
  8. {
  9. public Filter<JobStage> DefineFilter(Job[] items)
  10. {
  11. if (items.Length == 1)
  12. return new Filter<JobStage>(x => x.Job.ID).IsEqualTo(items.First().ID).And(x => x.IsHeader).IsEqualTo(false);
  13. return new Filter<JobStage>(x => x.ID).IsEqualTo(Guid.Empty);
  14. }
  15. public Filter<JobStage> DefineFilter(JobStage[] items)
  16. {
  17. if (items.Length == 1)
  18. return new Filter<JobStage>(x => x.Job.ID).IsEqualTo(items.First().Job.ID).And(x => x.IsHeader).IsEqualTo(false);
  19. return new Filter<JobStage>(x => x.ID).IsEqualTo(Guid.Empty);
  20. }
  21. public Filter<JobStage> DefineFilter(ManufacturingPacket[] items)
  22. {
  23. if (items.Length == 1)
  24. return new Filter<JobStage>(x => x.Job.ID).IsEqualTo(items.First().SetoutLink.JobLink.ID).And(x => x.IsHeader).IsEqualTo(false);
  25. return new Filter<JobStage>(x => x.ID).IsEqualTo(Guid.Empty);
  26. }
  27. public Filter<JobStage> DefineFilter(Setout[] items)
  28. {
  29. if (items.Length == 1)
  30. return new Filter<JobStage>(x => x.Job.ID).IsEqualTo(items.First().JobLink.ID).And(x => x.IsHeader).IsEqualTo(false);
  31. return new Filter<JobStage>(x => x.ID).IsEqualTo(Guid.Empty);
  32. }
  33. public override Filter<JobStage> DefineFilter()
  34. {
  35. return new Filter<JobStage>(x => x.ID).IsEqualTo(Guid.Empty);
  36. }
  37. public override Columns<JobStage> DefineColumns()
  38. {
  39. return new Columns<JobStage>(
  40. x => x.ID,
  41. x => x.Name
  42. );
  43. }
  44. public override SortOrder<JobStage> DefineSortOrder()
  45. {
  46. return new SortOrder<JobStage>(x => x.Sequence);
  47. }
  48. }
  49. }