/// <summary>
        /// Ajoute un nouveau salarié à la liste à l'aide d'une nouvelle fenêtre
        /// </summary>
        public Personne Add()
        {
            SalarieWindow salarieWindow = new SalarieWindow();
            salarieWindow.creation = true;
            Personne tmp = new Personne();
            tmp.Salarie = new Salarie();
            tmp.Salarie.Salarie_Interne = new Salarie_Interne();
            tmp.Salarie.Tiers = new Tiers();
            tmp.Salarie.Interimaire = new Interimaire();
            tmp.Adresse1 = new Adresse();
            tmp.Adresse2 = new Adresse();
            salarieWindow.ListAgences = new ObservableCollection<Agence_Interimaire>(((App)App.Current).mySitaffEntities.Agence_Interimaire.OrderBy(ai => ai.Fournisseur.Entreprise.Libelle));
            salarieWindow.VilleListPerso = new ObservableCollection<Ville>(((App)App.Current).mySitaffEntities.Ville.OrderBy(vil => vil.Libelle));
            salarieWindow.PaysListPerso = new ObservableCollection<Pays>(((App)App.Current).mySitaffEntities.Pays.OrderBy(pay => pay.Libelle));
            salarieWindow.VilleListPro = new ObservableCollection<Ville>(((App)App.Current).mySitaffEntities.Ville.OrderBy(vil => vil.Libelle));
            salarieWindow.PaysListPro = new ObservableCollection<Pays>(((App)App.Current).mySitaffEntities.Pays.OrderBy(pay => pay.Libelle));
            salarieWindow.ListCivilite = new ObservableCollection<Civilite>(((App)App.Current).mySitaffEntities.Civilite.OrderBy(civ => civ.Libelle_Long));
            salarieWindow.ListEntreprise = new ObservableCollection<Entreprise>(((App)App.Current).mySitaffEntities.Entreprise.Where(ent => ent.Fournisseur != null).Where(ent => ent.Fournisseur.Sous_Traitant != null || ent.Fournisseur.Agence_Interimaire != null).OrderBy(ent => ent.Libelle));
            salarieWindow.ListGroupe = new ObservableCollection<Groupe>(((App)App.Current).mySitaffEntities.Groupe.OrderBy(grp => grp.Libelle));
            salarieWindow.listEntreprise_Mere = new ObservableCollection<Entreprise_Mere>(((App)App.Current).mySitaffEntities.Entreprise_Mere.OrderBy(em => em.Nom));
            salarieWindow.ListContrats = new ObservableCollection<Contrat>(((App)App.Current).mySitaffEntities.Contrat.OrderBy(ct => ct.Libelle));
            salarieWindow.listOutillage = new ObservableCollection<Outillage>(((App)App.Current).mySitaffEntities.Outillage.OrderBy(ou => ou.Libelle));
            salarieWindow.DataContext = tmp;
            salarieWindow.bloquerSalarieInterne();
            salarieWindow.bloquerSalarieInterimaire();
            salarieWindow.bloquerSalarieTiers();

            //booléen nullable vrai ou faux ou null
            bool? dialogResult = salarieWindow.ShowDialog();

            if (dialogResult.HasValue && dialogResult.Value == true)
            {
                return (Personne)salarieWindow.DataContext;
            }
            else
            {
                try
                {
                    ((App)App.Current).mySitaffEntities.Detach((Personne)salarieWindow.DataContext);
                }
                catch (Exception)
                {
                }
                return null;
            }
        }
        /// <summary>
        /// Ouvre le salarié séléctionné à l'aide d'une nouvelle fenêtre
        /// </summary>
        public Personne Open()
        {
            if (this._DataGridMain.SelectedItem != null)
            {
                if (this._DataGridMain.SelectedItems.Count == 1)
                {
                    SalarieWindow salarieWindow = new SalarieWindow();
                    Personne tmp = new Personne();
                    tmp = (Personne)this._DataGridMain.SelectedItem;
                    salarieWindow.ListAgences = new ObservableCollection<Agence_Interimaire>(((App)App.Current).mySitaffEntities.Agence_Interimaire.OrderBy(ai => ai.Fournisseur.Entreprise.Libelle));
                    salarieWindow.VilleListPerso = new ObservableCollection<Ville>(((App)App.Current).mySitaffEntities.Ville.OrderBy(vil => vil.Libelle));
                    salarieWindow.PaysListPerso = new ObservableCollection<Pays>(((App)App.Current).mySitaffEntities.Pays.OrderBy(pay => pay.Libelle));
                    salarieWindow.VilleListPro = new ObservableCollection<Ville>(((App)App.Current).mySitaffEntities.Ville.OrderBy(vil => vil.Libelle));
                    salarieWindow.PaysListPro = new ObservableCollection<Pays>(((App)App.Current).mySitaffEntities.Pays.OrderBy(pay => pay.Libelle));
                    salarieWindow.ListCivilite = new ObservableCollection<Civilite>(((App)App.Current).mySitaffEntities.Civilite.OrderBy(civ => civ.Libelle_Long));
                    salarieWindow.ListEntreprise = new ObservableCollection<Entreprise>(((App)App.Current).mySitaffEntities.Entreprise.Where(ent => ent.Fournisseur != null).Where(ent => ent.Fournisseur.Sous_Traitant != null || ent.Fournisseur.Agence_Interimaire != null).OrderBy(ent => ent.Libelle));
                    salarieWindow.ListGroupe = new ObservableCollection<Groupe>(((App)App.Current).mySitaffEntities.Groupe.OrderBy(grp => grp.Libelle));
                    salarieWindow.listEntreprise_Mere = new ObservableCollection<Entreprise_Mere>(((App)App.Current).mySitaffEntities.Entreprise_Mere.OrderBy(em => em.Nom));
                    salarieWindow.ListContrats = new ObservableCollection<Contrat>(((App)App.Current).mySitaffEntities.Contrat.OrderBy(ct => ct.Libelle));
                    salarieWindow.listOutillage = new ObservableCollection<Outillage>(((App)App.Current).mySitaffEntities.Outillage.OrderBy(ou => ou.Libelle));
                    foreach (Salarie_Outillage so in tmp.Salarie.Salarie_Outillage)
                    {
                        salarieWindow.listOutillage.Remove(so.Outillage1);
                    }
                    if (((Personne)this._DataGridMain.SelectedItem).Salarie.Salarie_Interne == null)
                    {
                        salarieWindow.bloquerSalarieInterne();
                        tmp.Salarie.Salarie_Interne = new Salarie_Interne();
                    }
                    else
                    {
                        salarieWindow.checkBox_SalarieInterne.IsChecked = true;
                    }
                    if (((Personne)this._DataGridMain.SelectedItem).Salarie.Interimaire == null)
                    {
                        salarieWindow.bloquerSalarieInterimaire();
                        tmp.Salarie.Interimaire = new Interimaire();
                    }
                    else
                    {
                        salarieWindow.checkBox_SalarieInterimaire.IsChecked = true;
                    }
                    if (((Personne)this._DataGridMain.SelectedItem).Salarie.Tiers == null)
                    {
                        salarieWindow.bloquerSalarieTiers();
                        tmp.Salarie.Tiers = new Tiers();
                    }
                    else
                    {
                        salarieWindow.checkBox_SalarieTiers.IsChecked = true;
                    }
                    if (tmp.Adresse1 == null)
                    {
                        tmp.Adresse1 = new Adresse();
                    }
                    if (tmp.Adresse2 == null)
                    {
                        tmp.Adresse2 = new Adresse();
                    }
                    salarieWindow.DataContext = tmp;

                    bool? dialogResult = salarieWindow.ShowDialog();
                    if (dialogResult.HasValue && dialogResult.Value == true)
                    {
                        return (Personne)salarieWindow.DataContext;
                    }
                    else
                    {
                        return null;
                    }

                }
                else
                {
                    MessageBox.Show("Vous ne devez sélectionner qu'un seul salarié.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return null;
                }
            }
            else
            {
                MessageBox.Show("Vous devez sélectionner un salarié.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return null;
            }
        }
        /// <summary>
        /// Ouvre le salarié séléctionné en lecture seule à l'aide d'une nouvelle fenêtre
        /// </summary>
        public Personne Look(Personne salarieToLook)
        {
            if (this._DataGridMain.SelectedItem != null || salarieToLook != null)
            {
                if (this._DataGridMain.SelectedItems.Count == 1 || salarieToLook != null)
                {
                    SalarieWindow salarieWindow = new SalarieWindow();
                    salarieWindow.DataContext = new Personne();
                    salarieWindow.ListAgences = new ObservableCollection<Agence_Interimaire>(((App)App.Current).mySitaffEntities.Agence_Interimaire.OrderBy(ai => ai.Fournisseur.Entreprise.Libelle));
                    salarieWindow.VilleListPerso = new ObservableCollection<Ville>(((App)App.Current).mySitaffEntities.Ville.OrderBy(vil => vil.Libelle));
                    salarieWindow.PaysListPerso = new ObservableCollection<Pays>(((App)App.Current).mySitaffEntities.Pays.OrderBy(pay => pay.Libelle));
                    salarieWindow.VilleListPro = new ObservableCollection<Ville>(((App)App.Current).mySitaffEntities.Ville.OrderBy(vil => vil.Libelle));
                    salarieWindow.PaysListPro = new ObservableCollection<Pays>(((App)App.Current).mySitaffEntities.Pays.OrderBy(pay => pay.Libelle));
                    salarieWindow.ListCivilite = new ObservableCollection<Civilite>(((App)App.Current).mySitaffEntities.Civilite.OrderBy(civ => civ.Libelle_Long));
                    salarieWindow.ListEntreprise = new ObservableCollection<Entreprise>(((App)App.Current).mySitaffEntities.Entreprise.OrderBy(ent => ent.Libelle));
                    salarieWindow.ListGroupe = new ObservableCollection<Groupe>(((App)App.Current).mySitaffEntities.Groupe.OrderBy(grp => grp.Libelle));
                    salarieWindow.listEntreprise_Mere = new ObservableCollection<Entreprise_Mere>(((App)App.Current).mySitaffEntities.Entreprise_Mere.OrderBy(em => em.Nom));
                    salarieWindow.ListContrats = new ObservableCollection<Contrat>(((App)App.Current).mySitaffEntities.Contrat.OrderBy(ct => ct.Libelle));
                    salarieWindow.listOutillage = new ObservableCollection<Outillage>(((App)App.Current).mySitaffEntities.Outillage.OrderBy(ou => ou.Libelle));

                    if (salarieToLook != null)
                    {
                        foreach (Salarie_Outillage so in salarieToLook.Salarie.Salarie_Outillage)
                        {
                            salarieWindow.listOutillage.Remove(so.Outillage1);
                        }
                        salarieWindow.DataContext = salarieToLook;
                        if (salarieToLook.Salarie.Salarie_Interne != null)
                        {
                            salarieWindow.checkBox_SalarieInterne.IsChecked = true;
                        }
                        if (salarieToLook.Salarie.Interimaire != null)
                        {
                            salarieWindow.checkBox_SalarieInterimaire.IsChecked = true;
                        }
                        if (salarieToLook.Salarie.Tiers != null)
                        {
                            salarieWindow.checkBox_SalarieTiers.IsChecked = true;
                        }
                    }
                    else
                    {
                        foreach (Salarie_Outillage so in ((Personne)this._DataGridMain.SelectedItem).Salarie.Salarie_Outillage)
                        {
                            salarieWindow.listOutillage.Remove(so.Outillage1);
                        }
                        salarieWindow.DataContext = this._DataGridMain.SelectedItem;
                        if (((Personne)this._DataGridMain.SelectedItem).Salarie.Salarie_Interne != null)
                        {
                            salarieWindow.checkBox_SalarieInterne.IsChecked = true;
                        }
                        if (((Personne)this._DataGridMain.SelectedItem).Salarie.Interimaire != null)
                        {
                            salarieWindow.checkBox_SalarieInterimaire.IsChecked = true;
                        }
                        if (((Personne)this._DataGridMain.SelectedItem).Salarie.Tiers != null)
                        {
                            salarieWindow.checkBox_SalarieTiers.IsChecked = true;
                        }
                    }

                    salarieWindow.LectureSeule();

                    bool? dialogResult = salarieWindow.ShowDialog();
                    return null;
                }
                else
                {
                    MessageBox.Show("Vous ne devez sélectionner qu'un seul salarié.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return null;
                }
            }
            else
            {
                MessageBox.Show("Vous devez sélectionner un salarié.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return null;
            }
        }