Esempio n. 1
0
        // Profile Label
        private void labelProfile_Click(object sender, EventArgs e)
        {
            if (currentSelectedLabel == this.labelProfile)
            {
                return;
            }
            this.labelProfile.Focus();
            restoreAndAddAnimation(this.labelProfile);
            currentSelectedLabel = this.labelProfile;

            // Timetable
            StudentTimetableForm.hideAllComponents();
            StudentTimetableForm.resetStudentTimetableInformation();

            // Fees
            StudentViewFeesForm.hideAllComponents();
            StudentViewFeesForm.resetStudentFeesInformation();

            StudentProfileForm.showAllComponents();
            StudentProfileForm.updateStudentInformation();
        }
Esempio n. 2
0
        public void logout()
        {
            this.panelLogout.Focus();
            // Profile
            StudentProfileForm.disposeAllComponents();
            StudentEditProfileForm.disposeAllComponents();

            // Timetable
            StudentTimetableForm.disposeAllComponents();
            StudentTimetableForm.resetStudentTimetableInformation();

            // Fees
            StudentViewFeesForm.disposeAllComponents();
            StudentViewFeesForm.resetStudentFeesInformation();

            Program.getStudentForm().Hide();
            Program.initLoginForm();
            Program.getLoginForm().ShowDialog();
            Program.getStudentForm().Close();
            User.setCurrentUser(null);
        }
Esempio n. 3
0
        // Fees Label
        private void labelFees_Click(object sender, EventArgs e)
        {
            if (currentSelectedLabel == this.labelFees)
            {
                return;
            }
            this.labelFees.Focus();
            restoreAndAddAnimation(this.labelFees);
            currentSelectedLabel = this.labelFees;
            // Profile
            StudentProfileForm.hideAllComponents();
            StudentProfileForm.resetProfileInformation();
            StudentEditProfileForm.hideAllComponents();
            StudentEditProfileForm.resetEditProfileInformation();

            // Timetable
            StudentTimetableForm.hideAllComponents();
            StudentTimetableForm.resetStudentTimetableInformation();

            StudentViewFeesForm.updateStudentInformation();
            StudentViewFeesForm.showAllComponents();
            StudentViewFeesForm.updateOutstandingBalance();
        }
Esempio n. 4
0
        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;
            }
        }