private void ajouterButton(object sender, RoutedEventArgs e)
        {
            myDataObject.nomCommuneProperty = nomTextBox.Text;

            myDataObject.departementCommune = (DepartementViewModel)listeDepartementsCombo.SelectedItem;
            CommuneViewModel nouveau = new CommuneViewModel(CommuneDAL.getMaxIdCommune() + 1, myDataObject.nomCommuneProperty, myDataObject.departementCommuneProperty);

            le.Add(nouveau);
            CommuneORM.insertCommune(nouveau);
            listeCommunes.Items.Refresh();
        }
Пример #2
0
        /// <summary>
        /// Recherche la ou les communes en fonction du code postal
        /// </summary>
        /// <param name="codePostal"></param>
        /// <returns></returns>
        private List <Commune> RechercherCommunes(string codePostal)
        {
            int i            = 0;
            var isCodePostal = int.TryParse(codePostal, out i);

            List <Commune> communes = new List <Commune>();

            if (codePostal != string.Empty && isCodePostal)
            {
                using (var dal = new CommuneDAL(DAL.DAL.Bdd))
                {
                    communes = dal.GetFilteredCommunes(Convert.ToInt32(codePostal));
                }
            }

            return(communes);
        }
Пример #3
0
        private void ajouterCommune_Click(object sender, EventArgs e)
        {
            myDataObject.nomCommuneProperty = Nom.Text;
            if ((DepartementViewModel)listeDepartementsCombo.SelectedItem != null)
            {
                myDataObject.departementCommune = (DepartementViewModel)listeDepartementsCombo.SelectedItem;
            }
            else
            {
                myDataObject.departementCommune = new DepartementViewModel(1, "MauvaisNumeroDepartement", 0);
            }
            CommuneViewModel nouveau = new CommuneViewModel(CommuneDAL.getMaxIdCommune() + 1, myDataObject.nomCommuneProperty, myDataObject.departementCommune);

            lu.Add(nouveau);
            CommuneORM.insertCommune(nouveau);
            listeDepartementsCombo.ItemsSource = lp;
            listeCommunes.Items.Refresh();
            listeDepartementsCombo.Items.Refresh();
            listeCommunes.ItemsSource = lu;
        }
Пример #4
0
        /////////////////////////////////////   Commune     /////////////////////////////////////
        /////////////////////////////////////   Commune     /////////////////////////////////////
        private void ValideCommune_Click(object sender, RoutedEventArgs e)
        {
            myDataObject2 = new CommuneViewModel();
            myDataObject2.nomCommuneProperty  = NomCommune.Text;
            myDataObject2.CodePostaleProperty = CodePostale.Text;
            myDataObject2.DepartementCommune  = (DepartementViewModel)listeDepartementsCombo.SelectedItem;
            CommuneViewModel nouveau = new CommuneViewModel(CommuneDAL.getMaxIdCommune() + 1, myDataObject2.nomCommuneProperty, myDataObject2.CodePostaleProperty, myDataObject2.DepartementCommune);

            lp2.Add(nouveau);

            CommuneORM.insertCommune(nouveau);

            listeDepartementsCombo.ItemsSource = lp3;
            listeCommunes.Items.Refresh();
            listeDepartementsCombo.Items.Refresh();
            listeCommunes.ItemsSource = lp2;
            compteur = lp2.Count();

            ((TextBox)NomCommune).Text  = string.Empty;
            ((TextBox)CodePostale).Text = string.Empty;

            MessageBox.Show("Commune ajoutée avec succes ! ");
        }
Пример #5
0
 //public static void insertCommune(CommuneViewModel e)
 //{
 //    CommuneDAL.insertCommune(new CommuneDAO(e.idCommuneProperty, e.nomCommuneProperty, e.departementCommuneProperty.idDepartementProperty));
 //}
 public static void insertCommune(CommuneDAO e)
 {
     CommuneDAL.insertCommune(e);
 }
Пример #6
0
 public static void supprimerCommune(int id)
 {
     CommuneDAL.supprimerCommune(id);
 }
Пример #7
0
 //public static void updateCommune(CommuneViewModel e)
 //{
 //    CommuneDAL.updateCommune(new CommuneDAO(e.idCommuneProperty, e.nomCommuneProperty, e.departementCommuneProperty.idDepartementProperty));
 //}
 public static void updateCommune(CommuneDAO e)
 {
     CommuneDAL.updateCommune(e);
 }
Пример #8
0
        public static CommuneDAO getCommunes(int idCommune)
        {
            CommuneDAO e = CommuneDAL.getCommune(idCommune);

            return(e);
        }
Пример #9
0
        public static ObservableCollection <CommuneDAO> listeCommunes()
        {
            ObservableCollection <CommuneDAO> l = CommuneDAL.selectCommunes();

            return(l);
        }
Пример #10
0
 public static void insertCommune(CommuneDAO c)
 {
     CommuneDAL.insertCommune(c);
 }
Пример #11
0
 public static void updateCommune(CommuneDAO d)
 {
     CommuneDAL.updateCommune(d);
 }
Пример #12
0
        public static CommuneDAO getCommune(int idCommune)
        {
            CommuneDAO p = CommuneDAL.getCommune(idCommune);

            return(p);
        }
Пример #13
0
        public static ObservableCollection <CommuneDAO> listeCommuneDepartement(int idDepartement)
        {
            ObservableCollection <CommuneDAO> l = CommuneDAL.selectCommuneDepartement(idDepartement);

            return(l);
        }
Пример #14
0
 public static void insertCommune(CommuneDAO p)
 {
     CommuneDAL.insertCommune(p);
 }
Пример #15
0
 public static void selectCommune(int id)
 {
     CommuneDAL.SelectCommune(id);
 }
Пример #16
0
 public static void updateCommune(CommuneDAO p)
 {
     CommuneDAL.updateCommune(p);
 }
Пример #17
0
 public static void insertCommune(CommuneDAO d)
 {
     CommuneDAL.insertCommune(d);
 }
Пример #18
0
 public static void updateCommune(CommuneDAO c)
 {
     CommuneDAL.updateCommune(c);
 }