private void AddToLog(String ucard) { if (timer1.Enabled) { return; } try { Entities.Students stu = DBO.getStudentKH(ucard); String dt = DateTime.Now.ToString(); String evnt = "禁止进门."; if (stu != null) { if (stu.ENABLE) { HardDeviceManaging.OpenTheDoor(); timer1.Enabled = true; evnt = "允许进门."; lbl_ordre.BackColor = Color.Blue; } else { lbl_ordre.BackColor = Color.Red; } lbl_card.Text = stu.CARD; lbl_class.Text = stu.CLASS; lbl_dtime.Text = dt; lbl_name.Text = stu.NAME; lbl_ordre.Text = evnt; lbl_sno.Text = stu.SNO; DBO.Record(stu, dt, evnt); } else { lbl_card.Text = "N/A"; lbl_class.Text = "N/A"; lbl_dtime.Text = dt; lbl_name.Text = "N/A"; lbl_ordre.Text = evnt; lbl_ordre.BackColor = Color.Red; lbl_sno.Text = "N/A"; //MessageBox.Show("未注册!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception e) { DBO.Err(e); MessageBox.Show(e.Message); } }
private void 开ToolStripMenuItem_Click(object sender, EventArgs e) { HardDeviceManaging.OpenTheDoor(); timer1.Enabled = true; }
private void 关ToolStripMenuItem_Click(object sender, EventArgs e) { HardDeviceManaging.LockTheDoor(); }
private void timer1_Tick(object sender, EventArgs e) { HardDeviceManaging.LockTheDoor(); timer1.Enabled = false; }