SupplierProductLookup.cs 980 B

1234567891011121314151617181920212223242526272829303132
  1. using InABox.Core;
  2. namespace Comal.Classes
  3. {
  4. public class SupplierProductLookup : EntityLookup<SupplierProduct>, ILookupDefinition<SupplierProduct, Product>
  5. {
  6. public Filter<SupplierProduct> DefineFilter(Product[] items)
  7. {
  8. var id = items != null && items.Length == 1 ? items[0].ID : CoreUtils.FullGuid;
  9. return new Filter<SupplierProduct>(x => x.ProductLink.ID).IsEqualTo(id);
  10. }
  11. public override Columns<SupplierProduct> DefineColumns()
  12. {
  13. return new Columns<SupplierProduct>(
  14. x => x.ID,
  15. x => x.SupplierLink.Code,
  16. x => x.SupplierLink.Name
  17. );
  18. }
  19. public override Filter<SupplierProduct> DefineFilter()
  20. {
  21. return null;
  22. }
  23. public override SortOrder<SupplierProduct> DefineSortOrder()
  24. {
  25. return new SortOrder<SupplierProduct>(x => x.SupplierLink.Code);
  26. }
  27. }
  28. }