<%@page contentType="text/html;charset=GBK"%>
<%@page import="java.sql.*" errorPage="/public/error.jsp"%>
<%@ include file="/public/checkvalidadmin.jsp"%>
<jsp:useBean id="conn" scope="page" class="test.ConnOracle"/>

<%!
ResultSet rs = null;

String testid;
String teachername;
String mianshif;
String mianshij;
String suggest;

String sql = "";
int result = 0;
%>

<%
request.setCharacterEncoding("GBK");
testid   = request.getParameter("testid");
teachername   = request.getParameter("teachername");
mianshif      = request.getParameter("interviewscore");
mianshij      = request.getParameter("interviewresult");
suggest       = request.getParameter("suggest");

// 避免用户直接在浏览器地址栏输入页面地址所产生的Exception
if(testid==null || testid.equals("")) {
    out.println("<center>");
	out.println("请进行合法操作！");
	out.println("</center>");
	return;
}

try{
	sql  = "select * from test_result_info where ";
	sql += " testid=" + testid;
	rs = conn.executeQuery( sql );

	if(!rs.next()) {
		out.println("<center>");
		out.println("数据库没有代号为" + testid + "的测试结果信息！<br>");
		out.println("单击这里<a href=javascript:history.back()>返回</a><br>");
		out.println("</center>");
	} else {
		sql = "update test_result set teachername='" + (String)session.getAttribute("adminname") + "'";
		sql+= ",mianshif=" + mianshif;
		sql+= ",mianshij=" + mianshij;
		sql+= ",suggest='" + suggest + "'";
		sql+= " where testid=" + testid ;
		result = conn.executeUpdate( sql );
		if(result !=1 ) {
			out.println("<center>");
			out.println("保存面试结果操作失败！<br><br>");
			out.println("单击这里<a href=javascript:history.back()>返回</a><br>");
			out.println("</center>");
		}
	}
}catch(Exception ee) {
	out.println("<center>");
	out.println("保存面试结果操作失败！<br><br>");
	out.println("请将下列信息告知管理员<br><br>");
	out.println(ee.toString() + "<br><br>");
	out.println("单击这里<a href=javascript:history.back()>返回</a><br>");
	out.println("</center>");
}
%>
<jsp:forward page="studentinterview.jsp">
   <jsp:param name="id" value="<%=testid%>"/>
</jsp:forward>
</center>
</Body>

</html>