IFixBJTestingPointDI.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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. namespace GDNXFD.Data
  10. {
  11. [Table("IFIXBJTESTINGPOINTDI2")]
  12. public class IFixBJTestingPointDI : INotifyPropertyChanged
  13. {
  14. #region 数据库映射
  15. private string _id;
  16. private string _stationId;
  17. private string _pointKey;
  18. private string _description;
  19. private string _area1;
  20. private string _area2;
  21. private string _area3;
  22. private string _area4;
  23. private string _levelId;
  24. private string _almext1;
  25. private string _almext2;
  26. [Column("ID")]
  27. public string Id
  28. {
  29. get { return _id; }
  30. set
  31. {
  32. _id = value;
  33. RaisePropertyChanged();
  34. }
  35. }
  36. [Column("STATIONID")]
  37. public string StationId
  38. {
  39. get { return _stationId; }
  40. set
  41. {
  42. _stationId = value;
  43. RaisePropertyChanged();
  44. }
  45. }
  46. [Column("POINTKEY")]
  47. public string PointKey
  48. {
  49. get { return _pointKey; }
  50. set
  51. {
  52. _pointKey = value;
  53. RaisePropertyChanged();
  54. }
  55. }
  56. [Column("DESCRIPTION")]
  57. public string Description
  58. {
  59. get { return _description; }
  60. set
  61. {
  62. _description = value;
  63. RaisePropertyChanged();
  64. }
  65. }
  66. [Column("AREA1")]
  67. public string Area1
  68. {
  69. get { return _area1; }
  70. set
  71. {
  72. _area1 = value;
  73. RaisePropertyChanged();
  74. }
  75. }
  76. [Column("AREA2")]
  77. public string Area2
  78. {
  79. get { return _area2; }
  80. set
  81. {
  82. _area2 = value;
  83. RaisePropertyChanged();
  84. }
  85. }
  86. [Column("AREA3")]
  87. public string Area3
  88. {
  89. get { return _area3; }
  90. set
  91. {
  92. _area3 = value;
  93. RaisePropertyChanged();
  94. }
  95. }
  96. [Column("AREA4")]
  97. public string Area4
  98. {
  99. get { return _area4; }
  100. set
  101. {
  102. _area4 = value;
  103. RaisePropertyChanged();
  104. }
  105. }
  106. [Column("LEVELID")]
  107. public string LevelId
  108. {
  109. get { return _levelId; }
  110. set
  111. {
  112. _levelId = value;
  113. RaisePropertyChanged();
  114. }
  115. }
  116. [Column("ALMEXT1")]
  117. public string AlmExt1
  118. {
  119. get { return _almext1; }
  120. set
  121. {
  122. _almext1 = value;
  123. RaisePropertyChanged();
  124. }
  125. }
  126. [Column("ALMEXT2")]
  127. public string AlmExt2
  128. {
  129. get { return _almext2; }
  130. set
  131. {
  132. _almext2 = value;
  133. RaisePropertyChanged();
  134. }
  135. }
  136. private bool _enabled;
  137. [Column("ENABLED")]
  138. public bool Enabled
  139. {
  140. get { return _enabled; }
  141. set
  142. {
  143. _enabled = value;
  144. RaisePropertyChanged();
  145. }
  146. }
  147. #endregion
  148. #region 辅助属性
  149. private string _tmp;
  150. [NotMapped]
  151. public string Category
  152. {
  153. get
  154. {
  155. if (_area1 == "GF")
  156. return "光伏";
  157. else
  158. return "升压站";
  159. }
  160. set
  161. {
  162. _tmp = value;
  163. if (_tmp == "光伏")
  164. _area1 = "GF";
  165. else
  166. _area1 = "SYZ";
  167. }
  168. }
  169. [NotMapped]
  170. public string Rank
  171. {
  172. get
  173. {
  174. if (_levelId == "1")
  175. return "低";
  176. else if (_levelId == "2")
  177. return "中低";
  178. else if (_levelId == "3")
  179. return "中";
  180. else if (_levelId == "4")
  181. return "中高";
  182. else if (_levelId == "5")
  183. return "高";
  184. return "中";
  185. }
  186. set
  187. {
  188. _tmp = value;
  189. if (_tmp == "低")
  190. _levelId = "1";
  191. else if (_tmp == "中低")
  192. _levelId = "2";
  193. else if (_tmp == "中")
  194. _levelId = "3";
  195. else if (_tmp == "中高")
  196. _levelId = "4";
  197. else if (_tmp == "高")
  198. _levelId = "5";
  199. else
  200. _levelId = "3";
  201. }
  202. }
  203. [NotMapped]
  204. public string StationName
  205. {
  206. get
  207. {
  208. switch(_stationId)
  209. {
  210. case "MHS_FDC":
  211. return "麻黄山风场";
  212. case "NSS_FDC":
  213. return "牛首山风场";
  214. case "QS_FDC":
  215. return "青山风场";
  216. case "SBQ_FDC":
  217. return "石板泉风场";
  218. case "XS_FDC":
  219. return "香山风场";
  220. case "DWK_GDC":
  221. return "大武口光伏电站";
  222. case "PL_GDC":
  223. return "平罗光伏电站";
  224. case "XH_GDC":
  225. return "宣和光伏电站";
  226. case "MCH_GDC":
  227. return "马场湖光伏电站";
  228. default:
  229. return "_stationId";
  230. }
  231. }
  232. set
  233. {
  234. _tmp = value;
  235. switch (_tmp)
  236. {
  237. case "麻黄山风场":
  238. _stationId = "MHS_FDC";
  239. break;
  240. case "牛首山风场":
  241. _stationId = "NSS_FDC";
  242. break;
  243. case "青山风场":
  244. _stationId = "QS_FDC";
  245. break;
  246. case "石板泉风场":
  247. _stationId = "SBQ_FDC";
  248. break;
  249. case "香山风场":
  250. _stationId = "XS_FDC";
  251. break;
  252. case "大武口光伏电站":
  253. _stationId = "DWK_GDC";
  254. break;
  255. case "平罗光伏电站":
  256. _stationId = "PL_GDC";
  257. break;
  258. case "宣和光伏电站":
  259. _stationId = "XH_GDC";
  260. break;
  261. case "马场湖光伏电站":
  262. _stationId = "MCH_GDC";
  263. break;
  264. default:
  265. break;
  266. }
  267. }
  268. }
  269. #endregion
  270. /// <summary>
  271. /// Property changed event
  272. /// </summary>
  273. public event PropertyChangedEventHandler PropertyChanged;
  274. private void RaisePropertyChanged([CallerMemberName] string caller = "")
  275. {
  276. if (PropertyChanged != null)
  277. {
  278. PropertyChanged(this, new PropertyChangedEventArgs(caller));
  279. }
  280. }
  281. }
  282. }