E
engahmedbarbary
Guest
I have zk machine have attendance of more users and i need to get last record per machine
meaning last user making attendance i need to get it
or any way can get last record per machine
i need only to using datetime not date
calling button
private void btnPullData_Click(object sender, EventArgs e)
{
try
{
ShowStatusBar(string.Empty, true);
ICollection<MachineInfo> lstMachineInfo = manipulator.GetLogData(objZkeeper, int.Parse(tbxMachineNumber.Text.Trim()));
DateTime LastRecord = DateTime.Today.AddDays(-1);
lstMachineInfo = lstMachineInfo.Where(x => x.DateOnlyRecord > LastRecord).ToList();
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);
}
}
and function it self as below
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;
lstEnrollData.Add(objInfo);
}
return lstEnrollData;
}
class machineinfo as following
public class MachineInfo
{
public int MachineNumber { get; set; }
public int IndRegID { get; set; }
public string DateTimeRecord { get; set; }
public DateTime DateOnlyRecord
{
get { return DateTime.Parse(DateTime.Parse(DateTimeRecord).ToString("yyyy-MM-dd")); }
}
public DateTime TimeOnlyRecord
{
get { return DateTime.Parse(DateTime.Parse(DateTimeRecord).ToString("hh:mm:ss tt")); }
}
}
i need to replace
replace
(x => x.DateOnlyRecord > LastRecord)
with
DateTimeRecord
Continue reading...
meaning last user making attendance i need to get it
or any way can get last record per machine
i need only to using datetime not date
calling button
private void btnPullData_Click(object sender, EventArgs e)
{
try
{
ShowStatusBar(string.Empty, true);
ICollection<MachineInfo> lstMachineInfo = manipulator.GetLogData(objZkeeper, int.Parse(tbxMachineNumber.Text.Trim()));
DateTime LastRecord = DateTime.Today.AddDays(-1);
lstMachineInfo = lstMachineInfo.Where(x => x.DateOnlyRecord > LastRecord).ToList();
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);
}
}
and function it self as below
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;
lstEnrollData.Add(objInfo);
}
return lstEnrollData;
}
class machineinfo as following
public class MachineInfo
{
public int MachineNumber { get; set; }
public int IndRegID { get; set; }
public string DateTimeRecord { get; set; }
public DateTime DateOnlyRecord
{
get { return DateTime.Parse(DateTime.Parse(DateTimeRecord).ToString("yyyy-MM-dd")); }
}
public DateTime TimeOnlyRecord
{
get { return DateTime.Parse(DateTime.Parse(DateTimeRecord).ToString("hh:mm:ss tt")); }
}
}
i need to replace
replace
(x => x.DateOnlyRecord > LastRecord)
with
DateTimeRecord
Continue reading...