1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using System;
- using System.Linq;
- using Comal.Classes;
- using InABox.Core;
- using InABox.DynamicGrid;
- namespace PRSDesktop
- {
- public class QuoteTakeoffs : DynamicDataGrid<QuoteTakeoff>, IQuotePage, IDataModelSource
- {
-
- public Guid ParentID { get; set; }
-
- public QuoteTakeoffs()
- {
- Options.AddRange(
- DynamicGridOption.RecordCount,
- DynamicGridOption.AddRows,
- DynamicGridOption.EditRows,
- DynamicGridOption.DeleteRows,
- DynamicGridOption.SelectColumns,
- DynamicGridOption.MultiSelect
- );
- }
- public event DataModelUpdateEvent OnUpdateDataModel;
- public string SectionName => "Quote Takeoffs";
- public DataModel DataModel(Selection selection)
- {
- var ids = ExtractValues(x => x.ID, selection).ToArray();
- return new BaseDataModel<QuoteTakeoff>(new Filter<QuoteTakeoff>(x => x.ID).InList(ids));
- }
-
- protected override void Reload(Filters<QuoteTakeoff> criteria, Columns<QuoteTakeoff> columns, ref SortOrder<QuoteTakeoff> sort,
- Action<CoreTable, Exception> action)
- {
- criteria.Add(new Filter<QuoteTakeoff>(x => x.Quote.ID).IsEqualTo(ParentID));
- base.Reload(criteria, columns, ref sort, action);
- }
- protected override QuoteTakeoff CreateItem()
- {
- var result = base.CreateItem();
- result.Quote.ID = ParentID;
- return result;
- }
- }
- }
|