Notification.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq.Expressions;
  4. using InABox.Core;
  5. namespace Comal.Classes
  6. {
  7. [UserTracking("Notifications")]
  8. public class Notification : Entity, IRemotable, IPersistent, IOneToMany<Job>, ILicense<CoreLicense>
  9. {
  10. [EditorSequence(1)]
  11. [DateTimeEditor(Editable = Editable.Hidden)]
  12. public override DateTime Created
  13. {
  14. get => base.Created;
  15. set => base.Created = value;
  16. }
  17. [EditorSequence(2)]
  18. public EmployeeLink Sender { get; set; }
  19. [EditorSequence(3)]
  20. public EmployeeLink Employee { get; set; }
  21. [EditorSequence(4)]
  22. public JobLink Job { get; set; }
  23. [EditorSequence(5)]
  24. [TextBoxEditor]
  25. public string Title { get; set; }
  26. [EditorSequence(6)]
  27. [RichTextEditor]
  28. public string Description { get; set; }
  29. [EditorSequence(7)]
  30. [TimestampEditor]
  31. public DateTime Closed { get; set; }
  32. [NullEditor]
  33. public string EntityType { get; set; }
  34. [NullEditor]
  35. public Guid EntityID { get; set; }
  36. private class DocumentCountFormula : ComplexFormulaGenerator<Notification, int>
  37. {
  38. public override IComplexFormulaNode<Notification, int> GetFormula() =>
  39. Count<NotificationDocument, Guid>(x => x.Property(x => x.ID)).WithLink(x => x.Entity.ID, x => x.ID);
  40. }
  41. [NullEditor]
  42. [ComplexFormula(typeof(DocumentCountFormula))]
  43. public int DocumentCount { get; set; }
  44. }
  45. }