private void btnBack_Click(object sender, EventArgs e)
        {
            Admin_Portal addd = new Admin_Portal();

            addd.Show();
            this.Hide();
        }
Exemple #2
0
        private void btn_back_Click(object sender, EventArgs e)
        {
            Admin_Portal ap = new Admin_Portal();

            ap.Show();
            this.Hide();
        }
Exemple #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            Admin_Portal ad = new Admin_Portal();

            ad.Show();
            this.Hide();
        }
Exemple #4
0
        private void AdminLog_btn_Click(object sender, EventArgs e)
        {
            try
            {
                // check connection to the database
                // initialize connection to an empty string
                String con = string.Empty;
                con = "Server=127.0.0.1; SslMode=none;port=3306; Uid=root; Database=Studentdb; Password="******"SELECT login.username, login.password, login.role FROM login WHERE username='******' and password='******'";
                using (MySqlConnection sqlcon = new MySqlConnection(con))
                {
                    sqlcon.Open();
                    string[] Item = new string[1];
                    using (MySqlCommand com = new MySqlCommand(sql, sqlcon))
                    {
                        using (MySqlDataReader auth = com.ExecuteReader())
                        {
                            // if (username_txtbox.Text != "")
                            if (auth.HasRows)
                            {
                                auth.Read();
                                if (auth["role"].ToString() == "0")
                                {
                                    Admin_Portal mm = new Admin_Portal();
                                    mm.Show();
                                    this.Hide();
                                }

                                else if (auth["role"].ToString() == "1")

                                {
                                    Lecturer_Portal lecportal = new Lecturer_Portal();
                                    lecportal.Show();
                                    this.Hide();
                                }
                            }
                            else
                            {
                                MessageBox.Show("username or password is incorect. Please Try Again!!" +
                                                "");
                                username_txtbox.Text = "";
                                password_txtbox.Text = "";
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Login error()" + ex);
            }
        }