Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Problem
How to get last row in date today from zk machine ?


i work on application depend on attendance employee on machine

i need to depend on log file data on machine to get data

i already connect to machine by using csharp and get all data of time attendance

but i need to get last row per machine meaning last attendance row per day today

i already added zkemkeeper.dll

What I have tried:

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");
Posted
Updated 19-Jul-23 0:31am
Comments
MadMyche 3-Apr-19 5:21am    
And what are the results of this code you have tried?
ahmed_sa 3-Apr-19 5:43am    
result show to me is all records for log of machine
ahmed_sa 3-Apr-19 5:43am    
can you please help me

1 solution

... = lstMachineInfo.Where( x => x.date < DateTime.Now ).Last();
or
... = lstMachineInfo.Where(...).OrderDescending( x => x.date ).First();
or
etc.
 
Share this answer
 
Comments
ahmed_sa 3-Apr-19 17:08pm    
thank you very much in my case i do as following
(x => x.DateTimeRecord < DateTime.Now)
DateTimeRecord is string
How to convert it to datetime
Member 13930394 20-Dec-20 22:59pm    
have you found the solution of this problem?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900