12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using Comal.Classes;
- using InABox.Core;
- using InABox.DynamicGrid;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PRSDesktop.Panels.Jobs;
- public class JobProductMappingsGrid : DynamicDataGrid<JobProductMapping>, IJobControl, IDataModelSource
- {
- public Job Job { get; set; }
- JobPanelSettings IJobControl.Settings { get; set; }
- public string SectionName => "Job Product Mappings";
- public event DataModelUpdateEvent? OnUpdateDataModel;
- protected override bool CanCreateItems()
- {
- return Job.ID != Guid.Empty;
- }
- protected override JobProductMapping CreateItem()
- {
- var result = base.CreateItem();
- result.Job.ID = Job.ID;
- result.Job.Synchronise(Job);
- return result;
- }
- public DataModel DataModel(Selection selection)
- {
- var ids = ExtractValues(x => x.ID, selection).ToArray();
- return new BaseDataModel<JobProductMapping>(new Filter<JobProductMapping>(x => x.ID).InList(ids));
- }
- protected override void Reload(Filters<JobProductMapping> criteria, Columns<JobProductMapping> columns, ref SortOrder<JobProductMapping>? sort, Action<CoreTable?, Exception?> action)
- {
- criteria.Add(new Filter<JobProductMapping>(x => x.Job.ID).IsEqualTo(Job.ID));
- base.Reload(criteria, columns, ref sort, action);
- }
- }
|