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); } }
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"; } }
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 }