public virtual void add_libl(pe_libl libl) { libl.pe_ip = this; libl.no_ip = this.no_ip; // cette collection est un Set, soit un ensemble d'éléments uniques if (this.pe_libl_list.Contains(libl)) { var persistant_controller = new persistant_controller(hibernate_util.get_instance().get_current_session()); persistant_controller.session.Merge(libl); } else { this.pe_libl_list.Add(libl); } }
private void Cb_database_SelectionChanged(object sender, SelectionChangedEventArgs e) { ISession session; ComboBox cb_onnection = (ComboBox)sender; String connection_string = (String)cb_onnection.SelectedValue; if ((session = hibernate_util.get_instance().get_session(connection_string)) != null) { _persistant_controller = new persistant_controller(session); List <pe_ip> ips = session.CreateCriteria <pe_ip>().List <pe_ip>().OrderBy(x => x.no_ip).ToList(); ips = (from ip in ips where ip.pe_grmu_list.Count > 0 orderby ip.no_ip ascending select ip).ToList(); // ips = (from ip in ips where new int[]{ 8, 11}.Contains(ip.no_ip) select ip).ToList(); tree_main.ItemsSource = new ObservableCollection <pe_ip>(ips); } }