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); } }
public static Models.Student GetStudent(Entities.Students s, Entities.Registrations r) { return(new Models.Student { Id = s.Id, FamilyId = s.FamilyId, FirstName = s.FirstName, LastName = s.LastName, ChineseName = s.ChineseName, Birthday = s.Birthday, Gender = s.Gender, Grade = r == null ? string.Empty : r.Grade }); }