/// <summary> /// 登陆 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogin_Click(object sender, EventArgs e) { #region 验证 if (cmbUserAccount.SelectedItem == null) { ShowToolTip("请选择用户"); return; } if (string.IsNullOrEmpty(txtUserPassword.Text)) { ShowToolTip("请输入密码"); return; } #endregion user = commonDao.Login(eUserRoleCodes.化验员.ToString(), cmbUserAccount.SelectedValue.ToString(), MD5Util.Encrypt(txtUserPassword.Text)); if (user != null) { if (user.UserAccount == GlobalVars.AdminAccount) { LoginSuccess(); return; } if (FingerCheckCount == 1) //用户1 { finger = commonDao.SelfDber.Entities <CmcsFinger>("where UserId=:UserId", new { Userid = user.PartyId }); if (finger == null || finger.Count == 0) { ShowToolTip("未注册指纹"); return; } } if (Fingerdll.ZAZOpenDeviceEx(ref hHandle, 2, 0, 0, 2, 0) == 0) { GrossCheck = false; timer_Finger.Enabled = true; } else { ShowToolTip("指纹设备未连接"); return; } } else { ShowToolTip("帐号或密码错误,请重新输入!"); txtUserPassword.ResetText(); txtUserPassword.Focus(); } }
/// <summary> /// 初始化外接设备 /// </summary> public void InitHardware() { int ret = 0; ret = Fingerdll.ZAZOpenDeviceEx(ref hHandle, 2, 0, 0, 2, 0); if (ret == 0) { this.IsConnect = true; ShowInfomation("设备打开成功"); btn_eroll_Click(null, null); } else { this.IsConnect = false; ShowInfomation(Fingerdll.ZAZErr2Strt(ret)); } }