Révision 6f451cc1 GES_PAC/Model/SerieAnimal.cs

Voir les différences:

GES_PAC/Model/SerieAnimal.cs
1 1

2
using Microsoft.Maui.Layouts;
2
using SQLite;
3
using System.ComponentModel.DataAnnotations.Schema;
3 4

  
4 5
namespace GES_PAC.Model
5 6
{
6 7
    public class SerieAnimal
7 8
    {
8
        public long Id { get; set; }
9
        #region Propriétés
10
        [PrimaryKey, AutoIncrement]
11
        public int Id { get; set; }
9 12
        public int NumeroBoite { get; set; }
10 13
        public double Poids { get; set; }
11 14
        public DateTime DatePesee { get; set; }
12 15
        public string RFID { get; set; }
13 16
        public List<Mesure> Mesures { get; set; }
14 17
        public List<Comportement> Comportements { get; set; }
18
        public int SerieId { get; set; }
19
        [ForeignKey("SerieId")]
20
        public Serie Serie { get; set; }
15 21
        public bool IsOut { get; set; } = false;
22
        #endregion
16 23

  
24
        #region Constructeurs
25
        public SerieAnimal() { }
17 26
        public SerieAnimal(int numeroBoite, double poids, DateTime datePesee, string rFID)
18 27
        {
19 28
            NumeroBoite = numeroBoite;
......
23 32
            Mesures = [];
24 33
            Comportements = [];
25 34
        }
35
        #endregion
26 36

  
27 37
        public int GetMeasureCount()
28 38
        {
......
31 41

  
32 42
        internal void AddMeasure(Mesure newMeasure)
33 43
        {
44
            newMeasure.SerieAnimal = this;
34 45
            Mesures.Add(newMeasure);
35 46
        }
36 47

  
......
45 56

  
46 57
        public void AddBehaviour(Comportement newBehaviour)
47 58
        {
59
            newBehaviour.SerieAnimal = this;
48 60
            Comportements.Add(newBehaviour);
49 61
        }
50 62

  

Formats disponibles : Unified diff