/// <summary> /// Log in as one of the trainee in the list /// </summary> private void Student_list_view_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { BE.Trainee trainee = Student_list_view.SelectedItem as BE.Trainee; MessageBoxResult result = MessageBox.Show("האם ברצונך להתחבר למערכת בתור " + trainee.First_name + " " + trainee.Last_name + "?", "התחברות כתלמיד", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { StudentWindow studentWindow = new StudentWindow(trainee); this.Close(); studentWindow.ShowDialog(); } } catch (Exception) { } }
private void LogInStudent(object sender, RoutedEventArgs e) { try { // search for trainee with the wanted id List <BE.Trainee> resualt = iBL_Imp.SearchTrainee(trainee_id.Text, true, false, false); // if there is no resualt if (resualt.Count == 0) { student_error_message.Visibility = Visibility.Visible; return; } // if the password is not correct if (resualt[0].Password != iBL_Imp.Encrypte(student_password.Password)) { student_error_message.Visibility = Visibility.Visible; return; } /////////////////////////////////////////////////////////// student_error_message.Visibility = Visibility.Collapsed; student_password.Password = ""; trainee_id.Text = ""; StudentWindow studentWindow = new StudentWindow(resualt[0]); this.Visibility = Visibility.Hidden; studentWindow.ShowDialog(); this.Visibility = Visibility.Visible; } catch (Exception ex) { MessageBox.Show(ex.Message); } }