Révision 5d673ce0 GES_PAC/Model/Journee.cs

Voir les différences:

GES_PAC/Model/Journee.cs
1 1

  
2
using System.Diagnostics;
3
using System.Linq;
4

  
2 5
namespace GES_PAC.Model
3 6
{
4 7
    public class Journee
5 8
    {
9
        #region Propriétés
6 10
        public Personne Responsable { get; set; }
7 11
        public Lieu Lieu { get; set; }
8 12
        public long Id { get; set; }
9 13
        public DateTime Date { get; set; }
10
        public string Espece { get; set; }
11 14
        public string Regime { get; set; }
12 15
        public List<Serie> Series { get; set; }
13 16
        public List<Calibration> Calibrations { get; set; }
14
        
15
        public Journee(DateTime Date, Personne Responsable, Lieu Lieu, string Espece, string Regime)
17
        #endregion
18

  
19
        #region Constructeurs
20
        public Journee(DateTime Date, Personne Responsable, Lieu Lieu, string Regime)
16 21
        {
17 22
            this.Responsable = Responsable;
18 23
            this.Lieu = Lieu;
19 24
            this.Date = Date;
20
            this.Espece = Espece;
21 25
            this.Regime = Regime;
22
            this.Series = [];
23
            this.Calibrations = [];
26
            Series = [];
27
            Calibrations = [];
28
        }
29
        #endregion
30

  
31
        #region Méthodes
32

  
33
        public bool AddCalibration(MesureCalibration mesureCalibration)
34
        {
35
            if (Calibrations.Count == 0 || Calibrations.Last().IsComplete())
36
            {
37
                Calibrations.Add(new Calibration(Calibrations.Count == 0 ? PhaseCalibration.Debut : PhaseCalibration.Fin, mesureCalibration));
38
            }
39
            else
40
            {
41
                Calibrations.Last().Mesures.Add(mesureCalibration);
42
                return Calibrations.Last().IsComplete();
43
            }
44
            return false;
45
        }
46

  
47
        public PhaseCalibration GetCurrentPhase()
48
        {
49
            if (Calibrations.Count == 0 || !Calibrations.Last().IsComplete())
50
            {
51
                return PhaseCalibration.Debut;
52
            }
53
            return PhaseCalibration.Fin;
54
        }
55

  
56
        public Calibration GetCurrentCalibration()
57
        {
58
            return Calibrations.FirstOrDefault(c => c.Phase == GetCurrentPhase());
59
        }
60

  
61
        public List<TypeCalibration> GetCurrentMissingCalibration()
62
        {
63
            if (Calibrations.Count == 0 || Calibrations.Last().IsComplete())
64
            {
65
                return TypeCalibration.All;
66
            }
67
            return TypeCalibration.All.Except(Calibrations.Last().GetTypesDone()).ToList();
24 68
        }
69
        #endregion
25 70
    }
26 71
}

Formats disponibles : Unified diff