public List <Attendance_Record> fetchAttendance(AttendanceDataConfig config) { try { objZkeeper = new ZkemClient(RaiseDeviceEvent); bool IsDeviceConnected = objZkeeper.Connect_Net(config.IPAddress, config.PortNumber); int todaysRecord = 0; if (IsDeviceConnected) { string deviceInfo = manipulator.FetchDeviceInfo(objZkeeper, config.MachineNumber); ///tbxMachineNumber.Text.Trim() ///lblDeviceInfo.Text = deviceInfo; ICollection <MachineInfo> lstMachineInfo = manipulator.GetLogData(objZkeeper, config.MachineNumber); ///tbxMachineNumber.Text.Trim() var attendanceRecord = new List <Attendance_Record>(); foreach (var item in lstMachineInfo) { if (DateTime.Compare(item.DateOnlyRecord, config.DateTo) == 0)///DateTime.Parse(item.DateTimeRecord).Date { attendanceRecord.Add(new Attendance_Record() { Information_Id = item.IndRegID, Attendance_Timing = DateTime.Parse(item.DateTimeRecord) }); todaysRecord++; } } return(attendanceRecord); } return(new List <Attendance_Record>()); } catch (Exception ex) { return(new List <Attendance_Record>()); } }
public ActionResult AttendanceRecord() { AttendanceDataConfig config = new AttendanceDataConfig(); config.IPAddress = "103.88.232.188"; config.PortNumber = 4370; config.MachineNumber = 1; config.DateTo = DateTime.Now.Date; var data = fetchAttendance(config); return(View("View", data)); }