public void SetIsOutDateClient(int roomNum, RemoteSetColor SetColor, DateTime now) { // string nw = now.ToString().Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)[1]; DateTime nw = DateTime.Now; SqlServerHelper.ExeProc_SetOutdate(roomNum, nw); UpdateSeat(roomNum, SetColor); }
/// <summary> /// 系统启动时扫描一次本自习室座位的使用情况。 /// </summary> /// <param name="room"></param> /// <param name="SetColor"></param> public void Scan(int room, RemoteSetColor SetColor) { string sql = "select no from tb_seat where anyone=1"; DataTable dt = SqlServerHelper.ExecuteDataTable(sql); foreach (DataRow item in dt.Rows) { SetColor((int)item[0], Brushes.Red); } }
public void UpdateSeat(int roomNum, RemoteSetColor SetColor) { DataTable dt = SqlServerHelper.ExeProc_GetOutdate(roomNum); //挨个修改颜色; List <int> list = new List <int>(); foreach (DataRow item in dt.Rows) { list.Add((int)item[0]); } for (int i = 0; i < int.Parse(ConfigurationManager.AppSettings["tableCount"]) * 4; i++) { if (list.Contains(i)) { SetColor(i, Brushes.Green); } else { SetColor(i, Brushes.Red); } } }