private void boutonSupprimer_Click(object sender, RoutedEventArgs e)
        {
            if (selectedSociete != null)
            {
                Offre o = App.dbContext.Offres.FirstOrDefault(oTemp => oTemp.Annonceur.Identifiant == selectedSociete.Identifiant);

                if (o == null)
                {
                    try
                    {
                        App.dbContext.Societes.Remove(selectedSociete);
                        App.dbContext.SaveChanges();

                        Societes.Remove(selectedSociete);
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                }
                else
                {
                    MessageBox.Show("Impossible de supprimer l'annonceur car il est rataché à une ou plusieurs offre(s)", "Erreur de suppression", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
        private void boutonEnregistrer_Click(object sender, RoutedEventArgs e)
        {
            if (selectedSociete != null)
            {
                Boolean isOk = true;
                int     num;
                Adresse adresse = selectedSociete.Adresse;
                this.UpdateSources();
                if (VerificationFormulaire())
                {
                    if (int.TryParse(this.textBoxAdresseNumero.Text, out num))
                    {
                        adresse.Numero = num;
                    }
                    else
                    {
                        isOk = false;
                    }

                    if (isOk == true)
                    {
                        if (selectedSociete is Annonceur)
                        {
                            if (radioAnnonceur.IsChecked == true)
                            {
                                try
                                {
                                    App.dbContext.SaveChangesAsync();
                                    MessageBox.Show("Annonceur enregistré", "Validation", MessageBoxButton.OK, MessageBoxImage.Information);
                                }
                                catch (Exception)
                                {
                                    throw;
                                }
                            }
                            else
                            {
                                try
                                {
                                    Diffuseur d = new Diffuseur();
                                    d.RaisonSociale = this.textBoxRaisonSociale.Text;
                                    d.Telephone     = this.textBoxTelephone.Text;
                                    d.Email         = this.textBoxEmail.Text;
                                    d.NumeroSiret   = this.textBoxSiret.Text;
                                    d.Adresse       = adresse;

                                    App.dbContext.Societes.Remove(selectedSociete);
                                    Societes.Remove(selectedSociete);

                                    App.dbContext.Societes.Add(d);
                                    App.dbContext.SaveChangesAsync();
                                    MessageBox.Show("Diffuseur enregistré", "Validation", MessageBoxButton.OK, MessageBoxImage.Information);

                                    Societes.Add(d);
                                    listeSociete.SelectedItem = d;
                                }
                                catch (Exception)
                                {
                                    throw;
                                }
                            }
                        }
                        else
                        {
                            if (radioDiffuseur.IsChecked == true)
                            {
                                try
                                {
                                    App.dbContext.SaveChangesAsync();
                                    MessageBox.Show("Diffuseur enregistré", "Validation", MessageBoxButton.OK, MessageBoxImage.Information);
                                }
                                catch (Exception)
                                {
                                    throw;
                                }
                            }
                            else
                            {
                                try
                                {
                                    Annonceur a = new Annonceur();
                                    a.RaisonSociale = this.textBoxRaisonSociale.Text;
                                    a.Telephone     = this.textBoxTelephone.Text;
                                    a.Email         = this.textBoxEmail.Text;
                                    a.NumeroSiret   = this.textBoxSiret.Text;
                                    a.Adresse       = adresse;

                                    App.dbContext.Societes.Remove(selectedSociete);
                                    Societes.Remove(selectedSociete);

                                    App.dbContext.Societes.Add(a);
                                    App.dbContext.SaveChangesAsync();
                                    MessageBox.Show("Annonceur enregistré", "Validation", MessageBoxButton.OK, MessageBoxImage.Information);

                                    Societes.Add(a);
                                    listeSociete.SelectedItem = a;
                                }
                                catch (Exception)
                                {
                                    throw;
                                }
                            }
                        }
                    }
                    else
                    {
                        this.labelErreurAdresseNumero.Visibility = System.Windows.Visibility.Visible;
                    }
                }
            }
        }