public MainWindow()
        {
            InitializeComponent();
            DALConnection.OpenConnection();

            lp  = DepartementORM.listeDepartement();
            lp1 = PersonenORM.listePersonne();
            lp2 = EtudeORM.listeEtude();
            lp3 = AnimauxORM.listeAnimaux();
            lp4 = CommuneORM.listeCommune();
            lp5 = PlageORM.listePlage();
            lp7 = ZoneEtudeORM.listeZoneEtude();



            //LIEN AVEC la VIEW
            listeDepartement.ItemsSource = lp;
            listeCommune.ItemsSource     = lp4;
            listePlage.ItemsSource       = PlageZone;
            listeEtude.ItemsSource       = lp2;
            // listeDepartement2.ItemsSource = lp;
            // listeCommune2.ItemsSource = CommuneParDepartement;
            listePlage2.ItemsSource = lp5;
            // this.DataContext = lp; // bind de la liste avec la source, permettant le binding mais de façon globale sur toute la fenetre
        }
 private void AjoutCommune_Click_1(object sender, EventArgs e)
 {
     try
     {
         if (codePosatelDepartementTextBox.Text.Length > 5)
         {
             throw new CodePostalCommuneInvalideException("Code Postal trop long");
         }
         if (codePosatelDepartementTextBox.Text.Length < 5)
         {
             throw new CodePostalCommuneInvalideException("Code Postal trop court");
         }
         if (codePosatelDepartementTextBox.Text.Length == 0)
         {
             throw new CodePostalCommuneInvalideException("Code Postal requit");
         }
         myDataObject4 = new CommuneViewModel();
         myDataObject4.nomCommuneProperty = nomCommuneTextBox.Text;
         myDataObject4.codePostalProperty = codePosatelDepartementTextBox.Text;
         DepartementViewModel departement = (DepartementViewModel)listeDepartement.SelectedItem;
         CommuneViewModel     nouveau     = new CommuneViewModel(0, myDataObject4.nomCommuneProperty, myDataObject4.codePostalProperty, departement);
         lp4.Add(nouveau);
         CommuneORM.insertCommune(nouveau);
         lp4 = CommuneORM.listeCommune();
         nomCommuneTextBox.Text             = string.Empty;
         codePosatelDepartementTextBox.Text = string.Empty;
         listeDepartement.Items.Refresh();
     }
     catch (CodePostalCommuneInvalideException exptcodepostal)
     {
         MessageBox.Show(exptcodepostal.Message);
     }
 }