public static string OpenDelay() { string result = ""; try { using (SerialPort sp = new SerialPort(Common.LockCOM, 9600)) { byte[] data = FourInFourOutHelper.OpenDelay(0, Common.OpenPoint, Common.DelayTimes); sp.Open(); sp.Write(data, 0, 9); sp.Close(); result = "电子锁打开成功!"; } } catch (Exception ex) { result = "电子锁打开失败!原因:" + ex.Message + "!"; } return(result); }
public void HandleCardNo(string cardNo) { string result; if (CheckPrivilege(cardNo) == -1) { result = "人员信息不存在"; } else if (CheckPrivilege(cardNo) == 0) { result = "没有开门权限"; } else if (CheckPrivilege(cardNo) == 1) { result = "有开门权限;" + FourInFourOutHelper.OpenDelay(); } else { result = "权限查找出错"; } AddMsg("接收卡号:" + cardNo + ";结果:" + result); }
private void btnOpen_Click(object sender, EventArgs e) { FourInFourOutHelper.OpenDelay(); }