在线考试系统报告.doc_第1页
在线考试系统报告.doc_第2页
在线考试系统报告.doc_第3页
在线考试系统报告.doc_第4页
在线考试系统报告.doc_第5页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

在线考试系统报告摘 要 随着计算机应用的迅猛发展,网络应用不断扩大,如远程教育和虚拟大学的出现等等,且这些应用正逐步深入到千家万户。人们迫切要求利用这些技术来进行在线考试,以减轻教师的工作负担及提高工作效率,与此同时也提高了考试的质量,从而使考试更趋于公证!客观!更加激发学生的学习兴趣。在线考试系统是为了方面学生考试、老师阅卷、提高考试的公正性、公平。一、 项目名称 1.1 在线考试系统 二、 项目目标 2.1 使用Gridview进行数据的添加、删除、更新 2.2 运用Javascript来进行考试倒计时三、 项目中的具体任务 3.1 学生在线考试 3.2 后台编辑试题 3.3 当场评卷四、 工具与设备 5.1 软件Visual Studio 2005和SQL 2005 五、 流程图分析 4.1 数据库的组织结构 A、这是SQL 2005的表 B、数据库的流程图学生和管理员(Users)选择考试科目(Course)试卷的类型(Paper) 分数(Score)填空题(FillBlankProblem)判断题(JudgeProblem)多选题(MultiProblem)单选题(SingleProblem)试卷的题目类型(PaperDetail) 4.2 前台结构 A、前台登录 B、准备考试 C、卷面 计时代码: 编写卷面的后台代码:using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using MyOnLineExam.DataAccessLayer;using System.Data.SqlClient;using MyOnLineExam.BusinessLogicLayer;public partial class Web_UserTest : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) if (!IsPostBack) lblPaperName.Text = SessionPaperName.ToString(); InitData(); /初始化试卷,从数据库中将试题取出 protected void InitData() /Response.Write(SessionPaperID.ToString(); /Response.End(); SqlParameter Params1 = new SqlParameter2; DataBase DB = new DataBase(); int paperID = int.Parse(SessionPaperID.ToString(); Params10 = DB.MakeInParam(PaperID, SqlDbType.Int, 4, paperID); /试卷编号 Params11 = DB.MakeInParam(Type, SqlDbType.VarChar, 10, 单选题); /题目类型 DataSet ds1 = DB.GetDataSet(Proc_PaperDetail,Params1); GridView1.DataSource = ds1; GridView1.DataBind(); (Label)GridView1.HeaderRow.FindControl(Label27).Text = (Label)GridView1.Rows0.FindControl(Label4).Text; SqlParameter Params2 = new SqlParameter2; Params20 = DB.MakeInParam(PaperID, SqlDbType.Int, 4, paperID); /试卷编号 Params21 = DB.MakeInParam(Type, SqlDbType.VarChar, 10, 多选题); /题目类型 DataSet ds2 = DB.GetDataSet(Proc_PaperDetail, Params2); GridView2.DataSource = ds2; GridView2.DataBind(); (Label)GridView2.HeaderRow.FindControl(Label28).Text = (Label)GridView2.Rows0.FindControl(Label8).Text; SqlParameter Params3 = new SqlParameter2; Params30 = DB.MakeInParam(PaperID, SqlDbType.Int, 4, paperID); /试卷编号 Params31 = DB.MakeInParam(Type, SqlDbType.VarChar, 10, 判断题); /题目类型 DataSet ds3 = DB.GetDataSet(Proc_PaperDetail, Params3); GridView3.DataSource = ds3; GridView3.DataBind(); (Label)GridView3.HeaderRow.FindControl(Label29).Text = (Label)GridView3.Rows0.FindControl(Label12).Text; SqlParameter Params4 = new SqlParameter2; Params40 = DB.MakeInParam(PaperID, SqlDbType.Int, 4, paperID); /试卷编号 Params41 = DB.MakeInParam(Type, SqlDbType.VarChar, 10, 填空题); /题目类型 DataSet ds4 = DB.GetDataSet(Proc_PaperDetail, Params4); GridView4.DataSource = ds4; GridView4.DataBind(); (Label)GridView4.HeaderRow.FindControl(Label30).Text = (Label)GridView4.Rows0.FindControl(Label17).Text; /提交试卷,生成成绩 protected void imgBtnSubmit_Click(object sender, ImageClickEventArgs e) int score = 0; int singlemark = int.Parse(Label)GridView1.Rows0.FindControl(Label4).Text);/取出单选题的每题分值 foreach (GridViewRow dr in GridView1.Rows)/对单选题每题进行判断用户选择答案 string str = ; if (RadioButton)dr.FindControl(RadioButton1).Checked) str = A; else if (RadioButton)dr.FindControl(RadioButton2).Checked) str = B; else if (RadioButton)dr.FindControl(RadioButton3).Checked) str = C; else if (RadioButton)dr.FindControl(RadioButton4).Checked) str = D; if (Label)dr.FindControl(Label3).Text.Trim() = str)/将用户选择结果和答案进行比较 score = score + singlemark; int multimark = int.Parse(Label)GridView2.Rows0.FindControl(Label8).Text);/取出多选题每题分值 foreach (GridViewRow dr in GridView2.Rows)/对多选题每题进行判断用户选择答案 string str = ; if (CheckBox)dr.FindControl(CheckBox1).Checked) str += A; if (CheckBox)dr.FindControl(CheckBox2).Checked) str += B; if (CheckBox)dr.FindControl(CheckBox3).Checked) str += C; if (CheckBox)dr.FindControl(CheckBox4).Checked) str += D; if (Label)dr.FindControl(Label7).Text.Trim() = str)/将用户选择结果和答案进行比较 score = score + multimark; int judgemark = int.Parse(Label)GridView3.Rows0.FindControl(Label12).Text);/取出判断题每题分值 foreach (GridViewRow dr in GridView3.Rows)/对判断题每题进行判断用户选择答案 bool j = false; if (CheckBox)dr.FindControl(CheckBox5).Checked) j = true; if (j = bool.Parse(Label)dr.FindControl(Label11).Text.Trim() score = score + judgemark; int fillmark = int.Parse(Label)GridView4.Rows0.FindControl(Label17).Text);/取出填空题每题分值 foreach (GridViewRow dr in GridView4.Rows) string str = ; str = (TextBox)dr.FindControl(TextBox1).Text.Trim(); if (str = (Label)dr.FindControl(Label16).Text.Trim() score = score + fillmark; Scores insertScore = new Scores(); /创建Scores类对象 insertScore.UserID = SessionuserID.ToString();/设置Scores对象的属性 insertScore.PaperID=int.Parse(SessionPaperID.ToString(); insertScore.Score = score; if (insertScore.InsertByProc()/调用InsertByProc方法向数据库中插入成绩 if (score = 8)/根据成绩给出相应提示 Response.Write(alert(您太棒了!您的成绩为:+score+分!); else if (score = 6) Response.Write(alert(合格!您的成绩为:+score+分!); else Response.Write(alert(需要努力了!您的成绩为:+score+分!); Panel1.Visible = true; protected void imgBtnAnswer_Click(object sender, ImageClickEventArgs e) Response.Redirect(TestAnswer.aspx); D、算出分数 E、 跳去后台管理 添加科目的后台代码: protected void imgBtnSave_Click(object sender, ImageClickEventArgs e) if (Page.IsValid) Course course = new Course(); /创建考试科目对象 course.Name = txtName.Text; /设置考试科目对象属性 if (course.InsertByProc() /调用添加考试科目方法添加考试科目 lblMessage.Text = 成功添加该考试科目!; else lblMessage.Text = 添加该考试科目失败!; F、 录入试题单选题 单选题录入的后台代码: protected void Page_Load(object sender, EventArgs e) if (!IsPostBack) InitDDLData(); /初始化考试科目下拉列表框 if (RequestID!=null)/如果是修改题目,初始化数据 InitData(); /初始化考试科目 protected void InitDDLData() Course course = new Course(); /创建考试科目对象 DataSet ds = course.QueryCourse(); /查询考试科目信息 ddlCourse.DataSource = ds; /指名考试科目列表框数据源 ddlCourse.DataTextField = Name; /DataTextField显示Name字段值 ddlCourse.DataValueField = ID; /DataValueField显示ID字段值 ddlCourse.DataBind(); /绑定数据 /初始化数据 protected void InitData() int SingleProblemID = int.Parse(RequestID.ToString(); /取出传递过来的试题编号 SingleProblem singleproblem = new SingleProblem(); /创建单选题对象 if (singleproblem.LoadData(SingleProblemID) /如果取出题目信息,分别放在相应控件显示 ddlCourse.SelectedValue = singleproblem.CourseID.ToString(); txtTitle.Text = singleproblem.Title; txtAnswerA.Text = singleproblem.AnswerA; txtAnswerB.Text = singleproblem.AnswerB; txtAnswerC.Text = singleproblem.AnswerC; txtAnswerD.Text = singleproblem.AnswerD; ddlAnswer.SelectedItem.Text = singleproblem.Answer; else /查询出错,给出提示 lblMessage.Text = 加载数据出错!; /添加或修改事件 protected void imgBtnSave_Click(object sender, ImageClickEventArgs e) if (Page.IsValid) SingleProblem singleproblem = new SingleProblem(); /创建单选题对象 singleproblem.CourseID = int.Parse(ddlCourse.SelectedValue);/为单选题对象各属性赋值 singleproblem.Title = txtTitle.Text; singleproblem.AnswerA = txtAnswerA.Text; singleproblem.AnswerB = txtAnswerB.Text; singleproblem.AnswerC = txtAnswerC.Text; singleproblem.AnswerD = txtAnswerD.Text; singleproblem.Answer = ddlAnswer.SelectedItem.Text; if (RequestID != null) /如果是修改题目信息 singleproblem.ID = int.Parse(RequestID.ToString(); /取出试题主键 if (singleproblem.UpdateByProc(int.Parse(RequestID.ToString()/调用修改试题方法修改试题 lblMessage.Text = 成功修改该单选题!; else lblMessage.Text = 修改该单选题失败!; else /如果是添加试题 if (singleproblem.InsertByProc() /调用添加试题方法添加试题 lblMessage.Text = 成功添加该单选题!; else lblMessage.Text = 添加该单选题失败!; 多选题 多选题录入的后台代码: protected void Page_Load(object sender, EventArgs e) if (!IsPostBack) InitDDLData(); /初始化考试科目下拉列表框 if (RequestID!=null)/如果是修改题目,初始化数据 InitData(); /初始化考试科目 protected void InitDDLData() Course course = new Course(); /创建考试科目对象 DataSet ds = course.QueryCourse(); /查询考试科目信息 ddlCourse.DataSource = ds; /指名考试科目列表框数据源 ddlCourse.DataTextField = Name; /DataTextField显示Name字段值 ddlCourse.DataValueField = ID; /DataValueField显示ID字段值 ddlCourse.DataBind(); /绑定数据 /初始化数据 protected void InitData() int SingleProblemID = int.Parse(RequestID.ToString(); /取出传递过来的试题编号 SingleProblem singleproblem = new SingleProblem(); /创建单选题对象 if (singleproblem.LoadData(SingleProblemID) /如果取出题目信息,分别放在相应控件显示 ddlCourse.SelectedValue = singleproblem.CourseID.ToString(); txtTitle.Text = singleproblem.Title; txtAnswerA.Text = singleproblem.AnswerA; txtAnswerB.Text = singleproblem.AnswerB; txtAnswerC.Text = singleproblem.AnswerC; txtAnswerD.Text = singleproblem.AnswerD; ddlAnswer.SelectedItem.Text = singleproblem.Answer; else /查询出错,给出提示 lblMessage.Text = 加载数据出错!; /添加或修改事件 protected void imgBtnSave_Click(object sender, ImageClickEventArgs e) if (Page.IsValid) SingleProblem singleproblem = new SingleProblem(); /创建单选题对象 singleproblem.CourseID = int.Parse(ddlCourse.SelectedValue);/为单选题对象各属性赋值 singleproblem.Title = txtTitle.Text; singleproblem.AnswerA = txtAnswerA.Text; singleproblem.AnswerB = txtAnswerB.Text; singleproblem.AnswerC = txtAnswerC.Text; singleproblem.AnswerD = txtAnswerD.Text; singleproblem.Answer = ddlAnswer.SelectedItem.Text; if (RequestID != null) /如果是修改题目信息 singleproblem.ID = int.Parse(RequestID.ToString(); /取出试题主键 if (singleproblem.UpdateByProc(int.Parse(RequestID.ToString()/调用修改试题方法修改试题 lblMessage.Text = 成功修改该单选题!; else lblMessage.Text = 修改该单选题失败!; else /如果是添加试题 if (singleproblem.InsertByProc() /调用添加试题方法添加试题 lblMessage.Text = 成功添加该单选题!; else lblMessage.Text = 添加该单选题失败!; 填空题 填空题录入的后台代码: protected void Page_Load(object sender, EventArgs e) if (!IsPostBack) InitDDLData(); /初始化考试科目下拉列表框 if (RequestID != null)/如果是修改题目,初始化数据 InitData(); /初始化考试科目 protected void InitDDLData() Course course = new Course(); /创建考试科目对象 DataSet ds = course.QueryCourse(); /查询考试科目信息 ddlCourse.DataSource = ds; /指名考试科目列表框数据源 ddlCourse.DataTextField = Name; /DataTextField显示Name字段值 ddlCourse.DataValueField = ID; /DataValueField显示ID字段值 ddlCourse.DataBind(); /绑定数据 /初始化数据 protected void InitData() int fillblankProblemID = int.Parse(RequestID.ToString(); /取出传递过来的试题编号 FillBlankProblem fillblankproblem = new FillBlankProblem(); /创建填空题对象 if (fillblankproblem.LoadData(fillblankProblemID) /如果取出题目信息,分别放在相应控件显示 ddlCourse.SelectedValue = fillblankproblem.CourseID.ToString(); txtFrontTitle.Text = fillblankproblem.FrontTitle; txtBackTitle.Text = fillblankproblem.BackTitle; txtAnswer.Text = fillblankproblem.Answer; else /查询出错,给出提示 lblMessage.Text = 加载数据出错!; /添加或修改事件 protected void imgBtnSave_Click(object sender, ImageClickEventArgs e) if (Page.IsValid) FillBlankProblem fillblankproblem = new FillBlankProblem(); /创建填空题对象 fillblankproblem.CourseID = int.Parse(ddlCourse.SelectedValue);/为填空题对象各属性赋值 fillblankproblem.FrontTitle=txtFrontTitle.Text; fillblankproblem.BackTitle = txtBackTitle.Text; fillblankproblem.Answer = txtAnswer.Text; if (RequestID != null) /如果是修改题目信息 fillblankproblem.ID = int.Parse(RequestID.ToString(); /取出试题主键 if (fillblankproblem.UpdateByProc(int.Parse(RequestID.ToString()/调用修改试题方法修改试题 lblMessage.Text = 成功修改该填空题!; else

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论