SupplierProductLookup.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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.Product.ID).IsEqualTo(id);
  10. }
  11. Columns<Product> ILookupDefinition<SupplierProduct, Product>.DefineFilterColumns()
  12. => new Columns<Product>(x => x.ID);
  13. public override Columns<SupplierProduct> DefineColumns()
  14. {
  15. return new Columns<SupplierProduct>(
  16. x => x.ID,
  17. x => x.SupplierLink.Code,
  18. x => x.SupplierLink.Name
  19. );
  20. }
  21. public override Filter<SupplierProduct> DefineFilter()
  22. {
  23. return null;
  24. }
  25. public override SortOrder<SupplierProduct> DefineSortOrder()
  26. {
  27. return new SortOrder<SupplierProduct>(x => x.SupplierLink.Code);
  28. }
  29. }
  30. }