private void Button_Click(object sender, RoutedEventArgs e) { try { if ((bool)old_user.IsChecked) { if (userID.Text == "מספר זהות" || userFirstName.Text == "שם פרטי" || userLastName.Text == "שם משפחה") //missing detailes { throw new Exception("אנא מלא את כל הפרטים"); } Checks.CheckID(userID.Text); if (combo.SelectedIndex == 0) { throw new Exception("אנא סמן את בחירתך"); } if (combo.SelectedIndex == 1) { tester = bl.GetTester(userID.Text); if (tester.NameTester.FirstName != userFirstName.Text || tester.NameTester.LastName != userLastName.Text) { throw new Exception("אחד או יותר מהנתונים שהוזנו שגויים"); } log_in_tester log_in_tester = new log_in_tester(tester); log_in_tester.ShowDialog(); } if (combo.SelectedIndex == 2) { trainee = bl.GetTrainee(userID.Text); if (trainee.NameTrainee.FirstName != userFirstName.Text || trainee.NameTrainee.LastName != userLastName.Text) { throw new Exception("אחד או יותר מהנתונים שהוזנו שגויים"); } log_in_trainee log_in_trainee = new log_in_trainee(trainee); log_in_trainee.ShowDialog(); } } if ((bool)new_user.IsChecked) { if (combo.SelectedIndex == 0) { throw new Exception("אנא סמן את בחירתך"); } if (combo.SelectedIndex == 1) { sign_in_tester sign_in_tester = new sign_in_tester(); sign_in_tester.ShowDialog(); } if (combo.SelectedIndex == 2) { sign_in_trainee sign_in_trainee = new sign_in_trainee(); sign_in_trainee.ShowDialog(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error); } }
public update_trainee(Trainee oldTrainee, log_in_trainee log_In) { InitializeComponent(); log = log_In; trainee = oldTrainee; bl = FactoryBL.GetBL(); DataContext = trainee; carTypeTraineeComboBox.ItemsSource = Enum.GetValues(typeof(CarType)); gearboxTraineeComboBox.ItemsSource = Enum.GetValues(typeof(Gearbox)); genderTraineeComboBox.ItemsSource = Enum.GetValues(typeof(Gender)); }
private void next_Click(object sender, RoutedEventArgs e) { try { bl.changeTrainee(trainee); Close(); log.Close(); log_in_trainee log_In = new log_in_trainee(trainee); log_In.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void next_Click(object sender, RoutedEventArgs e) { try { if (birthDateTraineeDatePicker.SelectedDate == null) { throw new Exception("אנא השלם את כל הפרטים"); } bl.addTrainee(trainee); log_in_trainee log_In = new log_in_trainee(trainee); log_In.ShowDialog(); Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error); } }