12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System;
- using System.Linq;
- using Comal.Classes;
- using InABox.Core;
- using InABox.DynamicGrid;
- namespace PRSDesktop
- {
- public class QuoteDesignItemGrid : DynamicManyToManyDataGrid<QuoteDesignItem, QuoteDesign>
- {
- public QuoteDesignItemGrid()
- {
- Options.AddRange(DynamicGridOption.RecordCount, DynamicGridOption.SelectColumns);
- HiddenColumns.Add(x => x.Design.ID);
- HiddenColumns.Add(x => x.Design.Quote.ID);
- }
- public Guid DesignID
- {
- get => ID;
- set
- {
- ID = value;
- Refresh(false, true);
- }
- }
- public Guid QuoteID { get; set; }
- protected override void Reload(Filters<QuoteDesignItem> criteria, Columns<QuoteDesignItem> columns, ref SortOrder<QuoteDesignItem> sort,
- Action<CoreTable, Exception> action)
- {
- criteria.Add(new Filter<QuoteDesignItem>(x => x.Design.ID).IsEqualTo(DesignID));
- base.Reload(criteria, columns, ref sort, action);
- }
- protected override QuoteDesignItem CreateItem()
- {
- var result = base.CreateItem();
- result.Design.ID = DesignID;
- result.Design.Quote.ID = QuoteID;
- return result;
- }
- protected override object GetFilter()
- {
- var ids = CurrentGuids();
- if (ids.Any())
- return new Filter<QuoteTakeoff>(x => x.Quote.ID).IsEqualTo(QuoteID).And(x => x.ID).NotInList(CurrentGuids());
- return new Filter<QuoteTakeoff>(x => x.Quote.ID).IsEqualTo(QuoteID);
- }
- }
- }
|