Exemplo n.º 1
0
        //evenement pour page acceuil
        private void afficherDetailsEtudiant(object sender, RoutedEventArgs e)
        {
            int idEdtudiant = (int)((Button)sender).DataContext;

            ProfileEtudiantVue vue = new ProfileEtudiantVue(User, idEdtudiant);

            vue.Show();
            this.Close();
        }
Exemplo n.º 2
0
        //Modifier Etudiant
        private void BtnAjouterEtudiant_Click(object sender, RoutedEventArgs e)
        {
            MonEtudiant.Prenom     = ChoixPrenomVue.Text;
            MonEtudiant.Nom        = ChoixNomVue.Text;
            MonEtudiant.Courriel   = ChoixCourrierlVue.Text;
            MonEtudiant.Telephone1 = ChoixTel1Vue.Text;
            MonEtudiant.Telephone2 = ChoixTel2Vue.Text;
            MonEtudiant.Telephone3 = ChoixTel3Vue.Text;
            MonEtudiant.Adresse    = ChoixAdresseVue.Text;
            MonEtudiant.Ville      = ChoixVilleVue.Text;

            if (ChoixDateNaissaceVue.SelectedDate != null)
            {
                DateTime?ChoixDateTemp = ChoixDateNaissaceVue.SelectedDate;
                Object   objectdate    = ChoixDateTemp;
                MonEtudiant.DateNaissance = (DateTime)objectdate;
            }

            if (ChoixStatutsResidenceVue.SelectedValue != null)
            {
                MonEtudiant.IdStatusResidence = ListeDescription.recupererIdDescription(ChoixStatutsResidenceVue.SelectedValue.ToString(), ListeDescription.listStatusResidence);
            }

            MonEtudiant.Vehicule       = ChkBxVehicule.IsChecked;
            MonEtudiant.PermisConduire = ChkBxVehicule.IsChecked;
            MonEtudiant.RiveNord       = ChkBxRiveNord.IsChecked;
            MonEtudiant.RiveSud        = ChkBxRiveSud.IsChecked;
            MonEtudiant.Commentaire    = ChoixCommentaireVue.Text;
            MonEtudiant.Langues        = new List <Langue>();


            if (Langue1Choix.SelectedItem != null)
            {
                Langue langue1 = new Langue();
                langue1.Id     = ListeDescription.recupererIdLangue(Langue1Choix.SelectedValue.ToString());
                langue1.Niveau = ListeDescription.recupererIdDescription(Niveau1Choix.SelectedValue.ToString(), ListeDescription.listNiveauLangue);
                MonEtudiant.Langues.Add(langue1);
            }

            if (Langue2Choix.SelectedItem != null)
            {
                Langue langue2 = new Langue();
                langue2.Id     = ListeDescription.recupererIdLangue(Langue2Choix.SelectedValue.ToString());
                langue2.Niveau = ListeDescription.recupererIdDescription(Niveau2Choix.SelectedValue.ToString(), ListeDescription.listNiveauLangue);
                MonEtudiant.Langues.Add(langue2);
            }

            if (Langue3Choix.SelectedItem != null)
            {
                Langue langue3 = new Langue();
                langue3.Id     = ListeDescription.recupererIdLangue(Langue3Choix.SelectedValue.ToString());
                langue3.Niveau = ListeDescription.recupererIdDescription(Niveau3Choix.SelectedValue.ToString(), ListeDescription.listNiveauLangue);
                MonEtudiant.Langues.Add(langue3);
            }

            if (Langue4Choix.SelectedItem != null)
            {
                Langue langue4 = new Langue();
                langue4.Id     = ListeDescription.recupererIdLangue(Langue4Choix.SelectedValue.ToString());
                langue4.Niveau = ListeDescription.recupererIdDescription(Niveau4Choix.SelectedValue.ToString(), ListeDescription.listNiveauLangue);
                MonEtudiant.Langues.Add(langue4);
            }

            if (FormationChoix.SelectedValue != null)
            {
                MonEtudiant.IdFormation = ListeDescription.recupererIdFormation(FormationChoix.SelectedValue.ToString());
            }

            if (DateFinFormaionChoix.SelectedDate != null)
            {
                DateTime?dateFin       = DateFinFormaionChoix.SelectedDate;
                Object   objectdateFin = dateFin;
                MonEtudiant.DateFinFormation = (DateTime)objectdateFin;
            }

            if (StatusCarriereChoix.SelectedValue != null)
            {
                MonEtudiant.IdStatusCarriere = ListeDescription.recupererIdDescription(StatusCarriereChoix.SelectedValue.ToString(), ListeDescription.listStatusCarrieres);
            }


            if (MonEtudiant.Nom.Length <= 0 || MonEtudiant.Prenom.Length <= 0 || MonEtudiant.Courriel.Length <= 0 ||
                MonEtudiant.DateFinFormation == null || StatusCarriereChoix.SelectedValue == null || FormationChoix.SelectedValue == null)
            {
                MessageBox.Show("Veuillez remplir les champs obligatoire", "Modification d'un étudiant", MessageBoxButton.OK, MessageBoxImage.Information);
            }


            else
            {
                Double SalaireEspereDouble;
                if (Double.TryParse(SalaireChoix.Text, out SalaireEspereDouble))
                {
                    Double.TryParse(SalaireChoix.Text, out SalaireEspereDouble);
                }
                else
                {
                    SalaireEspereDouble = 0;
                }

                Object objectSalaire = SalaireEspereDouble;
                MonEtudiant.SalaireEspere = (Double?)objectSalaire;

                MonEtudiant.PosteDesire = PosteDesirerChoix.Text;
                MonEtudiant.Experiences = ExperiencesAnterieurChoix.Text;


                List <int> listInteretRecherche = null;
                if (InteretChoix.SelectedItems != null)
                {
                    listInteretRecherche = new List <int>();
                    foreach (ListBoxItem item in InteretChoix.SelectedItems)
                    {
                        if (item != null)
                        {
                            listInteretRecherche.Add(ListeDescription.recupererIdDescription(item.Content.ToString(), ListeDescription.listInterets));
                        }
                    }
                }


                List <int> listTechnologieRecherche = null;
                if (TechnologieChoix.SelectedItems != null)
                {
                    listTechnologieRecherche = new List <int>();
                    foreach (ListBoxItem item in TechnologieChoix.SelectedItems)
                    {
                        if (item != null)
                        {
                            listTechnologieRecherche.Add(ListeDescription.recupererIdDescription(item.Content.ToString(), ListeDescription.listTechnologie));
                        }
                    }
                }


                if (MonEtudiant.PhotoURL == null)
                {
                    MonEtudiant.PhotoURL = "images\\ProfilImageVide.png";
                }

                MonEtudiant.Modification = new Modification();
                MonEtudiant.Modification.UtilisateurId    = User.Id;
                MonEtudiant.Modification.DateModification = DateTime.Now;

                int reponse = ManagerEtudiant.modifierEtudiant(MonEtudiant, listInteretRecherche, listTechnologieRecherche, MonEtudiant.Langues);

                if (reponse != -1)
                {
                    ProfileEtudiantVue vue = new ProfileEtudiantVue(User, MonEtudiant.Id);
                    vue.Show();
                    this.Close();
                }
            }
        }