/
agontar
/
TOROS
Обзор
Документация
Войти
/
agontar
/
TOROS
Код
Запросы
0
Задачи
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Webapplication_new/Models/Sensor.cs
79 строк
4 KB
gav
initial upload
17 сен 2024, 16:04
17 сен 2024, 16:04
356ccc9
Код
Авторство
О чём код?
using System.ComponentModel.DataAnnotations; namespace WebApplication1.Models { public class Sensor { public int SensorId { get; set; } [Display(Name = "ID датчика")] public string id { get; set; } = string.Empty; [Display(Name = "Имя датчика")] public string SensorName { get; set; } = string.Empty; [Display(Name = "IP адрес")] public string SensorIP { get; set; } = string.Empty; [Display(Name = "Тип")] public string SensorType { get; set; } = string.Empty; [Display(Name = "Напряжение батареи, вольт")] [DisplayFormat(DataFormatString = "{0:N}", ApplyFormatInEditMode = true)] public float Voltage { get; set; } [Display(Name = "Температура, °С")] [DisplayFormat(DataFormatString = "{0:N1}", ApplyFormatInEditMode = true)] public float Temperature { get; set; } [Display(Name = "Виброускорение Х, м/с²")] [DisplayFormat(DataFormatString = "{0:N}", ApplyFormatInEditMode = true)] public float X_VA { get; set; } [Display(Name = "Виброускорение Y, м/с²")] [DisplayFormat(DataFormatString = "{0:N}", ApplyFormatInEditMode = true)] public float Y_VA { get; set; } [Display(Name = "Виброускорение Z, м/с²")] [DisplayFormat(DataFormatString = "{0:N}", ApplyFormatInEditMode = true)] public float Z_VA { get; set; } [Display(Name = "Виброскорость X, мм/с")] [DisplayFormat(DataFormatString = "{0:N}", ApplyFormatInEditMode = true)] public float X_VS { get; set; } [Display(Name = "Виброскорость Y, мм/с")] [DisplayFormat(DataFormatString = "{0:N}", ApplyFormatInEditMode = true)] public float Y_VS { get; set; } [Display(Name = "Виброскорость Z, мм/с")] [DisplayFormat(DataFormatString = "{0:N}", ApplyFormatInEditMode = true)] public float Z_VS { get; set; } [Display(Name = "Вибросмещение X, мкм")] [DisplayFormat(DataFormatString = "{0:N}", ApplyFormatInEditMode = true)] public float X_VM { get; set; } [Display(Name = "Вибросмещение Y, мкм")] [DisplayFormat(DataFormatString = "{0:N}", ApplyFormatInEditMode = true)] public float Y_VM { get; set; } [Display(Name = "Вибросмещение Z, мкм")] [DisplayFormat(DataFormatString = "{0:N}", ApplyFormatInEditMode = true)] public float Z_VM { get; set; } [Display(Name = "Мощность, -dBm")] [DisplayFormat(DataFormatString = "{0:N1}", ApplyFormatInEditMode = true)] public float Power { get; set; } [Display(Name = "Фильтр")] public byte[] Filter { get; set; } = new byte[1]; [Display(Name = "Часы последнего сбора данных")] public byte HH { get; set; } [Display(Name = "Минуты последнего сбора данных")] public byte MM { get; set; } public string PointColor { get; set; } = "green"; public DateTime date_time { get; set; } public string DispInfo { get; set; } = string.Empty; public string GetColor(float value) { if (value > 3) { return "green"; } else if (value >= 2.5f) { return "yellow"; } else return "black"; } } }