SupplierPayment.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Comal.Classes;
  5. using InABox.Core;
  6. using InABox.DynamicGrid;
  7. namespace PRSDesktop
  8. {
  9. public class SupplierPayments : DynamicDataGrid<Payment>, IPanel<Payment>
  10. {
  11. public SupplierPayments()
  12. {
  13. Options.AddRange(DynamicGridOption.RecordCount, DynamicGridOption.FilterRows, DynamicGridOption.SelectColumns);
  14. }
  15. public bool IsReady { get; set; }
  16. public event DataModelUpdateEvent? OnUpdateDataModel;
  17. public Dictionary<string, object[]> Selected()
  18. {
  19. return new Dictionary<string, object[]> { { typeof(Payment).EntityName(), SelectedRows } };
  20. }
  21. public void CreateToolbarButtons(IPanelHost host)
  22. {
  23. //
  24. }
  25. public string SectionName => "Supplier Payments";
  26. public DataModel DataModel(Selection selection)
  27. {
  28. var ids = ExtractValues(x => x.ID, selection).ToArray();
  29. return new BaseDataModel<Payment>(new Filter<Payment>(x => x.ID).InList(ids));
  30. }
  31. public void Refresh()
  32. {
  33. Refresh(false, true);
  34. }
  35. public void Setup()
  36. {
  37. Refresh(true, false);
  38. }
  39. public void Shutdown()
  40. {
  41. }
  42. public void Heartbeat(TimeSpan time)
  43. {
  44. }
  45. public Dictionary<Type, CoreTable> DataEnvironment()
  46. {
  47. return new Dictionary<Type, CoreTable>
  48. {
  49. { typeof(Payment), Data }
  50. };
  51. }
  52. }
  53. }