private void cbDepartement_DropDownClosed(object sender, EventArgs e) { Patient p = cbNSSPatient.SelectedItem as Patient; Departement dep = cbDepartement.SelectedItem as Departement; cbTypeLit.ItemsSource = MainWindow.bdHospital.TypeLits.ToList(); if (p.DateNaissance.Value.AddYears(16) > DateTime.Today) { cbDepartement.SelectedIndex = 3; } }
private void cbTypeLit_SelectionChanged(object sender, SelectionChangedEventArgs e) { TypeLit tli = cbTypeLit.SelectedItem as TypeLit; Departement dep = cbDepartement.SelectedItem as Departement; try { cbNumeroLit.ItemsSource = MainWindow.bdHospital.Lits.Where(lit => lit.NumeroType == tli.NumeroType & lit.IdDepartement == dep.IdDepartement & lit.Occupe == false).ToList(); } catch (Exception) { cbNumeroLit.ItemsSource = null; } }
public int typeLitFact(int typeUser) { int res = 1; Departement Dep = cbDepartement.SelectedItem as Departement; List <Lit> listlit = MainWindow.bdHospital.Lits.Where(l => l.IdDepartement == Dep.IdDepartement & l.Occupe == false).ToList(); for (int i = 0; i < listlit.Count - 1; i++) { if (listlit[i].NumeroType < typeUser) { res = typeUser; } } return(res); }