示例#1
0
        //Enroll a certain user's specified fingerprint template online.
        //It only supports 9.0 fingerprint arithmetic at present.
        private void btnStartEnroll_Click(object sender, EventArgs e)
        {
            if (bIsConnected == false)
            {
                MessageBox.Show("Please connect the device first!", "Error");
                return;
            }

            if (txtUserID.Text.Trim() == "" || cbFingerIndex.Text.Trim() == "")
            {
                MessageBox.Show("UserID,FingerIndex must be inputted first!", "Error");
                return;
            }
            int idwErrorCode = 0;

            int    iUserID      = Convert.ToInt32(txtUserID.Text.Trim());
            string sUserID      = txtUserID.Text.Trim();
            int    iFingerIndex = Convert.ToInt32(cbFingerIndex.Text.Trim());

            axCZKEM1.CancelOperation();
            axCZKEM1.DelUserTmp(iMachineNumber, iUserID, iFingerIndex);
            if (axCZKEM1.StartEnroll(iUserID, iFingerIndex))
            {
                MessageBox.Show("Start to Enroll a new User,UserID=" + iUserID.ToString() + " FingerID=" + iFingerIndex.ToString(), "Start");
                iCanSaveTmp = 1;
                axCZKEM1.StartIdentify();//After enrolling templates,you should let the device into the 1:N verification condition
            }
            else
            {
                axCZKEM1.GetLastError(ref idwErrorCode);
                MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error");
            }
        }
示例#2
0
        //Enroll a certain user's specified fingerprint template online.
        //Only TFT screen devices with firmware version Ver 6.60 version later support duress fingerprint.
        //While you are using 9.0 fingerprint arithmetic and your device's firmware version is under ver6.60,you should set
        //the paremeter flag of function "StartEnrollEx" as an integer 1.
        private void btnStartEnroll_Click(object sender, EventArgs e)
        {
            if (bIsConnected == false)
            {
                MessageBox.Show("Please connect the device first!", "Error");
                return;
            }

            if (txtUserID.Text.Trim() == "" || cbFingerIndex.Text.Trim() == "" || cbFlag.Text.Trim() == "")
            {
                MessageBox.Show("UserID,FingerIndex must be inputted first!", "Error");
                return;
            }
            int idwErrorCode = 0;

            int    iUserID      = Convert.ToInt32(txtUserID.Text.Trim());
            string sUserID      = txtUserID.Text.Trim();
            int    iFingerIndex = Convert.ToInt32(cbFingerIndex.Text.Trim());
            int    iFlag        = Convert.ToInt32(cbFlag.Text.Trim());

            axCZKEM1.CancelOperation();
            axCZKEM1.SSR_DelUserTmpExt(iMachineNumber, sUserID, iFingerIndex);//If the specified index of user's templates has existed ,delete it first.(SSR_DelUserTmp is also available sometimes)
            if (axCZKEM1.StartEnrollEx(sUserID, iFingerIndex, iFlag))
            {
                MessageBox.Show("Start to Enroll a new User,UserID=" + sUserID + " FingerID=" + iFingerIndex.ToString() + " Flag=" + iFlag.ToString(), "Start");
                iCanSaveTmp = 1;
                axCZKEM1.StartIdentify();//After enrolling templates,you should let the device into the 1:N verification condition
            }
            else
            {
                axCZKEM1.GetLastError(ref idwErrorCode);
                MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error");
            }
        }
示例#3
0
        private void btnEnroll_Click(object sender, EventArgs e)
        {
            if (!_isFingerprintConnected)
            {
                this.ShowWarning("Tidak ada koneksi dengan fingerprint device!");
                return;
            }

            try
            {
                string userId      = txtCode.Text;
                int    fingerIndex = 1;

                axCZKEM1.CancelOperation();
                axCZKEM1.SSR_DelUserTmpExt(1, userId, fingerIndex);
                if (axCZKEM1.StartEnrollEx(userId, fingerIndex, 1))
                {
                    this.ShowWarning("Mohon letakkan jari pada fingerprint, lalu ikuti langkah-langkah verifikasi sampai selesai!");
                    axCZKEM1.StartIdentify();

                    txtCode.Properties.ReadOnly         = true;
                    txtMechanicName.Properties.ReadOnly = false;
                    txtAddress.Properties.ReadOnly      = false;
                    txtPhoneNumber.Properties.ReadOnly  = false;
                }
                else
                {
                    int errorCode = 0;
                    axCZKEM1.GetLastError(ref errorCode);
                    MethodBase.GetCurrentMethod().Error("Unable to enroll user. Error Code: " + errorCode);
                    this.ShowError("Operasi gagal! Kode Error=" + errorCode.ToString());
                }
            }
            catch (Exception ex)
            {
                MethodBase.GetCurrentMethod().Fatal("An error occured while trying to enroll data", ex);
                this.ShowError("Operasi gagal!");
            }
        }
        public int sta_OnlineEnroll(string txtUserID, string cbFingerIndex, string cbFlag)
        {
            /*
             * txtUserID = "1";
             * cbFingerIndex = "9";
             * cbFlag = "0";
             */
            if (GetConnectState() == false)
            {
                Logger.WriteLog("ERROR: Nuk jeni lidhur me pajisjen");
                return(-1024);
            }

            if (txtUserID == "" || cbFingerIndex == "" || cbFlag == "")
            {
                Logger.WriteLog("ERROR: Plotesoni te gjitha fushat e kerkuara. userId, fingerIndex dhe cbFlag");
                return(-1023);
            }

            int    iPIN2Width      = 0;
            int    iIsABCPinEnable = 0;
            int    iT9FunOn        = 0;
            string strTemp         = "";

            axCZKEM1.GetSysOption(GetMachineNumber(), "~PIN2Width", out strTemp);
            iPIN2Width = Convert.ToInt32(strTemp);
            axCZKEM1.GetSysOption(GetMachineNumber(), "~IsABCPinEnable", out strTemp);
            iIsABCPinEnable = Convert.ToInt32(strTemp);
            axCZKEM1.GetSysOption(GetMachineNumber(), "~T9FunOn", out strTemp);
            iT9FunOn = Convert.ToInt32(strTemp);

            /*
             * axCZKEM1.GetDeviceInfo(iMachineNumber, 76, ref iPIN2Width);
             * axCZKEM1.GetDeviceInfo(iMachineNumber, 77, ref iIsABCPinEnable);
             * axCZKEM1.GetDeviceInfo(iMachineNumber, 78, ref iT9FunOn);
             */

            if (txtUserID.Length > iPIN2Width)
            {
                Logger.WriteLog("ERROR: User ID error! The max length is " + iPIN2Width.ToString());
                Logger.WriteLog("INFO: Restarting Middlware Service...");
                Environment.Exit(1);
                return(-1022);
            }

            if (iIsABCPinEnable == 0 || iT9FunOn == 0)
            {
                if (txtUserID.Substring(0, 1) == "0")
                {
                    Logger.WriteLog("ERROR: User ID error! The first letter can not be as 0");
                    return(-1022);
                }

                foreach (char tempchar in txtUserID.ToCharArray())
                {
                    if (!(char.IsDigit(tempchar)))
                    {
                        Logger.WriteLog("ERROR: User ID error! User ID only support digital");
                        return(-1022);
                    }
                }
            }

            int    idwErrorCode = 0;
            string sUserID      = txtUserID;
            int    iFingerIndex = Convert.ToInt32(cbFingerIndex);
            int    iFlag        = Convert.ToInt32(cbFlag);

            axCZKEM1.CancelOperation();
            //If the specified index of user's templates has existed ,delete it first
            axCZKEM1.SSR_DelUserTmpExt(iMachineNumber, sUserID, iFingerIndex);
            if (axCZKEM1.StartEnrollEx(sUserID, iFingerIndex, iFlag))
            {
                Logger.WriteLog("INFO: Skano gisht te ri per: " + sUserID + " GishtID=" + iFingerIndex.ToString() + " Flag=" + iFlag.ToString());
                if (axCZKEM1.StartIdentify())
                {
                    Logger.WriteLog("INFO: UserID" + sUserID);
                }
                ;//After enrolling templates,you should let the device into the 1:N verification condition
            }
            else
            {
                axCZKEM1.GetLastError(ref idwErrorCode);
                Logger.WriteLog("ERRORs: Operation failed,ErrorCode=" + idwErrorCode.ToString());
            }

            return(1);
        }