日期:2014-05-17 浏览次数:20942 次
protected void Timer1_Tick(object sender, EventArgs e) { Paper ptime=new Paper(); int paperid = Convert.ToInt32(Session["PaperID"].ToString()); DataSet index = ptime.checktime(paperid); int index01 = int.Parse(index.ToString()); index01--; //考试时间到了 if (index01 == 0) { //设置Timer控件不可见 this.Timer1.Enabled = false; Response.Redirect("login.aspx"); } else { //显示考试剩余时间 this.lbtime.Text = index01 / 60 + "分" + index01 % 60 + "秒将停止考试,请及时“提交”试卷,否则试卷作费成绩无效!"; } }
public DataSet checktime( int paperid) { DataBase DB = new DataBase(); SqlParameter[] Params = new SqlParameter[1]; Params[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); return DB.GetDataSet("Proc_papertime", Params); }
public DataSet GetDataSet(string ProcName, SqlParameter[] Params) { Open(); SqlCommand Cmd = CreateCommand(ProcName, Params); SqlDataAdapter adapter = new SqlDataAdapter(Cmd); DataSet dataset = new DataSet(); adapter.Fill(dataset); Close(); return dataset; }