LocalityGrid.cs 881 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Threading;
  3. using InABox.Core;
  4. using InABox.DynamicGrid;
  5. using NPOI.SS.Formula;
  6. namespace PRSDesktop;
  7. public class LocalityGrid : DynamicDataGrid<Locality>
  8. {
  9. public Guid StateId { get; set; }
  10. protected override void DoReconfigure(DynamicGridOptions options)
  11. {
  12. base.DoReconfigure(options);
  13. options.MultiSelect = true;
  14. }
  15. protected override void Reload(Filters<Locality> criteria, Columns<Locality> columns, ref SortOrder<Locality>? sort, CancellationToken token, Action<CoreTable?, Exception?> action)
  16. {
  17. criteria.Add(new Filter<Locality>(x => x.State.ID).IsEqualTo(StateId));
  18. base.Reload(criteria, columns, ref sort, token, action);
  19. }
  20. public override Locality CreateItem()
  21. {
  22. var result = base.CreateItem();
  23. result.State.ID = StateId;
  24. return result;
  25. }
  26. }