ProductLookups.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using InABox.Core;
  5. namespace Comal.Classes
  6. {
  7. public class ProductLookups : EntityLookup<Product>
  8. {
  9. public override Columns<Product> DefineColumns()
  10. {
  11. return Columns.None<Product>()
  12. .Add(
  13. x => x.ID,
  14. x => x.Code,
  15. x => x.Name,
  16. x => x.TaxCode.ID,
  17. x => x.PurchaseGL.ID,
  18. x => x.NettCost)
  19. .AddDimensionsColumns(x => x.DefaultInstance.Dimensions, Dimensions.ColumnsType.All);
  20. }
  21. public override string FormatLookup(Dictionary<string, object?> values, IEnumerable<string> exclude)
  22. {
  23. return $"{values["Name"]}";
  24. }
  25. public override Filter<Product> DefineFilter()
  26. {
  27. return new Filter<Product>(x => x.Expired).IsEqualTo(DateTime.MinValue);
  28. }
  29. public override SortOrder<Product> DefineSortOrder()
  30. {
  31. return new SortOrder<Product>(x => x.Code);
  32. }
  33. }
  34. }