Пример #1
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();
            }
        }
Пример #2
0
        public List <QuestionRelation> LoadQuestionsRelation(string TopicID)
        {
            DataTable               dtQuestionsR  = null;
            List <DataRow>          drQuestionR   = null;
            QuestionRelation        questionR     = null;
            List <QuestionRelation> questionRColl = null;
            List <Question>         questionColl  = null;
            List <GroupType>        GroupTypeColl = null;
            List <TopicType>        topicTypeColl = null;
            List <QuestionMode>     quesModeColl  = null;
            string groupID = string.Empty;
            string topicID = string.Empty;

            try
            {
                LoadXML();
                GroupTypeColl = LoadGroup();
                topicTypeColl = LoadTopic(string.Empty);
                quesModeColl  = LoadMode();
                questionRColl = new List <QuestionRelation>();

                dtQuestionsR = oeEntity.Tables[EntityConstents.TBL_QUESTIONS_REL];

                drQuestionR = dtQuestionsR.AsEnumerable().Where(qr => qr.Field <string>("Fk_TopicType") == TopicID).ToList();

                List <string> questionIDs = drQuestionR.AsEnumerable().Select(qr => qr.Field <string>("Fk_Que_ID")).ToList();
                questionColl = LoadQuestion(questionIDs);

                foreach (DataRow dr in drQuestionR)
                {
                    //groupID = dr[EntityConstents.COL_QUESTIONS_REL_GROUPTYPE].ToString();
                    topicID = dr[EntityConstents.COL_QUESTIONS_REL_TOPICTYPE].ToString();

                    questionR           = new QuestionRelation();
                    questionR.ID        = dr[EntityConstents.COL_QUESTIONS_REL_ID].ToString();
                    questionR.Questionn = questionColl.Where(que => que.ID == dr[EntityConstents.COL_QUESTIONS_REL_QUSID].ToString()).SingleOrDefault();
                    // questionR.GroupType = GroupTypeColl.Where(gc => gc.ID == groupID).SingleOrDefault();
                    questionR.TopicType = topicTypeColl.Where(gc => gc.ID == topicID).SingleOrDefault();
                    questionRColl.Add(questionR);
                }
            }
            catch
            {
                throw;
            }
            return(questionRColl);
        }
Пример #3
0
        public void AddQuestion(oEEntiti QuestionRelationEntity)
        {
            DataTable        dtQuestion = null;
            DataRow          drNew      = null;
            Question         Question   = null;
            QuestionRelation QuestionR  = null;

            try
            {
                QuestionR = QuestionRelationEntity as QuestionRelation;
                Question  = QuestionR.Questionn;

                if (QuestionR.EntityState != EntityOperationalState.None)
                {
                    AddQuestionRelation(QuestionR);
                }

                if (Question.EntityState != EntityOperationalState.None)
                {
                    LoadXML();
                    dtQuestion = oeEntity.Tables[EntityConstents.TBL_QUESTIONS];

                    if (Question.EntityState == EntityOperationalState.New)
                    {
                        drNew = dtQuestion.NewRow();
                        dtQuestion.Rows.Add(drNew);
                        drNew[EntityConstents.COL_QUESTIONS_ID] = Guid.NewGuid().ToString();
                    }
                    else
                    {
                        drNew = dtQuestion.AsEnumerable().Where(ans => ans.Field <string>("ID") == Question.ID).SingleOrDefault();
                    }

                    drNew[EntityConstents.COL_QUESTIONS_QUESTION]     = Question.Questionn;
                    drNew[EntityConstents.COL_QUESTIONS_LEVEL]        = Question.ComplexLevel;
                    drNew[EntityConstents.COL_QUESTIONS_POINT]        = Question.Point;
                    drNew[EntityConstents.COL_QUESTIONS_QUESTIONMODE] = Question.QuestionMode.ID;

                    saveXML(oeEntity);
                }
            }
            catch
            {
            }
        }
Пример #4
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();
            }
        }
Пример #5
0
        private void AddQuestionRelation(oEEntiti QuestionRelation)
        {
            DataTable        dtQuestionRelation = null;
            DataRow          drNew     = null;
            QuestionRelation QuestionR = null;

            try
            {
                LoadXML();
                dtQuestionRelation = oeEntity.Tables[EntityConstents.TBL_QUESTIONS_REL];
                QuestionR          = QuestionRelation as QuestionRelation;

                if (QuestionR.EntityState != EntityOperationalState.None)
                {
                    if (QuestionR.EntityState == EntityOperationalState.New)
                    {
                        drNew = dtQuestionRelation.NewRow();
                        dtQuestionRelation.Rows.Add(drNew);
                        drNew[EntityConstents.COL_QUESTIONS_ID] = Guid.NewGuid().ToString();
                    }
                    else
                    {
                        drNew = dtQuestionRelation.AsEnumerable().Where(ans => ans.Field <string>("ID") == QuestionR.ID).SingleOrDefault();
                    }

                    //drNew[EntityConstents.COL_QUESTIONS_REL_GROUPTYPE] = QuestionR.GroupType.ID;
                    drNew[EntityConstents.COL_QUESTIONS_REL_TOPICTYPE] = QuestionR.TopicType.ID;
                    drNew[EntityConstents.COL_QUESTIONS_REL_QUSID]     = QuestionR.Questionn.ID;

                    saveXML(oeEntity);
                }
            }
            catch
            {
                throw;
            }
        }