QuoteDesignItem.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using InABox.Core;
  2. using System.Linq;
  3. namespace Comal.Classes
  4. {
  5. [UserTracking(typeof(Quote))]
  6. public class QuoteDesignItem : Entity, IRemotable, IPersistent, ISequenceable, IManyToMany<QuoteDesign, QuoteTakeoff>,
  7. ILicense<QuotesManagementLicense>
  8. {
  9. [NullEditor]
  10. [EntityRelationship(DeleteAction.Cascade)]
  11. public QuoteDesignLink Design { get; set; }
  12. private class QuoteTakeoffLookup : LookupDefinitionGenerator<QuoteTakeoff, QuoteDesignItem>
  13. {
  14. public override Filter<QuoteTakeoff> DefineFilter(QuoteDesignItem[] items)
  15. {
  16. if (items == null || !items.Any())
  17. return LookupFactory.DefineFilter<QuoteTakeoff>();
  18. return new Filter<QuoteTakeoff>(x => x.Quote.ID).IsEqualTo(items.First().Design.Quote.ID);
  19. }
  20. public override Columns<QuoteDesignItem> DefineFilterColumns()
  21. => new Columns<QuoteDesignItem>(x => x.Design.Quote.ID);
  22. }
  23. [LookupDefinition(typeof(QuoteTakeoffLookup))]
  24. [EntityRelationship(DeleteAction.Cascade)]
  25. public QuoteTakeoffLink Takeoff { get; set; }
  26. [EntityRelationship(DeleteAction.SetNull)]
  27. public QuoteDesignSectionLink Section { get; set; }
  28. [NullEditor]
  29. public long Sequence { get; set; }
  30. }
  31. }