//点击提交按钮事件 protected void btnOk_Click(object sender, EventArgs e) { btnOk.Enabled = false; //单选题判定,判断对错,显示正确答案 TestLowManager.JudgingRadio(rdolistS1, rLow1, lblS1A, btnS1E); TestLowManager.JudgingRadio(rdolistS2, rLow2, lblS2A, btnS2E); TestLowManager.JudgingRadio(rdolistS3, rLow3, lblS3A, btnS3E); TestLowManager.JudgingRadio(rdolistS4, rLow4, lblS4A, btnS4E); TestLowManager.JudgingRadio(rdolistS5, rLow5, lblS5A, btnS5E); //判断题判定,判断对错,显示正确答案 TestLowManager.JudgingJudge(rdolistJ1, jLow1, lblJ1A, btnJ1E); TestLowManager.JudgingJudge(rdolistJ2, jLow2, lblJ2A, btnJ2E); TestLowManager.JudgingJudge(rdolistJ3, jLow3, lblJ3A, btnJ3E); TestLowManager.JudgingJudge(rdolistJ4, jLow4, lblJ4A, btnJ4E); TestLowManager.JudgingJudge(rdolistJ5, jLow5, lblJ5A, btnJ5E); //判断分数等级 int scoreJudge = TestLowManager.Score2(TestLowManager.radioScore2(rLow1, rLow2, rLow3, rLow4, rLow5, rdolistS1, rdolistS2, rdolistS3, rdolistS4, rdolistS5), TestLowManager.judgeScore2(jLow1, jLow2, jLow3, jLow4, jLow5, rdolistJ1, rdolistJ2, rdolistJ3, rdolistJ4, rdolistJ5)); string stuId = Session["stuId"].ToString(); //将分数写入成绩表中 TestLowManager.UpdateStudyingScore(stuId, learningLevel, TestLowManager.radioScore2(rLow1, rLow2, rLow3, rLow4, rLow5, rdolistS1, rdolistS2, rdolistS3, rdolistS4, rdolistS5) + TestLowManager.judgeScore2(jLow1, jLow2, jLow3, jLow4, jLow5, rdolistJ1, rdolistJ2, rdolistJ3, rdolistJ4, rdolistJ5)); string str = null; //判断测试等级 str = TestLowManager.ShowScoreString2(TestLowManager.radioScore2(rLow1, rLow2, rLow3, rLow4, rLow5, rdolistS1, rdolistS2, rdolistS3, rdolistS4, rdolistS5), TestLowManager.judgeScore2(jLow1, jLow2, jLow3, jLow4, jLow5, rdolistJ1, rdolistJ2, rdolistJ3, rdolistJ4, rdolistJ5), scoreJudge); //Response.Write(string.Format("<script type = 'text/javascript'> alert('{0}'); </script>", str)); RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('{0}'); </script>", str)); }
//点击注册按钮事件 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { //判断用户学号是否占有 if (StudentInfoManager.StudentRegistCheck(txtstuId.Text) == false) { //Response.Write("<script type = 'text/javascript'> alert('该学号已占用!'); </script>"); RegisterClientScriptBlock("", "<script>alert('该学号已占用!')</script>"); return; } //判断是否选择性别 if (RadioButton1.Checked == false && RadioButton2.Checked == false) { //Response.Write("<script type = 'text/javascript'> alert('您未选择性别!'); </script>"); RegisterClientScriptBlock("", "<script>alert('您未选择性别!')</script>"); return; } //检测用户输入的密码是否一致 if (txtpsw.Text != txtpsw1.Text) { //Response.Write("<script type = 'text/javascript'> alert('您输入的密码不一致!'); </script>"); RegisterClientScriptBlock("", "<script>alert('您输入的密码不一致!')</script>"); txtpsw.Focus(); return; } string stuId = txtstuId.Text; string stuName = txtstuName.Text; string password = txtpsw.Text; string photo = "~/load/教育技术头像.PNG"; //系统自动上传一张固定头像,用户可在后期手动更改 string gender = "男"; if (RadioButton2.Checked == true) { gender = "女"; } string className = txtclassName.Text; string email = txtemail.Text; string telephone = txttel.Text; DateTime birthday = Convert.ToDateTime("2012-1-1"); //系统暂定生日为2012-1-1,用户可在后期手动更改 string learningStyle = ""; StudentInfo studentInfo = new StudentInfo(stuId, stuName, password, learningStyle, photo, gender, className, telephone, email, birthday); StudentInfoManager.AddStudent(studentInfo); //将用户信息记录到数据库 TestLowManager.UpdateStudyingScore2(stuId); //在用户成绩表增加该用户最初记录 Session["stuId"] = txtstuId.Text; Session["password"] = txtpsw.Text; //生成以学号为文件名的XML文件 System.Xml.XmlTextWriter xmlWriter = new XmlTextWriter(Server.MapPath("./XML/" + Session["stuId"].ToString() + ".xml"), System.Text.Encoding.UTF8); xmlWriter.Formatting = Formatting.Indented; xmlWriter.WriteStartDocument(); xmlWriter.WriteStartElement("学习建议"); xmlWriter.WriteEndElement(); //写文档结束,调用WriteEndDocument方法 xmlWriter.WriteEndDocument(); //关闭textWriter xmlWriter.Close(); Response.Redirect("LearningStyleTest.aspx"); //注册完成后跳转到学习风格测试 }
//点击确定按钮事件 protected void btnOk_Click(object sender, EventArgs e) { TestLowManager.JudgingRadio(rdolistS1, rLow1, lblS1A, btnS1E); TestLowManager.JudgingRadio(rdolistS2, rLow2, lblS2A, btnS2E); TestLowManager.JudgingRadio(rdolistS3, rLow3, lblS3A, btnS3E); TestLowManager.JudgingRadio(rdolistS4, rLow4, lblS4A, btnS4E); TestLowManager.JudgingRadio(rdolistS5, rLow5, lblS5A, btnS5E); TestLowManager.JudgingJudge(rdolistJ1, jLow1, lblJ1A, btnJ1E); TestLowManager.JudgingJudge(rdolistJ2, jLow2, lblJ2A, btnJ2E); TestLowManager.JudgingJudge(rdolistJ3, jLow3, lblJ3A, btnJ3E); TestLowManager.JudgingJudge(rdolistJ4, jLow4, lblJ4A, btnJ4E); TestLowManager.JudgingBlank(bLow1, txtB11, lblB11A, btnB11E); TestLowManager.JudgingBlank(bLow2, txtB21, lblB21A, btnB21E); TestLowManager.JudgingBlank(bLow3, txtB21, lblB31A, btnB31E); TestLowManager.JudgingDesign(dLow1, btnanswer); btnOk.Enabled = false; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["stuId"] != null) { int score1 = 0; int score2 = 0; string stuId = Session["stuId"].ToString(); stuNews1 = ClassUnitManager.GetStudyingInform(stuId); score1 = stuNews1.pretest; //获取前测分数 score2 = stuNews1.low; //获取初级测试分数 //不是第一次做题,读取断点 if (int.Parse(Request.QueryString["caid"].ToString().Trim()) == 1) { BreakingPointRadio bpr = new BreakingPointRadio(); bpr = BreakingPointManager.LoadBreakingPointRadio(Session["stuId"].ToString()); rLow1 = TestLowManager.GetLowRadio(bpr.r1); //读取用户单选题断点记录 TestLowManager.ShowQuestionRadioLow(rLow1, rdolistS1, lblS1); //显示单选题题目 rLow2 = TestLowManager.GetLowRadio(bpr.r2); TestLowManager.ShowQuestionRadioLow(rLow2, rdolistS2, lblS2); rLow3 = TestLowManager.GetLowRadio(bpr.r3); TestLowManager.ShowQuestionRadioLow(rLow3, rdolistS3, lblS3); rLow4 = TestLowManager.GetLowRadio(bpr.r4); TestLowManager.ShowQuestionRadioLow(rLow4, rdolistS4, lblS4); rLow5 = TestLowManager.GetLowRadio(bpr.r5); TestLowManager.ShowQuestionRadioLow(rLow5, rdolistS5, lblS5); BreakingPointJudge bpj = new BreakingPointJudge(); bpj = BreakingPointManager.LoadBreakingPointJudge(Session["stuId"].ToString()); jLow1 = TestLowManager.GetLowJudge(bpj.j1); //读取用户判断题断点记录 TestLowManager.ShowQuestionJudgeLow(jLow1, rdolistJ1, lblJ1); //显示判断题题目 jLow2 = TestLowManager.GetLowJudge(bpj.j2); TestLowManager.ShowQuestionJudgeLow(jLow2, rdolistJ2, lblJ2); jLow3 = TestLowManager.GetLowJudge(bpj.j3); TestLowManager.ShowQuestionJudgeLow(jLow3, rdolistJ3, lblJ3); jLow4 = TestLowManager.GetLowJudge(bpj.j4); TestLowManager.ShowQuestionJudgeLow(jLow4, rdolistJ4, lblJ4); BreakingPointBlank bpb = new BreakingPointBlank(); bpb = BreakingPointManager.LoadBreakingPointBlank(Session["stuId"].ToString()); bLow1 = TestLowManager.GetLowBlank(bpb.b1); //读取用户填空题断点记录 TestLowManager.ShowQuestionBlankLow(bLow1, lblB1, lblB12); //显示填空题题目 bLow2 = TestLowManager.GetLowBlank(bpb.b2); TestLowManager.ShowQuestionBlankLow(bLow2, lblB2, lblB22); bLow3 = TestLowManager.GetLowBlank(bpb.b3); TestLowManager.ShowQuestionBlankLow(bLow3, lblB3, lblB32); BreakingPointDesign bpd = new BreakingPointDesign(); bpd = BreakingPointManager.LoadBreakingPointDesign(Session["stuId"].ToString()); dLow1 = TestLowManager.GetLowDesign(bpd.d1); //读取用户设计题断点记录 TestLowManager.ShowQuestionDesignLow(dLow1, lblD1, lblD1S1, lblD1S2, rdolistD1S1, rdolistD1S2); //显示填空题题目 TestLowManager.ShowRadioLowBreakingpoint(bpr, rdolistS1, rdolistS2, rdolistS3, rdolistS4, rdolistS5); //显示单选题的断点自选选项 TestLowManager.ShowJudgeLowBreakingpoint(bpj, rdolistJ1, rdolistJ2, rdolistJ3, rdolistJ4); //显示判断题的断点自选选项 TestLowManager.ShowBlankLowBreakingpoint(bpb, txtB11, txtB21, txtB31); //显示填空题的断点自选选项 } //第一次做题 else if (int.Parse(Request.QueryString["caid"].ToString().Trim()) == 0) { //判断前测分数是否到60分 if (score1 >= 60) { //随机出题(加入错题的权重,原先的题号不变,多余的错题作为普通题目放到最后进行随机) long tick = DateTime.Now.Ticks; Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32)); int iDown = 1; int iUp = TestLowManager.CountRadioLow(); int[] rr = new int[iUp + 1]; for (int mn = 1; mn <= TestLowManager.CountRadioLow(); mn++) { rr[mn] = WrongRadioManager.WrongRadionum(Session["stuId"].ToString(), mn, "Low", "WrongRadio"); iUp = iUp + rr[mn]; } int[] n = new int[5]; while (true) { int i; n[0] = ran.Next(iDown, iUp); n[1] = ran.Next(iDown, iUp); n[2] = ran.Next(iDown, iUp); n[3] = ran.Next(iDown, iUp); n[4] = ran.Next(iDown, iUp); //对随机选出的5个数重映射题号 for (i = 0; i <= 4; i++) { if (n[i] > TestLowManager.CountRadioLow()) { int temp; temp = n[i] - TestLowManager.CountRadioLow(); int p; for (p = 1; p <= TestLowManager.CountRadioLow(); p++) { temp = temp - rr[p]; if (temp <= 0) { break; } } n[i] = p; } } //题目不重复 if (n[0] != n[1] && n[0] != n[2] && n[0] != n[3] && n[0] != n[4] && n[1] != n[2] && n[1] != n[3] && n[1] != n[4] && n[2] != n[3] && n[2] != n[4] && n[3] != n[4]) { i = 4; } if (i == 4) { break; } } rLow1 = TestLowManager.GetLowRadio(n[0]); //获取判断题题目 TestLowManager.ShowQuestionRadioLow(rLow1, rdolistS1, lblS1); //显示判断题题目 rLow2 = TestLowManager.GetLowRadio(n[1]); TestLowManager.ShowQuestionRadioLow(rLow2, rdolistS2, lblS2); rLow3 = TestLowManager.GetLowRadio(n[2]); TestLowManager.ShowQuestionRadioLow(rLow3, rdolistS3, lblS3); rLow4 = TestLowManager.GetLowRadio(n[3]); TestLowManager.ShowQuestionRadioLow(rLow4, rdolistS4, lblS4); rLow5 = TestLowManager.GetLowRadio(n[4]); TestLowManager.ShowQuestionRadioLow(rLow5, rdolistS5, lblS5); //随机出题 int iUp1 = TestLowManager.CountJudgeLow(); int[] jj = new int[iUp1 + 1]; for (int mn = 1; mn <= TestLowManager.CountJudgeLow(); mn++) { jj[mn] = WrongRadioManager.WrongRadionum(Session["stuId"].ToString(), mn, "Low", "WrongJudge"); iUp1 = iUp1 + jj[mn]; } int[] j = new int[4]; while (true) { int i; j[0] = ran.Next(iDown, iUp1); j[1] = ran.Next(iDown, iUp1); j[2] = ran.Next(iDown, iUp1); j[3] = ran.Next(iDown, iUp1); //对随机选出的4个数重映射题号 for (i = 0; i <= 3; i++) { if (j[i] > TestLowManager.CountJudgeLow()) { int temp; temp = j[i] - TestLowManager.CountJudgeLow(); int p; for (p = 1; p <= TestLowManager.CountJudgeLow(); p++) { temp = temp - jj[p]; if (temp <= 0) { break; } } j[i] = p; } } if (j[0] != j[1] && j[0] != j[2] && j[0] != j[3] && j[1] != j[2] && j[1] != j[3] && j[2] != j[3]) { i = 3; } if (i == 3) { break; } } jLow1 = TestLowManager.GetLowJudge(j[0]); TestLowManager.ShowQuestionJudgeLow(jLow1, rdolistJ1, lblJ1); jLow2 = TestLowManager.GetLowJudge(j[1]); TestLowManager.ShowQuestionJudgeLow(jLow2, rdolistJ2, lblJ2); jLow3 = TestLowManager.GetLowJudge(j[2]); TestLowManager.ShowQuestionJudgeLow(jLow3, rdolistJ3, lblJ3); jLow4 = TestLowManager.GetLowJudge(j[3]); TestLowManager.ShowQuestionJudgeLow(jLow4, rdolistJ4, lblJ4); //随机出题 int iUp2 = TestLowManager.CountBlankLow(); int[] kk = new int[iUp2 + 1]; for (int mn = 1; mn <= TestLowManager.CountBlankLow(); mn++) { kk[mn] = WrongRadioManager.WrongRadionum(Session["stuId"].ToString(), mn, "Low", "WrongBlank"); iUp2 = iUp2 + kk[mn]; } int[] k = new int[3]; while (true) { int i; k[0] = ran.Next(iDown, iUp2); k[1] = ran.Next(iDown, iUp2); k[2] = ran.Next(iDown, iUp2); //对随机选出的3个数重映射题号 for (i = 0; i <= 2; i++) { if (k[i] > TestLowManager.CountBlankLow()) { int temp; temp = k[i] - TestLowManager.CountBlankLow(); int p; for (p = 1; p <= TestLowManager.CountBlankLow(); p++) { temp = temp - kk[p]; if (temp <= 0) { break; } } k[i] = p; } } if (k[0] != k[1] && k[0] != k[2] && k[1] != k[2]) { i = 2; } if (i == 2) { break; } } bLow1 = TestLowManager.GetLowBlank(k[0]); TestLowManager.ShowQuestionBlankLow(bLow1, lblB1, lblB12); bLow2 = TestLowManager.GetLowBlank(k[1]); TestLowManager.ShowQuestionBlankLow(bLow2, lblB2, lblB22); bLow3 = TestLowManager.GetLowBlank(k[2]); TestLowManager.ShowQuestionBlankLow(bLow3, lblB3, lblB32); //随机出题 int iUp3 = TestLowManager.CountDesignlow(); int[] m = new int[2]; m[0] = ran.Next(iDown, iUp3); dLow1 = TestLowManager.GetLowDesign(m[0]); TestLowManager.ShowQuestionDesignLow(dLow1, lblD1, lblD1S1, lblD1S2, rdolistD1S1, rdolistD1S2); } else { lblTitle.Visible = false; PanelAll.Visible = false; PanelDesign.Visible = false; btnSubmit.Visible = false; btnOk.Visible = false; btnSave.Visible = false; //Response.Write("<script type = 'text/javascript'> alert('你未通过前测,不能进行该等级测试!'); </script>"); RegisterClientScriptBlock("", "<script>alert('你未通过前测,不能进行初级测试!')</script>"); } } } else { Response.Redirect("Login.aspx"); } } }
//点击确定按钮事件 protected void btnOk_Click(object sender, EventArgs e) { btnSuggest.Visible = true; int[] r = new int[5]; //用于存放学习建议 int[] j = new int[4]; int[] b = new int[3]; int[] rr = new int[6]; //用于存放错题的学习建议,有1~5种类型,数字长度选6 btnOk.Enabled = false; btnSave.Enabled = false; correct = TestLowManager.JudgingRadio(rdolistS1, rLow1, lblS1A, btnS1E); //单选题判定,判断对错,显示正确答案 //记录错题 if (correct == false) { r[0] = rLow1.suggestion; WrongRadioManager.addRadioToWrongTotal(Session["stuId"].ToString(), rLow1.Id, "Low", "WrongRadio"); } correct = TestLowManager.JudgingRadio(rdolistS2, rLow2, lblS2A, btnS2E); if (correct == false) { r[1] = rLow2.suggestion; WrongRadioManager.addRadioToWrongTotal(Session["stuId"].ToString(), rLow2.Id, "Low", "WrongRadio"); } correct = TestLowManager.JudgingRadio(rdolistS3, rLow3, lblS3A, btnS3E); if (correct == false) { r[2] = rLow3.suggestion; WrongRadioManager.addRadioToWrongTotal(Session["stuId"].ToString(), rLow3.Id, "Low", "WrongRadio"); } correct = TestLowManager.JudgingRadio(rdolistS4, rLow4, lblS4A, btnS4E); if (correct == false) { r[3] = rLow4.suggestion; WrongRadioManager.addRadioToWrongTotal(Session["stuId"].ToString(), rLow4.Id, "Low", "WrongRadio"); } correct = TestLowManager.JudgingRadio(rdolistS5, rLow5, lblS5A, btnS5E); if (correct == false) { r[4] = rLow5.suggestion; WrongRadioManager.addRadioToWrongTotal(Session["stuId"].ToString(), rLow5.Id, "Low", "WrongRadio"); } correct = TestLowManager.JudgingJudge(rdolistJ1, jLow1, lblJ1A, btnJ1E); //判断题判定,判断对错,显示正确答案 //记录错题 if (correct == false) { j[0] = jLow1.suggestion; WrongRadioManager.addRadioToWrongTotal(Session["stuId"].ToString(), jLow1.Id, "Low", "WrongJudge"); } correct = TestLowManager.JudgingJudge(rdolistJ2, jLow2, lblJ2A, btnJ2E); if (correct == false) { j[1] = jLow2.suggestion; WrongRadioManager.addRadioToWrongTotal(Session["stuId"].ToString(), jLow2.Id, "Low", "WrongJudge"); } correct = TestLowManager.JudgingJudge(rdolistJ3, jLow3, lblJ3A, btnJ3E); if (correct == false) { j[2] = jLow3.suggestion; WrongRadioManager.addRadioToWrongTotal(Session["stuId"].ToString(), jLow3.Id, "Low", "WrongJudge"); } correct = TestLowManager.JudgingJudge(rdolistJ4, jLow4, lblJ4A, btnJ4E); if (correct == false) { j[3] = jLow4.suggestion; WrongRadioManager.addRadioToWrongTotal(Session["stuId"].ToString(), jLow4.Id, "Low", "WrongJudge"); } correct = TestLowManager.JudgingBlank(bLow1, txtB11, lblB11A, btnB11E); //填空题判定,判断对错,显示正确答案 //记录错题 if (correct == false) { b[0] = bLow1.suggestion; WrongRadioManager.addRadioToWrongTotal(Session["stuId"].ToString(), bLow1.Id, "Low", "WrongBlank"); } correct = TestLowManager.JudgingBlank(bLow2, txtB21, lblB21A, btnB21E); if (correct == false) { b[1] = bLow2.suggestion; WrongRadioManager.addRadioToWrongTotal(Session["stuId"].ToString(), bLow2.Id, "Low", "WrongBlank"); } correct = TestLowManager.JudgingBlank(bLow3, txtB21, lblB31A, btnB31E); if (correct == false) { b[2] = bLow3.suggestion; WrongRadioManager.addRadioToWrongTotal(Session["stuId"].ToString(), bLow3.Id, "Low", "WrongBlank"); } correct = TestLowManager.JudgingDesignRadio(rdolistD1S1, rdolistD1S2, dLow1, lblD1S1A, lblD1S2A); //设计题判定,判断对错,显示正确答案 //记录错题 if (correct == false) { WrongRadioManager.addRadioToWrongTotal(Session["stuId"].ToString(), dLow1.Id, "Low", "WrongDesign"); } string stuId = Session["stuId"].ToString(); //判断分数是否合格 bool scoreJudge = TestLowManager.Score(TestLowManager.radioScore(rLow1, rLow2, rLow3, rLow4, rLow5, rdolistS1, rdolistS2, rdolistS3, rdolistS4, rdolistS5), TestLowManager.judgeScore(jLow1, jLow2, jLow3, jLow4, rdolistJ1, rdolistJ2, rdolistJ3, rdolistJ4), TestLowManager.blankScore(bLow1, bLow2, bLow3, txtB11, txtB21, txtB31), TestLowManager.designScore(dLow1, rdolistD1S1, rdolistD1S2)); //判断单选错题的学习建议是否重复,同时生成XML文件 System.Xml.XmlTextWriter xmlWriter = new XmlTextWriter(Server.MapPath("./XML/" + Session["stuId"].ToString() + ".xml"), System.Text.Encoding.UTF8); xmlWriter.Formatting = Formatting.Indented; xmlWriter.WriteStartDocument(); xmlWriter.WriteStartElement("学习建议"); for (int i = 0; i <= 4; i++) { if (r[i] != 0) { rr[r[i]] = r[i]; //如果r[i]不为0,表明为错题,就把建议编号放到相应的rr数组中 } } //判断判断错题的学习建议是否重复 for (int i = 0; i <= 3; i++) { if (j[i] != 0) { rr[j[i]] = j[i]; //如果j[i]不为0,表明为错题,就把建议编号放到相应的jj数组中 } } //判断填空错题的学习建议是否重复 for (int i = 0; i <= 2; i++) { if (b[i] != 0) { rr[b[i]] = b[i]; //如果b[i]不为0,表明为错题,就把建议编号放到相应的bb数组中 } } for (int i = 0; i <= 5; i++) { if (rr[i] != 0) { //写入XML文件 xmlWriter.WriteStartElement("错题"); xmlWriter.WriteAttributeString("类型", rr[i].ToString()); xmlWriter.WriteEndElement(); } } //写文档结束,调用WriteEndDocument方法 xmlWriter.WriteEndDocument(); //关闭textWriter xmlWriter.Close(); //判断分数是否合格,若合格则上传文件 if (scoreJudge == true) { //实现设计题上传 Boolean fileOK = false; // 指定路径 String path = Server.MapPath("~/"); // 文件上传控件中如果已经包含文件 if (FUDesignLow.HasFile) { // 得到文件的后缀 String fileExtension = System.IO.Path.GetExtension(FUDesignLow.FileName).ToLower(); // 允许的文件后缀 String[] allowedExtensions = { ".cs" }; // 看包含的文件是否是被允许的文件后缀 for (int i = 0; i < allowedExtensions.Length; i++) { if (fileExtension == allowedExtensions[i]) { //如果是,标志位置为真 fileOK = true; } } } if (fileOK) { try { //文件另存在服务器指定目录下 FUDesignLow.PostedFile.SaveAs(Server.MapPath("./DesignWorks/low/") + FUDesignLow.FileName); lbText.Text = "文件上传成功!"; path = "~/DesignWorks/low/" + FUDesignLow.FileName; } catch (Exception ex) { lbText.Text = "文件上传失败!"; } } else { lbText.Text = "注意:只能上传*.cs文件!"; } //将上传地址写入数据库 DateTime createTime = DateTime.Now; string fileName = FUDesignLow.FileName; int n = TestLowManager.AddDesignUpload(stuId, learningLevel, createTime, path, fileName); } //将分数写入成绩表中 TestLowManager.UpdateStudyingScore(stuId, learningLevel, TestLowManager.radioScore(rLow1, rLow2, rLow3, rLow4, rLow5, rdolistS1, rdolistS2, rdolistS3, rdolistS4, rdolistS5) + TestLowManager.judgeScore(jLow1, jLow2, jLow3, jLow4, rdolistJ1, rdolistJ2, rdolistJ3, rdolistJ4) + TestLowManager.blankScore(bLow1, bLow2, bLow3, txtB11, txtB21, txtB31) + TestLowManager.designScore(dLow1, rdolistD1S1, rdolistD1S2)); string str = null; //判断测试等级 str = TestLowManager.ShowScoreString(TestLowManager.radioScore(rLow1, rLow2, rLow3, rLow4, rLow5, rdolistS1, rdolistS2, rdolistS3, rdolistS4, rdolistS5), TestLowManager.judgeScore(jLow1, jLow2, jLow3, jLow4, rdolistJ1, rdolistJ2, rdolistJ3, rdolistJ4), TestLowManager.blankScore(bLow1, bLow2, bLow3, txtB11, txtB21, txtB31), TestLowManager.designScore(dLow1, rdolistD1S1, rdolistD1S2), scoreJudge); //Response.Write(string.Format("<script type = 'text/javascript'> alert('{0}'); </script>", str)); RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('{0}'); </script>", str)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["stuId"] != null) { //随机出题 long tick = DateTime.Now.Ticks; Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32)); int iDown = 1; int iUp = TestLowManager.CountRadioLow(); int[] n = new int[5]; while (true) { int i = 0; n[0] = ran.Next(iDown, iUp); n[1] = ran.Next(iDown, iUp); n[2] = ran.Next(iDown, iUp); n[3] = ran.Next(iDown, iUp); n[4] = ran.Next(iDown, iUp); if (n[0] != n[1] && n[0] != n[2] && n[0] != n[3] && n[0] != n[4] && n[1] != n[2] && n[1] != n[3] && n[1] != n[4] && n[2] != n[3] && n[2] != n[4] && n[3] != n[4]) { i = 4; } if (i == 4) { break; } } rLow1 = TestLowManager.GetLowRadio(n[0]); TestLowManager.ShowQuestionRadioLow(rLow1, rdolistS1, lblS1); rLow2 = TestLowManager.GetLowRadio(n[1]); TestLowManager.ShowQuestionRadioLow(rLow2, rdolistS2, lblS2); rLow3 = TestLowManager.GetLowRadio(n[2]); TestLowManager.ShowQuestionRadioLow(rLow3, rdolistS3, lblS3); rLow4 = TestLowManager.GetLowRadio(n[3]); TestLowManager.ShowQuestionRadioLow(rLow4, rdolistS4, lblS4); rLow5 = TestLowManager.GetLowRadio(n[4]); TestLowManager.ShowQuestionRadioLow(rLow5, rdolistS5, lblS5); //随机出题 int iUp1 = TestLowManager.CountJudgeLow(); int[] j = new int[4]; while (true) { int i = 0; j[0] = ran.Next(iDown, iUp1); j[1] = ran.Next(iDown, iUp1); j[2] = ran.Next(iDown, iUp1); j[3] = ran.Next(iDown, iUp1); if (j[0] != j[1] && j[0] != j[2] && j[0] != j[3] && j[1] != j[2] && j[1] != j[3] && j[2] != j[3]) { i = 3; } if (i == 3) { break; } } jLow1 = TestLowManager.GetLowJudge(j[0]); TestLowManager.ShowQuestionJudgeLow(jLow1, rdolistJ1, lblJ1); jLow2 = TestLowManager.GetLowJudge(j[1]); TestLowManager.ShowQuestionJudgeLow(jLow2, rdolistJ2, lblJ2); jLow3 = TestLowManager.GetLowJudge(j[2]); TestLowManager.ShowQuestionJudgeLow(jLow3, rdolistJ3, lblJ3); jLow4 = TestLowManager.GetLowJudge(j[3]); TestLowManager.ShowQuestionJudgeLow(jLow4, rdolistJ4, lblJ4); //随机出题 int iUp2 = TestLowManager.CountBlankLow(); int[] k = new int[3]; while (true) { int i = 0; k[0] = ran.Next(iDown, iUp2); k[1] = ran.Next(iDown, iUp2); k[2] = ran.Next(iDown, iUp2); if (k[0] != k[1] && k[0] != k[2] && k[1] != k[2]) { i = 2; } if (i == 2) { break; } } bLow1 = TestLowManager.GetLowBlank(k[0]); TestLowManager.ShowQuestionBlankLow(bLow1, lblB1, lblB12); bLow2 = TestLowManager.GetLowBlank(k[1]); TestLowManager.ShowQuestionBlankLow(bLow2, lblB2, lblB22); bLow3 = TestLowManager.GetLowBlank(k[2]); TestLowManager.ShowQuestionBlankLow(bLow3, lblB3, lblB32); //随机出题 int iUp3 = TestLowManager.CountDesignlow(); int[] m = new int[2]; m[0] = ran.Next(iDown, iUp3); dLow1 = TestLowManager.GetLowDesign(m[0]); TestLowManager.ShowQuestionDesignLow2(dLow1, lblD1); } else { Response.Redirect("Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["stuId"] != null) { int score1 = 0; string stuId = Session["stuId"].ToString(); stuNews1 = ClassUnitManager.GetStudyingInform(stuId); //获取学生各部分成绩 score1 = stuNews1.pretest; //获取前测分数 //判断前测分数是否到60分 if (score1 < 60) { //随机出题 long tick = DateTime.Now.Ticks; Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32)); int iDown = 1; int iUp = TestLowManager.CountRadioLow(); int[] n = new int[5]; while (true) { int i = 0; n[0] = ran.Next(iDown, iUp); n[1] = ran.Next(iDown, iUp); n[2] = ran.Next(iDown, iUp); n[3] = ran.Next(iDown, iUp); n[4] = ran.Next(iDown, iUp); //题目不重复 if (n[0] != n[1] && n[0] != n[2] && n[0] != n[3] && n[0] != n[4] && n[1] != n[2] && n[1] != n[3] && n[1] != n[4] && n[2] != n[3] && n[2] != n[4] && n[3] != n[4]) { i = 4; } if (i == 4) { break; } } rLow1 = TestLowManager.GetLowRadio(n[0]); //获取前测单选题题目 TestLowManager.ShowQuestionRadioLow(rLow1, rdolistS1, lblS1); //显示单选题题目 rLow2 = TestLowManager.GetLowRadio(n[1]); TestLowManager.ShowQuestionRadioLow(rLow2, rdolistS2, lblS2); rLow3 = TestLowManager.GetLowRadio(n[2]); TestLowManager.ShowQuestionRadioLow(rLow3, rdolistS3, lblS3); rLow4 = TestLowManager.GetLowRadio(n[3]); TestLowManager.ShowQuestionRadioLow(rLow4, rdolistS4, lblS4); rLow5 = TestLowManager.GetLowRadio(n[4]); TestLowManager.ShowQuestionRadioLow(rLow5, rdolistS5, lblS5); //随机出题 int iUp1 = TestLowManager.CountJudgeLow(); int[] j = new int[5]; while (true) { int i = 0; j[0] = ran.Next(iDown, iUp1); j[1] = ran.Next(iDown, iUp1); j[2] = ran.Next(iDown, iUp1); j[3] = ran.Next(iDown, iUp1); j[4] = ran.Next(iDown, iUp1); if (j[0] != j[1] && j[0] != j[2] && j[0] != j[3] && j[0] != j[4] && j[1] != j[2] && j[1] != j[3] && j[1] != j[4] && j[2] != j[3] && j[2] != j[4] && j[3] != j[4]) { i = 4; } if (i == 4) { break; } } jLow1 = TestLowManager.GetLowJudge(j[0]); //获取前测判断题题目 TestLowManager.ShowQuestionJudgeLow(jLow1, rdolistJ1, lblJ1); //显示判断题题目 jLow2 = TestLowManager.GetLowJudge(j[1]); TestLowManager.ShowQuestionJudgeLow(jLow2, rdolistJ2, lblJ2); jLow3 = TestLowManager.GetLowJudge(j[2]); TestLowManager.ShowQuestionJudgeLow(jLow3, rdolistJ3, lblJ3); jLow4 = TestLowManager.GetLowJudge(j[3]); TestLowManager.ShowQuestionJudgeLow(jLow4, rdolistJ4, lblJ4); jLow5 = TestLowManager.GetLowJudge(j[4]); TestLowManager.ShowQuestionJudgeLow(jLow5, rdolistJ5, lblJ5); } //判断前测分数是否在60至75分之间 else if (score1 >= 60 && score1 < 75) { lblTitle.Visible = false; PanelAll.Visible = false; btnOk.Visible = false; Response.Write("<script type = 'text/javascript'> alert('你已通过前测,可直接进入低级测试单元!'); </script>"); //RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('你已通过前测,可直接进入低级测试单元!');location.href= 'TestLow.aspx?caid=0'</script>")); } //判断前测分数是否在75至90分之间 else if (score1 >= 75 && score1 < 90) { lblTitle.Visible = false; PanelAll.Visible = false; btnOk.Visible = false; //Response.Write("<script type = 'text/javascript'> alert('你已通过前测,可直接进入中级测试单元!'); </script>"); RegisterClientScriptBlock("", "<script>alert('你已通过前测,可直接进入中级测试单元!')</script>"); //RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('你已通过前测,可直接进入中级测试单元!');location.href= 'TestMid.aspx?caid=0'</script>")); } else { lblTitle.Visible = false; PanelAll.Visible = false; btnOk.Visible = false; //Response.Write("<script type = 'text/javascript'> alert('你已通过前测,可直接进入高级测试单元!'); </script>"); RegisterClientScriptBlock("", "<script>alert('你已通过前测,可直接进入高级测试单元!')</script>"); //RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('你已通过前测,可直接进入高级测试单元!');location.href= 'TestHigh.aspx?caid=0'</script>")); } } else { Response.Redirect("Login.aspx"); } } }