private void btnsignIn_Click(object sender, RoutedEventArgs e) { //Button Name :btnsignIn_Click() //Purpose : calls metthod GetStudentDetails to check if exists and logs in //Input : studentId //Output : MenuScreen window bool hasValues = HasValues(); if (hasValues) { bool isNum = IsNumber(); if (isNum) { string studentId = txtStudentId.Text; string studentName = txtUserName.Text; string studentPass = txtPassword.Text; studentDetail = myStudentProxy.GetStudentDetail(studentId); if (studentDetail != null) { if (studentDetail.StudentName == studentName) { if (studentDetail.StudentPassword == studentPass) { var showMenu = new MenueScreen(); showMenu.Show(); } else { MessageBox.Show("wrong password ", "INFORMATION", MessageBoxButton.OK, MessageBoxImage.Information); } } else { MessageBox.Show("wrong name ", "INFORMATION", MessageBoxButton.OK, MessageBoxImage.Information); } } else { MessageBox.Show("login fail", "INFORMATION", MessageBoxButton.OK, MessageBoxImage.Information); } } else { MessageBox.Show("make sure student ID is a number!", "INFORMATION", MessageBoxButton.OK, MessageBoxImage.Information); } } else { MessageBox.Show("Please enter Id.", "INFORMATION", MessageBoxButton.OK, MessageBoxImage.Information); } }
private void btnSearch_Click(object sender, RoutedEventArgs e) { //Button Name : btnSearch_Click //Purpose : calls for method GetStudentDetail() to check if student exists //Input : studentId //Output : student bool hasValues = HasValues(); if (hasValues) { bool isNum = IsNumber(); if (isNum) { students = myStudentProxy.ListStudents(); string studentId = txtStudentId.Text; studentDetail = myStudentProxy.GetStudentDetail(studentId); if (studentDetail != null) { txtStudentName.Text = studentDetail.StudentName.ToString(); txtStudentPassword.Text = studentDetail.StudentPassword.ToString(); } else { MessageBox.Show("student does not exist", "INFORMATION", MessageBoxButton.OK, MessageBoxImage.Information); } } else { MessageBox.Show("make sure student ID is a number!", "INFORMATION", MessageBoxButton.OK, MessageBoxImage.Information); } } else { MessageBox.Show("Please enter Id.", "INFORMATION", MessageBoxButton.OK, MessageBoxImage.Information); } txtStudentName.IsEnabled = true; txtStudentPassword.IsEnabled = true; txtStudentId.IsEnabled = false; }