Ejemplo n.º 1
0
 private void mnu_DelTemplate_Click(object sender, EventArgs e)
 {
     if (UpdatingItem != null)
     {
         foreach (DataGridViewRow row in templateGrid.SelectedRows)
         {
             StaffBioTemplate sbt = row.Tag as StaffBioTemplate;
             CommandResult    ret = (new StaffBLL(AppSettings.CurrentSetting.ConnectUri)).DeleteTemplate(sbt);
             if (ret.Result != ResultCode.Successful)
             {
                 MessageBox.Show(ret.Message);
             }
             else
             {
                 templateGrid.Rows.Remove(row);
             }
         }
     }
     else
     {
         foreach (DataGridViewRow row in templateGrid.SelectedRows)
         {
             templateGrid.Rows.Remove(row);
         }
     }
 }
Ejemplo n.º 2
0
        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);
                }
            }
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        /// <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));
            }
        }
Ejemplo n.º 5
0
        /// <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());
                    }
                }
            }
        }
Ejemplo n.º 6
0
        protected override CommandResult AddItem(object addingItem)
        {
            Staff         staff = addingItem as Staff;
            CommandResult ret   = (new StaffBLL(AppSettings.CurrentSetting.ConnectUri)).Add(staff);

            if (ret.Result == ResultCode.Successful && picPhoto.Tag != null)
            {
                CommandResult ret1 = (new StaffBLL(AppSettings.CurrentSetting.ConnectUri)).SavePhoto(staff.ID, picPhoto.Tag.ToString());
                if (ret1.Result != ResultCode.Successful)
                {
                    MessageBox.Show("人员信息增加成功,但人员照片保存失败,失败原因:" + ret1.Message);
                }
            }
            if (templateGrid.Rows.Count > 0)
            {
                foreach (DataGridViewRow row in templateGrid.Rows)
                {
                    StaffBioTemplate sbt = row.Tag as StaffBioTemplate;
                    sbt.StaffID = staff.ID;
                    CommandResult ret1 = (new StaffBLL(AppSettings.CurrentSetting.ConnectUri)).SaveTemplate(sbt);
                }
            }
            return(ret);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 删除生物识别模板
 /// </summary>
 /// <param name="template"></param>
 /// <returns></returns>
 public CommandResult DeleteTemplate(StaffBioTemplate template)
 {
     return(ProviderFactory.Create <IStaffBioTemplateProvider>(_RepoUri).Delete(template));
 }