JobScopeFormGrid.cs 936 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using Comal.Classes;
  3. using InABox.Core;
  4. using InABox.DynamicGrid;
  5. namespace PRSDesktop;
  6. public class JobScopeFormGrid : DynamicEntityFormGrid<JobForm, Job, JobLink>, IJobScopeGrid
  7. {
  8. public JobScope? Scope { get; set; }
  9. public JobScopeFormGrid(Job job): base(job)
  10. {
  11. }
  12. protected override void DoReconfigure(FluentList<DynamicGridOption> options)
  13. {
  14. base.DoReconfigure(options);
  15. options.Remove(DynamicGridOption.AddRows);
  16. }
  17. protected override void Reload(Filters<JobForm> criteria, Columns<JobForm> columns, ref SortOrder<JobForm>? sort, Action<CoreTable?, Exception?> action)
  18. {
  19. if ((Scope == null) || (Scope.ID == Guid.Empty))
  20. criteria.Add(new Filter<JobForm>(x => x.ID).None());
  21. else
  22. criteria.Add(new Filter<JobForm>(x => x.JobScope.ID).IsEqualTo(Scope.ID));
  23. base.Reload(criteria, columns, ref sort, action);
  24. }
  25. }