private void txtMatricule_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                if (txtAnnee.Text != null && txtAnnee.Text != "")
                {
                    // on cherche l'inscription de l'élève pour l'année saisit
                    InscrireBE inscrire = creerCertificatScolariteBL.rechercherInscrireSuivantCritere("matricule = '" + txtMatricule.Text + "' AND annee = '" + txtAnnee.Text + "'");

                    if (inscrire != null)
                    {
                        EleveBE eleve = new EleveBE();
                        eleve.matricule = txtMatricule.Text;
                        eleve           = creerCertificatScolariteBL.rechercherEleve(eleve);

                        if (eleve != null)
                        {
                            lblInfoEleve.Content = "[Nom :" + eleve.nom + ", Classe : " + inscrire.codeClasse + "]";
                            //imageEleve.Source = new BitmapImage(new Uri("../Images/"+ eleve2.photo+".jpg"));
                            if (eleve.photo != "")
                            {
                                try
                                {
                                    imageEleve.Source = new BitmapImage(new Uri(ConnexionUI.DOSSIER_PHOTO + eleve.photo));
                                }
                                catch (Exception) { imageEleve.Source = null; }
                            }
                            else
                            {
                                imageEleve.Source = null;
                            }
                        }
                        else
                        {
                            lblInfoEleve.Content = "";
                            imageEleve.Source    = null;
                            MessageBox.Show("Cette élève n'existe pas dans le système ! ", "School Brain : Alerte");
                        }
                    }
                    else
                    {
                        lblInfoEleve.Content = "";
                        imageEleve.Source    = null;
                        MessageBox.Show("Cette n'a pas éffectué d'inscription pour l'année choisi ! ", "School Brain : Alerte");
                    }
                }
            }
        }
Example #2
0
        //-------------------Imprimer les relevés des élèves sélectionnés-------------------
        public void imprimerCertificatScolarite(int annee, string classe)
        {
            //on vérifit si tous les champs ont été corectement rempli
            if ((cmbClasse.Text != null && txtAnnee.Text != null) && (cmbClasse.Text != "" && txtAnnee.Text != ""))
            {
                //--------------------- Action pour une classe particulière

                //Configure the ProgressBar
                ProgressBar1.Minimum = 0;
                ProgressBar1.Maximum = 1;
                ProgressBar1.Value   = 0;

                //Stores the value of the ProgressBar
                double value = 0;

                //Create a new instance of our ProgressBar Delegate that points
                // to the ProgressBar's SetValue method.
                UpdateProgressBarDelegate updatePbDelegate =
                    new UpdateProgressBarDelegate(ProgressBar1.SetValue);


                //on affiche la barre de progression
                ProgressBar1.Visibility = System.Windows.Visibility.Visible;

                // ***********calcul des moyennes
                //remplissage de la table "moyennes"


                for (int i = 0; i < listBoxEleve.Items.Count; i++)
                {
                    ListBoxItem item = listBoxEleve.ItemContainerGenerator.ContainerFromIndex(i) as ListBoxItem;

                    if (item != null)
                    {
                        CheckBox myCheckBox = FindVisualChild <CheckBox>(item) as CheckBox;
                        if (myCheckBox.IsChecked.Value)
                        {
                            // bulletinsAnnuelBL.genererBulletinAnnuelDunEleve((listBoxEleve.Items[i] as ElementListeEleve).matricule, annee, classe);

                            EleveBE eleve = new EleveBE();
                            eleve.matricule = (listBoxEleve.Items[i] as ElementListeEleve).matricule;
                            eleve           = creerCertificatScolariteBL.rechercherEleve(eleve);

                            // on cherche l'inscription de l'élève pour l'année saisit
                            InscrireBE inscrire = creerCertificatScolariteBL.rechercherInscrireSuivantCritere("matricule = '" + (listBoxEleve.Items[i] as ElementListeEleve).matricule + "' AND annee = '" + txtAnnee.Text + "'");

                            if (inscrire != null)
                            {
                                //on recherche la classe de l'élève
                                ClasseBE classeBE = new ClasseBE();
                                classeBE.codeClasse = classe;

                                classeBE = creerCertificatScolariteBL.rechercherClasse(classeBE);

                                if (classeBE != null)
                                {
                                    ParametresBE parametre = creerCertificatScolariteBL.getParametres();

                                    //MessageBox.Show("Matricule = " + (listBoxEleve.Items[i] as ElementListeEleve).matricule + " || Nom= " + (listBoxEleve.Items[i] as ElementListeEleve).nom + "=" + classe + "=" + annee.ToString());

                                    creerCertificatScolariteBL.etatCertificatScolarite(Convert.ToInt16(txtAnnee.Text), eleve, classeBE, inscrire, parametre);

                                    value += 1;

                                    Dispatcher.Invoke(updatePbDelegate,
                                                      System.Windows.Threading.DispatcherPriority.Background,
                                                      new object[] { ProgressBar.ValueProperty, value });
                                }
                            }
                        }
                    }
                }

                MessageBox.Show("Opération Terminée !! ");

                //on cache la barre de progression
                ProgressBar1.Visibility = System.Windows.Visibility.Hidden;
            }
            else
            {
                MessageBox.Show("Tous les champs doivent êtres remplis !! ");
            }
        }