public MainWindow() { InitializeComponent(); DALConnection.OpenConnection(); lp = DepartementORM.listeDepartement(); lp1 = PersonenORM.listePersonne(); lp2 = EtudeORM.listeEtude(); lp3 = AnimauxORM.listeAnimaux(); lp4 = CommuneORM.listeCommune(); lp5 = PlageORM.listePlage(); lp7 = ZoneEtudeORM.listeZoneEtude(); //LIEN AVEC la VIEW listeDepartement.ItemsSource = lp; listeCommune.ItemsSource = lp4; listePlage.ItemsSource = PlageZone; listeEtude.ItemsSource = lp2; // listeDepartement2.ItemsSource = lp; // listeCommune2.ItemsSource = CommuneParDepartement; listePlage2.ItemsSource = lp5; // this.DataContext = lp; // bind de la liste avec la source, permettant le binding mais de façon globale sur toute la fenetre }
private void ajouterEtude_Click(object sender, EventArgs e) { myDataObject.titreEtudeProperty = Titre.Text; if ((EquipeViewModel)listeEquipeCombo.SelectedItem != null) { myDataObject.equipeEtude = (EquipeViewModel)listeEquipeCombo.SelectedItem; } else { myDataObject.equipeEtude = new EquipeViewModel(1, "MauvaisNumeroEquipe", 0); } //////////////////////////////////////////////////nombre especes string valueToParse = nbEspeces.Text; int result; int defaultValue = 0; myDataObject.nbTotalEspeceRencontreeEtudeProperty = int.TryParse(valueToParse, out result) ? result : defaultValue; //////////////////////////////////////////////////date string valueToParse2 = Date.Text; DateTime result2; DateTime defaultValue2 = DateTime.Now; myDataObject.dateEtudeProperty = DateTime.TryParse(valueToParse2, out result2) ? result2 : defaultValue2; //////////////////////////////////////////////////insert EtudeViewModel nouveau = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, myDataObject.dateEtudeProperty, myDataObject.titreEtudeProperty, myDataObject.nbTotalEspeceRencontreeEtudeProperty, myDataObject.equipeEtudeProperty); lu.Add(nouveau); EtudeORM.insertEtude(nouveau); listeEquipeCombo.ItemsSource = lp; listeEtudes.Items.Refresh(); listeEquipeCombo.Items.Refresh(); listeEtudes.ItemsSource = lu; }
private void supprimerButton(object sender, RoutedEventArgs e) { EtudeViewModel toRemove = (EtudeViewModel)listeEtudes.SelectedItem; lp.Remove(toRemove); listeEtudes.Items.Refresh(); EtudeORM.supprimerEtude(selectedEtudeId); }
private void OnPropertyChanged(string info) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(info)); EtudeORM.updateEtude(this); } }
private void supprimerButton_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { EtudeViewModel toRemove = (EtudeViewModel)listeEtudes.SelectedItem; lp4.Remove(toRemove); EtudeORM.supprimerEtude(selectedEtudeId); MessageBox.Show("Etude supprimée avec succes ! "); }
//////////////////////////////////////////////////////////////////////////////// /////////////// Etude//////////////////////////////////////////////////////// private void ajouterEtudeButton_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { myDataObject_Etude = new EtudeViewModel(); myDataObject_Etude.DateProperty = Date_etudeTextBox.Text; myDataObject_Etude.SuperficieEtudierProperty = Super_etudeTextBox.Text; EtudeViewModel nouveau = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, myDataObject_Etude.DateProperty, myDataObject_Etude.SuperficieEtudierProperty); lp_Et.Add(nouveau); EtudeORM.insertEtude(nouveau); listeEtude.Items.Refresh(); compteur = lp_Et.Count(); myDataObject_Etude = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, "", ""); }
public MainWindow() { InitializeComponent(); DALConnection.OpenConnection(); lu = ComptageORM.listeComptages(); // Initialisation de la liste des personnes via la BDD. le = EtudeORM.listeEtudes(); lp = PlageORM.listePlages(); //lu = EtudeORM.getEtude(user.idPersonne); MainWindow.user = user; ListeEtude.ItemsSource = le; ListePlage.ItemsSource = lp; //listeComptages.ItemsSource = lu; }
public AfficherEtude() { InitializeComponent(); lp = EtudeORM.listeEtudes(); le = EquipeORM.listeEquipes(); listeEtudes.ItemsSource = lp; idEquipeTextBox.ItemsSource = le; myDataObject = new EtudeViewModel(); CultureInfo culture = (CultureInfo)CultureInfo.CurrentCulture.Clone(); culture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd"; culture.DateTimeFormat.LongTimePattern = ""; Thread.CurrentThread.CurrentCulture = culture; }
private void etudeButton_MouseDoubleClick(object sender, MouseButtonEventArgs e) { myDataObject3 = new EtudeViewModel(); myDataObject3.nomEtudeProperty = nomeTextBox.Text; myDataObject3.dateEtudeProperty = dateDatePicker.DisplayDate; myDataObject3.nbPersonneProperty = nbpersTextBox.Text; myDataObject3.idPersonneProperty = Convert.ToInt32(idpersTextBox.Text); EtudeViewModel nouveau = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, myDataObject3.nomEtudeProperty, myDataObject3.dateEtudeProperty, myDataObject3.nbPersonneProperty, myDataObject3.idPersonneProperty); et.Add(nouveau); EtudeORM.insertEtude(nouveau); listeEtudes.Items.Refresh(); compteur = et.Count(); myDataObject3 = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, "", myDataObject3.dateEtudeProperty, "", myDataObject3.idPersonneProperty); }
public EtudeB() { InitializeComponent(); lp1 = PlageORM.listePlages(); listePlagesCombo.ItemsSource = lp1; lp4 = EtudeORM.ListeEtude(); listeEtudes.ItemsSource = lp4; CultureInfo culture = (CultureInfo)CultureInfo.CurrentCulture.Clone(); culture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd-HH-mm-ss"; //Format BDD culture.DateTimeFormat.LongTimePattern = ""; Thread.CurrentThread.CurrentCulture = culture; }
//////////////////////////////////////////////////////////////////////////////// /////////////// Etude//////////////////////////////////////////////////////// private void supprimerButton_Etude_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { EtudeViewModel toRemove = (EtudeViewModel)listeEtude.SelectedItem; MessageBoxResult result = MessageBox.Show("Voulez vous bien supprimer l'Etude " + toRemove.idEtudeProperty + " de la table ?", "Table Etude", MessageBoxButton.YesNo); switch (result) { case MessageBoxResult.Yes: MessageBox.Show("L'étude a été suprimmer", "Table Etude"); lp_Et.Remove(toRemove); listeEtude.Items.Refresh(); EtudeORM.supprimerEtude(selectedEtudeId); break; case MessageBoxResult.No: MessageBox.Show("L'étude n'a pas été supprimer", "Table Etude"); break; } }
public EspeceNombre() { InitializeComponent(); lp8 = EspeceNombreORM.ListeEspeceNombres(); listeEspecesNombres.ItemsSource = lp8; lp1 = PlageORM.listePlages(); listePlagesCombo.ItemsSource = lp1; lp4 = EtudeORM.ListeEtude(); listeEtudesCombo.ItemsSource = lp4; lp5 = EspeceORM.listeEspeces(); listeEspeceCombo.ItemsSource = lp5; lp7 = ZoneInvestigationORM.ListeZoneInvestigation(); listeZonesCombo.ItemsSource = lp7; lp8 = EspeceNombreORM.ListeEspeceNombres(); }
public MainWindow() { InitializeComponent(); DALConnection.OpenConnection(); lp = PersonneORM.listePersonnes(); listePersonnes.ItemsSource = lp; pl = PlageORM.listePlages(); listePlages.ItemsSource = pl; dp = DepartementORM.listeDepartements(); listeDepartements.ItemsSource = dp; et = EtudeORM.listeEtudes(); listeEtudes.ItemsSource = et; }
///////////////////////////////////// Etudes ///////////////////////////////////// ///////////////////////////////////// Etudes ///////////////////////////////////// /// private void ValideEtude_Click(object sender, RoutedEventArgs e) { myDataObject4 = new EtudeViewModel(); myDataObject4.NbPersonneEtudeProperty = Convert.ToDecimal(NbPersonne.SelectionBoxItem); myDataObject4.dateCreationProperty = Convert.ToDateTime(dateCreationDatePicker.SelectedDate); myDataObject4.dateFinProperty = Convert.ToDateTime(dateFinDatePicker1.SelectedDate); myDataObject4.PlageEtude = (PlageViewModel)listePlagesCombo.SelectedItem; myDataObject4.TitreEtudeProperty = Titre.Text; EtudeViewModel nouveau = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, myDataObject4.NbPersonneEtudeProperty, myDataObject4.TitreEtudeProperty, myDataObject4.PlageEtudeProperty, myDataObject4.dateCreationProperty, myDataObject4.dateFinProperty); lp4.Add(nouveau); EtudeORM.insertEtude(nouveau); compteur = lp4.Count(); listeEtudes.ItemsSource = lp4; ((TextBox)Titre).Text = string.Empty; MessageBox.Show("Etude ajoutée avec succes ! "); }
public ZoneInvestigation() { InitializeComponent(); lp = UsersORM.listeUsers(); listeUsersCombo.ItemsSource = lp; lp1 = PlageORM.listePlages(); listePlageCombo.ItemsSource = lp1; lp4 = EtudeORM.ListeEtude(); listeEtudesCombo.ItemsSource = lp4; listeDateCombo.ItemsSource = lp4; lp7 = ZoneInvestigationORM.ListeZoneInvestigation(); ListeEtudeZone.ItemsSource = lp7; lp7 = ZoneInvestigationORM.ListeZoneInvestigation(); CultureInfo culture = (CultureInfo)CultureInfo.CurrentCulture.Clone(); culture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd-HH-mm-ss"; //Format BDD culture.DateTimeFormat.LongTimePattern = ""; Thread.CurrentThread.CurrentCulture = culture; }
private void ajouterButton(object sender, RoutedEventArgs e) { myDataObject.dateEtudeProperty = (DateTime)dateTextBox.SelectedDate; //DateTime defaultValDate = DateTime.Now; //myDataObject.dateEtudeProperty = DateTime.TryParse(, out DateTime resultDate) ? resultDate : defaultValDate; myDataObject.titreEtudeProperty = titreTextBox.Text; int.TryParse(nbTotalEspeceRencontreeTextBox.Text, out int resultNbEspece); myDataObject.nbTotalEspeceRencontreeEtudeProperty = resultNbEspece; //int defaultValEquipe = 1; //si mauvaise valeur -> équipe 1 par default myDataObject.equipeEtude = (EquipeViewModel)idEquipeTextBox.SelectedItem; EtudeViewModel nouveau = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, myDataObject.dateEtudeProperty, myDataObject.titreEtudeProperty, myDataObject.nbTotalEspeceRencontreeEtudeProperty, myDataObject.equipeEtudeProperty); lp.Add(nouveau); EtudeORM.insertEtude(nouveau); listeEtudes.Items.Refresh(); myDataObject = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, myDataObject.dateEtudeProperty, "", myDataObject.nbTotalEspeceRencontreeEtudeProperty, myDataObject.equipeEtudeProperty); }
public MainWindow(Window actual_window) { window = actual_window; InitializeComponent(); DALConnection.OpenConnection(); // Initialisation de la liste des personnes via la BDD. lp = PersonneORM.listePersonnes(); lp_prel = PrelevementORM.listePrelevements(); lp_Esp = EspeceORM.listeEspeces(); lp_Et = EtudeORM.listeEtude(); lp_Pl = PlageORM.listePlages(); lc = CommuneORM.listeCommunes(); de = DepartementORM.listeDepartements(); //LIEN AVEC la VIEW listePersonnes.ItemsSource = lp; listePrelevement.ItemsSource = lp_prel; listeEspece.ItemsSource = lp_Esp; listeEtude.ItemsSource = lp_Et; listePlages.ItemsSource = lp_Pl; // bind de la liste avec la source, permettant le binding. // this.DataContext = lp; // bind de la liste avec la source, permettant le binding mais de façon globale sur toute la fenetre //COMBO BOX FONCTIONNEL foreach (var item in lc) { liste_box1.Items.Add(item.nomVilleProperty); } foreach (var item in de) { liste_box3.Items.Add(item.nomProperty); } foreach (var item2 in lp_prel) { liste_box2.Items.Add(item2.idprelevementProperty); } }
private void AjouterEtude_Click_1(object sender, EventArgs e) { myDataObject2 = new EtudeViewModel(); myDataObject2.nomEtudeProperty = nomEtudeTextBox.Text; myDataObject6 = new PlageDeEtudeViewModel(); EtudeViewModel nouveau = new EtudeViewModel(0, myDataObject2.nomEtudeProperty); lp2.Add(nouveau); EtudeORM.insertEtude(nouveau); lp2 = EtudeORM.listeEtude(); EtudeViewModel newEtude = EtudeORM.listeEtude().Last(); foreach (PlageViewModel plage in lp5) { if (plage.isChekedProperty) { PlageDeEtudeViewModel ajoutNouveau = new PlageDeEtudeViewModel(newEtude, plage); PlageDeEtudeORM.insertPlageDeEtude(ajoutNouveau); } } nomEtudeTextBox.Text = string.Empty; }
public AfficherChoixEtude() { InitializeComponent(); le = EtudeORM.listeEtudes(); etudeComboBox.ItemsSource = le; }
private void ListeEtude_Selected(object sender, RoutedEventArgs e) { PlageZone = new ObservableCollection <PlageViewModel>(); PlageZone = EtudeORM.listeEtudePlage((EtudeViewModel)listeEtude.SelectedItem); listePlage.ItemsSource = PlageZone; }