private void addZonePButton_Click(object sender, EventArgs e) { selectedEtudeId = (letudes.ElementAt <EtudeViewModel>(listeEtudeSelect.SelectedIndex)).idEtudeProperty; EtudeViewModel etude = ORMEtude.getEtude(selectedEtudeId); selectedPlageId = (lplages.ElementAt <PlageViewModel>(listePlageSelect.SelectedIndex)).idPlageProperty; PlageViewModel plage = ORMPlage.getPlage(selectedPlageId); selectedAdminId = (ladmins.ElementAt <PersonneViewModel>(liste2AdminSelect.SelectedIndex)).idPersonneProperty; PersonneViewModel personne = ORMPersonne.getPersonne(selectedAdminId); int angle1 = int.Parse(Angle1TextBox.Text); int angle2 = int.Parse(Angle2TextBox.Text); int angle3 = int.Parse(Angle3TextBox.Text); int angle4 = int.Parse(Angle4TextBox.Text); zonePDataObject = new ZonePrelevementViewModel(); zonePDataObject.idEtudeProperty = etude; zonePDataObject.idPlageProperty = plage; zonePDataObject.Angle1Property = angle1; zonePDataObject.Angle2Property = angle2; zonePDataObject.Angle3Property = angle3; zonePDataObject.Angle4Property = angle4; zonePDataObject.idPersonneProperty = personne; ZonePrelevementViewModel nouvelle = new ZonePrelevementViewModel(DALZonePrelevement.getMaxIdZone(), zonePDataObject.idEtudeProperty, zonePDataObject.idPlageProperty, zonePDataObject.Angle1Property, zonePDataObject.Angle2Property, zonePDataObject.Angle3Property, zonePDataObject.Angle4Property, zonePDataObject.idPersonneProperty); lzonesP.Add(nouvelle); ORMZonePrelevement.addZone(nouvelle); listeZones2.Items.Refresh(); }
private void addEtudeButton_Click(object sender, EventArgs e) { selectedAdminId = (ladmins.ElementAt <PersonneViewModel>(listeAdminsSelect.SelectedIndex)).idPersonneProperty; PersonneViewModel personne = ORMPersonne.getPersonne(selectedAdminId); string date = dateEtudeDatePicker.Text; DateTime myDate; DateTime current = DateTime.Now; etudeDataObject = new EtudeViewModel(); etudeDataObject.nomEtudeProperty = nomEtudeTextBox.Text; etudeDataObject.dateEtudeProperty = DateTime.TryParse(date, out myDate) ? myDate : current; etudeDataObject.idPersonneProperty = personne; EtudeViewModel nouvelle = new EtudeViewModel(DALEtude.getMaxIdEtude(), etudeDataObject.nomEtudeProperty, etudeDataObject.dateEtudeProperty, etudeDataObject.idPersonneProperty); letudes.Add(nouvelle); ORMEtude.addEtude(nouvelle); listeEtudes.Items.Refresh(); }