示例#1
0
        private void m_btnSubmit_Click(object sender, EventArgs e)
        {
            if (this.m_tbAns.Text == String.Empty)//未输入答案
            {
                return;
            }
            if (Convert.ToInt32(this.m_tvSubStru.SelectedNode.Tag) < 0)//没选中题目
            {
                return;
            }

            Question que = m_ques.FindOneQuestion(Convert.ToInt32(this.m_tvSubStru.SelectedNode.Tag.ToString()));

            if (que == null)
            {
                return;
            }
            if (String.Equals(m_tbAns.Text, que.answer))
            {
                /*和数据库交互,存储当前题目正确回答*/
                MessageBox.Show("正确回答!");
            }
            else
            {   /*和数据库交互,存储当前题目已经做过*/
                MessageBox.Show("Wrong ans!");
            }
        }
示例#2
0
文件: problem.cs 项目: bxdaze/bxdaze
 public void init(int qid)
 {
     m_que = m_queMan.FindOneQuestion(qid);
     if (m_que == null)
     {
         MessageBox.Show("错误选择");
         return;
     }
     this.m_lbTitle.Text      = this.m_que.title;
     this.m_lbBody.Text       = this.m_que.body;
     this.m_lbAns.Text        = this.m_que.answer;
     this.m_lbAns.ForeColor   = Color.White;
     this.m_lbBody.ForeColor  = Color.Black;
     this.m_lbTitle.ForeColor = Color.Black;
 }
示例#3
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            Question que;

            if (this.m_tbAns.Text == String.Empty)//当前用户没有输入答案
            {
                que    = m_question.FindOneQuestion(Convert.ToInt32(this.treeView1.SelectedNode.Tag));
                user_q = que;
                this.m_lbTitle.Text = que.title;
                this.m_lbBody.Text  = que.body;
                return;
            }
            //获取题目答案
            int qid = Convert.ToInt32(treeView1.SelectedNode.Tag.ToString()); //当前点击的树状图问题节点qid

            if (qid < 0)                                                      //检测用户是否点击的题目
            {
                return;
            }
            //Question corrAns = m_question.FindOneQuestion(qid);
            Question corrAns = user_q;

            if (String.Equals(this.m_tbAns.Text, corrAns.answer))
            {
                score += 1;
            }
            //更新题目显示
            if (Convert.ToInt32(this.treeView1.SelectedNode.Tag) <= -1)
            {
                return;
            }
            que = m_question.FindOneQuestion(Convert.ToInt32(this.treeView1.SelectedNode.Tag));
            this.m_lbTitle.Text = que.title;
            this.m_lbBody.Text  = que.body;
            user_q = que;
        }