using DTS.Common.Base; using DTS.Common.Interface.TestSetups; using System.Data; namespace DTS.Common.Classes.TestSetups { /// /// Describes a record in the ROIPeriodChannels table /// public class ROIPeriodChannelRecord : BasePropertyChanged, IROIPeriodChannelRecord { /// /// The field that matches the same field in the TestSetupROIs table /// private int _testSetupROIId; public int TestSetupROIId { get => _testSetupROIId; set => SetProperty(ref _testSetupROIId, value, "TestSetupROIId"); } /// /// The name of a channel in a ROI period. /// private string _channelName; public string ChannelName { get => _channelName; set => SetProperty(ref _channelName, value, "ChannelName"); } /// /// The id of a channel in a ROI period. /// private long _channelId; public long ChannelId { get => _channelId; set => SetProperty(ref _channelId, value, "ChannelId"); } /// /// Builds a ROIPeriodChannel record after a call to sp_ROIPeriodChannelsGet /// /// public ROIPeriodChannelRecord(IDataReader reader, int storedProcedureVersionToUse) { TestSetupROIId = Utility.GetInt(reader, "TestSetupROIId"); ChannelName = Utility.GetString(reader, "ChannelName", ""); if (storedProcedureVersionToUse >= Constants.ROIPERIODCHANNELS_CHANNELID_DB_VERSION) { ChannelId = Utility.GetLong(reader, "ChannelId"); } else { ChannelId = -1; //So we know the database doesn't have a ChannelId field in the ROIPeriodChannels table } } } }