private static string getDefaultUsername() { string username = StudentRegistrationForm.getStudentName(); username = username.ToLower(); username = username.Replace(" ", ""); return(username); }
private static void buttonNewRegistration_Click(object sender, EventArgs e) { hideAllComponents(); StudentRegistrationForm.resetStudentInformation(); StudentAccountForm.resetAccountInformation(); resetAccountInformation(); StudentRegistrationForm.showAllComponents(); }
private static void buttonConfirm_Click(object sender, EventArgs e) { string username = textBoxUsername.Text; string password = textBoxPassword.Text; string confirmPassword = textBoxConfirmPassword.Text; if (username == "" || username.Replace(" ", "") == "") { MessageBox.Show("Username cannot be empty."); return; } if (!Program.getDatabaseUtils().isUsernameUnique(username)) { MessageBox.Show("This Username has been taken. Please try another."); return; } if (password == "" || password.Replace(" ", "") == "") { MessageBox.Show("Password cannot be empty."); return; } if (confirmPassword == "" || confirmPassword.Replace(" ", "") == "") { MessageBox.Show("Confirm password cannot be empty."); return; } if (password != confirmPassword) { MessageBox.Show("Password is not match."); return; } password = Md5Converter.encrypt(password); bool createAccount = Program.getDatabaseUtils().addNewUser(username, password, EnumUser.Student, StudentRegistrationForm.getStudentName(), StudentRegistrationForm.getGender(), StudentRegistrationForm.getDateOfBirth(), StudentRegistrationForm.getEmail(), StudentRegistrationForm.getContactNumber(), StudentRegistrationForm.getAddress()); if (!createAccount) { MessageBox.Show("An error occurred! Failed to create account."); } else { hideAllComponents(); StudentInformationForm.showAllComponents(); StudentInformationForm.updateStudentInformation(username); } }
private static void buttonEnrollCourse_Click(object sender, EventArgs e) { if (selectedStudent == null) { MessageBox.Show("An error occurred while doing this process"); return; } Program.getStaffForm().setCurrentSelectedLabel(2); hideAllComponents(); CourseEnrollmentForm.updateCoursesTable(false); CourseEnrollmentForm.showAllComponents(); CourseEnrollmentForm.setSelectedStudent(selectedStudent); StudentRegistrationForm.resetStudentInformation(); StudentAccountForm.resetAccountInformation(); resetAccountInformation(); }
private static void buttonBack_Click(object sender, EventArgs e) { hideAllComponents(); StudentRegistrationForm.showAllComponents(); }