Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            Staff_MainPage Main = new Staff_MainPage();

            Main.ShowDialog();
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            connection.Open();
            OleDbCommand command = new OleDbCommand();

            command.Connection  = connection;
            command.CommandText = "select * from Users where UserID = '" + txtUserID.Text + "' and Password = '******' and Role = '" + comboBox1.Text + "'";
            command.ExecuteNonQuery();



            OleDbDataReader reader = command.ExecuteReader();
            int             count  = 0;

            while (reader.Read())
            {
                count = count + 1;
            }
            if ((count == 1) && (comboBox1.Text == "Staff"))
            {
                MessageBox.Show("Login Successful");
                connection.Close();
                connection.Dispose();
                this.Hide();
                Staff_MainPage f4 = new Staff_MainPage();
                f4.ShowDialog();
            }
            else if ((count == 1) && (comboBox1.Text == "Student"))
            {
                MessageBox.Show("Login Successful");
                connection.Close();
                connection.Dispose();
                this.Hide();
                Student_MainPage SMP = new Student_MainPage();
                SMP.ShowDialog();
            }
            else if ((count == 1) && (comboBox1.Text == "Tutor"))
            {
                MessageBox.Show("Login Successful");
                connection.Close();
                connection.Dispose();
                this.Hide();
                Tutor_Mainpage TMP = new Tutor_Mainpage();
                TMP.ShowDialog();
            }
            else if (count > 1)
            {
                MessageBox.Show("Duplicate Username and Password");
            }
            else
            {
                MessageBox.Show("Wrong UserID or Password or Role");
            }

            connection.Close();
        }