Files
DP44/Common/DTS.CommonCore/.svn/pristine/56/5629dc75b20f42ae7c424eaf96eb398114ec568d.svn-base

99 lines
3.1 KiB
Plaintext
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
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 StreamInputRecord : TagAwareBase, IStreamInputRecord
{
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 const string DEFAULT_UDP_ADDRESS = "UDP://239.1.2.10:8400";
protected string _udpAddress = DEFAULT_UDP_ADDRESS;
public string StreamInUDPAddress
{
get => _udpAddress;
set => SetProperty(ref _udpAddress, value, "StreamInUDPAddress");
}
public StreamInputRecord(ISensorData sd)
{
try
{
Id = sd.DatabaseId;
SerialNumber = sd.SerialNumber;
StreamInUDPAddress = sd.StreamInUDPAddress;
Broken = sd.Broken;
DoNotUse = sd.DoNotUse;
LastModified = sd.LastModified;
LastUpdatedBy = sd.LastUpdatedBy;
}
catch (Exception ex)
{
APILogger.Log("Failed to process: ", ex);
}
}
public StreamInputRecord(IDataReader reader)
{
try
{
Id = Utility.GetInt(reader, "Id");
SerialNumber = Utility.GetString(reader, "SerialNumber");
StreamInUDPAddress = Utility.GetString(reader, "UDPAddress");
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);
}
}
}
}