195 lines
6.9 KiB
C#
195 lines
6.9 KiB
C#
using DTS.Common.Base;
|
|
using DTS.Common.Interface.Graphs;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Data;
|
|
|
|
namespace DTS.Common.Classes.TestSetups
|
|
{
|
|
/// <summary>
|
|
/// Implementation of a graph record in the database
|
|
/// <inheritdoc cref="IGraphRecord"/>
|
|
/// </summary>
|
|
public class GraphRecord : BasePropertyChanged, IGraphRecord
|
|
{
|
|
private int _graphId;
|
|
/// <summary>
|
|
/// database key for graph
|
|
/// </summary>
|
|
public int GraphId
|
|
{
|
|
get => _graphId;
|
|
set => SetProperty(ref _graphId, value, "GraphId");
|
|
}
|
|
private int _testSetupId;
|
|
/// <summary>
|
|
/// test setup key for graph
|
|
/// </summary>
|
|
public int TestSetupId
|
|
{
|
|
get => _testSetupId;
|
|
set => SetProperty(ref _testSetupId, value, "TestSetupId");
|
|
}
|
|
private string _graphName;
|
|
/// <summary>
|
|
/// name of graph
|
|
/// </summary>
|
|
[MaxLength(50)]
|
|
public string GraphName
|
|
{
|
|
get => _graphName;
|
|
set => SetProperty(ref _graphName, value, "GraphName");
|
|
}
|
|
private string _graphDescription;
|
|
/// <summary>
|
|
/// description of graph
|
|
/// </summary>
|
|
[MaxLength(50)]
|
|
public string GraphDescription
|
|
{
|
|
get => _graphDescription;
|
|
set => SetProperty(ref _graphDescription, value, "GraphDescription");
|
|
}
|
|
private string _channelsString;
|
|
/// <summary>
|
|
/// all the channels in the graph
|
|
/// </summary>
|
|
[MaxLength(2048)]
|
|
public string ChannelsString
|
|
{
|
|
get => _channelsString;
|
|
set => SetProperty(ref _channelsString, value, "ChannelsString");
|
|
}
|
|
private bool _useDomainMin;
|
|
/// <summary>
|
|
/// whether to restrict domain axis to a min value
|
|
/// </summary>
|
|
public bool UseDomainMin
|
|
{
|
|
get => _useDomainMin;
|
|
set => SetProperty(ref _useDomainMin, value, "UseDomainMin");
|
|
}
|
|
private double _domainMin = double.MinValue;
|
|
/// <summary>
|
|
/// the minimum value to show on domain axis
|
|
/// (only valid when UseDomainMin is true)
|
|
/// </summary>
|
|
public double DomainMin
|
|
{
|
|
get => _domainMin;
|
|
set => SetProperty(ref _domainMin, value, "DomainMin");
|
|
}
|
|
private bool _useDomainMax;
|
|
/// <summary>
|
|
/// whether to restrict domain axis to a max value
|
|
/// </summary>
|
|
public bool UseDomainMax
|
|
{
|
|
get => _useDomainMax;
|
|
set => SetProperty(ref _useDomainMax, value, "UseDomainMax");
|
|
}
|
|
private double _domainMax = double.MaxValue;
|
|
/// <summary>
|
|
/// maximum value to show on domain axis
|
|
/// (only valid when UseDomainMax is true)
|
|
/// </summary>
|
|
public double DomainMax
|
|
{
|
|
get => _domainMax;
|
|
set => SetProperty(ref _domainMax, value, "DomainMax");
|
|
}
|
|
private bool _useRangeMin;
|
|
/// <summary>
|
|
/// whether to restrict range axis to a min value
|
|
/// </summary>
|
|
public bool UseRangeMin
|
|
{
|
|
get => _useRangeMin;
|
|
set => SetProperty(ref _useRangeMin, value, "UseRangeMin");
|
|
}
|
|
private double _rangeMin = double.MinValue;
|
|
/// <summary>
|
|
/// minimum value to show on range axis
|
|
/// (only valid when UseRangeMin is true)
|
|
/// </summary>
|
|
public double RangeMin
|
|
{
|
|
get => _rangeMin;
|
|
set => SetProperty(ref _rangeMin, value, "RangeMin");
|
|
}
|
|
private bool _useRangeMax;
|
|
/// <summary>
|
|
/// whether to restrict range axis to a max value
|
|
/// </summary>
|
|
public bool UseRangeMax
|
|
{
|
|
get => _useRangeMax;
|
|
set => SetProperty(ref _useRangeMax, value, "UseRangeMax");
|
|
}
|
|
private double _rangeMax = double.MaxValue;
|
|
/// <summary>
|
|
/// the maximum value to show on the range axis
|
|
/// (only valid when UseRangeMax is true)
|
|
/// </summary>
|
|
public double RangeMax
|
|
{
|
|
get => _rangeMax;
|
|
set => SetProperty(ref _rangeMax, value, "RangeMax");
|
|
}
|
|
private string _thresholdsString;
|
|
/// <summary>
|
|
/// any thresholds/lines to show on the graph
|
|
/// </summary>
|
|
[MaxLength(2048)]
|
|
public string ThresholdsString
|
|
{
|
|
get => _thresholdsString;
|
|
set => SetProperty(ref _thresholdsString, value, "ThresholdsString");
|
|
}
|
|
private bool _localOnly = false;
|
|
/// <summary>
|
|
/// whether to synchronize record with central db
|
|
/// [deprecated]
|
|
/// </summary>
|
|
public bool LocalOnly
|
|
{
|
|
get => _localOnly;
|
|
set => SetProperty(ref _localOnly, value, "LocalOnly");
|
|
}
|
|
public GraphRecord() { }
|
|
public GraphRecord(IGraphRecord copy)
|
|
{
|
|
DomainMax = copy.DomainMax;
|
|
DomainMin = copy.DomainMin;
|
|
ChannelsString = copy.ChannelsString;
|
|
ThresholdsString = copy.ThresholdsString;
|
|
GraphDescription = copy.GraphDescription;
|
|
GraphId = copy.GraphId;
|
|
GraphName = copy.GraphName;
|
|
RangeMax = copy.RangeMax;
|
|
RangeMin = copy.RangeMin;
|
|
TestSetupId = copy.TestSetupId;
|
|
UseDomainMax = copy.UseDomainMax;
|
|
UseDomainMin = copy.UseDomainMin;
|
|
UseRangeMax = copy.UseRangeMax;
|
|
UseRangeMin = copy.UseRangeMin;
|
|
}
|
|
public GraphRecord(IDataReader reader)
|
|
{
|
|
GraphId = Utility.GetInt(reader, "GraphId", -1);
|
|
TestSetupId = Utility.GetInt(reader, "TestSetupId", -1);
|
|
GraphName = Utility.GetString(reader, "GraphName");
|
|
GraphDescription = Utility.GetString(reader, "GraphDescription");
|
|
ChannelsString = Utility.GetString(reader, "Channels");
|
|
DomainMax = Utility.GetDouble(reader, "DomainMax", double.MaxValue);
|
|
DomainMin = Utility.GetDouble(reader, "DomainMin", double.MinValue);
|
|
RangeMax = Utility.GetDouble(reader, "RangeMax", double.MaxValue);
|
|
RangeMin = Utility.GetDouble(reader, "RangeMin", double.MinValue);
|
|
ThresholdsString = Utility.GetString(reader, "Thresholds");
|
|
UseDomainMax = Utility.GetBool(reader, "UseDomainMax");
|
|
UseDomainMin = Utility.GetBool(reader, "UseDomainMin");
|
|
UseRangeMax = Utility.GetBool(reader, "UseRangeMax");
|
|
UseRangeMin = Utility.GetBool(reader, "UseRangeMin");
|
|
}
|
|
}
|
|
}
|