大型项目ASP.NET三层考试系统,vs2012 sqlserver2008,全面可用,含有数据库文件。 /// <summary>
/// 根据试卷ID返回题型名称及题型个数的表
/// </summary>
/// <param name="Sjid">试卷ID</param>
/// <returns></returns>
public DataTable DtAnswer(int Sjid)
{
string sql = "select * from tbQuestionTypes where SjID=" Sjid;
return DBHelper.GetDataTable(sql);
}
/// <summary>
/// 保存客观题答案
/// </summary>
/// <param name="Tobj"></param>
/// <returns></returns>
public int AddObjAnswer(TbObjectiveTopic Tobj)
{
StringBuilder sbsql = new StringBuilder();
sbsql.Append("insert into tbObjTopic(SjID,YhID,DxtNo,DxtAnswer,DuoxtNo,DuoxtAnswer,PdtNo,PdtAnswer,Zt,Remark) ");
sbsql.Append("values(@SjID,@YhID,@DxtNo,@DxtAnswer,@DuoxtNo,@DuoxtAnswer,@PdtNo,@PdtAnswer,@Zt,@Remark);select @@IDENTITY");
SqlParameter[] paras = new SqlParameter[] {
new SqlParameter("@SjID",Tobj.SjID),
new SqlParameter("@YhID",Tobj.YhID),
new SqlParameter("@DxtNo",Tobj.DxtNo),
new SqlParameter("@DxtAnswer",Tobj.DxtAnwser),
new SqlParameter("@DuoxtNo",Tobj.DuoxtNo),
new SqlParameter("@DuoxtAnswer",Tobj.DuoxtAnwser),
new SqlParameter("@PdtNo",Tobj.PdtNo),
new SqlParameter("@PdtAnswer",Tobj.PdtAnswer),
new SqlParameter("@Zt",Tobj.Zt),
new SqlParameter("@Remark",Tobj.Remark)
};
return DBHelper.GetScalar(sbsql.ToString(), paras);
}
/// <summary>
/// 保存主观题答案
/// </summary>
/// <param name="Tobj"></param>
/// <returns></returns>
public int AddResultAnswer(TbObjectiveTopic Tobj)
{
StringBuilder sbsql = new StringBuilder();
sbsql.Append("insert into tbResult(KgtID,ZgtNo,ZgtAnswer,Zt,Remark) ");
sbsql.Append("values(@KgtID,@ZgtNo,@ZgtAnswer,@Zt,@Remark) ;select @@IDENTITY");
SqlParameter[] paras = new SqlParameter[] {
new SqlParameter("@KgtID",Tobj.KgtID),
new SqlParameter("@ZgtNo",Tobj.ZgtNo),
new SqlParameter("@ZgtAnswer",Tobj.ZgtAnswer),
new SqlParameter("@Zt",2),
new SqlParameter("@Remark",Tobj.Remark)
};
return DBHelper.GetScalar(sbsql.ToString(), paras);
}
/// <summary>
/// 获得答题卡内所有内容
/// </summary>
/// <param name="Zt">查找(答题卡)状态筛选,如果为1,就是除老师以为的所有答题卡信息</param>
/// <returns></returns>
public DataTable getAnswerCard(int Zt)
{
string sql = "";
if (Zt == 1)
sql = "select * from tbObjTopic where Zt > 1";
else
sql = "select * from tbObjTopic where Zt=" Zt;
return DBHelper.GetDataTable(sql);
}
评论