private void Button_Click(object sender, RoutedEventArgs e) { if ((Nom1.Text == "") || (Prenom1.Text == "") || (Adr.Text == "") || (Email.Text == "") || (tel.Text == "") || (date.Text == "") || (comboSexe.Text == "") || (comboSG.Text == "") || (tel.Text.Length < 10) || (!(est_val(Email.Text)))) { if (tel.Text.Length < 10) { nonnum.Visibility = Visibility.Visible; } else { nonnum.Visibility = Visibility.Hidden; } if ((Nom1.Text == "") || (Prenom1.Text == "") || (Adr.Text == "") || (Email.Text == "") || (tel.Text == "") || (date.Text == "") || (comboSexe.Text == "") || (comboSG.Text == "")) { pic2.Visibility = Visibility.Hidden; Pic.Visibility = Visibility.Visible; Remarque.Visibility = Visibility.Visible; Remarque.Content = "Champs Non Rempli(s)"; } if (!(est_val(Email.Text))) { nonadr.Visibility = Visibility.Visible; } else { nonadr.Visibility = Visibility.Hidden; } } else { Patient patient = new Patient(Nom1.Text, Prenom1.Text, Email.Text, Adr.Text, tel.Text, comboSexe.Text, DateTime.Parse(date.Text), comboSG.Text); patient.Insert_Nv_Patient(); Dossier_medical dossier = new Dossier_medical(patient.get_Id()); dossier.Creer_DM(); App.acc.pagepatients.addtoDatagGrid(Nom1.Text, Prenom1.Text, DateTime.Parse(date.Text), Adr.Text, comboSG.Text, tel.Text, patient.get_Id()); Stackajoutersucces.Visibility = System.Windows.Visibility.Visible; RecStackajoutersucces.Visibility = System.Windows.Visibility.Visible; maingrd.IsEnabled = false; } }
private void Button_Click(object sender, RoutedEventArgs e) { if ((Nom1.Text == "") || (Prenom1.Text == "") || (Adr.Text == "") || (Email.Text == "") || (tel.Text == "") || (date.Text == "") || (comboSexe.Text == "") || (comboSG.Text == "") || (tel.Text.Length < 10) || (!(est_val(Email.Text)))) { if (tel.Text.Length < 10) { nonnum.Visibility = Visibility.Visible; } else { nonnum.Visibility = Visibility.Hidden; } if ((Nom1.Text == "") || (Prenom1.Text == "") || (Adr.Text == "") || (Email.Text == "") || (tel.Text == "") || (date.Text == "") || (comboSexe.Text == "") || (comboSG.Text == "")) { pic2.Visibility = Visibility.Hidden; Pic.Visibility = Visibility.Visible; Remarque.Visibility = Visibility.Visible; Remarque.Content = "Champs Non Rempli(s)"; } if (!(est_val(Email.Text))) { nonadr.Visibility = Visibility.Visible; } else { nonadr.Visibility = Visibility.Hidden; } } else { Patient patient = new Patient(Nom1.Text, Prenom1.Text, Email.Text, Adr.Text, tel.Text, comboSexe.Text, DateTime.Parse(date.Text), comboSG.Text); patient.Insert_Nv_Patient(); Dossier_medical dossier = new Dossier_medical(patient.get_Id()); dossier.Creer_DM(); MessageBox.Show("Inséré avec succès!"); } }