public WindowAddEditCategorieEleveUI() { CultureInfo ci = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.Name); ci.DateTimeFormat.ShortDatePattern = "dd-MM-yyyy"; Thread.CurrentThread.CurrentCulture = ci; InitializeComponent(); creerModifierCategorieEleveBL = new CreerModifierCategorieEleveBL(); etat = 0; ancienObjet = new CategorieEleveBE(); // A mettre pour que le binding avec le DataGrid fonctionne ! grdListeCategorieEleve.DataContext = this; // Initialisation de la collection, qui va s'afficher dans la DataGrid : ListeCategorieEleves = new ObservableCollection <CategorieEleveBE>(); List <CategorieEleveBE> LCategorieEleveBE = creerModifierCategorieEleveBL.listerToutesLesCategorieEleve(); // on met la liste "LCategorieEleveBE" dans le DataGrid RemplirDataGrid(LCategorieEleveBE); }
private void statutEleve() { CategorieEleveBE c = new CategorieEleveBE(); eleve = new EleveBE(); eleve.matricule = txtMatricule.Text; eleve = prestationBL.rechercherEleve(eleve); if (eleve != null) { matricule = eleve.matricule; //recherche de sa classe InscrireBE inscrire = new InscrireBE(); inscrire.matricule = eleve.matricule; inscrire.annee = annee; inscrire = prestationBL.rechercherInscrire(inscrire); if (inscrire != null) { cmbClasse.Text = inscrire.codeClasse; } //chargement de ses camarades dans la liste des eleves eleves = new List <string>(); string codeclasse = cmbClasse.Text; List <EleveBE> listeleves = new List <EleveBE>(); listeleves = prestationBL.listerElevesDuneClasse(codeclasse, annee); if (listeleves != null) { foreach (EleveBE el in listeleves) { eleves.Add(el.matricule + " - " + el.nom); } } cmbEleve.ItemsSource = eleves; cmbEleve.Items.Refresh(); cmbEleve.Text = eleve.matricule + " - " + eleve.nom; //recherche de sa categorie dans la table appartenir AppartenirBE appartenir = new AppartenirBE(); appartenir.matricule = txtMatricule.Text; appartenir.annee = prestationBL.AnneeEnCours(); appartenir = prestationBL.rechercherCategorie(appartenir); categorie = appartenir.codeCatEleve; c.codeCatEleve = categorie; c = prestationBL.rechercherCategorieEleve(c); //lblNom.Content = eleve.nom + " - Catégorie : " + c.nomCatEleve; payers = prestationBL.listerSuivantCriterePayer("matricule = " + "'" + eleve.matricule + "' and annee =" + "'" + annee + "'"); //fraisInscription = prestationBL.obtenirFraisInscription(eleve); lignes = new List <LignePrestation>(); lignes = chargerGrid(); grdStatus.ItemsSource = lignes; grdStatus.Items.Refresh(); } else { MessageBox.Show("L'élève n'existe pas"); } }
// modifier une CategorieEleve public bool modifierCategorieEleve(CategorieEleveBE cat) { if (categorieEleveDA.modifier(cat)) { journalDA.journaliser("modification de la catégorie d'élève de code " + cat.codeCatEleve + ". ancien nom " + cat.nomCatEleve); return(true); } return(false); }
// supprimer une CategorieEleve public bool supprinerCategorieEleve(CategorieEleveBE cat) { if (categorieEleveDA.supprimer(cat)) { journalDA.journaliser("suppression de la catégorie d'élève de code " + cat.codeCatEleve + " et de nom " + cat.nomCatEleve); return(true); } return(false); }
private void txtMatricule_KeyUp(object sender, KeyEventArgs e) { txtReste.Text = ""; CategorieEleveBE c = new CategorieEleveBE(); if (e.Key == Key.Return) { statutEleve(); } }
//creer une CategorieEleve public bool creerCategorieEleve(string codeCat, string nomCat) { CategorieEleveBE categorie = new CategorieEleveBE(codeCat, nomCat); if (categorieEleveDA.ajouter(categorie)) { journalDA.journaliser("enregistrement d'une catégorie d'élève de code " + codeCat + " et de nom " + nomCat); return(true); } return(false); }
private void cmbImprimer_Click(object sender, RoutedEventArgs e) { if (lignes != null) { List <PrestationBE> prestations = new List <PrestationBE>(); prestations = prestationBL.listerTousPrestation(); CategorieEleveBE cat = new CategorieEleveBE(); cat.codeCatEleve = categorie; cat = prestationBL.rechercherCategorieEleve(cat); CreerEtat creerEtat = new CreerEtat("statut financier" + DateTime.Today.ToShortDateString(), "Situation financière de l'élève"); prestationBL.journaliser("Impression de l'état financier de " + eleve.matricule); creerEtat.statutFinancier(grdStatus, eleve, categorie + " - " + cat.nomCatEleve, totalAPayer, totalVerse, resteAPayer, totalRemise, prestations); } }
private void cmdEnregistrer_Click(object sender, RoutedEventArgs e) { if ((txtCode.Text != null && txtNom.Text != null) && (txtCode.Text != "" && txtNom.Text != "")) { CategorieEleveBE categorieEleve = new CategorieEleveBE(); categorieEleve.codeCatEleve = txtCode.Text; categorieEleve.nomCatEleve = txtNom.Text; if (etat == 1) { creerModifierCategorieEleveBL.modifierCategorieEleve(ancienObjet, categorieEleve); List <CategorieEleveBE> LCategorieEleveBE = creerModifierCategorieEleveBL.listerToutesLesCategorieEleve(); // on met la liste "LGroupeMatiereBE" dans le DataGrid RemplirDataGrid(LCategorieEleveBE); txtCode.Text = ""; txtNom.Text = ""; etat = 0; } else if (creerModifierCategorieEleveBL.rechercherCategorieEleve(categorieEleve) == null) { if (creerModifierCategorieEleveBL.creerCategorieEleve(txtCode.Text, txtNom.Text)) { MessageBox.Show("Opération réussie"); //on rafraichit les champs du formulaire txtCode.Text = ""; txtNom.Text = ""; List <CategorieEleveBE> LCategorieEleveBE = creerModifierCategorieEleveBL.listerToutesLesCategorieEleve(); //on rafraichir le DataGrid RemplirDataGrid(LCategorieEleveBE); } else { MessageBox.Show("Echec enregistrement : une erreure est survenue !"); } } else { MessageBox.Show("Une Catégorie d'élève ayant le code \"" + txtCode.Text + "\" existe deja dans le système \n \n Veuillez changer de code SVP !"); } } else { MessageBox.Show("Tous les champs doivent pas être remplis !"); } }
private void grdListeCategorieEleve_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (grdListeCategorieEleve.SelectedIndex != -1) { etat = 1; CategorieEleveBE categorieEleve = new CategorieEleveBE(); categorieEleve = creerModifierCategorieEleveBL.rechercherCategorieEleve(ListeCategorieEleves.ElementAt(grdListeCategorieEleve.SelectedIndex)); if (categorieEleve != null) { // on charge les informations dans le formulaire txtCode.Text = categorieEleve.codeCatEleve; txtNom.Text = categorieEleve.nomCatEleve; ancienObjet = categorieEleve; } grdListeCategorieEleve.UnselectAll(); } }
// rechercher un CategorieEleve public CategorieEleveBE rechercherCategorieEleve(CategorieEleveBE categorieEleve) { return(categorieEleveDA.rechercher(categorieEleve)); }
internal CategorieEleveBE rechercherCategorieEleve(CategorieEleveBE cat) { return(categorieEleveDA.rechercher(cat)); }