123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using System;
- using System.Threading;
- using Comal.Classes;
- using InABox.Core;
- using InABox.DynamicGrid;
- namespace PRSDesktop;
- public class JobScopeFormGrid : DynamicEntityFormGrid<JobForm, Job, JobLink>, IJobScopeGrid
- {
- public JobScope? Scope { get; set; }
- private readonly Column<JobForm> ScopeColumn = new Column<JobForm>(x => x.JobScope);
- public JobScopeFormGrid(Job job): base(job)
- {
- }
- protected override void CustomiseEditor(JobForm[] items, DynamicGridColumn column, BaseEditor editor)
- {
- base.CustomiseEditor(items, column, editor);
- if(ScopeColumn.IsEqualTo(column.ColumnName) || ScopeColumn.IsParentOf(column.ColumnName))
- {
- editor.Editable = Editable.Hidden;
- }
- }
- protected override void DoReconfigure(DynamicGridOptions options)
- {
- base.DoReconfigure(options);
- options.AddRows = false;
- }
- protected override void Reload(
- Filters<JobForm> criteria, Columns<JobForm> columns, ref SortOrder<JobForm>? sort,
- CancellationToken token, Action<CoreTable?, Exception?> action)
- {
- if ((Scope == null) || (Scope.ID == Guid.Empty))
- criteria.Add(new Filter<JobForm>(x => x.ID).None());
- else
- criteria.Add(new Filter<JobForm>(x => x.JobScope.ID).IsEqualTo(Scope.ID));
- base.Reload(criteria, columns, ref sort, token, action);
- }
- }
|