diff --git a/FrontendWebApi/ApiControllers/AlertController.cs b/FrontendWebApi/ApiControllers/AlertController.cs index 5f752fa..11be331 100644 --- a/FrontendWebApi/ApiControllers/AlertController.cs +++ b/FrontendWebApi/ApiControllers/AlertController.cs @@ -121,11 +121,11 @@ namespace FrontendWebApi.ApiControllers cell = row.CreateCell(i); if (i == 0) { - cell.SetCellValue(a.building_tag + a.floor_tag); + cell.SetCellValue(a.buildingFloorName); } if (i == 1) { - cell.SetCellValue(a.error_code); + cell.SetCellValue(a.uuid); } if (i == 2) { @@ -133,19 +133,19 @@ namespace FrontendWebApi.ApiControllers } if (i == 3) { - cell.SetCellValue(a.error_type); + cell.SetCellValue(a.alarmClass); } if (i == 4) { - cell.SetCellValue(a.device_number); + cell.SetCellValue(a.sourceName_zh); } if (i == 5) { - cell.SetCellValue(a.error_reason); + cell.SetCellValue(a.msgText); } if (i == 6) { - cell.SetCellValue(a.ACKconfirm); + cell.SetCellValue(a.ackState_zh); } if (i == 7) { diff --git a/FrontendWebApi/Models/Alert.cs b/FrontendWebApi/Models/Alert.cs index b287da2..d09c89c 100644 --- a/FrontendWebApi/Models/Alert.cs +++ b/FrontendWebApi/Models/Alert.cs @@ -1,14 +1,32 @@ -namespace FrontendWebApi.Models +using System; +using System.Collections.Generic; + +namespace FrontendWebApi.Models { - public class Alert : Actor + public class Alert { - public string building_tag { get; set; } - public string floor_tag { get; set; } - public string error_code { get; set; } - public string error_type { get; set; } - public string device_number { get; set; } - public string error_reason { get; set; } - public string ACKconfirm { get; set; } + public string buildingFloorName { get; set; } //building_name and floor_name + public string uuid { get; set; } //error_code + public string alarmClass { get; set; } //error_type + public string msgText { get; set; } //error_reason + public string sourceName_zh { get; set; } //device_number + public string ackState { get; set; } //ACKconfirm: Acked/Unacked + public DateTime timestamp { get; set; }//發生時間 occur time public string formId { get; set; } + public string ackState_zh + { + get + { + Dictionary name = new Dictionary() + { + { "Acked" , "確認" }, + { "Unacked" , "未確認" } + }; + return name[ackState]; + } + } + + public string created_at { get { return timestamp.ToString(); } set { } } + public string Created_at { get { return Convert.ToDateTime(created_at).ToString("yyyy-MM-dd HH:mm:ss"); } set { created_at = value; } } //發生時間顯示 } }