Esempio n. 1
0
        public void ShowExamAnswer(int examineeId, int examineeTakeId, string subjectName)
        {
            dgvDetails.Rows.Clear();

            _examineeId     = examineeId;
            _examineeTakeId = examineeTakeId;
            _subjectName    = subjectName;

            _examResultDetailsViewModel = _examineeTakeBLL.GetExamResultDetailsViewModel(_examineeId, _examineeTakeId, _subjectName);

            if (_examResultDetailsViewModel.Count > 0)
            {
                foreach (var item in _examResultDetailsViewModel)
                {
                    dgvDetails.Rows.Add("[ Type: " + SetExaminationType(item.ExaminationType) + " ]     [ Score: " + item.Score + " ]");
                    dgvDetails.Rows[dgvDetails.Rows.Count - 1].Cells[0].Style.BackColor = Color.LightYellow;
                    dgvDetails.Rows[dgvDetails.Rows.Count - 1].Cells[1].Style.BackColor = Color.LightYellow;
                    dgvDetails.Rows.Add("Question", "Answer");
                    dgvDetails.Rows[dgvDetails.Rows.Count - 1].Cells[0].Style.BackColor = Color.LightYellow;
                    dgvDetails.Rows[dgvDetails.Rows.Count - 1].Cells[0].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                    dgvDetails.Rows[dgvDetails.Rows.Count - 1].Cells[1].Style.BackColor = Color.LightYellow;
                    dgvDetails.Rows[dgvDetails.Rows.Count - 1].Cells[1].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;

                    foreach (var i in item.ExamDetails)
                    {
                        dgvDetails.Rows.Add(i.Quest, i.Answer);

                        if (i.IsCorrect == false)
                        {
                            dgvDetails.Rows[dgvDetails.Rows.Count - 1].Cells[1].Style.BackColor = Color.LightCoral;
                        }
                    }
                }

                dgvDetails.ClearSelection();
            }
        }