KanbanLookups.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  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. public override Columns<Kanban> DefineColumns()
  16. {
  17. return new Columns<Kanban>(
  18. x => x.ID,
  19. x => x.Number,
  20. x => x.Title
  21. );
  22. }
  23. public override Filter<Kanban> DefineFilter()
  24. {
  25. return new Filter<Kanban>(x => x.Closed).IsEqualTo(DateTime.MinValue);
  26. }
  27. public override SortOrder<Kanban> DefineSortOrder()
  28. {
  29. return new SortOrder<Kanban>(x => x.Number);
  30. }
  31. }
  32. }