2024-07-04 11:02:45 +05:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
2021-04-02 17:28:07 +05:00
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
2021-04-23 10:21:25 +05:00
|
|
|
using System.Text.Json.Serialization;
|
2021-04-02 17:28:07 +05:00
|
|
|
|
|
|
|
namespace AsbCloudDb.Model
|
|
|
|
{
|
2021-08-10 15:53:11 +05:00
|
|
|
[Table("t_telemetry_event"), Comment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии.")]
|
|
|
|
public partial class TelemetryEvent
|
2021-04-02 17:28:07 +05:00
|
|
|
{
|
|
|
|
[Column("id_event")]
|
2021-04-23 10:21:25 +05:00
|
|
|
public int IdEvent { get; set; }
|
|
|
|
|
|
|
|
[Column("id_telemetry")]
|
|
|
|
public int IdTelemetry { get; set; }
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
[ForeignKey(nameof(IdTelemetry))]
|
|
|
|
[InverseProperty(nameof(Model.Telemetry.Events))]
|
2023-02-20 15:06:26 +05:00
|
|
|
public virtual Telemetry Telemetry { get; set; } = null!;
|
2021-04-23 10:21:25 +05:00
|
|
|
|
2021-04-02 17:28:07 +05:00
|
|
|
[Column("id_category")]
|
2021-04-23 10:21:25 +05:00
|
|
|
public int IdCategory { get; set; }
|
|
|
|
|
2021-04-02 17:28:07 +05:00
|
|
|
[Column("message_template")]
|
2023-02-20 15:06:26 +05:00
|
|
|
public string MessageTemplate { get; set; } = string.Empty;
|
2021-04-23 10:21:25 +05:00
|
|
|
|
2021-08-10 15:53:11 +05:00
|
|
|
public string MakeMessageText(TelemetryMessage message)
|
2021-04-23 10:21:25 +05:00
|
|
|
{
|
2023-02-20 15:06:26 +05:00
|
|
|
var args = new string?[] { message.Arg0, message.Arg1, message.Arg2, message.Arg3 };
|
2021-04-23 10:21:25 +05:00
|
|
|
return string.Format(MessageTemplate, args);
|
|
|
|
}
|
2021-04-02 17:28:07 +05:00
|
|
|
}
|
|
|
|
}
|