温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:在线考试系统源码(毕业设计)
当前文件:
HBDGI338O5Y15/result.aspx.cs[3K,2009-6-12 11:43:44],打开代码结构图
HBDGI338O5Y15/result.aspx.cs[3K,2009-6-12 11:43:44],打开代码结构图1using System; 2
using System.Collections; 3
using System.ComponentModel; 4
using System.Data; 5
using System.Drawing; 6
using System.Web; 7
using System.Web.SessionState; 8
using System.Web.UI; 9
using System.Web.UI.WebControls; 10
using System.Web.UI.HtmlControls; 11
12
namespace TestOnline 13
{ 14
/// <summary> 15
/// result 的摘要说明。 16
/// </summary> 17
public class result : System.Web.UI.Page 18
{ 19
protected System.Web.UI.WebControls.ImageButton ImageButton1; 20
protected System.Web.UI.WebControls.Label lbl_score; 21
protected System.Web.UI.WebControls.Label lbl_stuId; 22
protected System.Web.UI.WebControls.Label lbl_stuName; 23
protected System.Web.UI.WebControls.Label lbl_courseName; 24
protected System.Web.UI.WebControls.ImageButton ImageButton3; 25
protected System.Web.UI.WebControls.ImageButton ImageButton2; 26
27
private void Page_Load(object sender, System.EventArgs e) 28
{ 29
if(!IsPostBack) 30
{ 31
32
if(Session["stuId"]!=null) 33
{ 34
//以下是获取学生和科目的相关信息. 35
string stuId=Convert.ToString(Session["stuId"]); 36
string courseId=Convert.ToString(Session["courseId"]); 37
string stuName=(new projClass()).getUserName(stuId); 38
string courseName=(new projClass()).getCourseNameAsCourseId(courseId); 39
lbl_stuId.Text=stuId; 40
lbl_stuName.Text=stuName; 41
lbl_courseName.Text=courseName; 42
43
44
Hashtable ht_rightAnswer,ht_stuAnswer; 45
ht_rightAnswer=(Hashtable)Session["rightAnswer"]; 46
ht_stuAnswer=(Hashtable)Session["stuAnswer"]; 47
if(Session["stuAnswer"]==null||Session["rightAnswer"]==null) 48
Response.Write("<script>alert(\"session没有获取!\");</script>"); 49
50
int score=0; 51
//给每一题验证答案 52
for(int i=1;i<=50;i++) 53
{ 54
if(ht_stuAnswer.Contains(i.ToString())&&ht_rightAnswer.Contains(i.ToString())) 55
if(ht_stuAnswer[i.ToString()].ToString().Equals(ht_rightAnswer[i.ToString()].ToString())) 56
{ 57
score=score+2; 58
} 59
} 60
lbl_score.Text=Convert.ToString(score); 61
int count=(new projClass()).updateScore(stuId,courseId,1,score); 62
int count1=(new projClass()).updateStuStatus(stuId,"",0); 63
if(count==0||count1==0) 64
Response.Write("<script>alert(\"更新状态错误!\");</script>"); 65
} 66
//没有获取到学生的学号,退出到登录页面 67
else Response.Redirect("login.aspx"); 68
} 69
} 70
71
Web 窗体设计器生成的代码 94
95
private void ImageButton2_Click(object sender, System.Web.UI.ImageClickEventArgs e) 96
//退出按钮 97
{ 98
Response.Redirect("login.aspx"); 99
} 100
101
private void ImageButton3_Click(object sender, System.Web.UI.ImageClickEventArgs e) 102
{ 103
Response.Redirect("userInfo.aspx"); 104
} 105
106
private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e) 107
{ 108
Response.Redirect("seeResult.aspx"); 109
} 110
} 111
} 112






}