init
This commit is contained in:
@@ -0,0 +1,203 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using DTS.Common.Base;
|
||||
using DTS.Common.DataModel;
|
||||
using DTS.Common.SharedResource.Strings;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace DataPROWin7.DataModel
|
||||
{
|
||||
public class LabratoryDetails : BasePropertyChanged
|
||||
{
|
||||
private readonly DTS.Common.ISO.LabratoryDetails _lab;
|
||||
|
||||
public enum Tags
|
||||
{
|
||||
LabratoryName,
|
||||
LabratoryContactName,
|
||||
LabratoryContactPhone,
|
||||
LabratoryContactFax,
|
||||
LabratoryContactEmail,
|
||||
LabratoryTestRefNumber,
|
||||
LabratoryProjectRefNumber,
|
||||
Name
|
||||
}
|
||||
public string LabratoryName
|
||||
{
|
||||
get => _lab.LabratoryName;
|
||||
set
|
||||
{
|
||||
_lab.LabratoryName = value;
|
||||
_isBlank = false;
|
||||
OnPropertyChanged(Tags.LabratoryName.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public string LabratoryContactName
|
||||
{
|
||||
get => _lab.LabratoryContactName;
|
||||
set
|
||||
{
|
||||
_lab.LabratoryContactName = value;
|
||||
_isBlank = false;
|
||||
OnPropertyChanged(Tags.LabratoryContactName.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public string LabratoryContactPhone
|
||||
{
|
||||
get => _lab.LabratoryContactPhone;
|
||||
set
|
||||
{
|
||||
_lab.LabratoryContactPhone = value;
|
||||
_isBlank = false;
|
||||
OnPropertyChanged(Tags.LabratoryContactPhone.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public string LabratoryContactFax
|
||||
{
|
||||
get => _lab.LabratoryContactFax;
|
||||
set
|
||||
{
|
||||
_lab.LabratoryContactFax = value;
|
||||
_isBlank = false;
|
||||
OnPropertyChanged(Tags.LabratoryContactFax.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public string LabratoryContactEmail
|
||||
{
|
||||
get => _lab.LabratoryContactEmail;
|
||||
set
|
||||
{
|
||||
_lab.LabratoryContactEmail = value;
|
||||
_isBlank = false;
|
||||
OnPropertyChanged(Tags.LabratoryContactEmail.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public string LabratoryTestRefNumber
|
||||
{
|
||||
get => _lab.LabratoryTestRefNumber;
|
||||
set
|
||||
{
|
||||
_lab.LabratoryTestRefNumber = value;
|
||||
_isBlank = false;
|
||||
OnPropertyChanged(Tags.LabratoryTestRefNumber.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public string LabratoryProjectRefNumber
|
||||
{
|
||||
get => _lab.LabratoryProjectRefNumber;
|
||||
set
|
||||
{
|
||||
_lab.LabratoryProjectRefNumber = value;
|
||||
_isBlank = false;
|
||||
OnPropertyChanged(Tags.LabratoryProjectRefNumber.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => _lab.Name;
|
||||
set
|
||||
{
|
||||
_lab.Name = value;
|
||||
_isBlank = false;
|
||||
OnPropertyChanged(Tags.Name.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public bool LocalOnly => _lab.LocalOnly;
|
||||
|
||||
public DateTime LastModified => _lab.LastModified;
|
||||
|
||||
public string LastModifiedBy => _lab.LastModifiedBy;
|
||||
|
||||
public int Version => _lab.Version;
|
||||
|
||||
public LabratoryDetails()
|
||||
{
|
||||
_lab = new DTS.Common.ISO.LabratoryDetails();
|
||||
_lab.Name = StringResources.TestTemplate_EmptyListName;
|
||||
}
|
||||
public bool HasBlankName()
|
||||
{
|
||||
return _lab.Name == StringResources.TestTemplate_EmptyListName;
|
||||
}
|
||||
public LabratoryDetails(DTS.Common.ISO.LabratoryDetails lab)
|
||||
{
|
||||
_lab = new DTS.Common.ISO.LabratoryDetails(lab);
|
||||
_isBlank = false;
|
||||
}
|
||||
public DTS.Common.ISO.LabratoryDetails GetIsoLab() { return _lab; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public bool IsBlank()
|
||||
{
|
||||
return _isBlank;
|
||||
}
|
||||
private bool _isBlank = true;
|
||||
}
|
||||
public class LabratoryDetailsList
|
||||
{
|
||||
protected LabratoryDetailsList()
|
||||
{
|
||||
}
|
||||
|
||||
public static LabratoryDetails[] GetAllLabs()
|
||||
{
|
||||
var isoLabs = DTS.Common.ISO.LabratoryDetails.GetAllLabratoryDetails();
|
||||
var labs = isoLabs.Select(isolab => new LabratoryDetails(isolab)).ToList();
|
||||
labs.Sort(CompareLabs);
|
||||
return labs.ToArray();
|
||||
}
|
||||
|
||||
public enum Tags
|
||||
{
|
||||
Labs
|
||||
}
|
||||
|
||||
public static void DeleteAll()
|
||||
{
|
||||
DTS.Common.ISO.LabratoryDetails.DeleteLabratoryDetails();
|
||||
}
|
||||
|
||||
private static int CompareLabs(LabratoryDetails a, LabratoryDetails b)
|
||||
{
|
||||
if (a == b) { return 0; }
|
||||
if (null == a) { return -1; }
|
||||
return null == b ? 1 : string.Compare(a.Name, b.Name, StringComparison.Ordinal);
|
||||
}
|
||||
public static void Delete(LabratoryDetails lab)
|
||||
{
|
||||
lab?.GetIsoLab().Delete(ApplicationProperties.CurrentUser.UserName);
|
||||
}
|
||||
|
||||
public static void Delete(LabratoryDetails[] labs)
|
||||
{
|
||||
foreach (var lab in labs)
|
||||
{
|
||||
Delete(lab);
|
||||
}
|
||||
}
|
||||
public static LabratoryDetails GetLab(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name)) { return null; }
|
||||
var iso = DTS.Common.ISO.LabratoryDetails.GetLabratoryDetails(name);
|
||||
return null == iso ? null : new LabratoryDetails(iso);
|
||||
}
|
||||
|
||||
public static void AddLab(LabratoryDetails lab)
|
||||
{
|
||||
lab.GetIsoLab().Commit(ApplicationProperties.CurrentUser.UserName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DTS.Common.Base;
|
||||
|
||||
namespace DataPROWin7.DataModel
|
||||
{
|
||||
/// <summary>
|
||||
/// this is a class for holding das specific settings in a test, for example sample rate or aaf
|
||||
/// it is serialized into tblTestSetupDASSettings
|
||||
/// </summary>
|
||||
public class DASSettings : BasePropertyChanged
|
||||
{
|
||||
public DASSettings()
|
||||
{
|
||||
}
|
||||
public DASSettings(DASSettings setting)
|
||||
{
|
||||
_DASSerialNumber = setting.DASSerialNumber;
|
||||
_sampleRate = setting.SampleRate;
|
||||
_excitationWarmupTimeMS = setting.ExcitationWarmupTimeMS;
|
||||
_aaf = setting.HardwareAAF;
|
||||
_preTriggerSeconds = setting.PreTriggerSeconds;
|
||||
_postTriggerSeconds = setting.PostTriggerSeconds;
|
||||
_statusLineCheck = setting.StatusLineCheck;
|
||||
_batteryCheck = setting.BatteryCheck;
|
||||
_inputVoltageMin = setting.InputVoltageMin;
|
||||
_inputVoltageMax = setting.InputVoltageMax;
|
||||
_batteryVoltageMin = setting.BatteryVoltageMin;
|
||||
_batteryVoltageMax = setting.BatteryVoltageMax;
|
||||
}
|
||||
private string _DASSerialNumber;
|
||||
public string DASSerialNumber { get => _DASSerialNumber; set => SetProperty(ref _DASSerialNumber, value, "DASSerialNumber"); }
|
||||
|
||||
private double _sampleRate;
|
||||
public double SampleRate { get => _sampleRate; set => SetProperty(ref _sampleRate, value, "SampleRate"); }
|
||||
|
||||
private int _excitationWarmupTimeMS;
|
||||
public int ExcitationWarmupTimeMS { get => _excitationWarmupTimeMS; set => SetProperty(ref _excitationWarmupTimeMS, value, "ExcitationWarmupTimeMS"); }
|
||||
|
||||
private double _aaf;
|
||||
public double HardwareAAF { get => _aaf; set => SetProperty(ref _aaf, value, "HardwareAAF"); }
|
||||
|
||||
private double _preTriggerSeconds;
|
||||
public double PreTriggerSeconds { get => _preTriggerSeconds; set => SetProperty(ref _preTriggerSeconds, value, "PreTriggerSeconds"); }
|
||||
|
||||
private double _postTriggerSeconds;
|
||||
public double PostTriggerSeconds { get => _postTriggerSeconds; set => SetProperty(ref _postTriggerSeconds, value, "PostTriggerSeconds"); }
|
||||
|
||||
private bool _statusLineCheck;
|
||||
public bool StatusLineCheck { get => _statusLineCheck; set => SetProperty(ref _statusLineCheck, value, "StatusLineCheck"); }
|
||||
|
||||
private bool _batteryCheck;
|
||||
public bool BatteryCheck { get => _batteryCheck; set => SetProperty(ref _batteryCheck, value, "BatteryCheck"); }
|
||||
|
||||
private double _inputVoltageMin;
|
||||
public double InputVoltageMin { get => _inputVoltageMin; set => SetProperty(ref _inputVoltageMin, value, "InputVoltageMin"); }
|
||||
|
||||
private double _inputVoltageMax;
|
||||
public double InputVoltageMax { get => _inputVoltageMax; set => SetProperty(ref _inputVoltageMax, value, "InputVoltageMax"); }
|
||||
|
||||
private double _batteryVoltageMin;
|
||||
public double BatteryVoltageMin { get => _batteryVoltageMin; set => SetProperty(ref _batteryVoltageMin, value, "BatteryVoltageMin"); }
|
||||
|
||||
private double _batteryVoltageMax;
|
||||
public double BatteryVoltageMax { get => _batteryVoltageMax; set => SetProperty(ref _batteryVoltageMax, value, "BatteryVoltageMax"); }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user