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); } }
private void frmQuestionBank_Load(object sender, EventArgs e) { QbQuestionsEntityState = EntityOperationalState.New; qbQuestions = new QBQuestions(); currentQuestionRelation = new List <QuestionRelation>(); selectedQuestionRelation = new List <QuestionRelation>(); htQBOrder = new Hashtable(); LoadData(); LoadQBCombo(); }
private void frmQuestionBank_Load(object sender, EventArgs e) { QbQuestionsEntityState = EntityOperationalState.New; qbQuestions = new QBQuestions(); currentQuestionRelation = new List <QuestionRelation>(); selectedQuestionRelation = new List <QuestionRelation>(); htQBOrder = new Hashtable(); LoadData(); LoadQBCombo(); cbAQGroupType.SelectedIndex = 0; cbAQGroupType_SelectionChangeCommitted(null, null); }
private void ResetAll() { ResetAllQB(); ResetAllAQ(); txtQBName.Text = string.Empty; txtQBRemarks.Text = string.Empty; currentQuestionRelation = new List <QuestionRelation>(); selectedQuestionRelation = new List <QuestionRelation>(); qbQuestions = new QBQuestions(); htQBOrder = new Hashtable(); QbQuestionsEntityState = EntityOperationalState.None; isQBQuestionChanged = false; }