CostSheetKit.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 CostSheetKit : Entity, IPersistent, IRemotable, ISequenceable, IOneToMany<CostSheetSection>, IOneToMany<CostSheet>,
  7. ILicense<QuotesManagementLicense>
  8. {
  9. [EntityRelationship(DeleteAction.Cascade)]
  10. public CostSheetLink CostSheet { get; set; }
  11. [EntityRelationship(DeleteAction.SetNull)]
  12. public CostSheetSectionLink Section { get; set; }
  13. private class KitLookup : LookupDefinitionGenerator<Kit, CostSheetKit>
  14. {
  15. public override Filter<Kit> DefineFilter(CostSheetKit[] items)
  16. {
  17. var result = new Filter<Kit>(x => x.Active).IsEqualTo(true);
  18. if (items.Any())
  19. result = result.And(x => x.Section.ID).IsEqualTo(items.First().Section.ID);
  20. return result;
  21. }
  22. public override Columns<CostSheetKit> DefineFilterColumns()
  23. => Columns.None<CostSheetKit>().Add(x => x.Section.ID);
  24. }
  25. [LookupDefinition(typeof(KitLookup))]
  26. [EntityRelationship(DeleteAction.SetNull)]
  27. public KitLink Kit { get; set; }
  28. [NullEditor]
  29. public long Sequence { get; set; }
  30. }
  31. }