Statistiques
| Branche: | Révision:

root / GES_PAC / Model / Calibration.cs @ 42456640

Historique | Voir | Annoter | Télécharger (1,161 ko)

1 65ad7e66 Lucas Bihannic
2 957b1f34 lbihannic
3 65ad7e66 Lucas Bihannic
namespace GES_PAC.Model
4
{
5
    public class Calibration
6
    {
7
        public long Id { get; set; }
8
        public PhaseCalibration Phase { get; set; }
9 5d673ce0 Lucas Bihannic
        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 65ad7e66 Lucas Bihannic
18 5d673ce0 Lucas Bihannic
        public void AddMesure(MesureCalibration mesure)
19
        {
20 09d4a0de lbihannic
            var index = Mesures.FindIndex(m => m.Type == mesure.Type);
21
            if (index != -1)
22
            {
23
                Mesures[index] = mesure;
24
                return;
25
            }
26 5d673ce0 Lucas Bihannic
            Mesures.Add(mesure);
27
        }
28
29
        public bool IsComplete()
30
        {
31 acb5dd8c lbihannic
            return Mesures.Select(m => m.Type).Distinct().ToList().Count == 3;
32 5d673ce0 Lucas Bihannic
        }
33
34
        public List<TypeCalibration> GetTypesDone()
35
        {
36
            return Mesures.Select(m => m.Type).Distinct().ToList();
37
        }
38 957b1f34 lbihannic
39
        internal MesureCalibration? getMesureCalibrationByType(TypeCalibration typeCalibration)
40
        {
41
            return Mesures.FirstOrDefault(mc => mc.Type == typeCalibration);
42
        }
43 65ad7e66 Lucas Bihannic
    }
44
}