Event.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using Expressive;
  2. using InABox.Clients;
  3. using InABox.Core;
  4. using System;
  5. using System.Collections;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading;
  10. namespace Comal.Classes
  11. {
  12. public enum EventType
  13. {
  14. AfterSave,
  15. Scheduled
  16. }
  17. public class Event : Entity, IRemotable, IPersistent, ILicense<CoreLicense>
  18. {
  19. [UniqueCodeEditor]
  20. [EditorSequence(1)]
  21. public string Code { get; set; } = "";
  22. [TextBoxEditor]
  23. [EditorSequence(2)]
  24. public string Description { get; set; } = "";
  25. [EditorSequence(3)]
  26. public EventType EventType { get; set; }
  27. /// <summary>
  28. /// Serialised event data.
  29. /// </summary>
  30. [NullEditor]
  31. public string Data { get; set; } = "";
  32. [EditorSequence(4)]
  33. [ExpressionEditor(null)]
  34. public string NotificationExpression { get; set; } = "";
  35. [Comment("Sets whether notifications are automatically sent when the event triggers. If false, the notifications must be manually sent by the event actions.")]
  36. [EditorSequence(5)]
  37. public bool NotificationsEnabled { get; set; } = true;
  38. [EditorSequence(6)]
  39. public bool Enabled { get; set; } = true;
  40. [Comment("Marks whether non-managers (users without the CanManageEvents security token) can view this event.")]
  41. [EditorSequence(7)]
  42. public bool Visible { get; set; } = true;
  43. static Event()
  44. {
  45. DefaultColumns.Add<Event>(x => x.Code);
  46. DefaultColumns.Add<Event>(x => x.Description);
  47. DefaultColumns.Add<Event>(x => x.EventType);
  48. }
  49. }
  50. public class EventLink : EntityLink<Event>
  51. {
  52. [CodePopupEditor(typeof(Event))]
  53. public override Guid ID { get; set; }
  54. public string Code { get; set; }
  55. public string Description { get; set; }
  56. }
  57. }