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; using System.Runtime.Serialization; using System.ServiceModel; using System.Drawing; namespace GDNXFD.Data { [DataContract] [Table("VIEW_ALERTHISTORY_NEW")] public class AlertInfo: INotifyPropertyChanged { [DataMember] [Column("ID")] public long Id { get; set; } [DataMember] [Column("ALERTTIME")] //报警时间 public DateTime AlertTime { get; set; } [DataMember] [Column("MESSAGETYPE")] //对象类型 public string MessageType { get; set; } [DataMember] [Column("SNAPID")] //报警内容 public long SnapID { get; set; } [DataMember] [Column("STATIONID")] public string StationId { get; set; } [DataMember] [Column("PROJECTID")] public string ProjectId { get; set; } [DataMember] [Column("LINEID")] public string LineId { get; set; } [DataMember] [Column("WINDTURBINEID")] public string WindturbineId { get; set; } [DataMember] [Column("ALERTVALUE")] //报警对应故障编码 public long AlertValue { get; set; } [DataMember] [Column("RANK")] //报警级别 public string Rank { get; set; } [DataMember] [Column("CATEGORY1")] public string Category1 { get; set; } [DataMember] [Column("CATEGORY2")] public string Category2 { get; set; } [DataMember] [Column("CATEGORY3")] public string Category3 { get; set; } [DataMember] [Column("ISOPENED")] public bool IsOpened { get; set; } [DataMember] [Column("ISCONFIRMED")] public bool IsConfirmed { get; set; } [DataMember] [Column("CONFIRMTIME")] public DateTime? ConfirmTime { get; set; } [DataMember] [Column("CONFIRMPERSON")] public string ConfirmPerson { get; set; } [DataMember] [Column("LASTUPDATETIME")] public DateTime? LastUpdateTime { get; set; } [DataMember] [Column("LASTUPDATEPERSON")] public string LastUpdatePerson { get; set; } [DataMember] [Column("LASTCLOSETIME")] public DateTime? LastCloseTime { get; set; } [DataMember] [Column("LASTCLOSEPERSON")] public string LastClosePerson { get; set; } [DataMember] [Column("STATIONNAME")] public string StationName { get; set; } [DataMember] [Column("PROJECTNAME")] public string ProjectName { get; set; } [DataMember] [Column("LINENAME")] public string LineName { get; set; } [DataMember] [Column("WINDTURBINENAME")] public string WindturbineName { get; set; } [DataMember] [Column("ALERTTEXT")] public string AlertText { get; set; } [DataMember] [Column("MODELID")] public string ModelId { get; set; } [DataMember] [Column("TESTINGPOINTKEY")] public string TestingPointKey { get; set; } [DataMember] [Column("IFIXPICTURE")] public string IFixPicture { get; set; } [DataMember] [Column("IFIXTAG")] public string IFixTag { get; set; } [DataMember] [Column("DATAINFO")] public string DataInfo { get; set; } /// /// Property changed event /// public event PropertyChangedEventHandler PropertyChanged; private void RaisePropertyChanged([CallerMemberName] string caller = "") { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(caller)); } } public string ObjectName { get { if (Category1 == "custom") { switch (Category2) { case "1": return WindturbineName; case "2": return StationName; case "3": return ProjectName; case "4": return LineName; case "5": return StationName; default: return "未知"; } } else if (Category1 == "windturbine") return WindturbineName; else return StationName; } } public string ObjectId { get { if (Category1 == "custom") { switch (Category2) { case "1": return WindturbineId; case "2": return StationId; case "3": return ProjectId; case "4": return LineId; case "5": return StationId; default: return ""; } } else if (Category1 == "windturbine") return WindturbineId; else return StationId; } } public string BackColor { get { if (IsOpened == true && IsConfirmed == false) { if (Rank == "4") return "#FFFF00"; else if (Rank == "5") return "#FF0000"; else return null; } else return null; } } public Color getBackGroundColor() { if (IsOpened == true && IsConfirmed == false) { if (Rank == "4") return Color.Yellow; else if (Rank == "5") return Color.Red; else return Color.White; } else return Color.White; } public string RankName { get { switch (Rank) { case "1": return "低"; case "2": return "中低"; case "3": return "中"; case "4": return "中高"; case "5": return "高"; default: return "低"; } } } public string CategoryName { get { switch (Category1) { case "custom": return "自定义"; case "windturbine": return "风机"; case "SYZ": return "升压站"; case "GF": return "光伏"; default: return "未知"; } } } } }