AlertInfo.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.ComponentModel.DataAnnotations.Schema;
  5. using System.Linq;
  6. using System.Runtime.CompilerServices;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Runtime.Serialization;
  10. using System.ServiceModel;
  11. using System.Drawing;
  12. namespace GDNXFD.Data
  13. {
  14. [DataContract]
  15. [Table("VIEW_ALERTHISTORY_NEW")]
  16. public class AlertInfo: INotifyPropertyChanged
  17. {
  18. [DataMember]
  19. [Column("ID")]
  20. public long Id { get; set; }
  21. [DataMember]
  22. [Column("ALERTTIME")] //报警时间
  23. public DateTime AlertTime { get; set; }
  24. [DataMember]
  25. [Column("MESSAGETYPE")] //对象类型
  26. public string MessageType { get; set; }
  27. [DataMember]
  28. [Column("SNAPID")] //报警内容
  29. public long SnapID { get; set; }
  30. [DataMember]
  31. [Column("STATIONID")]
  32. public string StationId { get; set; }
  33. [DataMember]
  34. [Column("PROJECTID")]
  35. public string ProjectId { get; set; }
  36. [DataMember]
  37. [Column("LINEID")]
  38. public string LineId { get; set; }
  39. [DataMember]
  40. [Column("WINDTURBINEID")]
  41. public string WindturbineId { get; set; }
  42. [DataMember]
  43. [Column("ALERTVALUE")] //报警对应故障编码
  44. public long AlertValue { get; set; }
  45. [DataMember]
  46. [Column("RANK")] //报警级别
  47. public string Rank { get; set; }
  48. [DataMember]
  49. [Column("CATEGORY1")]
  50. public string Category1 { get; set; }
  51. [DataMember]
  52. [Column("CATEGORY2")]
  53. public string Category2 { get; set; }
  54. [DataMember]
  55. [Column("CATEGORY3")]
  56. public string Category3 { get; set; }
  57. [DataMember]
  58. [Column("ISOPENED")]
  59. public bool IsOpened { get; set; }
  60. [DataMember]
  61. [Column("ISCONFIRMED")]
  62. public bool IsConfirmed { get; set; }
  63. [DataMember]
  64. [Column("CONFIRMTIME")]
  65. public DateTime? ConfirmTime { get; set; }
  66. [DataMember]
  67. [Column("CONFIRMPERSON")]
  68. public string ConfirmPerson { get; set; }
  69. [DataMember]
  70. [Column("LASTUPDATETIME")]
  71. public DateTime? LastUpdateTime { get; set; }
  72. [DataMember]
  73. [Column("LASTUPDATEPERSON")]
  74. public string LastUpdatePerson { get; set; }
  75. [DataMember]
  76. [Column("LASTCLOSETIME")]
  77. public DateTime? LastCloseTime { get; set; }
  78. [DataMember]
  79. [Column("LASTCLOSEPERSON")]
  80. public string LastClosePerson { get; set; }
  81. [DataMember]
  82. [Column("STATIONNAME")]
  83. public string StationName { get; set; }
  84. [DataMember]
  85. [Column("PROJECTNAME")]
  86. public string ProjectName { get; set; }
  87. [DataMember]
  88. [Column("LINENAME")]
  89. public string LineName { get; set; }
  90. [DataMember]
  91. [Column("WINDTURBINENAME")]
  92. public string WindturbineName { get; set; }
  93. [DataMember]
  94. [Column("ALERTTEXT")]
  95. public string AlertText { get; set; }
  96. [DataMember]
  97. [Column("MODELID")]
  98. public string ModelId { get; set; }
  99. [DataMember]
  100. [Column("TESTINGPOINTKEY")]
  101. public string TestingPointKey { get; set; }
  102. [DataMember]
  103. [Column("IFIXPICTURE")]
  104. public string IFixPicture { get; set; }
  105. [DataMember]
  106. [Column("IFIXTAG")]
  107. public string IFixTag { get; set; }
  108. [DataMember]
  109. [Column("DATAINFO")]
  110. public string DataInfo { get; set; }
  111. /// <summary>
  112. /// Property changed event
  113. /// </summary>
  114. public event PropertyChangedEventHandler PropertyChanged;
  115. private void RaisePropertyChanged([CallerMemberName] string caller = "")
  116. {
  117. if (PropertyChanged != null)
  118. {
  119. PropertyChanged(this, new PropertyChangedEventArgs(caller));
  120. }
  121. }
  122. public string ObjectName
  123. {
  124. get
  125. {
  126. if (Category1 == "custom")
  127. {
  128. switch (Category2)
  129. {
  130. case "1":
  131. return WindturbineName;
  132. case "2":
  133. return StationName;
  134. case "3":
  135. return ProjectName;
  136. case "4":
  137. return LineName;
  138. case "5":
  139. return StationName;
  140. default:
  141. return "未知";
  142. }
  143. }
  144. else if (Category1 == "windturbine")
  145. return WindturbineName;
  146. else
  147. return StationName;
  148. }
  149. }
  150. public string ObjectId
  151. {
  152. get
  153. {
  154. if (Category1 == "custom")
  155. {
  156. switch (Category2)
  157. {
  158. case "1":
  159. return WindturbineId;
  160. case "2":
  161. return StationId;
  162. case "3":
  163. return ProjectId;
  164. case "4":
  165. return LineId;
  166. case "5":
  167. return StationId;
  168. default:
  169. return "";
  170. }
  171. }
  172. else if (Category1 == "windturbine")
  173. return WindturbineId;
  174. else
  175. return StationId;
  176. }
  177. }
  178. public string BackColor
  179. {
  180. get
  181. {
  182. if (IsOpened == true && IsConfirmed == false)
  183. {
  184. if (Rank == "4")
  185. return "#FFFF00";
  186. else if (Rank == "5")
  187. return "#FF0000";
  188. else
  189. return null;
  190. }
  191. else
  192. return null;
  193. }
  194. }
  195. public Color getBackGroundColor()
  196. {
  197. if (IsOpened == true && IsConfirmed == false)
  198. {
  199. if (Rank == "4")
  200. return Color.Yellow;
  201. else if (Rank == "5")
  202. return Color.Red;
  203. else
  204. return Color.White;
  205. }
  206. else
  207. return Color.White;
  208. }
  209. public string RankName
  210. {
  211. get
  212. {
  213. switch (Rank)
  214. {
  215. case "1":
  216. return "低";
  217. case "2":
  218. return "中低";
  219. case "3":
  220. return "中";
  221. case "4":
  222. return "中高";
  223. case "5":
  224. return "高";
  225. default:
  226. return "低";
  227. }
  228. }
  229. }
  230. public string CategoryName
  231. {
  232. get
  233. {
  234. switch (Category1)
  235. {
  236. case "custom":
  237. return "自定义";
  238. case "windturbine":
  239. return "风机";
  240. case "SYZ":
  241. return "升压站";
  242. case "GF":
  243. return "光伏";
  244. default:
  245. return "未知";
  246. }
  247. }
  248. }
  249. }
  250. }