Example #1
0
        private void dgQuestions_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 5)
            {
                List <Question>     questionColl = null;
                List <string>       questionIDs  = null;
                string              quesModeID   = string.Empty;
                string              questionID   = string.Empty;
                MasterDataFunctions mDataFunc    = null;

                try
                {
                    mDataFunc   = new MasterDataFunctions();
                    questionIDs = new List <string>();
                    questionIDs.Add(dgQuestions.Rows[e.RowIndex].Cells[0].Value.ToString());
                    questionColl = mDataFunc.LoadQuestion(questionIDs);
                    frmAnswers answer = new frmAnswers(questionColl[0]);
                    answer.ShowDialog();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                txtQuestionQV.Text = dgQuestions.Rows[e.RowIndex].Cells[1].Value.ToString();
            }
        }
Example #2
0
        private void dgQuestions_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            List <Question>     questionColl     = null;
            List <string>       questionIDs      = null;
            string              quesModeID       = string.Empty;
            string              questionID       = string.Empty;
            MasterDataFunctions mDataFunc        = null;
            QuestionType        qtype            = null;
            List <QuestionType> questionTypeColl = null;

            try
            {
                mDataFunc   = new MasterDataFunctions();
                questionIDs = new List <string>();
                questionIDs.Add(dgQuestions.Rows[e.RowIndex].Cells[0].Value.ToString());
                questionColl                 = mDataFunc.LoadQuestion(questionIDs);
                EditedQuestion               = questionColl[0];
                txtQuestion.Text             = dgQuestions.Rows[e.RowIndex].Cells[1].Value.ToString();
                txtPoint.Text                = dgQuestions.Rows[e.RowIndex].Cells[2].Value.ToString();
                cbComplexlevel.SelectedIndex = cbComplexlevel.FindString(EditedQuestion.ComplexLevel);//cbComplexlevel.FindString(dgQuestions.Rows[e.RowIndex].Cells[3].Value.ToString());

                questionTypeColl             = mDataFunc.LoadQuestionTypeByQID(EditedQuestion.ID);
                qtype                        = questionTypeColl.Where(qt => qt.Type == QuestionTypes.Mode).SingleOrDefault();
                cbQuestionMode.SelectedIndex = cbQuestionMode.FindString(qtype.Code);    // cbQuestionMode.FindString(dgQuestions.Rows[e.RowIndex].Cells[4].Value.ToString());

                QuestionOperatonState = EntityOperationalState.Update;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            SaveAnswers         saveAnswer = null;
            MasterDataFunctions mDataFunc  = null;

            try
            {
                mDataFunc  = new MasterDataFunctions();
                saveAnswer = new SaveAnswers();

                if (EditedAnswer != null)
                {
                    saveAnswer.ID = EditedAnswer.ID;
                }

                saveAnswer.Answerr     = txtAnswer.Text;
                saveAnswer.AnswerOrder = txtAnswerOrder.Text;
                saveAnswer.Value       = txtAnsweValue.Text;
                saveAnswer.QuestionID  = question.ID;
                saveAnswer.EntityState = AnswerOperatonState;

                mDataFunc.SaveAnswers(saveAnswer);

                ResetAll();
                LoadAnswers();
                EditedAnswer = null;
                MessageBox.Show("Answer saved.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string              selQBID     = string.Empty;
            List <string>       selQBIDColl = null;
            MasterDataFunctions mDataFunc   = null;

            try
            {
                selQBIDColl = new List <string>();
                eidtedParticipentInfo.Code    = txtPartiCode.Text;
                eidtedParticipentInfo.Name    = txtPartiName.Text;
                eidtedParticipentInfo.Gender  = rbFemale.Checked ? "F" : "M";
                eidtedParticipentInfo.Email   = txtEmail.Text;
                eidtedParticipentInfo.Remarks = txtRemarks.Text;
                eidtedParticipentInfo.Active  = chkParticipentActive.Checked;

                foreach (var lstItem in lstSelectedQB.Items)
                {
                    selQBID = ((KeyValuePair <string, string>)lstItem).Key;
                    selQBIDColl.Add(selQBID);
                }
                eidtedParticipentInfo.QBIds = selQBIDColl;

                mDataFunc.AddParticipant(eidtedParticipentInfo);
            }
            catch
            {
                throw;
            }
        }
Example #5
0
        private void LoadAllQB()
        {
            MasterDataFunctions         mDataFunc     = null;
            List <QuestionBank>         qbColl        = null;
            Dictionary <string, string> listboxSource = null;

            try
            {
                mDataFunc = new MasterDataFunctions();
                qbColl    = mDataFunc.LoadQuestionBank();

                if (qbColl != null)
                {
                    listboxSource = new Dictionary <string, string>();

                    foreach (QuestionBank gt in qbColl)
                    {
                        listboxSource.Add(gt.ID, gt.ExamName);
                    }

                    lstAvailableQB.DataSource    = new BindingSource(listboxSource, null);
                    lstAvailableQB.DisplayMember = "Value";
                    lstAvailableQB.ValueMember   = "Key";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #6
0
        private void btnQBEdit_Click_1(object sender, EventArgs e)
        {
            MasterDataFunctions         mDataFunc   = null;
            List <QuestionBank>         qbColl      = null;
            Dictionary <string, string> comboSource = null;
            string qbID = string.Empty;

            try
            {
                ResetAll();
                QbQuestionsEntityState = EntityOperationalState.Update;
                isQBQuestionChanged    = false;

                qbID      = ((KeyValuePair <string, string>)cbQB.SelectedItem).Key;
                mDataFunc = new MasterDataFunctions();
                qbColl    = mDataFunc.LoadQuestionBank(qbID);


                if (qbColl != null)
                {
                    txtQBName.Text    = qbColl[0].ExamName;
                    txtQBRemarks.Text = qbColl[0].Remarks;

                    qbColl[0].Questions.ForEach(qb => htQBOrder.Add(qb.QuestionRelation.ID, qb.Order));
                    selectedQuestionRelation.AddRange(qbColl[0].Questions.Select(qbq => qbq.QuestionRelation));
                    LoadQBQuestions(selectedQuestionRelation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #7
0
        private void dgvAvailableQuestions_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 5)
            {
                List <string>       questionIDs      = null;
                string              quesModeID       = string.Empty;
                string              questionID       = string.Empty;
                MasterDataFunctions mDataFunc        = null;
                QuestionRelation    questionRelation = null;

                try
                {
                    mDataFunc   = new MasterDataFunctions();
                    questionIDs = new List <string>();
                    questionID  = dgvAvailableQuestions.Rows[e.RowIndex].Cells[0].Value.ToString();
                    questionIDs.Add(questionID);
                    questionRelation = currentQuestionRelation.Where(qr => qr.Questionn.ID == questionID).SingleOrDefault();;
                    selectedQuestionRelation.Add(questionRelation);
                    LoadQBQuestions(selectedQuestionRelation);
                    isQBQuestionChanged = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                //txtQuestionQV.Text = dgQuestions.Rows[e.RowIndex].Cells[1].Value.ToString();
            }
        }
Example #8
0
        private void LoadQBCombo()
        {
            MasterDataFunctions         mDataFunc   = null;
            List <QuestionBank>         qbColl      = null;
            Dictionary <string, string> comboSource = null;

            try
            {
                mDataFunc = new MasterDataFunctions();
                qbColl    = mDataFunc.LoadQuestionBank();

                if (qbColl != null && qbColl.Count > 0)
                {
                    comboSource = new Dictionary <string, string>();

                    foreach (QuestionBank gt in qbColl)
                    {
                        comboSource.Add(gt.ID, gt.ExamName);
                    }

                    cbQB.DataSource    = new BindingSource(comboSource, null);
                    cbQB.DisplayMember = "Value";
                    cbQB.ValueMember   = "Key";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #9
0
        private void LoadParticipentCombo()
        {
            MasterDataFunctions         mDataFunc       = null;
            List <Participant>          participentColl = null;
            Dictionary <string, string> listboxSource   = null;

            try
            {
                mDataFunc       = new MasterDataFunctions();
                participentColl = mDataFunc.LoadParticipents();

                if (participentColl != null)
                {
                    cbParticipent.DataSource = null;
                    listboxSource            = new Dictionary <string, string>();

                    foreach (Participant gt in participentColl)
                    {
                        listboxSource.Add(gt.ID, gt.Code);
                    }

                    cbParticipent.DataSource    = new BindingSource(listboxSource, null);
                    cbParticipent.DisplayMember = "Value";
                    cbParticipent.ValueMember   = "Key";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #10
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 #11
0
        private void cbGroupType_SelectionChangeCommitted(object sender, EventArgs e)
        {
            MasterDataFunctions mDataFunc = null;
            string groupType = string.Empty;
            List <QuestionType>         QuestionTypeColl = null;
            Dictionary <string, string> comboSource      = null;

            try
            {
                mDataFunc   = new MasterDataFunctions();
                groupType   = ((KeyValuePair <string, string>)cbGroupType.SelectedItem).Key;
                comboSource = new Dictionary <string, string>();

                QuestionTypeColl = mDataFunc.LoadQuestionType(QuestionTypes.Topic);
                QuestionTypeColl = QuestionTypeColl.Where(qt => qt.FkQuestionType.ID == groupType).ToList();

                if (QuestionTypeColl != null && QuestionTypeColl.Count > 0)
                {
                    foreach (QuestionType gt in QuestionTypeColl)
                    {
                        comboSource.Add(gt.ID, gt.Code);
                    }

                    cbTopicType.DataSource    = new BindingSource(comboSource, null);
                    cbTopicType.DisplayMember = "Value";
                    cbTopicType.ValueMember   = "Key";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #12
0
        private void cbAQGroupType_SelectionChangeCommitted(object sender, EventArgs e)
        {
            MasterDataFunctions mDataFunc             = null;
            string                      groupType     = string.Empty;
            List <TopicType>            topicTypeColl = null;
            Dictionary <string, string> comboSource   = null;

            try
            {
                mDataFunc     = new MasterDataFunctions();
                groupType     = ((KeyValuePair <string, string>)cbAQGroupType.SelectedItem).Key;
                topicTypeColl = mDataFunc.LoadTopic(groupType);

                comboSource = new Dictionary <string, string>();
                foreach (TopicType gt in topicTypeColl)
                {
                    comboSource.Add(gt.ID, gt.Code);
                }

                cbAQTopictype.DataSource = null;
                cbAQTopictype.Items.Clear();
                cbAQTopictype.DataSource    = new BindingSource(comboSource, null);
                cbAQTopictype.DisplayMember = "Value";
                cbAQTopictype.ValueMember   = "Key";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #13
0
        private void LoadQuestionsGrid()
        {
            List <QuestionRelation> questionRColl = null;
            MasterDataFunctions     mDataFunc     = null;
            string       groupTypeID = string.Empty;
            string       topicTypeID = string.Empty;
            QuestionType qtype       = null;

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

                questionRColl = mDataFunc.LoadQuestionsRelations(topicTypeID);

                if (questionRColl != null && questionRColl.Count > 0)
                {
                    dgQuestions.Rows.Clear();
                    //loop all row in datatable
                    for (int i = 0; i < questionRColl.Count; i++)
                    {
                        //add a row int datagridview before fill
                        dgQuestions.Rows.Add();
                        //fill the first cell value ot ith row of datagridview
                        dgQuestions.Rows[i].Cells[0].Value = questionRColl[i].Questionn.ID;
                        dgQuestions.Rows[i].Cells[1].Value = questionRColl[i].Questionn.Questionn;
                        dgQuestions.Rows[i].Cells[2].Value = questionRColl[i].Questionn.Point;
                        qtype = questionRColl[i].QuestionTyp.Where(qt => qt.Type == QuestionTypes.Topic).SingleOrDefault();
                        if (qtype != null)
                        {
                            dgQuestions.Rows[i].Cells[4].Value = qtype.Code;
                            dgQuestions.Rows[i].Cells[3].Value = qtype.FkQuestionType.Code;
                        }


                        //here for combobx column (cast the column as datagridviewcombobox column)
                        DataGridViewButtonCell cell = (DataGridViewButtonCell)dgQuestions.Rows[i].Cells[5];
                        //then assign the value of cell
                        cell.Value = "Answers";
                        //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;
            }
        }
Example #14
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            SaveQuestion        saveQuestion    = null;
            string              quesModeID      = string.Empty;
            string              questionID      = string.Empty;
            MasterDataFunctions mDataFunc       = null;
            QBQuestions         qbQuestions     = null;
            List <QBQuestions>  qbQuestionsColl = null;
            QBInfo              qbInfo          = null;
            string              qbID            = string.Empty;

            try
            {
                mDataFunc       = new MasterDataFunctions();
                saveQuestion    = new SaveQuestion();
                qbQuestionsColl = new List <QBQuestions>();
                if (cbQB.SelectedItem != null)
                {
                    qbID = ((KeyValuePair <string, string>)cbQB.SelectedItem).Key;
                }

                htQBOrder.Clear();
                for (int i = 0; i < dgvQB.Rows.Count - 1; i++)
                {
                    htQBOrder.Add(dgvQB.Rows[i].Cells[0].Value, dgvQB.Rows[i].Cells[3].Value);
                }

                foreach (QuestionRelation qr in selectedQuestionRelation)
                {
                    qbQuestions = new QBQuestions();
                    qbQuestions.Question_Rel_ID = qr.ID;
                    qbQuestions.Order           = htQBOrder[qr.ID].ToString();
                    qbQuestions.EntityState     = QbQuestionsEntityState;
                    qbQuestionsColl.Add(qbQuestions);
                }

                qbInfo         = new QBInfo();
                qbInfo.ID      = string.IsNullOrWhiteSpace(qbID) ? string.Empty : qbID;
                qbInfo.QBName  = txtQBName.Text;
                qbInfo.Remarks = txtQBRemarks.Text;
                qbInfo.QBQuestionsEntityState = isQBQuestionChanged ? EntityOperationalState.Update : EntityOperationalState.None;
                qbInfo.EntityState            = QbQuestionsEntityState;
                qbInfo.QBQuestions            = qbQuestionsColl;

                isQBQuestionChanged = false;

                mDataFunc.AddQuestionBank(qbInfo);
                MessageBox.Show("Question Bank saved.");
                ResetAll();
                LoadQBCombo();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #15
0
        private void LoadQBQuestions(List <QuestionRelation> questionRelation)
        {
            MasterDataFunctions mDataFunc = null;
            string       groupTypeID      = string.Empty;
            string       topicTypeID      = string.Empty;
            QuestionType qtype            = null;

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


                if (questionRelation != null)
                {
                    dgvQB.Rows.Clear();
                    //loop all row in datatable
                    for (int i = 0; i < questionRelation.Count; i++)
                    {
                        //add a row int datagridview before fill
                        dgvQB.Rows.Add();
                        //fill the first cell value ot ith row of datagridview
                        dgvQB.Rows[i].Cells[0].Value = questionRelation[i].ID;
                        dgvQB.Rows[i].Cells[1].Value = questionRelation[i].Questionn.ID;
                        dgvQB.Rows[i].Cells[2].Value = questionRelation[i].Questionn.Questionn;
                        if (htQBOrder.Contains(questionRelation[i].ID))
                        {
                            dgvQB.Rows[i].Cells[3].Value = htQBOrder[questionRelation[i].ID].ToString();
                        }
                        qtype = questionRelation[i].QuestionTyp.Where(qt => qt.Type == QuestionTypes.Topic).SingleOrDefault();
                        if (qtype != null)
                        {
                            dgvQB.Rows[i].Cells[4].Value = qtype.FkQuestionType.Code;
                            dgvQB.Rows[i].Cells[5].Value = qtype.Code;
                        }
                        //here for combobx column (cast the column as datagridviewcombobox column)
                        DataGridViewButtonCell cell = (DataGridViewButtonCell)dgvQB.Rows[i].Cells[6];
                        //then assign the value of cell
                        cell.Value = "Remove From 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;
            }
        }
Example #16
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            SaveQuestion saveQuestion = null;
            string       quesGroupID  = string.Empty;
            string       quesTopicID  = string.Empty;
            string       quesModeID   = string.Empty;

            string questionID             = string.Empty;
            MasterDataFunctions mDataFunc = null;

            try
            {
                mDataFunc    = new MasterDataFunctions();
                saveQuestion = new SaveQuestion();
                quesGroupID  = ((KeyValuePair <string, string>)cbGroupType.SelectedItem).Key;
                quesTopicID  = ((KeyValuePair <string, string>)cbTopicType.SelectedItem).Key;
                quesModeID   = ((KeyValuePair <string, string>)cbQuestionMode.SelectedItem).Key;

                if (EditedQuestion != null)
                {
                    saveQuestion.ID = EditedQuestion.ID;
                }

                saveQuestion.Questionn    = txtQuestion.Text;
                saveQuestion.ComplexLevel = cbComplexlevel.Text;
                saveQuestion.Point        = txtPoint.Text;
                saveQuestion.EntityState  = QuestionOperatonState;

                questionID = mDataFunc.SaveQuestion(saveQuestion);
                saveQuestion.QuestionID = questionID;

                if (QuestionOperatonState == EntityOperationalState.New)
                {
                    SaveQuestionTypeForQuestion(saveQuestion);
                }

                ResetAll();
                LoadQuestionsGrid();
                EditedQuestion = null;

                MessageBox.Show("Question saved.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #17
0
        private void LoadPartiQB(string ParticiID)
        {
            MasterDataFunctions         mDataFunc     = null;
            List <QuestionBank>         qbColl        = null;
            List <ParticipantAssesment> paColl        = null;
            Dictionary <string, string> listboxSource = null;

            try
            {
                mDataFunc = new MasterDataFunctions();
                paColl    = mDataFunc.LoadParticipentAssement(ParticiID);

                if (paColl != null)
                {
                    listboxSourcePartiQB = new Dictionary <string, string>();

                    txtPartiCode.Text = paColl[0].Participant.Code;
                    txtPartiName.Text = paColl[0].Participant.Name;
                    txtEmail.Text     = paColl[0].Participant.Email;
                    txtRemarks.Text   = paColl[0].Participant.Remarks;

                    rbMale.Checked               = paColl[0].Participant.Gender == "M" ? true : false;
                    rbFemale.Checked             = paColl[0].Participant.Gender == "F" ? true : false;
                    chkParticipentActive.Checked = paColl[0].Participant.Active;

                    cbParticipent.Items.Clear();
                    listboxSource = new Dictionary <string, string>();

                    foreach (ParticipantAssesment pa in paColl)
                    {
                        listboxSource.Add(pa.QuestionBank.ID, pa.QuestionBank.ExamName);
                        if (!selectedQBIDValue.ContainsKey(pa.QuestionBank.ID))
                        {
                            selectedQBIDValue.Add(pa.QuestionBank.ID, pa.QuestionBank.ExamName);
                        }
                    }

                    lstSelectedQB.DataSource    = new BindingSource(listboxSource, null);
                    lstSelectedQB.DisplayMember = "Value";
                    lstSelectedQB.ValueMember   = "Key";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #18
0
        private void SaveQuestionTypeForQuestion(SaveQuestion saveQuestion)
        {
            string modeID      = string.Empty;
            string groupTypeID = string.Empty;
            string topicTypeID = string.Empty;
            MasterDataFunctions      mDataFunc        = null;
            SaveQuestionType         saveQuestionType = null;
            SaveQuestionTypes        questionType     = null;
            List <SaveQuestionTypes> questionTypeColl = null;

            try
            {
                groupTypeID = ((KeyValuePair <string, string>)cbGroupType.SelectedItem).Key;
                topicTypeID = ((KeyValuePair <string, string>)cbTopicType.SelectedItem).Key;
                modeID      = ((KeyValuePair <string, string>)cbQuestionMode.SelectedItem).Key;

                mDataFunc        = new MasterDataFunctions();
                saveQuestionType = new SaveQuestionType();
                questionType     = new SaveQuestionTypes();
                questionTypeColl = new List <SaveQuestionTypes>();

                questionType.Type = QuestionTypes.Topic;
                questionType.ID   = topicTypeID;
                questionTypeColl.Add(questionType);
                questionType      = new SaveQuestionTypes();
                questionType.Type = QuestionTypes.Mode;
                questionType.ID   = modeID;
                questionTypeColl.Add(questionType);

                saveQuestionType.QuestionID    = saveQuestion.QuestionID;
                saveQuestionType.Code          = string.Empty;
                saveQuestionType.Description   = string.Empty;
                saveQuestionType.Type          = QuestionTypes.Question;
                saveQuestionType.QuestionTypes = questionTypeColl;

                mDataFunc.SaveQuestionTypeRelation(saveQuestionType);
            }
            catch
            {
                throw;
            }
        }
Example #19
0
        private void LoadData()
        {
            List <GroupType>            GroupTypColl = null;
            Dictionary <string, string> comboSource  = null;

            MasterDataFunctions mDataFunc = new MasterDataFunctions();

            #region LOAD GROUP
            GroupTypColl = mDataFunc.LoadGroup();
            comboSource  = new Dictionary <string, string>();
            foreach (GroupType gt in GroupTypColl)
            {
                comboSource.Add(gt.ID, gt.Code);
            }

            cbAQGroupType.DataSource    = new BindingSource(comboSource, null);
            cbAQGroupType.DisplayMember = "Value";
            cbAQGroupType.ValueMember   = "Key";

            #endregion
        }
Example #20
0
        private void LoadData()
        {
            List <QuestionType>         QuestionTypeColl = null;
            Dictionary <string, string> comboSource      = null;

            MasterDataFunctions mDataFunc = new MasterDataFunctions();

            comboSource      = new Dictionary <string, string>();
            QuestionTypeColl = mDataFunc.LoadQuestionType(QuestionTypes.Group);

            if (QuestionTypeColl != null && QuestionTypeColl.Count > 0)
            {
                foreach (QuestionType gt in QuestionTypeColl)
                {
                    comboSource.Add(gt.ID, gt.Code);
                }

                cbAQGroupType.DataSource    = new BindingSource(comboSource, null);
                cbAQGroupType.DisplayMember = "Value";
                cbAQGroupType.ValueMember   = "Key";
            }
        }
Example #21
0
        private void LoadAnswers()
        {
            List <Answer>       answersColl = null;
            List <string>       questionIDs = null;
            MasterDataFunctions mDataFunc   = null;
            string groupTypeID = string.Empty;
            string topicTypeID = string.Empty;

            try
            {
                mDataFunc   = new MasterDataFunctions();
                questionIDs = new List <string>();
                questionIDs.Add(question.ID);
                txtQuestion.Text = question.Questionn;
                answersColl      = mDataFunc.LoadAnswersByQuestion(questionIDs);

                if (answersColl != null)
                {
                    dgvAnswers.Rows.Clear();
                    //loop all row in datatable
                    for (int i = 0; i < answersColl.Count; i++)
                    {
                        //add a row int datagridview before fill
                        dgvAnswers.Rows.Add();
                        //fill the first cell value ot ith row of datagridview
                        dgvAnswers.Rows[i].Cells[0].Value = answersColl[i].ID;
                        dgvAnswers.Rows[i].Cells[1].Value = answersColl[i].Answerr;
                        dgvAnswers.Rows[i].Cells[2].Value = answersColl[i].AnswerOrder;
                        dgvAnswers.Rows[i].Cells[3].Value = answersColl[i].Value;
                    }
                }
            }
            catch
            {
                throw;
            }
        }
Example #22
0
        private void dgvQB_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 6)
            {
                List <string>       questionIDs      = null;
                string              quesModeID       = string.Empty;
                string              questionID       = string.Empty;
                MasterDataFunctions mDataFunc        = null;
                QuestionRelation    questionRelation = null;

                try
                {
                    mDataFunc   = new MasterDataFunctions();
                    questionIDs = new List <string>();
                    questionID  = dgvQB.Rows[e.RowIndex].Cells[1].Value.ToString();
                    questionIDs.Add(questionID);
                    questionRelation = selectedQuestionRelation.Where(qr => qr.Questionn.ID == questionID).SingleOrDefault();;
                    selectedQuestionRelation.Remove(questionRelation);
                    dgvQB.Rows.RemoveAt(e.RowIndex);
                    htQBOrder.Clear();

                    for (int i = 0; i < dgvQB.Rows.Count - 1; i++)
                    {
                        htQBOrder.Add(dgvQB.Rows[i].Cells[0].Value, dgvQB.Rows[i].Cells[3].Value);
                    }
                    isQBQuestionChanged = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                //txtQuestionQV.Text = dgQuestions.Rows[e.RowIndex].Cells[1].Value.ToString();
            }
        }
Example #23
0
        private void dgvAnswers_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            List <Answer>       answerColl = null;
            List <string>       answerIDs  = null;
            MasterDataFunctions mDataFunc  = null;

            try
            {
                mDataFunc = new MasterDataFunctions();
                answerIDs = new List <string>();
                answerIDs.Add(dgvAnswers.Rows[e.RowIndex].Cells[0].Value.ToString());
                answerColl   = mDataFunc.LoadAnswersByID(answerIDs);
                EditedAnswer = answerColl[0];

                txtAnswer.Text      = dgvAnswers.Rows[e.RowIndex].Cells[1].Value.ToString();
                txtAnswerOrder.Text = dgvAnswers.Rows[e.RowIndex].Cells[2].Value.ToString();
                txtAnsweValue.Text  = dgvAnswers.Rows[e.RowIndex].Cells[3].Value.ToString();
                AnswerOperatonState = EntityOperationalState.Update;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #24
0
        private void LoadData()
        {
            List <QuestionType>         QuestionTypeColl = null;
            Dictionary <string, string> comboSource      = null;

            MasterDataFunctions mDataFunc = new MasterDataFunctions();

            #region LOAD GROUP

            comboSource      = new Dictionary <string, string>();
            QuestionTypeColl = mDataFunc.LoadQuestionType(QuestionTypes.Group);

            if (QuestionTypeColl != null && QuestionTypeColl.Count > 0)
            {
                foreach (QuestionType gt in QuestionTypeColl)
                {
                    comboSource.Add(gt.ID, gt.Code);
                }

                cbGroupType.DataSource    = new BindingSource(comboSource, null);
                cbGroupType.DisplayMember = "Value";
                cbGroupType.ValueMember   = "Key";
            }
            #endregion

            #region LOADTOPIC

            /*TopicTypeColl = mDataFunc.LoadTopic();
             * comboSource = new Dictionary<string, string>();
             * foreach (TopicType gt in TopicTypeColl)
             * {
             *  comboSource.Add(gt.ID, gt.Code);
             * }
             *
             * cbTopicType.DataSource = new BindingSource(comboSource, null);
             * cbTopicType.DisplayMember = "Value";
             * cbTopicType.ValueMember = "Key";*/
            #endregion

            #region MODE
            comboSource      = new Dictionary <string, string>();
            QuestionTypeColl = mDataFunc.LoadQuestionType(QuestionTypes.Mode);

            if (QuestionTypeColl != null && QuestionTypeColl.Count > 0)
            {
                foreach (QuestionType gt in QuestionTypeColl)
                {
                    comboSource.Add(gt.ID, gt.Code);
                }

                cbQuestionMode.DataSource    = new BindingSource(comboSource, null);
                cbQuestionMode.DisplayMember = "Value";
                cbQuestionMode.ValueMember   = "Key";
            }
            #endregion

            #region COMPLEXLEVEL
            cbComplexlevel.Items.Add("1");
            cbComplexlevel.Items.Add("2");
            cbComplexlevel.Items.Add("3");
            cbComplexlevel.Items.Add("4");
            cbComplexlevel.Items.Add("5");
            #endregion
        }