private void addZoneEButton_Click(object sender, EventArgs e) { selectedEspeceId = (lespèces.ElementAt <EspèceViewModel>(listeEspeces.SelectedIndex)).idEspèceProperty; EspèceViewModel espece = ORMEspèce.getEspèce(selectedEspeceId); selectedZoneId = (lzonesP.ElementAt <ZonePrelevementViewModel>(listeZones.SelectedIndex)).idZonePrelevementProperty; ZonePrelevementViewModel zone = ORMZonePrelevement.getZone(selectedZoneId); selectedEtudeId = (letudes.ElementAt <EtudeViewModel>(listeEtudes2.SelectedIndex)).idEtudeProperty; EtudeViewModel etude = ORMEtude.getEtude(selectedEtudeId); selectedPlageId = (lplages.ElementAt <PlageViewModel>(listePlages2.SelectedIndex)).idPlageProperty; PlageViewModel plage = ORMPlage.getPlage(selectedPlageId); int nbr = int.Parse(nbrAnimaux.Text); zoneEDataObject = new ZoneEspeceViewModel(); zoneEDataObject.idEspeceProperty = espece; zoneEDataObject.idZonePrelevementProperty = zone; zoneEDataObject.idEtudeProperty = etude; zoneEDataObject.idPlageProperty = plage; zoneEDataObject.nombreProperty = nbr; ZoneEspeceViewModel nouvelle = new ZoneEspeceViewModel(DALZoneEspece.getMaxIdZone(), zoneEDataObject.idEspeceProperty, zoneEDataObject.idZonePrelevementProperty, zoneEDataObject.idEtudeProperty, zoneEDataObject.idPlageProperty, zoneEDataObject.nombreProperty); ORMZoneEspece.addZone(nouvelle); }
public static ObservableCollection <ZoneEspeceViewModel> listeZones() { ObservableCollection <DAOZoneEspece> listeDAO = DAOZoneEspece.listeZones(); ObservableCollection <ZoneEspeceViewModel> listeZones = new ObservableCollection <ZoneEspeceViewModel>(); foreach (DAOZoneEspece item in listeDAO) { int idZone = item.IdZoneDAO; int idEspece = item.IdEspeceDAO; int idEtude = item.IdEtudeDAO; int idPlage = item.IdPlageDAO; ZonePrelevementViewModel zoneID = ORMZonePrelevement.getZone(idZone); EspèceViewModel especeID = ORMEspèce.getEspèce(idEspece); EtudeViewModel etudeID = ORMEtude.getEtude(idEtude); PlageViewModel plageID = ORMPlage.getPlage(idPlage); ZoneEspeceViewModel zone = new ZoneEspeceViewModel(item.idZoneEDAO, especeID, zoneID, etudeID, plageID, item.NombreDAO); listeZones.Add(zone); } return(listeZones); }
public static void addZone(ZoneEspeceViewModel zone) { DAOZoneEspece.addZone(new DAOZoneEspece(zone.idZoneEProperty, zone.idEspece.idEspèceProperty, zone.idZone.idZonePrelevementProperty, zone.idEtude.idEtudeProperty, zone.idPlage.idPlageProperty, zone.nombreProperty)); }