private void btnthoat_Click(object sender, EventArgs e)
        {
            this.Hide();
            FormAdmin ad = new FormAdmin();

            ad.Show();
        }
        private void btndnhap_Click(object sender, EventArgs e)
        {
            DataTable dt = myCB.Login(txttendn.Text, txtmk.Text, cboloaitk.Text);

            if (dt.Rows[0][0].ToString() == "1")
            {
                if (cboloaitk.Text == "admin")
                {
                    this.Hide();
                    FormAdmin main = new FormAdmin();
                    main.Show();
                }
                else
                {
                    this.Hide();
                    FormGV maingv = new FormGV(txttendn.Text);
                    maingv.Show();
                }
            }
            else
            {
                DialogResult result = MessageBox.Show("Đăng nhập không thành công", "Thông Báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                if (result == DialogResult.OK)
                {
                    txttendn.Text = "";
                    txtmk.Text    = "";
                }
                else if (result == DialogResult.Cancel)
                {
                }
            }
        }
Пример #3
0
        private void btndnhap_Click(object sender, EventArgs e)
        {
            DataTable dt = myCB.Login(txttendn.Text, txtmk.Text, cboloaitk.Text);

            if (dt.Rows[0][0].ToString() == "1")
            {
                if (cboloaitk.Text == "admin")
                {
                    this.Hide();
                    FormAdmin main = new FormAdmin();
                    main.Show();
                }
                else
                {
                    //this.Hide();
                    //FormMainGiaoVien maingv = new FormMainGiaoVien();
                    //maingv.Show();
                }
            }
            else
            {
                MessageBox.Show("Đăng nhập không thành công");
            }
        }