protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["stuId"] != null) { string stuId = Session["stuId"].ToString(); stuNews1 = StudentInfoManager.Getstudentnews(stuId); StudentInfoManager.Showstudentnews1(stuNews1, lblstuName, lblstyle, imgphoto); if (lblstyle.Text == "活跃型+视觉型" || lblstyle.Text == "活跃型+言语型") { lbldata.Text = "视频"; } else if (lblstyle.Text == "沉思型+视觉型") { lbldata.Text = "图片"; } else if (lblstyle.Text == "沉思型+言语型") { lbldata.Text = "文字"; } else { Response.Redirect("../LearningStyleText.aspx"); } rbl1.SelectedValue = "0"; //再读一遍XML string Num = ""; //C#读取XML文件 http://www.cnblogs.com/xiaoxiangfeizi/archive/2011/08/07/2120807.html XmlDocument doc = new XmlDocument(); //使用的时候,首先声明一个XmlDocument对象,然后调用Load方法,从指定的路径加载XML文件 doc.Load(Server.MapPath("../XML/" + Session["stuId"].ToString() + ".xml")); //然后可以通过调用SelectSingleNode得到指定的结点,通过GetAttribute得到具体的属性值.参看下面的代码 // 得到根节点"学习建议" XmlNode xn = doc.SelectSingleNode("学习建议"); // 得到根节点的所有子节点 XmlNodeList xnl = xn.ChildNodes; foreach (XmlNode xn1 in xnl) { // 将节点转换为元素,便于得到节点的属性值 XmlElement xe = (XmlElement)xn1; // 得到Type和ISBN两个属性的属性值 Num = Num + xe.GetAttribute("类型").ToString() + ","; } if (Num == "") { lblsug.Text = lblstuName.Text + "同学,欢迎进入学习资料素材库!"; } else { lblsug.Text = lblstuName.Text + "同学,在上次测试中你需要复习知识点有:" + Num; } } else { Response.Redirect("../Login.aspx"); } } }
//点击保存按钮事件 protected void btnSubmit0_Click(object sender, EventArgs e) { string stuId = txtstuId.Text; stuNews1 = StudentInfoManager.Getstudentnews(stuId); string photo = stuNews1.photo; string stuName = txtstuName.Text; string email = txtemail.Text; string gender = "男"; if (rdolistgender.Items[1].Selected == true) { gender = "女"; } string className = txtclassName.Text; string telephone = txttel.Text; DateTime birthday = DateTime.Parse(txtbirthday.Text); string learningStyle = txtlearningStyle.Text; Boolean fileOK = false; String path = Server.MapPath("~/"); if (fUpload.HasFile) { String fileExtension = System.IO.Path.GetExtension(fUpload.FileName).ToLower(); String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" }; for (int i = 0; i < allowedExtensions.Length; i++) { if (fileExtension == allowedExtensions[i]) { fileOK = true; } } } if (fileOK) { try { fUpload.PostedFile.SaveAs(Server.MapPath("./load/") + fUpload.FileName); lbText.Text = "文件上传成功!"; photo = "~/load/" + fUpload.FileName; } catch (Exception ex) { lbText.Text = "文件上传失败!"; } } else { lbText.Text = "注意:只能上传gif、png、jpeg或者jpg图像文件!"; } StudentInfo studentInfo = new StudentInfo(stuId, stuName, className, email, photo, gender, telephone, birthday, learningStyle); StudentInfoManager.UpdateStudent(studentInfo); stuNews1 = StudentInfoManager.Getstudentnews(stuId); StudentInfoManager.Showstudentnews2(stuNews1, txtstuId, txtstuName, txtclassName, rdolistgender, txtemail, imgphoto, txttel, txtbirthday, txtlearningStyle); lblgender.Text = stuNews1.gender; RegisterClientScriptBlock("", "<script>alert('修改成功!')</script>"); return; }
//点击注册按钮事件 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 Page_Load(object sender, EventArgs e) { if (Session["stuId"] != null) { string stuId = Session["stuId"].ToString(); stuNews1 = StudentInfoManager.Getstudentnews(stuId); StudentInfoManager.Showstudentnews(stuNews1, lblstuId, lblstuName, lblclassName, lblgender, imgphoto); Session["stutext"] = ""; } else { Response.Redirect("Login.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["teaId"] != null) { if (!IsPostBack) { GridView1.DataSource = StudentInfoManager.ShowData(); GridView1.DataBind(); lblnum.Text = StudentInfoManager.num().ToString(); } } else { Response.Redirect("Login.aspx"); } }
//点击确定按钮事件 protected void btnSubmit_Click(object sender, EventArgs e) { string stuId = txtstuId.Text; string password = txtpsw1.Text; stuNews1 = StudentInfoManager.Getstudentnews(stuId); if (txtpsw.Text != stuNews1.password) { RegisterClientScriptBlock("", "<script>alert('原密码输入错误!')</script>"); txtpsw.Focus(); } else { StudentInfo studentInfo1 = new StudentInfo(stuId, password); StudentInfoManager.UpdatePsw(studentInfo1); //密码更新 RegisterClientScriptBlock("", "<script>alert('密码修改成功!')</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["stuId"] != null) { if (txtstuId.Text == "") { if (Session["stuId"] != null) { string stuId = Session["stuId"].ToString(); stuNews1 = StudentInfoManager.Getstudentnews(stuId); //获取个人信息 StudentInfoManager.Showstudentnews2(stuNews1, txtstuId, txtstuName, txtclassName, rdolistgender, txtemail, imgphoto, txttel, txtbirthday, txtlearningStyle); //显示个人信息 lblgender.Text = stuNews1.gender; rdolistgender.Items[0].Selected = false; rdolistgender.Items[0].Selected = false; } } } else { Response.Redirect("Login.aspx"); } }
//点击学习建议按钮事件 protected void btnSuggest_Click(object sender, EventArgs e) { Session["stutext"] = "初级"; string Num = ""; //C#读取XML文件 XmlDocument doc = new XmlDocument(); //使用的时候,首先声明一个XmlDocument对象,然后调用Load方法,从指定的路径加载XML文件 doc.Load(Server.MapPath("./XML/" + Session["stuId"].ToString() + ".xml")); //然后可以通过调用SelectSingleNode得到指定的结点,通过GetAttribute得到具体的属性值,参看下面的代码 // 得到根节点"学习建议" XmlNode xn = doc.SelectSingleNode("学习建议"); // 得到根节点的所有子节点 XmlNodeList xnl = xn.ChildNodes; foreach (XmlNode xn1 in xnl) { // 将节点转换为元素,便于得到节点的属性值 XmlElement xe = (XmlElement)xn1; // 得到Type和ISBN两个属性的属性值 Num = Num + xe.GetAttribute("类型").ToString() + ","; } if (Num == "") { Num = "0"; } int suggestion = Convert.ToInt32(Num.Substring(0, 1)); string stuId = Session["stuId"].ToString(); StudentInfo stuNews2 = new StudentInfo(); stuNews2 = StudentInfoManager.Getstudentnews(stuId); //判断学生错题知识点的第一个 if (suggestion == 1) { if (stuNews2.learningStyle == "活跃型+视觉型" || stuNews2.learningStyle == "活跃型+言语型") { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataVideo1.aspx'</script>", Num)); //跳转到学习资料库知识点1视频呈现界面 } else if (stuNews2.learningStyle == "沉思型+视觉型") { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataPicture1.aspx'</script>", Num)); //跳转到学习资料库知识点1图片呈现界面 } else if (stuNews2.learningStyle == "沉思型+言语型") { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataText1.aspx'</script>", Num)); //跳转到学习资料库知识点1文字呈现界面 } } else if (suggestion == 2) { if (stuNews2.learningStyle == "活跃型+视觉型" || stuNews2.learningStyle == "活跃型+言语型") { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataVideo2.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+视觉型") { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataPicture2.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+言语型") { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataText2.aspx'</script>", Num)); } } else if (suggestion == 3) { if (stuNews2.learningStyle == "活跃型+视觉型" || stuNews2.learningStyle == "活跃型+言语型") { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataVideo3.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+视觉型") { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataPicture3.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+言语型") { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataText3.aspx'</script>", Num)); } } else if (suggestion == 4) { if (stuNews2.learningStyle == "活跃型+视觉型" || stuNews2.learningStyle == "活跃型+言语型") { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataVideo4.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+视觉型") { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataPicture4.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+言语型") { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataText4.aspx'</script>", Num)); } } else if (suggestion == 5) { if (stuNews2.learningStyle == "活跃型+视觉型" || stuNews2.learningStyle == "活跃型+言语型") { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataVideo5.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+视觉型") { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataPicture5.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+言语型") { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataText5.aspx'</script>", Num)); } } else { RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Congratulations!你可以选择进入到学习资料库进行温故!');location.href= 'StudyData/StudyDataDefault.aspx'</script>")); //跳转到学习资料库知识点1主界面 } }
protected void Page_Load(object sender, EventArgs e) { if (Session["stuId"] != null) { string stuId = Session["stuId"].ToString(); string learningstyle = ""; stuNews1 = StudentInfoManager.Getstudentnews(stuId); learningstyle = stuNews1.learningStyle; //判断是否进行过学习风格测试 if (learningstyle == "") { r1 = LearningStyleManager.GetRadio(1); //获取学习风格测试题 LearningStyleManager.ShowQuestionRadio(r1, rdolistS1, lblS1); //显示题目 r2 = LearningStyleManager.GetRadio(2); LearningStyleManager.ShowQuestionRadio(r2, rdolistS2, lblS2); r3 = LearningStyleManager.GetRadio(3); LearningStyleManager.ShowQuestionRadio(r3, rdolistS3, lblS3); r4 = LearningStyleManager.GetRadio(4); LearningStyleManager.ShowQuestionRadio(r4, rdolistS4, lblS4); r5 = LearningStyleManager.GetRadio(5); LearningStyleManager.ShowQuestionRadio(r5, rdolistS5, lblS5); r6 = LearningStyleManager.GetRadio(6); LearningStyleManager.ShowQuestionRadio(r6, rdolistS6, lblS6); r7 = LearningStyleManager.GetRadio(7); LearningStyleManager.ShowQuestionRadio(r7, rdolistS7, lblS7); r8 = LearningStyleManager.GetRadio(8); LearningStyleManager.ShowQuestionRadio(r8, rdolistS8, lblS8); r9 = LearningStyleManager.GetRadio(9); LearningStyleManager.ShowQuestionRadio(r9, rdolistS9, lblS9); r10 = LearningStyleManager.GetRadio(10); LearningStyleManager.ShowQuestionRadio(r10, rdolistS10, lblS10); r11 = LearningStyleManager.GetRadio(11); LearningStyleManager.ShowQuestionRadio(r11, rdolistS11, lblS11); r12 = LearningStyleManager.GetRadio(12); LearningStyleManager.ShowQuestionRadio(r12, rdolistS12, lblS12); r13 = LearningStyleManager.GetRadio(13); LearningStyleManager.ShowQuestionRadio(r13, rdolistS13, lblS13); r14 = LearningStyleManager.GetRadio(14); LearningStyleManager.ShowQuestionRadio(r14, rdolistS14, lblS14); r15 = LearningStyleManager.GetRadio(15); LearningStyleManager.ShowQuestionRadio(r15, rdolistS15, lblS15); r16 = LearningStyleManager.GetRadio(16); LearningStyleManager.ShowQuestionRadio(r16, rdolistS16, lblS16); r17 = LearningStyleManager.GetRadio(17); LearningStyleManager.ShowQuestionRadio(r17, rdolistS17, lblS17); r18 = LearningStyleManager.GetRadio(18); LearningStyleManager.ShowQuestionRadio(r18, rdolistS18, lblS18); r19 = LearningStyleManager.GetRadio(19); LearningStyleManager.ShowQuestionRadio(r19, rdolistS19, lblS19); r20 = LearningStyleManager.GetRadio(20); LearningStyleManager.ShowQuestionRadio(r20, rdolistS20, lblS20); r21 = LearningStyleManager.GetRadio(21); LearningStyleManager.ShowQuestionRadio(r21, rdolistS21, lblS21); r22 = LearningStyleManager.GetRadio(22); LearningStyleManager.ShowQuestionRadio(r22, rdolistS22, lblS22); } else { lblTitle.Visible = false; PanelAll.Visible = false; btnSubmit.Visible = false; //Response.Write(string.Format("<script type = 'text/javascript'> alert('{0}'); </script>", "您的学习风格为" + learningstyle + "!")); RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('{0}'); </script>", "您的学习风格为" + learningstyle + "!")); } } else { Response.Redirect("Login.aspx"); } }
//点击提交按钮事件 protected void btnSubmit_Click(object sender, EventArgs e) { int na = 0; int nb = 0; int nc = 0; int nd = 0; if (rdolistS1.SelectedValue == "A") { na = na + 1; } else if (rdolistS1.SelectedValue == "B") { nb = nb + 1; } if (rdolistS2.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS2.SelectedValue == "B") { nd = nd + 1; } if (rdolistS3.SelectedValue == "A") { na = na + 1; } else if (rdolistS3.SelectedValue == "B") { nb = nb + 1; } if (rdolistS4.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS4.SelectedValue == "B") { nd = nd + 1; } if (rdolistS5.SelectedValue == "A") { na = na + 1; } else if (rdolistS5.SelectedValue == "B") { nb = nb + 1; } if (rdolistS6.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS6.SelectedValue == "B") { nd = nd + 1; } if (rdolistS7.SelectedValue == "A") { na = na + 1; } else if (rdolistS7.SelectedValue == "B") { nb = nb + 1; } if (rdolistS8.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS8.SelectedValue == "B") { nd = nd + 1; } if (rdolistS9.SelectedValue == "A") { na = na + 1; } else if (rdolistS9.SelectedValue == "B") { nb = nb + 1; } if (rdolistS10.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS10.SelectedValue == "B") { nd = nd + 1; } if (rdolistS11.SelectedValue == "A") { na = na + 1; } else if (rdolistS11.SelectedValue == "B") { nb = nb + 1; } if (rdolistS12.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS12.SelectedValue == "B") { nd = nd + 1; } if (rdolistS13.SelectedValue == "A") { na = na + 1; } else if (rdolistS13.SelectedValue == "B") { nb = nb + 1; } if (rdolistS14.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS14.SelectedValue == "B") { nd = nd + 1; } if (rdolistS15.SelectedValue == "A") { na = na + 1; } else if (rdolistS15.SelectedValue == "B") { nb = nb + 1; } if (rdolistS16.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS16.SelectedValue == "B") { nd = nd + 1; } if (rdolistS17.SelectedValue == "A") { na = na + 1; } else if (rdolistS17.SelectedValue == "B") { nb = nb + 1; } if (rdolistS18.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS18.SelectedValue == "B") { nd = nd + 1; } if (rdolistS19.SelectedValue == "A") { na = na + 1; } else if (rdolistS19.SelectedValue == "B") { nb = nb + 1; } if (rdolistS20.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS20.SelectedValue == "B") { nd = nd + 1; } if (rdolistS21.SelectedValue == "A") { na = na + 1; } else if (rdolistS21.SelectedValue == "B") { nb = nb + 1; } if (rdolistS22.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS22.SelectedValue == "B") { nd = nd + 1; } string learningstyle; string stuId = Session["stuId"].ToString(); string password = Session["password"].ToString(); Session["na"] = na; Session["nb"] = nb; Session["nc"] = nc; Session["nd"] = nd; if (na > nb && nc > nd) { learningstyle = "活跃型+视觉型"; Session["result"] = "您的学习风格为活跃型+视觉型,适合视频型学习方式!"; //Response.Write("<script type = 'text/javascript'> alert('您的学习风格为活跃型+视觉型!'); </script>"); } else if (na > nb && nc < nd) { learningstyle = "活跃型+言语型"; Session["result"] = "您的学习风格为活跃型+言语型!,适合视频型学习方式!"; //Response.Write("<script type = 'text/javascript'> alert('您的学习风格为活跃型+言语型!'); </script>"); } else if (na < nb && nc > nd) { learningstyle = "沉思型+视觉型"; Session["result"] = "您的学习风格为沉思型+视觉型,适合图片型学习方式!"; //Response.Write("<script type = 'text/javascript'> alert('您的学习风格为沉思型+视觉型!'); </script>"); } else { learningstyle = "沉思型+言语型"; Session["result"] = "您的学习风格为沉思型+言语型,适合文字型学习方式!"; //Response.Write("<script type = 'text/javascript'> alert('您的学习风格为沉思型+言语型!'); </script>"); } RegisterClientScriptBlock("", "<script type = 'text/javascript'> alert('测试结束,请点击页面下方的按钮查看学习风格测试结果!'); </script>"); StudentInfo studentInfo = new StudentInfo(stuId, learningstyle, password); StudentInfoManager.UpdateStudent2(studentInfo); //记录用户学习风格类型 btnSubmit.Visible = false; Panel1.Visible = true; }
//点击登录按钮事件 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { //判断是否选择用户类型 if (RadioButton1.Checked == false && RadioButton2.Checked == false) { //Response.Write("<script type = 'text/javascript'> alert('请选择用户类型!'); </script>"); RegisterClientScriptBlock("", "<script>alert('请选择用户类型!')</script>"); return; } //判断选择学生用户 else if (RadioButton2.Checked == true) { StudentInfo studentInfo = new StudentInfo(txtName.Text, txtPassword.Text); //登录成功 if (StudentInfoManager.StudentLoginCheck(studentInfo) && (txtcode.Text == lblcode.Text)) { Session["stuId"] = txtName.Text; Session["password"] = txtPassword.Text; Response.Redirect("StudentDefault.aspx"); //跳转到系统学生主界面 } //登录失败 else if ((!(StudentInfoManager.StudentLoginCheck(studentInfo))) && (txtcode.Text == lblcode.Text)) { //Response.Write("<script type = 'text/javascript'> alert('用户名或密码错误!'); </script>"); RegisterClientScriptBlock("", "<script>alert('用户名或密码错误!')</script>"); txtName.Text = ""; txtPassword.Text = ""; txtName.Focus(); } else if (StudentInfoManager.StudentLoginCheck(studentInfo) && (txtcode.Text != lblcode.Text)) { //Response.Write("<script type = 'text/javascript'> alert('验证码错误!'); </script>"); RegisterClientScriptBlock("", "<script>alert('验证码错误!')</script>"); txtcode.Text = ""; txtcode.Focus(); } else if ((!(StudentInfoManager.StudentLoginCheck(studentInfo))) && (txtcode.Text != lblcode.Text)) { //Response.Write("<script type = 'text/javascript'> alert('用户名或密码错误!'); </script>"); RegisterClientScriptBlock("", "<script>alert('用户名或密码错误!')</script>"); txtName.Text = ""; txtPassword.Text = ""; txtName.Focus(); } } //判断选择教师用户 else if (RadioButton1.Checked == true) { TeacherInfo teacherInfo = new TeacherInfo(txtName.Text, txtPassword.Text); //登录成功 if (TeacherInfoManager.TeacherLoginCheck(teacherInfo) && (txtcode.Text == lblcode.Text)) { Session["teaId"] = txtName.Text; Response.Redirect("TeacherDefault.aspx"); //跳转到系统教师主界面 } //登录失败 else if ((!(TeacherInfoManager.TeacherLoginCheck(teacherInfo))) && (txtcode.Text == lblcode.Text)) { //Response.Write("<script type = 'text/javascript'> alert('用户名或密码错误!'); </script>"); RegisterClientScriptBlock("", "<script>alert('用户名或密码错误!')</script>"); txtName.Text = ""; txtPassword.Text = ""; txtName.Focus(); } else if (TeacherInfoManager.TeacherLoginCheck(teacherInfo) && (txtcode.Text != lblcode.Text)) { //Response.Write("<script type = 'text/javascript'> alert('验证码错误!'); </script>"); RegisterClientScriptBlock("", "<script>alert('验证码错误!')</script>"); txtcode.Text = ""; txtcode.Focus(); } else if ((!(TeacherInfoManager.TeacherLoginCheck(teacherInfo))) && (txtcode.Text != lblcode.Text)) { //Response.Write("<script type = 'text/javascript'> alert('用户名或密码错误!'); </script>"); RegisterClientScriptBlock("", "<script>alert('用户名或密码错误!')</script>"); txtName.Text = ""; txtPassword.Text = ""; txtName.Focus(); } } }
protected void btnSuggest_Click(object sender, EventArgs e) { Session["stutext"] = "高级"; string Num = ""; int suggestion = 0; //C#读取XML文件 http://www.cnblogs.com/xiaoxiangfeizi/archive/2011/08/07/2120807.html XmlDocument doc = new XmlDocument(); //使用的时候,首先声明一个XmlDocument对象,然后调用Load方法,从指定的路径加载XML文件 doc.Load(Server.MapPath("./XML/" + Session["stuId"].ToString() + ".xml")); //然后可以通过调用SelectSingleNode得到指定的结点,通过GetAttribute得到具体的属性值.参看下面的代码 // 得到根节点"学习建议" XmlNode xn = doc.SelectSingleNode("学习建议"); // 得到根节点的所有子节点 XmlNodeList xnl = xn.ChildNodes; foreach (XmlNode xn1 in xnl) { // 将节点转换为元素,便于得到节点的属性值 XmlElement xe = (XmlElement)xn1; // 得到Type和ISBN两个属性的属性值 Num = Num + xe.GetAttribute("类型").ToString() + ","; } if (Num == "") { Num = "0"; } suggestion = Convert.ToInt32(Num.Substring(0, 1)); //学习建议跳转 string stuId = Session["stuId"].ToString(); StudentInfo stuNews2 = new StudentInfo(); stuNews2 = StudentInfoManager.Getstudentnews(stuId); if (suggestion == 1) { if (stuNews2.learningStyle == "活跃型+视觉型" || stuNews2.learningStyle == "活跃型+言语型") { //Msg = "StudyData/StudyDataVideo1.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataVideo1.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+视觉型") { //Msg = "StudyData/StudyDataPicture1.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataPicture1.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+言语型") { //Msg = "StudyData/StudyDataText1.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataText1.aspx'</script>", Num)); } } else if (suggestion == 2) { if (stuNews2.learningStyle == "活跃型+视觉型" || stuNews2.learningStyle == "活跃型+言语型") { //Msg = "StudyData/StudyDataVideo2.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataVideo2.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+视觉型") { //Msg = "StudyData/StudyDataPicture2.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataPicture2.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+言语型") { //Msg = "StudyData/StudyDataText2.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataText2.aspx'</script>", Num)); } } else if (suggestion == 3) { if (stuNews2.learningStyle == "活跃型+视觉型" || stuNews2.learningStyle == "活跃型+言语型") { //Msg = "StudyData/StudyDataVideo3.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataVideo3.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+视觉型") { //Msg = "StudyData/StudyDataPicture3.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataPicture3.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+言语型") { //Msg = "StudyData/StudyDataText3.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataText3.aspx'</script>", Num)); } } else if (suggestion == 4) { if (stuNews2.learningStyle == "活跃型+视觉型" || stuNews2.learningStyle == "活跃型+言语型") { //Msg = "StudyData/StudyDataVideo4.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataVideo4.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+视觉型") { //Msg = "StudyData/StudyDataPicture4.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataPicture4.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+言语型") { //Msg = "StudyData/StudyDataText4.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataText4.aspx'</script>", Num)); } } else if (suggestion == 5) { if (stuNews2.learningStyle == "活跃型+视觉型" || stuNews2.learningStyle == "活跃型+言语型") { //Msg = "StudyData/StudyDataVideo5.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataVideo5.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+视觉型") { //Msg = "StudyData/StudyDataPicture5.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataPicture5.aspx'</script>", Num)); } else if (stuNews2.learningStyle == "沉思型+言语型") { //Msg = "StudyData/StudyDataText5.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataText5.aspx'</script>", Num)); } } else { //Msg = "StudyData/StudyDataDefault.aspx"; RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Congratulations!同学,你可以选择进入到学习资料库进行温故!');location.href= 'StudyData/StudyDataDefault.aspx'</script>")); } //RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('Attention!同学,你需要复习的知识点有{0}');location.href= 'StudyData/StudyDataText1.aspx'</script>", Num)); //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "<script>alert('修改成功!');location.href='a.aspx?type=1}'</script>", false); }