Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
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);
            }
        }