private void btnTeacherNavigation_Click(object sender, RoutedEventArgs e) { var tForm = new TeacherNavigation(LoginTeacher.TeacherId); tForm.Show(); this.Close(); }
private void btnLogin_Click(object sender, RoutedEventArgs e) { //Course Id validation if (clsValidation.ValidateForEmptiness(TxtUserId.Text) == false) { MessageBox.Show("User id is required"); } else if (clsValidation.ValidateForNumeric(TxtUserId.Text) == false) { MessageBox.Show("User id is not a number"); } else if (clsValidation.ValidateForLength(TxtUserId.Text, 5) == false) { MessageBox.Show("User id is not correct"); } else if (clsValidation.ValidateForEmptiness(TxtPassWord.Password) == false) { MessageBox.Show("Password is required"); } else { if (RadioTeacher.IsChecked == true) { clsTeacher Teacher = new clsTeacher(); Teacher.TeacherId = int.Parse(TxtUserId.Text); Teacher.Password = TxtPassWord.Password; bool FlagT = Teacher.Login(); if (FlagT) { var tForm = new TeacherNavigation(Teacher.TeacherId); tForm.Show(); this.Close(); } else { MessageBox.Show("User Id or password not correct!"); } } else if (RadioStudent.IsChecked == true) { clsTeacher Teacher = new clsTeacher(); Teacher.TeacherId = int.Parse(TxtUserId.Text); Teacher.Password = TxtPassWord.Password; bool FlagS = Teacher.Login(); if (FlagS) { var tForm = new TeacherNavigation(Teacher.TeacherId); tForm.Show(); this.Close(); } else { MessageBox.Show("User Id or password not correct!"); } } else { MessageBox.Show("Problem to login this system!"); } } }