Exemplo n.º 1
0
        private void dgvExam_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int rowIndex = e.RowIndex;

            if (rowIndex >= 0)
            {
                int columnIndex = e.ColumnIndex;

                if (columnIndex == 5)
                {
                    DialogResult result = MessageBox.Show("Are you sure you want to restore this exam?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (result == DialogResult.Yes)
                    {
                        int examId = _examViewModelList[rowIndex].ExamId;

                        _examBLL.SendExamToArchieve(examId, false);
                        SetArchivedExam();
                    }
                }
            }
        }
        private void dgvExam_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int rowIndex = e.RowIndex;

            if (rowIndex >= 0)
            {
                string examType = dgvExam.Rows[rowIndex].Cells[2].Value.ToString();
                _selectedExamType = SetExamType(examType);
                _examId           = (int)dgvExam.Rows[rowIndex].Cells[0].Value;

                ExamViewModel examVM = _examViewModelList.Where(ex => ex.ExamId == _examId).Single();   //  select exam from list using _examId
                lblAddedBy.Text       = string.Format("Created By: {0}", examVM.CreatedBy);
                lblDateTimeAdded.Text = string.Format("Date and Time Created: {0}", examVM.DateTimeAdded);

                int columnIndex = e.ColumnIndex;

                if (columnIndex == 5)   //  if user clicked QUESTION button in DataGridView
                {
                    ShowQuestionFrom(_examId);
                }

                if (columnIndex == 6)   //  if user clicked ARCHIEVE button in DataGridView
                {
                    DialogResult result = MessageBox.Show(this, "Are you sure you want send this exam to archieve?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (result == DialogResult.Yes)
                    {
                        _examBLL.SendExamToArchieve(_examId, true);
                        lblStatus.Text = "  Successfully sent exam to archieve";

                        SetExamDatagridViewDataScource();
                        SetExamTotalDataGridViewDataSource();
                    }
                }
            }
        }