//确认开始考试 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("登陆出错,请联系管理员"); } } }
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(); }
public void BindData() { Teacher teacher = accountBll.GetTeacherById(Request.Cookies["uId"].Value.ToString()); tname = teacher.TName; tId = teacher.TId; nowExam = examBll.GetNowExam(); if (nowExam == null) { alert("暂无即将开始的考试", "/Desktop.aspx"); return; } invigilate = examBll.GetInvigilateByTidExamId(tId.ToString(), nowExam.ExamId.ToString()); if (invigilate == null) { invigilate = new Invigilate() { ExamRoomName = "", ExamRoomPosition = "", OtherTeacher = "" }; } }
protected void Page_Load(object sender, EventArgs e) { tId = Request.Cookies["uId"].Value.ToString(); nowExam = examBll.GetNowExam(); //判断有无即将开始的考试 if (nowExam == null) { alert("暂无即将开始的考试", "/Desktop.aspx"); return; } //判断老师是否已登记考场 if (examBll.IsExamHasInvigilate(nowExam.ExamId.ToString(), tId) == false) { alert("请先登记考场", "SingInExamRoom.aspx"); } //获取参数 if (Request.QueryString["pageNumber"] != null) { pageNumber = int.Parse(Request.QueryString["pageNumber"].ToString()); } if (Request.QueryString["para"] != null) { para = Request.QueryString["para"].ToString(); } if (Request.QueryString["sIds"] != null) { Array sIds = Request.QueryString["sIds"].ToString().Split(','); int flag = 1; for (int i = 0; i < sIds.Length; i++) { if (examBll.ChangeStuExamState(sIds.GetValue(i).ToString(), tId, nowExam.ExamId.ToString(), (int)StudentBLL.StudentExamState.Default) <= 0) { errAlert("学号为" + sIds.GetValue(i).ToString() + "的考生取消登记失败"); flag = 0; BindDate(); break; } } if (flag == 1) { SuAlert("成功取消登记 " + sIds.Length.ToString() + " 名考生"); } } BindDate(); }
//绑定所有题型 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(); } }
//绑定试卷标题 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(); }
//学生登录 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; } }
private void BindGrid() { GridView2.DataBind(); if (PrjPub.StudentID != null && PrjPub.StudentID != "") { string struesrId = PrjPub.StudentID; ExamBLL bkLL = new ExamBLL(); IList <RailExam.Model.Exam> ExamList = bkLL.GetExamByUserId(struesrId, 0, PrjPub.ServerNo); this.GridView4.DataSource = ExamList; this.GridView4.DataBind(); //即将考试 IList <RailExam.Model.Exam> ExamList1 = bkLL.GetComingExamByUserId(struesrId); this.GridView3.DataSource = ExamList1; this.GridView3.DataBind(); //历史考试 IList <RailExam.Model.Exam> ExamList2 = bkLL.GetHistoryExamByUserId(struesrId); this.GridView5.DataSource = ExamList2; this.GridView5.DataBind(); gvExamResult.Visible = true; } else { ExamBLL bkLL = new ExamBLL(); IList <RailExam.Model.Exam> ExamList = bkLL.GetNowExam(); this.GridView4.DataSource = ExamList; this.GridView4.DataBind(); IList <RailExam.Model.Exam> ExamList1 = bkLL.GetComingExam(); this.GridView3.DataSource = ExamList1; this.GridView3.DataBind(); IList <RailExam.Model.Exam> ExamList2 = bkLL.GetHistoryExam(); this.GridView5.DataSource = ExamList2; this.GridView5.DataBind(); gvExamResult.Visible = false; } }
//绑定考试信息 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); }