private void nomPatientT_TextChanged(object sender, TextChangedEventArgs e) { if (prenomPatientT.Text == "") { listPatientsTmp = rdv.RechercherPatientNom(nomPatientT.Text); } else { listPatientsTmp = rdv.RechercherPatient(nomPatientT.Text + " " + prenomPatientT.Text); } prenomPatientT.Items.Clear(); nomPatientT.Items.Clear(); foreach (Personne patient in listPatientsTmp) { prenomPatientT.Items.Add(prenomPatientT.Items.Add(patient.prenom)); nomPatientT.Items.Add(nomPatientT.Items.Add(patient.nom)); if (prenomPatientT.Items.Count != 0) { prenomPatientT.Items.RemoveAt(prenomPatientT.Items.Count - 1); } if (nomPatientT.Items.Count != 0) { nomPatientT.Items.RemoveAt(nomPatientT.Items.Count - 1); } } }
private void okBtn_Click(object sender, RoutedEventArgs e) { if (nomPatientT.Text == "" || prenomPatientT.Text == "") { MessageBox.Show("Veuillez remplir toutes les informations!"); if (nomPatientT.Text == "") { nomPatientT.BorderBrush = Brushes.Red; } else { nomPatientT.BorderBrush = Brushes.Black; } if (prenomPatientT.Text == "") { prenomPatientT.BorderBrush = Brushes.Red; } else { prenomPatientT.BorderBrush = Brushes.Black; } } else { Globals.NomPatient = nomPatientT.Text; Globals.PrenomPatient = prenomPatientT.Text; patients = pat.RechercherPatient(Globals.NomPatient + " " + Globals.PrenomPatient); if (patients.Count() != 0) { //(DateTime)patients[0].dateNaissance; DateTime date = (DateTime)patients[0].dateNaissance; Globals.Age = DateTime.Today.Year - date.Year; nomPatientT.IsEnabled = false; prenomPatientT.IsEnabled = false; okBtn.IsEnabled = false; this.GridDroit.Children.Add(new AjoutConsultation()); } else { nomPatientT.IsEnabled = false; prenomPatientT.IsEnabled = false; okBtn.IsEnabled = false; PopupPatient pop = new PopupPatient(); pop.SetGridAppelant = this.GridDroit; pop.SetTotal = GridTotal; pop.Show(); } } }
private void search_Click(object sender, RoutedEventArgs e) { foreach (specRadio p in listComplete) { if (p.IsChecked.Value == true) { Checked = p; } } if ((nomPatientT.Text == "" || prenomPatientT.Text == "") && (Checked.IsChecked == false)) { MessageBox.Show("Veuillez saisir toutes les informations ou choisir un patient !"); if (nomPatientT.Text == "") { nomPatientT.BorderBrush = Brushes.Red; } else { nomPatientT.BorderBrush = Brushes.Black; } if (prenomPatientT.Text == "") { prenomPatientT.BorderBrush = Brushes.Red; } else { prenomPatientT.BorderBrush = Brushes.Black; } } else { if (Checked.IsChecked != false) { Globals.NomPatient = Checked.nom; Globals.PrenomPatient = Checked.prenom; nomPatientT.Text = Globals.NomPatient; prenomPatientT.Text = Globals.PrenomPatient; listPatientsTmp = pat.RechercherPatient(Globals.NomPatient + " " + Globals.PrenomPatient); if (listPatientsTmp.Count() != 0) { Globals.AdressePatient = listPatientsTmp[0].adresse; DateTime date = (DateTime)listPatientsTmp[0].dateNaissance; Globals.Age = DateTime.Today.Year - date.Year; nomPatientT.IsEnabled = false; prenomPatientT.IsEnabled = false; search.IsEnabled = false; var parent = (Grid)this.Parent; parent.Children.Clear(); parent.Children.Add(new MenuPatient()); } else { nomPatientT.IsEnabled = false; prenomPatientT.IsEnabled = false; search.IsEnabled = false; Dialog.IsOpen = true; } } else { if (Checked.IsChecked == false && (nomPatientT.Text != "" && prenomPatientT.Text != "")) { Globals.NomPatient = nomPatientT.Text; Globals.PrenomPatient = prenomPatientT.Text; listPatientsTmp = pat.RechercherPatient(Globals.NomPatient + " " + Globals.PrenomPatient); if (listPatientsTmp.Count() != 0) { DateTime date = (DateTime)listPatientsTmp[0].dateNaissance; Globals.Age = DateTime.Today.Year - date.Year; nomPatientT.IsEnabled = false; prenomPatientT.IsEnabled = false; search.IsEnabled = false; var parent = (Grid)this.Parent; parent.Children.Clear(); parent.Children.Add(new MenuPatient()); } else { nomPatientT.IsEnabled = false; prenomPatientT.IsEnabled = false; search.IsEnabled = false; Dialog.IsOpen = true; } } } } }