using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; namespace GDNXFD.Data { [Table("IFIXBJTESTINGPOINTDI2")] public class IFixBJTestingPointDI : INotifyPropertyChanged { #region 数据库映射 private string _id; private string _stationId; private string _pointKey; private string _description; private string _area1; private string _area2; private string _area3; private string _area4; private string _levelId; private string _almext1; private string _almext2; [Column("ID")] public string Id { get { return _id; } set { _id = value; RaisePropertyChanged(); } } [Column("STATIONID")] public string StationId { get { return _stationId; } set { _stationId = value; RaisePropertyChanged(); } } [Column("POINTKEY")] public string PointKey { get { return _pointKey; } set { _pointKey = value; RaisePropertyChanged(); } } [Column("DESCRIPTION")] public string Description { get { return _description; } set { _description = value; RaisePropertyChanged(); } } [Column("AREA1")] public string Area1 { get { return _area1; } set { _area1 = value; RaisePropertyChanged(); } } [Column("AREA2")] public string Area2 { get { return _area2; } set { _area2 = value; RaisePropertyChanged(); } } [Column("AREA3")] public string Area3 { get { return _area3; } set { _area3 = value; RaisePropertyChanged(); } } [Column("AREA4")] public string Area4 { get { return _area4; } set { _area4 = value; RaisePropertyChanged(); } } [Column("LEVELID")] public string LevelId { get { return _levelId; } set { _levelId = value; RaisePropertyChanged(); } } [Column("ALMEXT1")] public string AlmExt1 { get { return _almext1; } set { _almext1 = value; RaisePropertyChanged(); } } [Column("ALMEXT2")] public string AlmExt2 { get { return _almext2; } set { _almext2 = value; RaisePropertyChanged(); } } private bool _enabled; [Column("ENABLED")] public bool Enabled { get { return _enabled; } set { _enabled = value; RaisePropertyChanged(); } } #endregion #region 辅助属性 private string _tmp; [NotMapped] public string Category { get { if (_area1 == "GF") return "光伏"; else return "升压站"; } set { _tmp = value; if (_tmp == "光伏") _area1 = "GF"; else _area1 = "SYZ"; } } [NotMapped] public string Rank { get { if (_levelId == "1") return "低"; else if (_levelId == "2") return "中低"; else if (_levelId == "3") return "中"; else if (_levelId == "4") return "中高"; else if (_levelId == "5") return "高"; return "中"; } set { _tmp = value; if (_tmp == "低") _levelId = "1"; else if (_tmp == "中低") _levelId = "2"; else if (_tmp == "中") _levelId = "3"; else if (_tmp == "中高") _levelId = "4"; else if (_tmp == "高") _levelId = "5"; else _levelId = "3"; } } [NotMapped] public string StationName { get { switch(_stationId) { case "MHS_FDC": return "麻黄山风场"; case "NSS_FDC": return "牛首山风场"; case "QS_FDC": return "青山风场"; case "SBQ_FDC": return "石板泉风场"; case "XS_FDC": return "香山风场"; case "DWK_GDC": return "大武口光伏电站"; case "PL_GDC": return "平罗光伏电站"; case "XH_GDC": return "宣和光伏电站"; case "MCH_GDC": return "马场湖光伏电站"; default: return "_stationId"; } } set { _tmp = value; switch (_tmp) { case "麻黄山风场": _stationId = "MHS_FDC"; break; case "牛首山风场": _stationId = "NSS_FDC"; break; case "青山风场": _stationId = "QS_FDC"; break; case "石板泉风场": _stationId = "SBQ_FDC"; break; case "香山风场": _stationId = "XS_FDC"; break; case "大武口光伏电站": _stationId = "DWK_GDC"; break; case "平罗光伏电站": _stationId = "PL_GDC"; break; case "宣和光伏电站": _stationId = "XH_GDC"; break; case "马场湖光伏电站": _stationId = "MCH_GDC"; break; default: break; } } } #endregion /// /// Property changed event /// public event PropertyChangedEventHandler PropertyChanged; private void RaisePropertyChanged([CallerMemberName] string caller = "") { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(caller)); } } } }