예제 #1
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            conn.ConectIP(txtTaiKhoan.Text, txtPass.Text, cmbHostName.Text, cmbdatabase.Text);
            conn.Connect1();
            if (conn.isCorrect == true)
            {
                if (rBUser.Checked == true && rBAdmin.Checked == false && txtTaiKhoan.Text != "admin")//Dang nhap la User
                {
                    flag = 2;
                    MessageBox.Show("Đăng nhập thành công!!!!");
                    this.Dispose();
                }
                else
                {
                    if (rBUser.Checked == false && rBAdmin.Checked == true && txtTaiKhoan.Text == "admin")
                    {
                        flag = 0;
                        MessageBox.Show("Đăng nhập thành công!!!!");

                        this.Dispose();
                    }
                    else
                    {
                        flag = 1;
                        MessageBox.Show("Sai Chức vụ truy cập ..Vui lòng chọn lại chức vụ!!!");
                        this.Dispose();
                    }
                }
            }
            else
            {
                flag = 1;
                MessageBox.Show("Sai tên đăng nhập hoặc mật khẩu!!!");
            }
        }