예제 #1
0
        public UserExamDetail(string logid) : this()
        {
            ArrayList logs = FT.DAL.Orm.SimpleOrmOperator.QueryConditionList <ExamLog>(" where id=" + logid);

            if (logs != null && logs.Count > 0)
            {
                ExamLog log = logs[0] as ExamLog;
                this.lbWelcome.Text = "身份证明为" + log.IdCard + "的"
                                      + log.Name + "在" + log.ExamDate + "时考试详细记录,考试分数为:" + log.Score;
                string sql = "select b.c_topictext as 试题内容,b.c_answer as 标准答案,a.answer as 考生答案,b.c_answer_a as 答案A,b.c_answer_b as 答案B"
                             + ",b.c_answer_c as 答案C,b.c_answer_d as 答案D "
                             + ",b.c_picpath as 图片路径 from table_exam_log_detail as a left join table_exam_topic as b on a.topicid=b.id where a.logid=" + logid + " order by a.id asc";
                DataTable dt = FT.DAL.DataAccessFactory.GetDataAccess().SelectDataTable(sql, "tmp");
                if (dt != null)
                {
                    int colIndex = dt.Columns.Count;
                    dt.Columns.Add("题号");
                    for (int i = 1; i <= dt.Rows.Count; i++)
                    {
                        dt.Rows[i - 1][colIndex] = i.ToString();
                    }
                    this.dataGridView1.DataSource = dt;
                }
            }
        }
예제 #2
0
        private void ExamWorkStation_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!this.isTrain && user != null && MessageBoxHelper.Confirm("是否需要保存本次模拟考试成绩?"))
            {
                int score = 0;
                int pass = 0, nopass = 0;
                for (int i = 0; i < topicsControl.Count; i++)
                {
                    if (topicsControl[i].IsRightAnswer)
                    {
                        score += topicsControl[i].Score;
                    }
                }
                if (score < 90)
                {
                    nopass = 1;
                }
                else
                {
                    pass = 1;
                }
                string sql = "update table_exam_user set i_all_count=i_all_count+1,i_pass_count=i_pass_count+"
                             + pass + ",i_not_pass_count=i_not_pass_count+"
                             + nopass + " where c_idcard='" + user.IdCard + "'";
                //FT.DAL.DataAccessFactory.GetDataAccess().ExecuteSql(sql);
                /*if()*/
                //开始保存考试记录并统计考试合格或者错误率
                string[] sqls = new string[topicsControl.Count + 1];
                sqls[0] = sql;
                ExamLog log = new ExamLog();
                log.ExamDate = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                log.IdCard   = user.IdCard;
                log.Name     = user.Name;
                log.Score    = score;
                if (FT.DAL.Orm.SimpleOrmOperator.Create(log))
                {
                    for (int i = 0; i < topicsControl.Count; i++)
                    {
                        sqls[i + 1] = "insert into table_exam_log_detail(logid,topicid,answer) values(" +
                                      log.Id.ToString() + "," + topicsControl[i].Topic.Id.ToString() + ",'" +
                                      topicsControl[i].Answer + "')";
                    }
                }
                FT.DAL.DataAccessFactory.GetDataAccess().ExecuteTransaction(sqls);


                //Environment.Exit(0);
                //Application.Exit();
            }
            else
            {
                //Environment.Exit(0);
                //Application.Exit();
            }
        }
예제 #3
0
        protected override void ShowDetail(int index)
        {
            ExamLog log = pager.Lists[this.dataGridView1.SelectedRows[0].Index] as ExamLog;

            if (log != null)
            {
                Form form = new UserExamDetail(log.Id.ToString());
                form.ShowInTaskbar = false;
                form.ShowDialog();
            }
        }
예제 #4
0
        private void ExamWorkStation_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!this.isTrain&&user!=null&&MessageBoxHelper.Confirm("�Ƿ���Ҫ���汾��ģ�⿼�Գɼ���"))
            {
                int score = 0;
                int pass = 0, nopass = 0;
                for (int i = 0; i < topicsControl.Count; i++)
                {
                    if (topicsControl[i].IsRightAnswer)
                        score += topicsControl[i].Score;
                }
                if (score < 90)
                {
                    nopass = 1;
                }
                else
                {
                    pass = 1;
                }
                string sql = "update table_exam_user set i_all_count=i_all_count+1,i_pass_count=i_pass_count+"
                    + pass + ",i_not_pass_count=i_not_pass_count+"
                    + nopass + " where c_idcard='" + user.IdCard + "'";
                //FT.DAL.DataAccessFactory.GetDataAccess().ExecuteSql(sql);
                /*if()*/
                //��ʼ���濼�Լ�¼��ͳ�ƿ��Ժϸ���ߴ�����
                string[] sqls = new string[topicsControl.Count+1];
                sqls[0] = sql;
                ExamLog log = new ExamLog();
                log.ExamDate=System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                log.IdCard=user.IdCard;
                log.Name=user.Name;
                log.Score=score;
                if(FT.DAL.Orm.SimpleOrmOperator.Create(log))
                {
                    for (int i = 0; i < topicsControl.Count; i++)
                    {
                        sqls[i + 1] = "insert into table_exam_log_detail(logid,topicid,answer) values("+
                            log.Id.ToString()+","+topicsControl[i].Topic.Id.ToString()+",'"+
                            topicsControl[i].Answer+ "')";
                    }

                }
                FT.DAL.DataAccessFactory.GetDataAccess().ExecuteTransaction(sqls);

                //Environment.Exit(0);
                //Application.Exit();
            }
            else{
                //Environment.Exit(0);
                //Application.Exit();
            }
        }