private void btnAjouter_Click(object sender, RoutedEventArgs e)
        {
            using (NLHContext context = new NLHContext())
            {
                // validate if fields are empty
                if (txtPrenom.Text == string.Empty || txtNom.Text == string.Empty || txtSpecialite.Text == string.Empty)
                {
                    MessageBox.Show("Une ou plus des champs est vide", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if ((string)btnAjouter.Content == "Ajouter")
                {
                    Medecin medecin = new Medecin
                    {
                        Prenom     = txtPrenom.Text.Trim(),
                        Nom        = txtNom.Text.Trim(),
                        Specialite = txtSpecialite.Text.Trim()
                    };


                    context.Medecins.Add(medecin);

                    dataGridMedecins.Items.Add(medecin);

                    context.SaveChanges();

                    Clear();

                    MessageBox.Show("Nouveau médecin ajouté !", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else if ((string)btnAjouter.Content == "Modifier")
                {
                    var med = dataGridMedecins.SelectedItem as Medecin;

                    med.Prenom     = txtPrenom.Text;
                    med.Nom        = txtNom.Text;
                    med.Specialite = txtSpecialite.Text;

                    context.Entry(med).State = EntityState.Modified;

                    context.SaveChanges();

                    MessageBox.Show("Médecin modifié !", "Info", MessageBoxButton.OK, MessageBoxImage.Information);

                    LoadDataGrid();
                }
            }
        }
        private void btnDonneConge_Click(object sender, RoutedEventArgs e)
        {
            using (NLHContext context = new NLHContext())
            {
                var idDossier = (comboPatients.SelectedItem as DossierAdmission).IdAdmission;

                var dos = context.DossierAdmissions.Include(d => d.Lit).Where(d => d.IdAdmission == idDossier).Single();

                dos.DateConge  = DateTime.Now;
                dos.Lit.Occupe = false;

                context.Entry(dos).State = EntityState.Modified;

                context.SaveChanges();

                MessageBox.Show("Congé donné le " + dos.DateConge, "Info", MessageBoxButton.OK, MessageBoxImage.Information);

                MessageBox.Show("Lit " + dos.NumLit + " dans le département " + dos.Lit.IdDepartement + " est libéré !", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }