Пример #1
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            ProgrammerPanel pp = new ProgrammerPanel();

            pp.Show();
            this.Close();
        }
Пример #2
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            string selectUser = "******" + Dashboard.usname + "'";

            db.DBConnect = db.DBConnection();
            MySqlCommand    usercmd = new MySqlCommand(selectUser, db.DBConnect);
            MySqlDataReader reader  = usercmd.ExecuteReader();

            while (reader.Read())
            {
                string users = reader.GetString("User_Type");
                if (users == "Admin")
                {
                    //MessageBox.Show("User inserted.");
                    usname = lblUsername.Text;
                    AdminPanel ap = new AdminPanel();
                    ap.Show();
                    this.Hide();
                }
                else if (users == "Programmer")
                {
                    //MessageBox.Show("You are a Programmer");
                    usname = lblUsername.Text;
                    ProgrammerPanel ap = new ProgrammerPanel();
                    ap.Show();
                    this.Hide();
                }
                else if (users == "Developer")
                {
                    //MessageBox.Show("You are a Developer ");
                    usname = lblUsername.Text;
                    DeveloperPanel ap = new DeveloperPanel();
                    ap.Show();
                    this.Hide();
                }
                else if (users == "Tester")
                {
                    //MessageBox.Show("You are a Tester");
                    usname = lblUsername.Text;
                    TesterPanel ap = new TesterPanel();
                    ap.Show();
                    this.Hide();
                }
            }
        }
Пример #3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string user = txtUsername.Text;
            string pass = txtPassword.Text;

            // string sql = "select User_type,Username,Password from staff where Username ='******' and Password ='******'";
            //string sql = "select  Username, Password from testuser where Username='******' and Password='******'";
            //string sql = "insert into testuser(Username,Password) values('" + user + "','" + pass + "')";

            db.DBConnect = db.DBConnection();
            DataTable        table   = new DataTable();
            MySqlDataAdapter adapter = new MySqlDataAdapter("select User_type,Username,Password from staff where Username ='******' and Password ='******'", db.DBConnect);

            // MySqlCommand ret = new MySqlCommand(sql, db.DBConnect);
            //MySqlDataReader reader = ret.ExecuteReader();
            //int count = reader.HasRows;
            adapter.Fill(table);
            if (table.Rows.Count > 0)
            {
                string utype;
                utype = table.Rows[0][0].ToString();
                // MessageBox.Show("User type is " + utype);
                if (utype == "Admin")
                {
                    //MessageBox.Show("User inserted.");
                    usname = txtUsername.Text;
                    AdminPanel ap = new AdminPanel();
                    ap.Show();
                    this.Hide();
                }
                else if (utype == "Programmer")
                {
                    //MessageBox.Show("You are a Programmer");
                    usname = txtUsername.Text;
                    ProgrammerPanel ap = new ProgrammerPanel();
                    ap.Show();
                    this.Hide();
                }
                else if (utype == "Developer")
                {
                    //MessageBox.Show("You are a Developer ");
                    usname = txtUsername.Text;
                    DeveloperPanel ap = new DeveloperPanel();
                    ap.Show();
                    this.Hide();
                }
                else if (utype == "Tester")
                {
                    //MessageBox.Show("You are a Tester");
                    usname = txtUsername.Text;
                    TesterPanel ap = new TesterPanel();
                    ap.Show();
                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("Incorrect username and password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtUsername.Clear();
                txtPassword.Clear();
            }
        }