public static void download(Model.fingerprint fingerprint) { //实例化指纹验证对象 Printer p = PrinterInstance.getInstance().getPrinter(); Bll.fingerprint fingerPrint_bll = new Gunark.BLL.fingerprint(); //p.OpenPort(); int userId = fingerprint.ID; string print = System.Text.Encoding.Default.GetString(fingerprint.USER_FINGERPRINT); string[] pr = print.Split(' '); byte[] finger = new byte[1600]; for (int i = 0; i < pr.Length - 1; i++) { finger[i] = Convert.ToByte(pr[i], 16); } //System.Windows.Forms.MessageBox.Show(fingerByte.Length.ToString()); //下载用户 bool isDownloadUser = false; List <Model.fingerprint> list = fingerPrint_bll.GetModelList("USER_POLICENUMB = " + fingerprint.USER_POLICENUMB); foreach (Model.fingerprint fi in list) { if (fi.IS_UPDATE == 1) { isDownloadUser = true; break; } } if (!isDownloadUser) { p.downloadUser((byte)userId); //while (true) //{ // if (p.Downuserbool) // { // fingerprint.IS_UPDATE = 1; // fingerPrint_bll.Update(fingerprint); // p.Downuserbool = false; // System.Windows.Forms.MessageBox.Show("用户下载成功"); // break; // } //} } //下载指纹 p.downloadfinger(finger, (byte)userId); //while (true) //{ // if (p.Downprinterbool) // { // System.Windows.Forms.MessageBox.Show("指纹下载成功!"); // break; // } //} }
public static void input(Model.fingerprint fingerprint, byte[] finger) { //实例化指纹验证对象 Printer p = PrinterInstance.getInstance().getPrinter(); Bll.fingerprint fingerPrint_bll = new Gunark.BLL.fingerprint(); //p.OpenPort(); int userId = fingerprint.ID; //下载用户 //System.Windows.Forms.MessageBox.Show("开始下载用户"); p.downloadUser((byte)userId); while (true) { if (p.Downuserbool) { p.Downuserbool = false; System.Windows.Forms.MessageBox.Show("用户下载成功"); break; } if (!p.DownuserFail) { System.Windows.Forms.MessageBox.Show("用户下载失败"); p.DownuserFail = true; break; } } //System.Threading.Thread.Sleep(5000); //if (p.GetDownuserbool()) //{ // p.Downuserbool = false; // System.Windows.Forms.MessageBox.Show("用户下载成功"); //} //else //{ // System.Windows.Forms.MessageBox.Show("用户下载失败"); //} //下载指纹 //System.Windows.Forms.MessageBox.Show("开始下载用户"); p.downloadfinger(finger, (byte)userId); while (true) { if (p.Downprinterbool) { p.Downprinterbool = false; System.Windows.Forms.MessageBox.Show("指纹录入成功!"); break; } if (!p.DownprinterFail) { p.DownprinterFail = true; System.Windows.Forms.MessageBox.Show("指纹录入失败"); break; } } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Gunark.Model.fingerprint model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Gunark.Model.fingerprint model) { return(dal.Add(model)); }
/// <summary> /// 指纹验证 /// </summary> /// <param name="p"></param> public bool verifyFinger() { //p.OpenPort(); p.cleanResult(); p.checkUser(); //p.ClosePort(); //等待指纹机返回结果 while (_continue) { if (p.GetResultFg().Equals("")) { continue; } string id = p.GetResultFg(); Model.fingerprint fingerPrint = finger_bll.GetModel(Convert.ToInt32(id)); //MessageBox.Show(id.ToString()); switch (role) { case "用枪警员": if (fingerPrint != null) { if (fingerPrint.USER_PRIVIEGES == 1) { PubFlag.policeNum = fingerPrint.USER_POLICENUMB; return(true); } } break; case "当班领导": if (fingerPrint != null) { if (fingerPrint.USER_PRIVIEGES == 5) { PubFlag.dutyLeaderNum = fingerPrint.USER_POLICENUMB; return(true); } } break; case "主管领导": if (fingerPrint != null) { if (fingerPrint.USER_PRIVIEGES == 6) { PubFlag.bossLeaderNum = fingerPrint.USER_POLICENUMB; return(true); } } break; case "枪柜管理员": if (fingerPrint != null) { if (fingerPrint.USER_PRIVIEGES == 3 || fingerPrint.USER_PRIVIEGES == 4) { PubFlag.gunarkAdminNum = fingerPrint.USER_POLICENUMB; return(true); } } break; default: break; } //指纹仪中没有当前指纹信息 if (p.GetResultFg().Equals("wrong")) { System.Windows.Forms.MessageBox.Show("指纹不存在!", "提示"); } break; } return(false); }