/// <summary> /// 处理学生不交卷,故障的情况 /// </summary> public static void UpdateScoreStatus() { tbScoreBLL scoreBLL = new tbScoreBLL(); while (true) { System.Threading.Thread.Sleep(1000 * 60 * 5);//每5分钟 List <tbScore> list = scoreBLL.GetModelList("scorestatus=2"); DateTime dt = DateTime.Now; foreach (tbScore item in list) { int duration = (int)DbHelperSQL.GetSingle("select durationtime from tbPaper,tbArrange where tbArrange.id=" + item.arrangeid + " and tbPaper.id=tbArrange.paperid"); TimeSpan ts = dt - item.starttime; if ((ts.Duration().TotalMinutes - (duration + 5)) > 0)//给5分钟的时间误差 { item.scorestatus = 4; scoreBLL.Update(item); } } } }