| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using System;
- using System.Linq;
- using System.Windows;
- using Comal.Classes;
- using InABox.Core;
- using InABox.DynamicGrid;
- namespace PRSDesktop
- {
- public class JobTimesheetGrid : TimesheetGrid, IJobControl, IDataModelSource
- {
-
-
- public Job Job { get; set; }
-
- public JobPanelSettings Settings { get; set; }
-
- protected override void DoReconfigure(FluentList<DynamicGridOption> options)
- {
- base.DoReconfigure(options);
- options.AddRange(
- DynamicGridOption.RecordCount,
- DynamicGridOption.FilterRows,
- DynamicGridOption.MultiSelect,
- DynamicGridOption.EditRows
- );
- }
- public event DataModelUpdateEvent OnUpdateDataModel;
- public string SectionName => "Job Timesheets";
- public DataModel DataModel(Selection selection)
- {
- var ids = ExtractValues(x => x.ID, selection).ToArray();
- return new BaseDataModel<TimeSheet>(new Filter<TimeSheet>(x => x.ID).InList(ids));
- }
- protected override void DoAdd(bool OpenEditorOnDirectEdit = false)
- {
- if (Job.ID.Equals(Guid.Empty) || Job.ID.Equals(CoreUtils.FullGuid))
- MessageBox.Show("Please select a Job first!");
- else
- base.DoAdd();
- }
- protected override TimeSheet CreateItem()
- {
- var result = base.CreateItem();
- result.JobLink.ID = Job.ID;
- result.JobLink.Synchronise(Job);
- return result;
- }
- protected override void Reload(Filters<TimeSheet> criteria, Columns<TimeSheet> columns, ref SortOrder<TimeSheet> sort,
- Action<CoreTable, Exception> action)
- {
- criteria.Add(new Filter<TimeSheet>(x => x.JobLink.ID).IsEqualTo(Job.ID));
- base.Reload(criteria, columns, ref sort, action);
- }
- }
- }
|