CostSheet.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq.Expressions;
  4. using InABox.Core;
  5. namespace Comal.Classes
  6. {
  7. public class CostSheetDocumentCount : CoreAggregate<CostSheet, CostSheetDocument, Guid>
  8. {
  9. public override Expression<Func<CostSheetDocument, Guid>> Aggregate => x => x.ID;
  10. public override AggregateCalculation Calculation => AggregateCalculation.Count;
  11. public override Dictionary<Expression<Func<CostSheetDocument, object>>, Expression<Func<CostSheet, object>>> Links =>
  12. new Dictionary<Expression<Func<CostSheetDocument, object>>, Expression<Func<CostSheet, object>>>()
  13. {
  14. { CostSheetDocument => CostSheetDocument.EntityLink.ID, Delivery => Delivery.ID }
  15. };
  16. }
  17. [UserTracking(typeof(Quote))]
  18. public class CostSheet : Entity, ICostSheet, IRemotable, IPersistent, IIssues, ILicense<QuotesManagementLicense>
  19. {
  20. [EntityRelationship(DeleteAction.SetNull)]
  21. [EditorSequence(3)]
  22. public CostSheetTypeLink Type { get; set; }
  23. [EntityRelationship(DeleteAction.SetNull)]
  24. [EditorSequence(4)]
  25. public CostSheetBrandLink Brand { get; set; }
  26. [CheckBoxEditor]
  27. [EditorSequence(5)]
  28. public bool Active { get; set; } = true;
  29. [Aggregate(typeof(CostSheetDocumentCount))]
  30. [IntegerEditor(Editable = Editable.Hidden)]
  31. [EditorSequence(6)]
  32. public int Documents { get; set; }
  33. [UniqueCodeEditor(Visible = Visible.Default, Editable = Editable.Enabled)]
  34. [EditorSequence(1)]
  35. public string Code { get; set; }
  36. [TextBoxEditor]
  37. [EditorSequence(2)]
  38. public string Description { get; set; }
  39. [NullEditor]
  40. public string Issues { get; set; }
  41. public override string ToString()
  42. {
  43. return string.Format("{0}: {1}", Code, Description);
  44. }
  45. }
  46. }