Exemple #1
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            // FUNCTION: check for the matric password is correct
            // PRE-CONDITIONS:
            // POST-CONDITIONS:

            if (passwordTextbox.Text == "" || matricTextbox.Text == "")
            {
                MessageBox.Show("Please enter your matriculation number and password.", "Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (matricTextbox.Text == "Admin")
            {
                if (loginAdmin.CheckAdmin(passwordTextbox.Text))
                {
                    AdminPage adminPage = new AdminPage(server);
                    this.Hide();
                    adminPage.ShowDialog();
                    SerSave(server);
                    this.passwordTextbox.Clear();
                    this.matricTextbox.Clear();
                    this.Show();
                }
                else
                {
                    MessageBox.Show("Pasword in invalid, please try again!", "Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                matricTextbox.Focus();
                return;
            }

            if (loginAdmin.CheckPassword(matricTextbox.Text, passwordTextbox.Text))
            {
                DashBoardPage dashBoardPage = new DashBoardPage(matricTextbox.Text, server);
                this.Hide();
                dashBoardPage.ShowDialog();
                SerSave(server);
                this.passwordTextbox.Clear();
                this.matricTextbox.Clear();
                this.Show();
            }
            else
            {
                MessageBox.Show("Invalid matriculation number or password, please try again!", "Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            matricTextbox.Focus();
            return;
        }
Exemple #2
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            // FUNCTION: check for the matric password is correct
            // PRE-CONDITIONS:
            // POST-CONDITIONS:

            if (passwordTextbox.Text == "" || matricTextbox.Text == "") {
                MessageBox.Show("Please enter your matriculation number and password.", "Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (matricTextbox.Text == "Admin") {
                if (loginAdmin.CheckAdmin(passwordTextbox.Text)) {
                    AdminPage adminPage = new AdminPage(server);
                    this.Hide();
                    adminPage.ShowDialog();
                    SerSave(server);
                    this.passwordTextbox.Clear();
                    this.matricTextbox.Clear();
                    this.Show();
                } else {
                    MessageBox.Show("Pasword in invalid, please try again!", "Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                matricTextbox.Focus();
                return;
            }

            if (loginAdmin.CheckPassword(matricTextbox.Text, passwordTextbox.Text)) {
                DashBoardPage dashBoardPage = new DashBoardPage(matricTextbox.Text, server);
                this.Hide();
                dashBoardPage.ShowDialog();
                SerSave(server);
                this.passwordTextbox.Clear();
                this.matricTextbox.Clear();
                this.Show();
            } else {
                MessageBox.Show("Invalid matriculation number or password, please try again!", "Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            matricTextbox.Focus();
            return;
        }