private void nouveauMatricule() { //recherche de sa classe acheters = new List <AcheterBE>(); achats_setarticle = new List <string>(); cmbClasse.Text = ""; InscrireBE inscrire = new InscrireBE(); inscrire.matricule = txtMatricule.Text; inscrire.annee = annee; inscrire = articleBL.rechercherInscrire(inscrire); if (inscrire != null) { cmbClasse.Text = inscrire.codeClasse; } //recherche des eleves inscrits dans cette classe pour charger le combobox des eleves eleves = new List <string>(); string codeclasse = cmbClasse.Text; List <EleveBE> listeleves = new List <EleveBE>(); listeleves = articleBL.listerElevesDuneClasse(codeclasse, annee); if (listeleves != null) { foreach (EleveBE el in listeleves) { eleves.Add(el.matricule + " - " + el.nom); } } cmbEleve.ItemsSource = eleves; eleve = new EleveBE(); eleve.matricule = txtMatricule.Text.ToString(); eleve = articleBL.rechercherEleve(eleve); if (eleve != null) { cmbEleve.Text = eleve.matricule + " - " + eleve.nom; acheters = articleBL.listerSuivantCritereAcheters(" matricule = " + "'" + eleve.matricule + "' AND annee = " + "'" + annee + "'"); if (acheters != null && acheters.Count > 0) { foreach (AcheterBE a in acheters) { achats_setarticle.Add(a.codesetarticle); } cmbArticle.ItemsSource = achats_setarticle; cmbArticle.SelectedIndex = 0; cmbArticle.Items.Refresh(); } } else { MessageBox.Show(MESSAGE_MATRICULE_ERRONE, "School brain:alerte", MessageBoxButton.OK, MessageBoxImage.Exclamation); acheters = new List <AcheterBE>(); achats_setarticle = new List <string>(); cmbArticle.ItemsSource = achats_setarticle; } }
private void txtMatricule_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { //recherche de sa classe cmbClasse.Text = ""; InscrireBE inscrire = new InscrireBE(); inscrire.matricule = txtMatricule.Text; inscrire.annee = annee; inscrire = articleBL.rechercherInscrire(inscrire); if (inscrire != null) { cmbClasse.Text = inscrire.codeClasse; } eleves = new List <string>(); string codeclasse = cmbClasse.Text; List <EleveBE> listeleves = new List <EleveBE>(); listeleves = articleBL.listerElevesDuneClasse(codeclasse, annee); if (listeleves != null) { foreach (EleveBE el in listeleves) { eleves.Add(el.matricule + " - " + el.nom); } } cmbEleve.ItemsSource = eleves; eleve = new EleveBE(); eleve.matricule = txtMatricule.Text.ToString(); eleve = articleBL.rechercherEleve(eleve); if (eleve != null) { cmbEleve.Text = eleve.matricule + " - " + eleve.nom; } else { MessageBox.Show(MESSAGE_MATRICULE_ERRONE, "School brain:alerte", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } }