EventItem.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Runtime.Serialization;
  6. using Aitex.Core.Util;
  7. namespace Aitex.Core.RT.Event
  8. {
  9. [DataContract]
  10. [Serializable]
  11. public enum EventLevel
  12. {
  13. [EnumMember]
  14. Information = 0,
  15. [EnumMember]
  16. Warning,
  17. [EnumMember]
  18. Alarm
  19. }
  20. [DataContract]
  21. [Serializable]
  22. public enum EventType
  23. {
  24. /// <summary>
  25. /// 在TopView显示一条记录
  26. /// </summary>
  27. [EnumMember]
  28. EventUI_Notify,
  29. /// <summary>
  30. /// 弹出对话框
  31. /// </summary>
  32. [EnumMember]
  33. Dialog_Nofity,
  34. /// <summary>
  35. ///
  36. /// </summary>
  37. [EnumMember]
  38. KickOut_Notify,
  39. /// <summary>
  40. ///
  41. /// </summary>
  42. [EnumMember]
  43. Sound_Notify,
  44. /// <summary>
  45. /// 在屏幕左下角弹出一个提醒的悬浮窗口,自动消失
  46. /// </summary>
  47. [EnumMember]
  48. UIMessage_Notify,
  49. [EnumMember]
  50. OperationLog,
  51. [EnumMember]
  52. HostNotification,
  53. }
  54. [DataContract]
  55. [Serializable]
  56. public class EventItem
  57. {
  58. [DataMember]
  59. public int Id { get; set; }
  60. [DataMember]
  61. public string EventEnum { get; set; } //
  62. [DataMember]
  63. public EventType Type { get; set; }
  64. [DataMember]
  65. public EventLevel Level { get; set; }
  66. [DataMember]
  67. public string Source { get; set; } //Which module send out this event
  68. [DataMember]
  69. public string Description { get; set; } //detail text
  70. [DataMember]
  71. public DateTime OccuringTime { get; set; } //
  72. [DataMember]
  73. public bool IsAcknowledged { get; set; }
  74. [DataMember]
  75. public string Explaination { get; set; }
  76. [DataMember]
  77. public string Solution { get; set; }
  78. [DataMember]
  79. public string GlobalDescription_en
  80. {
  81. get;
  82. set;
  83. }
  84. [DataMember]
  85. public string GlobalDescription_zh
  86. {
  87. get;
  88. set;
  89. }
  90. [DataMember]
  91. public SerializableDictionary<string, string> DVID
  92. {
  93. get;
  94. set;
  95. }
  96. public SerializableDictionary<string, object> ObjDVID
  97. {
  98. get;
  99. set;
  100. }
  101. public EventItem Clone()
  102. {
  103. EventItem result = new EventItem();
  104. result.Description = Description;
  105. result.EventEnum = EventEnum;
  106. result.Explaination = Explaination;
  107. result.Id = Id;
  108. result.IsAcknowledged = IsAcknowledged;
  109. result.Level = Level;
  110. result.OccuringTime = OccuringTime;
  111. result.Solution = Solution;
  112. result.Source = Source;
  113. result.Type = Type;
  114. result.GlobalDescription_en = GlobalDescription_en;
  115. result.GlobalDescription_zh = GlobalDescription_zh;
  116. result.DVID = DVID;
  117. result.ObjDVID = ObjDVID;
  118. return result;
  119. }
  120. public EventItem Clone(SerializableDictionary<string, object> objDvid)
  121. {
  122. EventItem result = new EventItem();
  123. result.Description = Description;
  124. result.EventEnum = EventEnum;
  125. result.Explaination = Explaination;
  126. result.Id = Id;
  127. result.IsAcknowledged = IsAcknowledged;
  128. result.Level = Level;
  129. result.OccuringTime = OccuringTime;
  130. result.Solution = Solution;
  131. result.Source = Source;
  132. result.Type = Type;
  133. result.GlobalDescription_en = GlobalDescription_en;
  134. result.GlobalDescription_zh = GlobalDescription_zh;
  135. result.DVID = DVID;
  136. result.ObjDVID = objDvid;
  137. return result;
  138. }
  139. public EventItem()
  140. {
  141. }
  142. public EventItem (string name )
  143. : this(0, "System", name, "", EventLevel.Information, EventType.EventUI_Notify)
  144. {
  145. }
  146. public EventItem(string name, string description)
  147. : this(0, "System", name, description, EventLevel.Information, EventType.EventUI_Notify)
  148. {
  149. }
  150. public EventItem(string source, string name, string description)
  151. :this(0, source,name,description, EventLevel.Information, EventType.EventUI_Notify)
  152. {
  153. }
  154. public EventItem(string name, EventType type, EventLevel level)
  155. : this(0,"System", name, "", level, type)
  156. {
  157. }
  158. public EventItem(string source, string name, string description, EventLevel level, EventType type)
  159. : this (0, source,name, description, level, type)
  160. {
  161. }
  162. public EventItem(int id, string source, string name, string description, EventLevel level, EventType type)
  163. {
  164. EventEnum = name;
  165. Type = type;
  166. Level = level;
  167. Source = source;
  168. Description = description;
  169. Id = id;
  170. }
  171. }
  172. }