// Student Profile Label private void labelStudentProfile_Click(object sender, EventArgs e) { if (currentSelectedLabel == this.labelStudentProfile) { return; } this.labelStudentProfile.Focus(); restoreAndAddAnimation(this.labelStudentProfile); currentSelectedLabel = this.labelStudentProfile; // Class Schedule TutorClassScheduleForm.hideAllComponents(); TutorClassScheduleForm.resetClassScheduleInformation(); TutorNewClassScheduleForm.hideAllComponents(); TutorNewClassScheduleForm.resetNewClassScheduleInformation(); TutorStudentProfileForm.showAllComponents(); TutorStudentProfileForm.updateTutorInformation(); }
public void logout() { this.panelLogout.Focus(); // Class Schedule TutorClassScheduleForm.disposeAllComponents(); TutorClassScheduleForm.resetClassScheduleInformation(); TutorNewClassScheduleForm.disposeAllComponents(); TutorNewClassScheduleForm.resetNewClassScheduleInformation(); // Student Profile TutorStudentProfileForm.disposeAllComponents(); TutorStudentProfileForm.resetStudentProfileInformation(); TutorViewStudentProfileForm.disposeAllComponents(); Program.getTutorForm().Hide(); Program.initLoginForm(); Program.getLoginForm().ShowDialog(); Program.getTutorForm().Close(); User.setCurrentUser(null); }
public void login() { string username = textBoxUsername.Text; string password = textBoxPassword.Text; if (password == "") { MessageBox.Show("Username cannot be empty."); return; } if (password == "") { MessageBox.Show("Password cannot be empty."); return; } password = Md5Converter.encrypt(password); User user = Program.getDatabaseUtils().verifyUser(username, password); if (user == null) { this.textBoxPassword.Text = ""; return; } User.setCurrentUser(user); clearTextboxes(); switch (user.Type) { case EnumUser.Staff: Program.getLoginForm().Hide(); Program.initStaffForm(); Program.getStaffForm().initProfileName(); Program.getStaffForm().setCurrentSelectedLabel(1); StudentRegistrationForm.showAllComponents(); Program.getStaffForm().ShowDialog(); Program.getLoginForm().Close(); break; case EnumUser.Tutor: Program.getLoginForm().Hide(); Program.initTutorForm(); Program.getTutorForm().initProfileName(); Program.getTutorForm().setCurrentSelectedLabel(1); TutorClassScheduleForm.showAllComponents(); TutorClassScheduleForm.updateTutorInformation(); Program.getTutorForm().ShowDialog(); Program.getLoginForm().Close(); break; case EnumUser.Student: Program.getLoginForm().Hide(); Program.initStudentForm(); Program.getStudentForm().initProfileName(); Program.getStudentForm().setCurrentSelectedLabel(1); StudentProfileForm.showAllComponents(); StudentProfileForm.updateStudentInformation(); Program.getStudentForm().ShowDialog(); Program.getLoginForm().Close(); break; default: MessageBox.Show("An error occurred while logging in."); break; } }