85 lines
2.6 KiB
C#
85 lines
2.6 KiB
C#
using DTS.Common.Enums;
|
|
using DTS.Common.Interface.Sensors;
|
|
using DTS.Common.Interface.Tags;
|
|
using DTS.Common.Utilities.Logging;
|
|
using System;
|
|
using System.Data;
|
|
|
|
namespace DTS.Common.Classes.Sensors
|
|
{
|
|
public class ThermocouplerRecord : TagAwareBase, IThermocouplerRecord
|
|
{
|
|
public override TagTypes TagType => TagTypes.Sensors;
|
|
private int _id;
|
|
public int Id
|
|
{
|
|
get => _id;
|
|
set => SetProperty(ref _id, value, "Id");
|
|
}
|
|
private string _serialNumber;
|
|
public string SerialNumber
|
|
{
|
|
get => _serialNumber;
|
|
set => SetProperty(ref _serialNumber, value, "SerialNumber");
|
|
}
|
|
private DateTime _lastModified;
|
|
public DateTime LastModified
|
|
{
|
|
get => _lastModified;
|
|
set => SetProperty(ref _lastModified, value, "LastModified");
|
|
}
|
|
private string _lastUpdatedBy;
|
|
public string LastUpdatedBy
|
|
{
|
|
get => _lastUpdatedBy;
|
|
set => SetProperty(ref _lastUpdatedBy, value, "LastUpdatedBy");
|
|
}
|
|
|
|
private bool _doNotUse;
|
|
public bool DoNotUse
|
|
{
|
|
get => _doNotUse;
|
|
set => SetProperty(ref _doNotUse, value, "DoNotUse");
|
|
}
|
|
private bool _broken;
|
|
public bool Broken
|
|
{
|
|
get => _broken;
|
|
set => SetProperty(ref _broken, value, "Broken");
|
|
}
|
|
|
|
public ThermocouplerRecord(ISensorData sd)
|
|
{
|
|
try
|
|
{
|
|
Id = sd.DatabaseId;
|
|
SerialNumber = sd.SerialNumber;
|
|
Broken = sd.Broken;
|
|
DoNotUse = sd.DoNotUse;
|
|
LastModified = sd.LastModified;
|
|
LastUpdatedBy = sd.LastUpdatedBy;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
APILogger.Log("Failed to process: ", ex);
|
|
}
|
|
}
|
|
public ThermocouplerRecord(IDataReader reader)
|
|
{
|
|
try
|
|
{
|
|
Id = Utility.GetInt(reader, "Id");
|
|
SerialNumber = Utility.GetString(reader, "SerialNumber");
|
|
Broken = Utility.GetBool(reader, "Broken");
|
|
DoNotUse = Utility.GetBool(reader, "DoNotUse");
|
|
LastModified = Utility.GetDateTime(reader, "LastModified", DateTime.MinValue);
|
|
LastUpdatedBy = Utility.GetString(reader, "LastModifiedBy");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
APILogger.Log("Failed to process: ", ex);
|
|
}
|
|
}
|
|
}
|
|
}
|