コード例 #1
0
        private void btnDelete_Click_1(object sender, EventArgs e)
        {
            string     id = TxtId.Text;
            AdminModel ad = new AdminModel();

            if (ad.DeleteQuetion(id) == true)
            {
                dataGridView1.DataSource = ad.GetQuestions();
                ResetGUI();
                MessageBox.Show("xoa roi");
            }
            else
            {
                MessageBox.Show("khong xoa duoc, xem lai");
            }
        }
コード例 #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            string id      = TxtId.Text;
            string subject = cb1.Text;
            string content = rtContent.Text;
            string a       = radioButtonA.Text;
            string b       = radioButtonB.Text;
            string c       = radioButtonC.Text;
            string d       = radioButtonD.Text;
            string correct = "";

            if (radioButtonA.Checked)
            {
                correct = "_a";
            }
            if (radioButtonB.Checked)
            {
                correct = "_b";
            }
            if (radioButtonC.Checked)
            {
                correct = "_c";
            }
            if (radioButtonD.Checked)
            {
                correct = "_d";
            }
            AdminModel ad = new AdminModel();

            if (ad.updatequestion(id, subject, content, correct, a, b, c, d))
            {
                dataGridView1.DataSource = ad.GetQuestions();
                ResetGUI();
                MessageBox.Show("Chuc mung may UPADTE thanh cong", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                MessageBox.Show("that bai");
            }
        }
コード例 #3
0
        private void btnViewall_Click(object sender, EventArgs e)
        {
            AdminModel ad = new AdminModel();

            dataGridView1.DataSource = ad.GetQuestions();
        }