Example #1
0
        private void btnAQSetRelations_Click(object sender, EventArgs e)
        {
            string groupTypeID = string.Empty;
            string topicTypeID = string.Empty;
            MasterDataFunctions     mDataFunc            = null;
            SaveQuestionRelation    saveQuestionRelation = null;
            List <QuestionRelation> questionRColl        = null;

            try
            {
                topicTypeID = ((KeyValuePair <string, string>)cbAQTopictype.SelectedItem).Key;

                mDataFunc            = new MasterDataFunctions();
                saveQuestionRelation = new SaveQuestionRelation();

                topicTypeID = ((KeyValuePair <string, string>)cbAQTopictype.SelectedItem).Key;

                mDataFunc     = new MasterDataFunctions();
                questionRColl = mDataFunc.LoadQuestionsRelation(topicTypeID);
                ResetAllAQ();
                LoadQuestionsGrid();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void LoadQuestionsGrid()
        {
            List <QuestionRelation> questionRColl = null;
            MasterDataFunctions     mDataFunc     = null;
            string groupTypeID = string.Empty;
            string topicTypeID = string.Empty;

            try
            {
                mDataFunc = new MasterDataFunctions();
                if (cbAQTopictype.SelectedItem != null)
                {
                    topicTypeID = ((KeyValuePair <string, string>)cbAQTopictype.SelectedItem).Key;
                }

                questionRColl = mDataFunc.LoadQuestionsRelation(topicTypeID);

                if (questionRColl != null)
                {
                    currentQuestionRelation = questionRColl;
                    dgvAvailableQuestions.Rows.Clear();
                    //loop all row in datatable
                    for (int i = 0; i < questionRColl.Count; i++)
                    {
                        //add a row int datagridview before fill
                        dgvAvailableQuestions.Rows.Add();
                        //fill the first cell value ot ith row of datagridview
                        dgvAvailableQuestions.Rows[i].Cells[0].Value = questionRColl[i].Questionn.ID;
                        dgvAvailableQuestions.Rows[i].Cells[1].Value = questionRColl[i].Questionn.Questionn;
                        dgvAvailableQuestions.Rows[i].Cells[2].Value = questionRColl[i].Questionn.Point;
                        dgvAvailableQuestions.Rows[i].Cells[3].Value = questionRColl[i].TopicType.GroupType.Code;
                        dgvAvailableQuestions.Rows[i].Cells[4].Value = questionRColl[i].TopicType.Code;

                        //here for combobx column (cast the column as datagridviewcombobox column)
                        DataGridViewButtonCell cell = (DataGridViewButtonCell)dgvAvailableQuestions.Rows[i].Cells[5];
                        //then assign the value of cell
                        cell.Value = "Add TO QB";
                        //see the top where we added the comboboxcolumn and define it's item,
                        //so here value is on of the items of coboboxcolumn item.

                        //delete button cell value
                    }
                }
            }
            catch
            {
                throw;
            }
        }