在线测试系统(毕业论文) 下载本文

苏州科技学院天平学院本科生毕业设计(论文)

图5.7 手工添加试卷界面

图5.8 选题界面

21

苏州科技学院天平学院本科生毕业设计(论文)

图5.9 选择填空题界面

实现代码(部分):通过设计类(Admin_Paper_AddPaperByManualSelection())[11]中的方法生成一份手工选择的试卷。

protected void Page_Load(object sender, EventArgs e) {

RoleCheck.DenyLogin(); //检查用户权限 }

protected void btnSave_Click(object sender, EventArgs e) {

PaperByManualSelection paper = new PaperByManualSelection(); paper.PaperName = txtPaperName.Text;

paper.PaperType.DeptID = Convert.ToInt16(drlDeptList.SelectedValue); paper.PaperType.DeptName = drlDeptList.SelectedItem.Text; paper.Creator.Name = SessionClass.GetLoginUser().Name; paper.CreatedTime = DateTime.Now;

paper.FillBlankList = SessionClass.GetFillBlankList(); paper.SingleSelectionList = SessionClass.GetSingleSelection();

22

苏州科技学院天平学院本科生毕业设计(论文)

//调用逻辑业务层中的CreatePaper()方法创建一份人工选题的试卷 new BLLPaperByManuaSelection().CreatePaper(paper); SessionClass.SetFillBlankList(null); SessionClass.SetSingleSelection(null);

Response.Redirect(\ }

图5.10 随机抽题试卷界面

图5.11 随机抽题界面

23

苏州科技学院天平学院本科生毕业设计(论文)

实现代码(部分):通过设计类(Admin_Paper_AddPaperByRandomSelection())中的方法创建一份随机抽题的试卷。

protected void Page_Load(object sender, EventArgs e) {

RoleCheck.DenyLogin(); //检查用户权限 }

protected void btnSave_Click(object sender, EventArgs e) { try {

PaperByRandomSelection paper = new PaperByRandomSelection(); paper.FillBlankSum = Convert.ToInt32(txtFillBlankSum.Text);

paper.SingleSelectionSum = Convert.ToInt32(txtSingleSelectionSum.Text); paper.PaperName = txtPaperName.Text;

paper.PaperType.DeptID = Convert.ToInt16(drlDeptList.SelectedValue); paper.PaperType.DeptName = drlDeptList.SelectedItem.Text; paper.Creator = SessionClass.GetLoginUser(); paper.CreatedTime = DateTime.Now; paper.FillBlankCateID =

Convert.ToInt32(drpSubjectTypeCategory1.SelectedValue);

paper.SingleSelectionCateID =

Convert.ToInt32(drpSubjectTypeCategory2.SelectedValue);

if (paper.FillBlankSum> Convert.ToInt32(Label1.Text)) {

lblMsg.Text = \填空题数量不能超过\题\ return; }

if (paper.SingleSelectionSum > Convert.ToInt32(Label2.Text))

24