Example #1
0
        private void Btn_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Bạn có muốn trở lại không ?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (dialogResult == DialogResult.OK)
            {
                this.Hide();
                ttn        = new ThiTracNghiem();
                ttn.denTTN = 1;
                ttn.Show();
            }
        }
Example #2
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            int       count = 0;
            DataTable dt    = crud.ReadData("SELECT * FROM Sinhvien");

            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    if (row["tenSV"].ToString() == txtAcc.Text && row["matKhauSV"].ToString() == txtPass.Text)
                    {
                        DialogResult dialogResult = MessageBox.Show("Đăng nhập thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        if (dialogResult == DialogResult.OK)
                        {
                            this.Hide();
                            ttn = new ThiTracNghiem();
                            DataTable dt2 = crud.ReadData("SELECT * FROM Sinhvien");
                            foreach (DataRow row2 in dt2.Rows)
                            {
                                if (txtAcc.Text == row["tenSV"].ToString())
                                {
                                    ttn.hoTen    = row["hoTenSV"].ToString();
                                    ttn.gioiTinh = row["gioiTinh"].ToString();
                                }
                            }
                            ttn.Show();
                        }
                        count++;
                    }
                }
                if (count == 0)
                {
                    lbShowError.Text = "Tài khoản hoặc Mật khẩu không đúng";
                    txtAcc.Text      = "";
                    txtPass.Text     = "";
                    txtAcc.Focus();
                }
            }
        }