Search code examples
c#time-and-attendancezkteco

How can I get absent days from ZKTeco device?


I have a ZKTeco K80 device, what I can get now are the logs data ( DateTime, InOut, VerifyMethod..)

  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);
        }

    }


  public ICollection<MachineInfo> GetLogData(ZkemClient objZkeeper, int machineNumber)
    {
        string dwEnrollNumber1 = "";
        int dwVerifyMode = 0;
        int dwInOutMode = 0;
        int dwYear = 0;
        int dwMonth = 0;
        int dwDay = 0;
        int dwHour = 0;
        int dwMinute = 0;
        int dwSecond = 0;
        int dwWorkCode = 0;

        ICollection<MachineInfo> lstEnrollData = new List<MachineInfo>();

        objZkeeper.ReadAllGLogData(machineNumber);

        while (objZkeeper.SSR_GetGeneralLogData(machineNumber, out dwEnrollNumber1, out dwVerifyMode, out dwInOutMode, out dwYear, out dwMonth, out dwDay, out dwHour, out dwMinute, out dwSecond, ref dwWorkCode))


        {
            string inputDate = new DateTime(dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond).ToString();

            MachineInfo objInfo = new MachineInfo();
            objInfo.MachineNumber = machineNumber;
            objInfo.IndRegID = int.Parse(dwEnrollNumber1);
            objInfo.DateTimeRecord = inputDate;
            objInfo.dwInOutMode = dwInOutMode;
            
            
            

            lstEnrollData.Add(objInfo);
        }

        return lstEnrollData;
    }

Ref : Csharp-ZKTeco-Biometric-Device-Getting-Started

I'm searching for a method to get the absent days , how can I configure the device to count all the absent days starting from a week and except Saturday and Sunday or this is not related to the device and should I configure it myself using SQL tables??


Solution

  • Well, you can not get the absent days from the biometric device. It must be part of your application logic. You have to read all the attendance data from the biometric device, and consider all the missing dates as absent days.