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 JobProductStylesGrid : DynamicDataGrid<JobStyle>, IJobControl, IDataModelSource
- {
- public Job Job { get; set; }
- JobPanelSettings IJobControl.Settings { get; set; }
- public string SectionName => "Job Product Styles";
- public event DataModelUpdateEvent? OnUpdateDataModel;
- protected override bool CanCreateItems()
- {
- return Job.ID != Guid.Empty;
- }
- protected override JobStyle 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<JobStyle>(new Filter<JobStyle>(x => x.ID).InList(ids));
- }
- protected override void Reload(Filters<JobStyle> criteria, Columns<JobStyle> columns, ref SortOrder<JobStyle>? sort, Action<CoreTable?, Exception?> action)
- {
- criteria.Add(new Filter<JobStyle>(x => x.Job.ID).IsEqualTo(Job.ID));
- base.Reload(criteria, columns, ref sort, action);
- }
- }
|