Example #1
0
        private void dGv_Ques_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (connectDb)
            {
                int id_ques = int.Parse(get_current_cell_content_dgv(dGv_Ques, 2).ToString());
                if (e.ColumnIndex == 0)   //edit
                {
                    if (e.RowIndex != -1) // not header
                    {
                        var f = new View.frmQues(this.idcourse, id_ques);
                        f.EvtSaveOk += F_EvtSaveOk;
                        f.ShowDialog();
                    }
                }

                if (e.ColumnIndex == 1)//xóa
                {
                    DialogResult res = MessageBox.Show("Bạn xác nhận muốn xóa câu hỏi có mã " + id_ques + "?", "Xác Nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (res == DialogResult.Yes)
                    {
                        Controller.AnswerController.deleteByIdQues(id_ques);
                        Controller.QuestionController.delete(id_ques);
                        dGv_Course_SelectionChanged(null, null);
                    }
                }
            }
        }
Example #2
0
 private void btnAddQues_Click(object sender, EventArgs e)
 {
     if (connectDb)
     {
         var f = new View.frmQues(this.idcourse);
         f.EvtSaveOk += F_EvtSaveOk;
         f.ShowDialog();
     }
 }