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(); }
/// <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); }
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; }
///////////////////////////////////// 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 ! "); }
//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); }
public static void supprimerCommune(int id) { CommuneDAL.supprimerCommune(id); }
//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); }
public static CommuneDAO getCommunes(int idCommune) { CommuneDAO e = CommuneDAL.getCommune(idCommune); return(e); }
public static ObservableCollection <CommuneDAO> listeCommunes() { ObservableCollection <CommuneDAO> l = CommuneDAL.selectCommunes(); return(l); }
public static void insertCommune(CommuneDAO c) { CommuneDAL.insertCommune(c); }
public static void updateCommune(CommuneDAO d) { CommuneDAL.updateCommune(d); }
public static CommuneDAO getCommune(int idCommune) { CommuneDAO p = CommuneDAL.getCommune(idCommune); return(p); }
public static ObservableCollection <CommuneDAO> listeCommuneDepartement(int idDepartement) { ObservableCollection <CommuneDAO> l = CommuneDAL.selectCommuneDepartement(idDepartement); return(l); }
public static void insertCommune(CommuneDAO p) { CommuneDAL.insertCommune(p); }
public static void selectCommune(int id) { CommuneDAL.SelectCommune(id); }
public static void updateCommune(CommuneDAO p) { CommuneDAL.updateCommune(p); }
public static void insertCommune(CommuneDAO d) { CommuneDAL.insertCommune(d); }
public static void updateCommune(CommuneDAO c) { CommuneDAL.updateCommune(c); }