Example #1
0
    //确认开始考试
    protected void Button2_Click(object sender, EventArgs e)
    {
        ExamBLL    examBll    = new ExamBLL();
        StuExamBLL stuExamBll = new StuExamBLL();

        examName = examBll.GetExamName(nowExam);
        nowExam  = examBll.GetNowExam();
        string sId = TextBox1.Text.Trim();

        DateTime now       = DateTime.Now.ToLocalTime();
        DateTime beginTime = DateTime.Parse(nowExam.ExamBegTime.ToString());

        if (DateTime.Compare(now, beginTime) < 0)
        {
            infoAlert("请待考试开始");
            return;
        }
        else
        {
            int paperId = stuExamBll.StuBeginExam(sId, nowExam.ExamId.ToString());
            //alert(paperId.ToString());
            if (paperId > 0)
            {
                string examId = examBll.GetNowExam().ExamId.ToString();
                Response.Cookies["examId"].Value = examId; //当前考试Id

                Response.Redirect("ExamMain.aspx");
            }

            else
            {
                errAlert("登陆出错,请联系管理员");
            }
        }
    }
Example #2
0
    //绑定学生信息
    protected void bindStuInfo()
    {
        StuExamBLL stuExamBll = new StuExamBLL();

        student = stuExamBll.GetStuInfo(studentId);
        if (student != null)
        {
            Sname.Text = student.StudentName;
            Sno.Text   = student.StudentId;
        }
    }
Example #3
0
    //绑定所有题型
    protected void bindAllTitleList()
    {
        ExamBLL examBll = new ExamBLL();
        Exam    nowExam = examBll.GetNowExam();

        if (nowExam != null)
        {
            StuExamBLL  stuExamBll = new StuExamBLL();
            List <Sort> sorts      = stuExamBll.GetExamTopicBySort(studentId, nowExam.ExamId.ToString());

            AllTitleList.DataSource = sorts;
            AllTitleList.DataBind();
        }
    }
Example #4
0
    //学生登录
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (TextBox1.Text == "" || TextBox2.Text == "")
        {
            errAlert("请输入学号和姓名!");
            return;
        }

        //     stuExamBll = new StuExamBLL();
        ExamBLL    examBll    = new ExamBLL();
        StuExamBLL stuExamBll = new StuExamBLL();

        Exam nowExam = examBll.GetNowExam();//当前考试

        if (nowExam == null)
        {
            errAlert("当前暂无考试!");
            return;
        }

        string erroeInfo = "";
        int    res       = stuExamBll.StuLogIn(TextBox1.Text.Trim(), TextBox2.Text.Trim(), nowExam.ExamId.ToString(), ref erroeInfo);

        if (res <= 0)
        {
            errAlert(erroeInfo);
            return;
        }
        else
        {
            Panel1.Visible = false;
            //判断手机号是否为空
            Student stu = db.Student.First(t => t.StudentId == TextBox1.Text.Trim());
            if (stu.StudentPhone.Trim() == "")
            {
                Panel3.Visible = true;
            }
            else
            {
                Panel2.Visible = true; // 显示确认开始考试
            }
            examName = examBll.GetExamName(nowExam);
            string sId = TextBox1.Text.Trim();
            //Session["sId"] = sId;
            Response.Cookies["sId"].Value = sId;
        }
    }
Example #5
0
    //所有题型
    protected void AllTitleList_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        Label  SortIdLabel = (Label)e.Item.FindControl("SortId");
        string sortId      = SortIdLabel.Text.ToString();

        Repeater TheTitleList    = (Repeater)e.Item.FindControl("theTitleList");
        Label    WaitNumberLabe  = (Label)e.Item.FindControl("WaitNumber");  //已做题目数量
        Label    TotalNumberLabe = (Label)e.Item.FindControl("TotalNumber"); //题目数量

        Flag2++;
        if (Flag2 == 1)
        {
            Param = "&sortId=" + SortIdLabel.Text;
        }
        if (Flag == 1 && Flag2 == 1)
        {
            BindTitle(sortId, 0); //第一次进入该页面时显示第一题
        }

        StuExamBLL stuExamBll = new StuExamBLL();

        int hasDoTopic = 0; //已做的题目数量

        List <StuExamTopic> stuExamTopics = stuExamBll.GetExamTopicBySortId(studentId, examId, sortId);

        foreach (var item in stuExamTopics)
        {
            if (item.StuAnswer != null && item.StuAnswer.Trim() != "")
            {
                hasDoTopic++;
            }
        }
        WaitNumberLabe.Text  = hasDoTopic.ToString();
        TotalNumberLabe.Text = stuExamTopics.Count().ToString();

        TheTitleList.DataSource = stuExamTopics;
        TheTitleList.DataBind();
    }