//确认开始考试 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("登陆出错,请联系管理员"); } } }
public void BindData() { DataClassesDataContext db = new DataClassesDataContext(); Exam exam = db.Exam.First(t => t.ExamId == decimal.Parse(examId)); theExamId = exam.TheExamId.ToString(); if (exam == null) { alert("获取试卷信息失败!", "AllExam.aspx"); } examName = examBll.GetExamName(exam); paper = examBll.GetPaperByExamIdByPage(examId, ref pageNumber, ref totalPage); if (paper != null) { sorts = examBll.GetPaperSorts(paper.PaperId.ToString()); } else { alert("获取试卷信息失败!", "AllExam.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { nowExam = exambll.GetNowExam(); examTitle = exambll.GetExamName(nowExam); if (Request.QueryString["pageNumber"] != null) { pageNumber = int.Parse(Request.QueryString["pageNumber"].ToString()); para = Request.QueryString["para"]; } if (Request.Form["StudentId"] != null) { if (Request.Form["flag"] == "0") { RestStu(); //重置考试状态 } if (Request.Form["flag"] == "1") { SetStuCheat(); //作弊 } } Bind(); }
//绑定试卷标题 protected void bindHeadLine() { ExamBLL examBll = new ExamBLL(); Exam nowExam = examBll.GetNowExam(); examName = examBll.GetExamName(nowExam); if (examName == null || examName == "") { //Response.Write("<script>alert('获取试卷信息有误')</script>"); Response.Redirect("StuLogIn.aspx"); } headLine.Text = examName; endTime = nowExam.ExamEndTime.ToString(); }
public void BindData() { DataClassesDataContext db = new DataClassesDataContext(); exam = stuExamBll.GetExamByThExamIdBySId(theExamId, sId); examName = examBll.GetExamName(exam); studnet = db.Student.First(t => t.StudentId == sId); if (exam == null) { alert("获取学生试卷出错", "ExamList.aspx"); return; } sorts = stuExamBll.GetExamTopicBySort(sId, exam.ExamId.ToString()); }
public void BindTopic() { DataClassesDataContext db = new DataClassesDataContext(); Exam exam = db.Exam.First(t => t.ExamId == decimal.Parse(examId)); theExamId = exam.TheExamId.ToString(); if (exam == null) { alert("获取试卷信息失败!", "AllExam.aspx"); } examName = examBll.GetExamName(exam); topics = examBll.GetPracTopicByExamId(ref pageNumber, ref totalPage, ref count, examId); }
//学生登录 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; } }
//绑定考试信息 protected void bindInfo() { ExamBLL examBll = new ExamBLL(); nowExam = examBll.GetNowExam();//当前考试 string examName; //var res = (db.proc_getNewExam()).ToArray(); if (nowExam == null) { //Label2.Text = "暂无考试"; Label2.Visible = true; // Button1.Enabled = false; // TextBox1.Enabled = false; beginTime = ""; return; } DateTime now = DateTime.Now.ToLocalTime(); DateTime endTime = DateTime.Parse(nowExam.ExamEndTime.ToString()); beginTime = nowExam.ExamBegTime.ToString(); //考试结束时间 //查询到的考试已结束 if (DateTime.Compare(now, endTime) > 0) { // Label2.Text = "暂无考试"; Label2.Visible = true; Button1.Enabled = true; // TextBox1.Enabled = false; return; } examName = examBll.GetExamName(nowExam); }