private void btnInitialQuestions_Click(object sender, EventArgs e) { foreach (var question in QuestionManager.m_QuestionsList) { QuestionManagerSql.AddQuestion(question); } //DataTable data = SQLiteHelper.SQLiteHelper.GetDataTable("select * from questions where 1=@data", new SQLiteParameter[] { new SQLiteParameter("@data", 1) }); }
private void buttonSave_Click(object sender, EventArgs e) { if (false == CheckQuestionInfo()) { return; } if (DialogResult.No == MessageBox.Show("确认要保存此题目信息吗?", "确认信息", MessageBoxButtons.YesNo)) { return; } BindUIToQuestion(out Question question); if (true == QuestionManagerSql.UpdateQuestion(question, m_question)) { //MessageBox.Show("保存题目信息成功,题目id:" + m_question.Id.ToString() + ".", "提示信息", MessageBoxButtons.OK); } else { MessageBox.Show("保存题目信息失败,题目id:" + m_question.Id.ToString() + "请检查题目信息!", "提示信息", MessageBoxButtons.OK); return; } ChapterInfo chapterSkill = (ChapterInfo)comboBoxSkill.SelectedItem; bool result = false; if (chapterSkill.ID != m_skillId) { if (chapterSkill.ID == 0) { result = QuestionManagerSql.DeleteQuestionGroup(m_question.Id, m_skillId); } else { result = QuestionManagerSql.UpdateQuestionGroup(m_question.Id, chapterSkill.ID, m_skillId, 1); } if (result) { //MessageBox.Show("保存技巧信息成功,题目id:" + m_question.Id.ToString() + ".", "提示信息", MessageBoxButtons.OK); } else { MessageBox.Show("保存技巧信息失败,题目id:" + m_question.Id.ToString() + "技巧ID:" + m_skillId + "新的技巧ID:" + chapterSkill.ID + "请检查题目信息!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } result = false; ChapterInfo chapterBank = (ChapterInfo)cboxBank.SelectedItem; if (chapterBank.ID != m_bankId) { if (chapterBank.ID == 0) { result = QuestionManagerSql.DeleteQuestionGroup(m_question.Id, m_bankId); } else { result = QuestionManagerSql.UpdateQuestionGroup(m_question.Id, chapterBank.ID, m_bankId, 2); } if (result) { //MessageBox.Show("保存强化信息成功,题目id:" + m_question.Id.ToString() + ".", "提示信息", MessageBoxButtons.OK); } else { MessageBox.Show("保存强化信息失败,题目id:" + m_question.Id.ToString() + "强化ID:" + m_skillId + "新的强化ID:" + chapterSkill.ID + "请检查题目信息!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } DialogResult = DialogResult.Yes; }