// Valide les modifications apporté lorsque l'on clique sur "Applied" public void ValidModif() { // Si les données minimales sont correctes alors modifier les valeurs if (modAnimalName.text != "" && modAnimalDay.text != "" && modAnimalDay.text != "" && modAnimalDay.text != "" && modAnimalIdent.text != "" && modAnimalRace.value != 0 && int.Parse(modAnimalDay.text) <= 31 && int.Parse(modAnimalDay.text) <= 12 && int.Parse(modAnimalDay.text) <= DateTime.Now.Year) { animal.animalName = modAnimalName.text; if (modAnimalSex.isOn) { animal.animalSex = "M"; } else { animal.animalSex = "F"; } animal.birthDay = int.Parse(modAnimalDay.text); animal.birthMonth = int.Parse(modAnimalMonth.text); animal.birthYear = int.Parse(modAnimalYear.text); animal.animalRace = loadClass.catLstRaces[modAnimalRace.value].id; if (animal.animalIdentification != modAnimalIdent.text) { loadClass.ChangeIdentNumber(animal.animalIdentification, modAnimalIdent.text); animal.animalIdentification = modAnimalIdent.text; } animal.animalLoof = modAnimalLoof.text; animal.animalFather = modAnimalFather.text; animal.animalMother = modAnimalMother.text; showClass.Show(); LoadAnimalStats(animal); loadClass.SaveAnimals(); showPanel.SetActive(true); modifPanel.SetActive(false); } // Sinon affiché le soucis else { if (modAnimalName.text == "") { mustName.color = Color.red; } else { mustName.color = Color.black; } if (modAnimalDay.text == "" || modAnimalMonth.text == "" || modAnimalYear.text == "" || int.Parse(modAnimalDay.text) > 31 || int.Parse(modAnimalMonth.text) > 12 || int.Parse(modAnimalYear.text) > DateTime.Now.Year) { mustDate.color = Color.red; } else { mustDate.color = Color.black; } if (modAnimalIdent.text == "") { mustIdent.color = Color.red; } else { mustIdent.color = Color.black; } if (modAnimalRace.value == 0) { mustDate.color = Color.red; } else { mustDate.color = Color.black; } } }