root / GES_PAC / Model / Calibration.cs @ e837cdf1
Historique | Voir | Annoter | Télécharger (1,161 ko)
1 |
|
---|---|
2 |
|
3 |
namespace GES_PAC.Model |
4 |
{ |
5 |
public class Calibration |
6 |
{ |
7 |
public long Id { get; set; } |
8 |
public PhaseCalibration Phase { get; set; } |
9 |
public List<MesureCalibration> Mesures { get; set; } |
10 |
|
11 |
public Calibration(PhaseCalibration Phase, MesureCalibration Mesure) |
12 |
{ |
13 |
this.Phase = Phase; |
14 |
Mesures = []; |
15 |
Mesures.Add(Mesure); |
16 |
} |
17 |
|
18 |
public void AddMesure(MesureCalibration mesure) |
19 |
{ |
20 |
var index = Mesures.FindIndex(m => m.Type == mesure.Type); |
21 |
if (index != -1) |
22 |
{ |
23 |
Mesures[index] = mesure; |
24 |
return; |
25 |
} |
26 |
Mesures.Add(mesure); |
27 |
} |
28 |
|
29 |
public bool IsComplete() |
30 |
{ |
31 |
return Mesures.Select(m => m.Type).Distinct().ToList().Count == 3; |
32 |
} |
33 |
|
34 |
public List<TypeCalibration> GetTypesDone() |
35 |
{ |
36 |
return Mesures.Select(m => m.Type).Distinct().ToList(); |
37 |
} |
38 |
|
39 |
internal MesureCalibration? getMesureCalibrationByType(TypeCalibration typeCalibration) |
40 |
{ |
41 |
return Mesures.FirstOrDefault(mc => mc.Type == typeCalibration); |
42 |
} |
43 |
} |
44 |
} |