laatzen/Common/CordonelAssemblyLine/Data/PressureResultDataNotifyable.cs
2021-10-01 11:09:20 +02:00

162 lines
4.7 KiB
C#

using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
namespace CordonelAssemblyLine.Data
{
public class PressureResultDataNotifyable : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public PressureResultDataNotifyable(PressureResultData baseData)
{
LeakRate = baseData.LeakRate;
Passed = baseData.Passed;
PcbId = baseData.PcbId;
Remark = baseData.Remark;
Rev = baseData.Rev;
TesterName = baseData.TesterName;
Testpoints = new ObservableCollection<PressureTestPoints>();
baseData.Testpoints.ForEach(o => Testpoints.Add(o));
TestPressure = baseData.TestPressure;
}
public PressureResultDataNotifyable()
{
}
public void InternalPropertyChanged(String propertyName = "")
{
NotifyPropertyChanged(propertyName);
}
public string PcbId;
private int rev = 0;
public int Rev
{
get { return rev; }
set
{
rev = value;
InternalPropertyChanged(nameof(Rev));
}
}
private bool? passed = false;
public bool? Passed
{
get { return passed; }
set
{
passed = value;
InternalPropertyChanged(nameof(Passed));
}
}
private string testerName = "";
public String TesterName
{
get { return testerName; }
set
{
testerName = value;
InternalPropertyChanged(nameof(TesterName));
}
}
private string testPressure = "6";
public String TestPressure
{
get { return testPressure; }
set
{
testPressure = value;
InternalPropertyChanged(nameof(TestPressure));
}
}
private string leakRate = " 0,00001";
public String LeakRate
{
get { return leakRate; }
set
{
leakRate = value;
InternalPropertyChanged(nameof(LeakRate));
}
}
private string remark = "";
public String Remark
{
get { return remark; }
set
{
remark = value;
InternalPropertyChanged(nameof(Remark));
}
}
private ObservableCollection<PressureTestPoints> testpoints = new ObservableCollection<PressureTestPoints>() {
new PressureTestPoints() { Ident = 1, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 2, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 3, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 4, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 5, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 6, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 7, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 8, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 9, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 10, Input = "0,000000200000" }
};
public ObservableCollection<PressureTestPoints> Testpoints
{
get { return testpoints; }
set
{
testpoints = value;
InternalPropertyChanged(nameof(Testpoints));
}
}
internal void SetAllTestPoints(string input)
{
foreach (var item in Testpoints)
{
item.Input = input;
}
InternalPropertyChanged(nameof(Testpoints));
}
public PressureResultData ToBase()
{
var baseData = new PressureResultData();
baseData.LeakRate = LeakRate;
baseData.Passed = Passed;
baseData.PcbId = PcbId;
baseData.Remark = Remark;
baseData.Rev = Rev;
baseData.TesterName = TesterName;
baseData.Testpoints = Testpoints.ToList();
baseData.TestPressure = TestPressure;
return baseData;
}
}
}