Notification.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. [Obsolete("Replaced with Type+EntityID")]
  33. [NullEditor]
  34. public DeliveryLink Delivery { get; set; }
  35. [Obsolete("Replaced with Type+EntityID")]
  36. [NullEditor]
  37. public KanbanLink Kanban { get; set; }
  38. [Obsolete("Replaced with Type+EntityID")]
  39. [NullEditor]
  40. public SetoutLink Setout { get; set; }
  41. [Obsolete("Replaced with Type+EntityID")]
  42. [NullEditor]
  43. public RequisitionLink Requisition { get; set; }
  44. [Obsolete("Replaced with Type+EntityID")]
  45. [NullEditor]
  46. public LeaveRequestLink LeaveRequestLink { get; set; }
  47. [NullEditor]
  48. public string EntityType { get; set; }
  49. [NullEditor]
  50. public Guid EntityID { get; set; }
  51. private class DocumentCountFormula : ComplexFormulaGenerator<Notification, int>
  52. {
  53. public override IComplexFormulaNode<Notification, int> GetFormula() =>
  54. Count<NotificationDocument, Guid>(x => x.Property(x => x.ID)).WithLink(x => x.EntityLink.ID, x => x.ID);
  55. }
  56. [NullEditor]
  57. [ComplexFormula(typeof(DocumentCountFormula))]
  58. public int DocumentCount { get; set; }
  59. }
  60. }