コード例 #1
0
        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);
            }
        }
コード例 #2
0
 private void 开ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     HardDeviceManaging.OpenTheDoor();
     timer1.Enabled = true;
 }
コード例 #3
0
 private void 关ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     HardDeviceManaging.LockTheDoor();
 }
コード例 #4
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     HardDeviceManaging.LockTheDoor();
     timer1.Enabled = false;
 }