RefreshData

Definition

Usage

Refresh the data in the device. This function is usually called after user information or fingerprints are uploaded. In this way, the modifications take effect immediately.

Parameter

Device number

Return Value

Return True if it is successful, or return False.

Related Function

None

 

Ejemplo

C#

   private void SaveTmpToDB(string sIp = "10.0.0.44", int iPort = 4370, int iMachineNumber = 1)
        {
            //Create Standalone SDK class dynamicly.
            zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
            axCZKEM1.Connect_Net(sIp, iPort);

            if (iCanSaveTmp == 0)//You haven't enrolled the templates.
            {
                MessageBox.Show("Please enroll the fingerprint templates first!", "Error");
                return;
            }

            String connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\..\data\Templates.mdb";
            OleDbConnection conn = new OleDbConnection(connString);

            int idwFingerIndex = Convert.ToInt32(cbFingerIndex.Text.Trim());
            int iTmpLength = 0;
            string sdwEnrollNumber = "1";
            int iFlag = 0;
            byte[] byTmpData = new byte[2000];//modify by darcy on Dec.9 2009
            string sName = "";
            string sPassword = "";
            int iPrivilege = 0;
            bool bEnabled = false;

            axCZKEM1.EnableDevice(iMachineNumber, false);
            axCZKEM1.ReadAllTemplate(iMachineNumber);
            while (axCZKEM1.SSR_GetUserInfo(iMachineNumber, sdwEnrollNumber, out sName, out sPassword, out iPrivilege, out bEnabled))
            {
                if (axCZKEM1.GetUserTmpEx(iMachineNumber, sdwEnrollNumber, idwFingerIndex, out iFlag, out byTmpData[0], out iTmpLength))
                {
                    //If you need to select or delete the data in the database ,you can just define the sql sentences by youself
                    string sql = "insergm fgt into Template(UserID,FingerID,Template,TmpLen,Flag) values('" + sdwEnrollNumber + "','" + idwFingerIndex + "','" + byTmpData + "','" + iTmpLength + "','" + iFlag + "')";//modify by darcy on Dec.9 2009
                    OleDbCommand cmd = new OleDbCommand(sql, conn);
                    conn.Open();
                    cmd.ExecuteNonQuery();
                    MessageBox.Show("Successfully save templates to database ! ", "Success");
                }
                else
                {
                    MessageBox.Show("Saving templates to database failed !", "Error");
                }
            }
            axCZKEM1.RefreshData(iMachineNumber);//the data in the device should be refreshed
            axCZKEM1.EnableDevice(iMachineNumber, true);
        }

VB

    'Create Standalone SDK class dynamicly.
    Dim axCZKEM1 As New zkemkeeper.CZKEM
    'Make sure you have enrolled the fingerprint templates you will save
    Dim iCanSaveTmp As Integer = 0

    Private Sub SaveTmpToDB(Optional ByVal sIp As String = "10.0.0.44", Optional ByVal iPort As Integer = 4370,
                                  Optional ByVal iMachineNumber As Integer = 1)

        axCZKEM1.Connect_Net(sIp, iPort)
        If iCanSaveTmp = 0 Then 'You haven't enrolled the templates.
            MsgBox("Please enroll the fingerprint templates first!", MsgBoxStyle.Exclamation, "Error")
            Return
        End If

        Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\..\data\Templates.mdb"
        Dim conn As OleDb.OleDbConnection = New OleDb.OleDbConnection(connString)

        Dim idwFingerIndex As Double = 1
        Dim iTmpLength As Double
        Dim sdwEnrollNumber As String = "1"
        Dim iFlag As Integer
        Dim byTmpData(2000) As Byte
        Dim sName As String = ""
        Dim sPassword As String = ""
        Dim iPrivilege As Integer
        Dim bEnabled As Boolean = False

        axCZKEM1.EnableDevice(iMachineNumber, False)
        axCZKEM1.ReadAllTemplate(iMachineNumber)

        While axCZKEM1.SSR_GetUserInfo(iMachineNumber, sdwEnrollNumber, sName, sPassword, iPrivilege, bEnabled) = True
            If axCZKEM1.GetUserTmpEx(iMachineNumber, sdwEnrollNumber, idwFingerIndex, iFlag, byTmpData(0), iTmpLength) = True Then
                ' If you need to select or delete the data in the database ,you can just define the sql sentences by youself
                Dim sql As String
                sql = "insert into Template(UserID,FingerID,Template,TmpLen,Flag) values('" & sdwEnrollNumber & "','" & idwFingerIndex & "','" & byTmpData(0) & "','" & iTmpLength & "','" & iFlag & "')"
                Dim cmd As OleDb.OleDbCommand = New OleDb.OleDbCommand(sql, conn)
                conn.Open()
                cmd.ExecuteNonQuery()
                MsgBox("Successfully save templates to database ! ", MsgBoxStyle.Information, "Success")
            Else
                MsgBox("Saving templates to database failed ! ", MsgBoxStyle.Information, "Error")
            End If
        End While
        axCZKEM1.RefreshData(iMachineNumber) 'the data in the device should be refreshed
        axCZKEM1.EnableDevice(iMachineNumber, True)
    End Sub