Notification.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 NotificationDocumentCount : CoreAggregate<Notification, NotificationDocument, Guid>
  8. {
  9. public override Expression<Func<NotificationDocument, Guid>> Aggregate => x => x.ID;
  10. public override AggregateCalculation Calculation => AggregateCalculation.Count;
  11. public override Dictionary<Expression<Func<NotificationDocument, object>>, Expression<Func<Notification, object>>> Links =>
  12. new Dictionary<Expression<Func<NotificationDocument, object>>, Expression<Func<Notification, object>>>()
  13. {
  14. { NotificationDocument => NotificationDocument.EntityLink.ID, Notification => Notification.ID }
  15. };
  16. }
  17. [UserTracking("Notifications")]
  18. public class Notification : Entity, IRemotable, IPersistent, IOneToMany<Job>, ILicense<CoreLicense>
  19. {
  20. [EditorSequence(1)]
  21. [DateTimeEditor(Editable = Editable.Hidden)]
  22. public override DateTime Created { get; set; }
  23. [EditorSequence(2)]
  24. public EmployeeLink Sender { get; set; }
  25. [EditorSequence(3)]
  26. public EmployeeLink Employee { get; set; }
  27. [EditorSequence(4)]
  28. public JobLink Job { get; set; }
  29. [EditorSequence(5)]
  30. [TextBoxEditor]
  31. public string Title { get; set; }
  32. [EditorSequence(6)]
  33. [RichTextEditor]
  34. public string Description { get; set; }
  35. [EditorSequence(7)]
  36. [TimestampEditor]
  37. public DateTime Closed { get; set; }
  38. [Obsolete("Replaced with Type+EntityID")]
  39. [NullEditor]
  40. public DeliveryLink Delivery { get; set; }
  41. [Obsolete("Replaced with Type+EntityID")]
  42. [NullEditor]
  43. public KanbanLink Kanban { get; set; }
  44. [Obsolete("Replaced with Type+EntityID")]
  45. [NullEditor]
  46. public SetoutLink Setout { get; set; }
  47. [Obsolete("Replaced with Type+EntityID")]
  48. [NullEditor]
  49. public RequisitionLink Requisition { get; set; }
  50. [Obsolete("Replaced with Type+EntityID")]
  51. [NullEditor]
  52. public LeaveRequestLink LeaveRequestLink { get; set; }
  53. [NullEditor]
  54. public string EntityType { get; set; }
  55. [NullEditor]
  56. public Guid EntityID { get; set; }
  57. [NullEditor]
  58. [Aggregate(typeof(NotificationDocumentCount))]
  59. public int DocumentCount { get; set; }
  60. protected override void Init()
  61. {
  62. base.Init();
  63. Employee = new EmployeeLink();
  64. Sender = new EmployeeLink();
  65. Job = new JobLink();
  66. Delivery = new DeliveryLink();
  67. Kanban = new KanbanLink();
  68. Setout = new SetoutLink();
  69. Requisition = new RequisitionLink();
  70. LeaveRequestLink = new LeaveRequestLink();
  71. }
  72. }
  73. }