using InABox.Core; using System.Linq; namespace Comal.Classes { [UserTracking(typeof(Quote))] public class QuoteDesignItem : Entity, IRemotable, IPersistent, ISequenceable, IManyToMany, ILicense { [NullEditor] [EntityRelationship(DeleteAction.Cascade)] public QuoteDesignLink Design { get; set; } private class QuoteTakeoffLookup : LookupDefinitionGenerator { public override Filter DefineFilter(QuoteDesignItem[] items) { if (items == null || !items.Any()) return LookupFactory.DefineFilter(); return new Filter(x => x.Quote.ID).IsEqualTo(items.First().Design.Quote.ID); } public override Columns DefineFilterColumns() => new Columns(x => x.Design.Quote.ID); } [LookupDefinition(typeof(QuoteTakeoffLookup))] [EntityRelationship(DeleteAction.Cascade)] public QuoteTakeoffLink Takeoff { get; set; } [EntityRelationship(DeleteAction.SetNull)] public QuoteDesignSectionLink Section { get; set; } [NullEditor] public long Sequence { get; set; } } }