KanbanLookups.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Linq;
  3. using InABox.Core;
  4. namespace Comal.Classes
  5. {
  6. public class KanbanLookups : EntityLookup<Kanban>, ILookupDefinition<Kanban, Assignment>
  7. {
  8. public Filter<Kanban> DefineFilter(Assignment[] items)
  9. {
  10. if (items == null || !items.Any())
  11. return DefineFilter();
  12. return new Filter<Kanban>(x => x.Closed).IsEqualTo(DateTime.MinValue).And(x => x.EmployeeLink.ID)
  13. .IsEqualTo(items.First().EmployeeLink.ID);
  14. }
  15. Columns<Assignment> ILookupDefinition<Kanban, Assignment>.DefineFilterColumns()
  16. => new Columns<Assignment>(x => x.EmployeeLink.ID);
  17. public override Columns<Kanban> DefineColumns()
  18. {
  19. return new Columns<Kanban>(
  20. x => x.ID,
  21. x => x.Number,
  22. x => x.Title
  23. );
  24. }
  25. public override Filter<Kanban> DefineFilter()
  26. {
  27. return new Filter<Kanban>(x => x.Closed).IsEqualTo(DateTime.MinValue);
  28. }
  29. public override SortOrder<Kanban> DefineSortOrder()
  30. {
  31. return new SortOrder<Kanban>(x => x.Number);
  32. }
  33. }
  34. }