Ejemplo n.º 1
0
        private void btnEditQuiz_Click(object sender, EventArgs e)
        {
            //sửa thông tin câu hỏi theo STT và Mã môn học của câu hỏi được chọn
            //lấy STT và mã môn học của câu hỏi được chọn
            int    rowindex     = dgvQuiz.CurrentRow.Index;
            int    stt          = Convert.ToInt32(dgvQuiz[0, rowindex].Value.ToString());
            string codeSubtract = dgvQuiz[1, rowindex].Value.ToString().Trim();
            //khởi tạo Câu hỏi
            QUIZ qEdit = new QUIZ()
            {
                id         = stt,
                idSubtract = codeSubtract,
                quizz      = txtQuiz.Text,
                a          = txtA.Text,
                b          = txtB.Text,
                c          = txtC.Text,
                d          = txtD.Text,
                answer     = Convert.ToChar(cbRight.SelectedItem.ToString()),
                rateHard   = Convert.ToInt32(cbLevelQuiz.SelectedValue)
            };

            //gọi hàm sửa
            TracNghiem.SuaCauHoi(qEdit);
            //đã xong chức năng
            OnLoad(e);
        }