Пример #1
0
        public EleveUI()
        {
            CultureInfo ci = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.Name);

            ci.DateTimeFormat.ShortDatePattern  = "dd-MM-yyyy";
            Thread.CurrentThread.CurrentCulture = ci;

            classes       = new List <string>();
            categories    = new List <string>();
            nomclasses    = new List <string>();
            nomcategories = new List <string>();

            sexes = new List <string>()
            {
                "Masculin", "Feminin"
            };
            etats = new List <string>()
            {
                "CLASSE", "NON CLASSE"
            };
            nationalites = new List <string>();
            langues      = new List <string> {
                "Français", "Anglais", "Espagnol", "Allemand", "Chinois", "Japonais"
            };
            regions      = new List <string>();
            departements = new List <string>();
            eleveBL      = new GestionEleveBL();
            Console.WriteLine(DateTime.Now.ToLongTimeString());
            matricule      = "";
            photo          = ""; //Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\PhotosEtudiants\\default.jpg";
            telephone      = "";
            email          = "";
            diplome        = "";
            telParent      = "";
            anneeDiplome   = 0;
            typeValidation = TYPE_ENREGISTRER;

            InitializeComponent();

            classes       = eleveBL.listerValeurColonneClasse("codeclasse");
            categories    = eleveBL.listerValeurColonneCategorie("codecateleve");
            nomclasses    = eleveBL.listerValeurColonneClasse("nomclasse");
            nomcategories = eleveBL.listerValeurColonneCategorie("nomcateleve");

            nationalites = eleveBL.listerValeurColonnePays("codepays");
            regions      = eleveBL.listerValeurColonneRegion("coderegion");
            departements = eleveBL.listerValeurColonneDepartement("codedept");

            annee                      = eleveBL.AnneeEnCours();
            txtAnnee.Text              = " / " + annee;
            txtAnneeScolaire.Text      = (annee - 1).ToString();
            cmbCategorie.ItemsSource   = categories;
            cmbCategorie.SelectedIndex = 0;
            cmbClasse.ItemsSource      = classes;
            cmbClasse.SelectedIndex    = 0;

            /*cmbDepartement.ItemsSource = departements;
             * cmbDepartement.SelectedIndex = 0;*/
            cmbLangue.ItemsSource        = langues;
            cmbLangue.SelectedIndex      = 0;
            cmbNationalite.ItemsSource   = nationalites;
            cmbNationalite.SelectedIndex = 0;

            /*cmbRegion.ItemsSource = regions;
             * cmbRegion.SelectedIndex = 0;*/
            cmbSexe.ItemsSource           = sexes;
            cmbSexe.SelectedIndex         = 0;
            cmbEtat.ItemsSource           = etats;
            cmbEtat.SelectedIndex         = 0;
            radioEnregistrement.IsChecked = true;
            radioNonRedoublant.IsChecked  = true;
            txtMatricule.IsEnabled        = false;
            //-------------MOI----------------------------------------------------
            txtMatricule.Text = nouveauMatricule(eleveBL.getDernierMatricule());
            //--------------------------------------------------------------------

            fonctionPere                  = "";
            fonctionMere                  = "";
            particulariteMedicale         = "";
            txtFonctionPere.Text          = "";
            txtFonctionMere.Text          = "";
            txtParticulariteMedicale.Text = "";
        }
Пример #2
0
        //methode pour initialiser les champs en fonction d'un objet EleveBE
        private void initialiserChamps(EleveBE eleve)
        {
            if (eleve != null)
            {
                InscrireBE   inscrire   = new InscrireBE();
                AppartenirBE appartenir = new AppartenirBE();
                ClasseBE     classe     = new ClasseBE();
                int          annee;

                inscrire.matricule   = eleve.matricule;
                appartenir.matricule = eleve.matricule;
                annee            = eleveBL.obtenirAnneeInscription(eleve);
                inscrire.annee   = annee;
                appartenir.annee = annee;

                inscrire   = eleveBL.rechercherInscrire(inscrire);
                appartenir = eleveBL.rechercherAppartenir(appartenir);
                if (inscrire == null)
                {
                    MessageBox.Show("L'inscription n'a pas été faite en " + annee + ", veuillez renseigner le champ Année pour recommencer");
                }
                else
                {
                    txtAdresse.Text         = eleve.adresse;
                    txtAnneeObtention.Text  = Convert.ToString(eleve.anneeDiplome);
                    txtDiplome.Text         = eleve.diplome;
                    txtEmail.Text           = eleve.email;
                    txtLieu.Text            = eleve.lieuNaissance;
                    txtMatricule.Text       = eleve.matricule;
                    txtNom.Text             = eleve.nom;
                    txtNomMere.Text         = eleve.nomMere;
                    txtNomPere.Text         = eleve.nomPere;
                    txtTelephone.Text       = eleve.telephone;
                    txtTelephoneParent.Text = eleve.telParent;

                    try
                    {
                        photo           = eleve.photo;
                        imgPhoto.Source = new BitmapImage(new Uri(ConnexionUI.DOSSIER_PHOTO + eleve.photo));
                    }
                    catch (Exception) { imgPhoto.Source = null; }

                    //MessageBox.Show(inscrire.annee+"");
                    dpiDateNaissance.SelectedDate = eleve.dateNaissance;
                    cmbClasse.SelectedIndex       = cmbClasse.Items.IndexOf(inscrire.codeClasse);
                    txtAnneeScolaire.Text         = Convert.ToString(inscrire.annee - 1);
                    cmbCategorie.SelectedIndex    = cmbCategorie.Items.IndexOf(appartenir.codeCatEleve);
                    //cmbCategorie.Text = appartenir.codeCatEleve;
                    //cmbDepartement.SelectedIndex = cmbDepartement.Items.IndexOf(eleve.codeDept);
                    txtFonctionPere.Text          = eleve.fonctionPere;
                    txtFonctionMere.Text          = eleve.fonctionMere;
                    txtParticulariteMedicale.Text = eleve.situationMedicale;
                    cmbLangue.SelectedIndex       = cmbLangue.Items.IndexOf(eleve.langue);
                    cmbNationalite.SelectedIndex  = cmbNationalite.Items.IndexOf(eleve.codePays);
                    //cmbRegion.SelectedIndex = cmbRegion.Items.IndexOf(eleve.codeRegion);
                    cmbSexe.SelectedIndex = cmbSexe.Items.IndexOf(eleve.sexe);
                    cmbEtat.SelectedIndex = cmbEtat.Items.IndexOf(eleve.etat);

                    //on fixe les champs qui ne doivent pas etre modifies, informations scolaires
                    txtMatricule.IsEnabled     = false;
                    cmbCategorie.IsEnabled     = false;
                    cmbClasse.IsEnabled        = false;
                    txtAnneeScolaire.IsEnabled = false;
                    classe.codeClasse          = inscrire.codeClasse;
                    classe = eleveBL.rechercherClasse(classe);
                    if (eleveBL.estRedoublant(eleve, classe, annee))
                    {
                        radioNonRedoublant.IsChecked = false;
                        radioRedoublant.IsChecked    = true;
                    }
                    else
                    {
                        radioNonRedoublant.IsChecked = true;
                        radioRedoublant.IsChecked    = false;
                    }
                }
            }
            else
            {
                txtAdresse.Text            = "";
                txtAnneeObtention.Text     = "";
                txtDiplome.Text            = "";
                txtEmail.Text              = "";
                txtLieu.Text               = "";
                txtMatricule.Text          = nouveauMatricule(eleveBL.getDernierMatricule());
                txtNom.Text                = "";
                txtNomMere.Text            = "";
                txtNomPere.Text            = "";
                txtTelephone.Text          = "";
                txtTelephoneParent.Text    = "";
                txtAnneeScolaire.Text      = (eleveBL.AnneeEnCours() - 1).ToString();
                cmbCategorie.SelectedIndex = 0;
                cmbClasse.SelectedIndex    = 0;
                //cmbDepartement.SelectedIndex = 0;
                txtFonctionPere.Text          = "";
                txtFonctionMere.Text          = "";
                txtParticulariteMedicale.Text = "";
                cmbLangue.SelectedIndex       = 0;
                cmbNationalite.SelectedIndex  = 0;
                //cmbRegion.SelectedIndex = 0;
                cmbSexe.SelectedIndex         = 0;
                cmbEtat.SelectedIndex         = 0;
                dpiDateNaissance.SelectedDate = DateTime.Today.Date;
                dpiDateNaissance.Text         = DateTime.Today.Date.ToShortDateString();

                imgPhoto.Source = null;

                cmbCategorie.IsEnabled        = true;
                cmbClasse.IsEnabled           = true;
                txtAnneeScolaire.IsEnabled    = true;
                radioEnregistrement.IsChecked = true;
                radioNonRedoublant.IsChecked  = true;
            }
        }