private void AddTemplateToGrid(StaffBioTemplate sbt) { int row = templateGrid.Rows.Add(); templateGrid.Rows[row].Tag = sbt; templateGrid.Rows[row].Cells["colBiosource"].Value = sbt.StrBioSource; templateGrid.Rows[row].Cells["colVersion"].Value = sbt.Version; templateGrid.Rows[row].Cells["colMemo"].Value = sbt.Memo; }
/// <summary> /// 保存用户指纹 /// </summary> /// <param name="template"></param> public void SetUserTemplate(StaffBioTemplate template) { if (!_Connected) { LJH.GeneralLibrary.LOG.FileLog.Log(Parameter.Name, "保存用户指纹失败,未连接设备"); return; } string temp = null; int size = 0; if (template.IsBiokey && template.Version == "9.0") { bool r = axCZKEM1.FPTempConvertNewStr(template.Template, ref temp, ref size); if (!r) { int idwErrorCode = 0; axCZKEM1.GetLastError(ref idwErrorCode); LJH.GeneralLibrary.LOG.FileLog.Log(Parameter.Name, "biokey指纹转换失败,ErrorCode=" + idwErrorCode.ToString()); } } else { temp = template.Template; } if (!string.IsNullOrEmpty(temp)) { int fingerIndex = (int)template.BioSource; if (fingerIndex >= 0 && fingerIndex <= 9) //指纹 { bool isTFT = axCZKEM1.IsTFTMachine(iMachineNumber); bool ret = axCZKEM1.SetUserTmpExStr(iMachineNumber, template.StaffID.ToString(), fingerIndex, 1, temp); if (!ret) { int idwErrorCode = 0; axCZKEM1.GetLastError(ref idwErrorCode); LJH.GeneralLibrary.LOG.FileLog.Log(Parameter.Name, "保存用户指纹失败,ErrorCode=" + idwErrorCode.ToString()); } } } }
/// <summary> /// 删除生物识别模板 /// </summary> /// <param name="template"></param> /// <returns></returns> public CommandResult DeleteTemplate(StaffBioTemplate template) { return ProviderFactory.Create<IStaffBioTemplateProvider>(_RepoUri).Delete(template); }
private void mnu_AddTemplate_Click(object sender, EventArgs e) { FrmFingerResgister frm = new FrmFingerResgister(); if (frm.ShowDialog() == DialogResult.OK) { StaffBioTemplate sbt = new StaffBioTemplate(); sbt.ID = Guid.NewGuid(); sbt.BioSource = (BioSource)frm.BioSource; sbt.Version = frm.Version; sbt.Template = frm.Template; sbt.IsBiokey = true; if (UpdatingItem != null) { Staff staff = UpdatingItem as Staff; sbt.StaffID = staff.ID; CommandResult ret = (new StaffBLL(AppSettings.CurrentSetting.ConnectUri)).SaveTemplate(sbt); if (ret.Result != ResultCode.Successful) { MessageBox.Show(ret.Message); } else { AddTemplateToGrid(sbt); } } else { AddTemplateToGrid(sbt); } } }
/// <summary> /// 保存生物识别模板,如果有系统中已经存在此模板,则替换 /// </summary> /// <param name="template"></param> /// <returns></returns> public CommandResult SaveTemplate(StaffBioTemplate template) { StaffBioTemplate original = ProviderFactory.Create<IStaffBioTemplateProvider>(_RepoUri).GetByID(template.ID).QueryObject; if (original == null) { return ProviderFactory.Create<IStaffBioTemplateProvider>(_RepoUri).Insert(template); } else { return ProviderFactory.Create<IStaffBioTemplateProvider>(_RepoUri).Update(template, original); } }