Révision ba296a27 GES_PAC/ViewModel/EnterAnimalViewModel.cs
GES_PAC/ViewModel/EnterAnimalViewModel.cs | ||
---|---|---|
4 | 4 |
|
5 | 5 |
namespace GES_PAC.ViewModel |
6 | 6 |
{ |
7 |
[QueryProperty(nameof(ChamberId), "chamberId")] |
|
7 | 8 |
public class EnterAnimalViewModel : BaseViewModel |
8 | 9 |
{ |
9 | 10 |
|
... | ... | |
29 | 30 |
{ |
30 | 31 |
_chamberId = value; |
31 | 32 |
OnPropertyChanged(); |
33 |
OnPropertyChanged(nameof(Titre)); |
|
32 | 34 |
} |
33 | 35 |
} |
34 | 36 |
|
... | ... | |
66 | 68 |
|
67 | 69 |
public bool NumRFIDError { get; private set; } = true; |
68 | 70 |
public bool PoidsError { get; private set; } = true; |
71 |
public string Titre => $"Information animal chambre {ChamberId}"; |
|
72 |
|
|
69 | 73 |
#endregion |
70 | 74 |
|
71 | 75 |
#region Constructeurs |
... | ... | |
76 | 80 |
#endregion |
77 | 81 |
|
78 | 82 |
#region Méthodes |
79 |
|
|
80 | 83 |
private async Task EnterAnimal() |
81 | 84 |
{ |
82 | 85 |
IsBusy = true; |
83 | 86 |
var date = DateTime.Now; |
84 | 87 |
var journeeActuelle = JourneeViewModel.Instance.GetCurrentDay(); |
85 |
var newSet = new SerieAnimal();
|
|
86 |
journeeActuelle.AddSerie(newSet); //getcurrentset a créer
|
|
88 |
var newAnimalSet = new SerieAnimal(ChamberId, Poids ?? 0, date, NumRFID);
|
|
89 |
journeeActuelle.GetCurrentSet().AddSerieAnimal(newAnimalSet);
|
|
87 | 90 |
|
88 |
await Shell.Current.GoToAsync(nameof(CreateCalibrationView));
|
|
91 |
await Shell.Current.GoToAsync(nameof(ChambersView));
|
|
89 | 92 |
IsBusy = false; |
90 | 93 |
} |
91 | 94 |
|
92 | 95 |
private void ValidateForm() |
93 | 96 |
{ |
94 |
NumRFIDError = NumRFID == null;
|
|
97 |
NumRFIDError = NumRFID.Length < 5 ;
|
|
95 | 98 |
PoidsError = Poids == null; |
96 | 99 |
|
97 | 100 |
OnPropertyChanged(nameof(NumRFIDError)); |
Formats disponibles : Unified diff