コード例 #1
0
ファイル: frmQuestionBank.cs プロジェクト: NarayanaswamyR/A2
        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);
            }
        }
コード例 #2
0
        public void SaveQuestionRelation(oEEntiti SaveQuestionR)
        {
            DataTable            dtQuestionR   = null;
            DataRow              drNew         = null;
            SaveQuestionRelation saveQuestionR = null;

            try
            {
                LoadXML();
                saveQuestionR = SaveQuestionR as SaveQuestionRelation;
                dtQuestionR   = oeEntity.Tables[EntityConstents.TBL_QUESTIONS_REL];

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

                //drNew[EntityConstents.COL_QUESTIONS_REL_GROUPTYPE] = saveQuestionR.GroupTypeID;
                drNew[EntityConstents.COL_QUESTIONS_REL_TOPICTYPE] = saveQuestionR.TopicTypeID;
                drNew[EntityConstents.COL_QUESTIONS_REL_QUSID]     = saveQuestionR.QuestionID;

                saveXML(oeEntity);
            }
            catch
            {
            }
        }