public static void setLessonIndex(int n) { m_lessonindex = n; CourseTime ct = m_db.getCourseTime(n); if (ct != null) { m_timeon = ct.timeOn; m_timeoff = ct.timeOff; } }
private void timer_lessonOff_Tick(object sender, EventArgs e) { int lessonid = Global.getLessonID(); string timenow = DateTime.Now.ToString("HHmm"); string timeoff = Global.getTimeOff(); string timeon = Global.getTimeOn(); int lessonIndex = Global.getLessonIndex(); if (lessonid == 0) { return; } //if(Global.isLessonOff()) // return; if (timenow.CompareTo(timeoff) > 0)//Global.getTeacherID() > 0 && { //过了下课时间 CourseTime ct = m_db.getCourseTime(lessonIndex + 1); if (ct != null) { if (timenow.CompareTo(ct.timeOn) > 0) { //Log.Info("过了下节课的上课时间 " + ct.timeOn + ", teacherid" + Global.getTeacherID()); } else { int minDiff = getTimediff(timenow, ct.timeOn); if (minDiff < 5 && !Global.isLessonOff()) { Common.setLessonOff(0, "", "");//自动下课 Log.Info("还没有到下节课的上课时间 " + ct.timeOn + ", teacherid" + Global.getTeacherID() + ", 执行下课"); } else { Log.Info("还没有到下节课的上课时间 " + ct.timeOn + ", teacherid" + Global.getTeacherID()); } //执行下课 //清空lesson信息 //是否需要自动取lesson信息 } } } }