Daniyal Baig
Daniyal Baig

Reputation: 86

ClearLogData from zkteco device using c# code

Here is a problem i am using ZKteco k40 device.I am getting data from device but i want to clear data from device which is fetched

 private void btnPullData_Click(object sender, EventArgs e)
    {
        try
        {
            ShowStatusBar(string.Empty, true);

            ICollection<MachineInfo> lstMachineInfo = manipulator.GetLogData(objZkeeper, int.Parse(tbxMachineNumber.Text.Trim()));

            if (lstMachineInfo != null && lstMachineInfo.Count > 0)
            {
                BindToGridView(lstMachineInfo);
                ShowStatusBar(lstMachineInfo.Count + " records found !!", true);
            }
            else
                DisplayListOutput("No records found");
        }
        catch (Exception ex)
        {
            DisplayListOutput(ex.Message);
        }

    }

1.There is 1000 log data in device and i want first 100 records and remove that 100 records from device.

Upvotes: 1

Views: 2010

Answers (1)

Daniyal Baig
Daniyal Baig

Reputation: 86

I resolve my issue!

public object ClearData(ZkemClient objZkeeper, int machineNumber, ClearFlag clearFlag)
        {
            int iDataFlag = (int)clearFlag;
            iDataFlag = 1;
            if (objZkeeper.ClearData(machineNumber, iDataFlag))
                return objZkeeper.RefreshData(machineNumber);
            else
            {
                int idwErrorCode = 0;
                objZkeeper.GetLastError(ref idwErrorCode);
                return idwErrorCode;
            }
        }

Clear the record specified by DataFlag from the device. DataFlag Type of the records to be cleared. The value ranges from 1 to 5. The meanings are as follows: 1. Attendance record 2. Fingerprint template data 3. None 4. Operation record 5. User information When the value of this parameter is 5, all user data in the device is deleted. Note: All fingerprint templates are also deleted.

Upvotes: 1

Related Questions