private void processList(CustomList <DiviceData> items) { try { CustomList <ATT_IO> daoList = new CustomList <ATT_IO>(); CustomList <ATT_IO> rejectList = new CustomList <ATT_IO>(); EmployeeManager empManager = new EmployeeManager(); CustomList <HRM_Emp> allEmp = empManager.GetEmpGeneralInfo(); foreach (HRM_Emp e in allEmp) { var q = items.FindAll(f => f.CardNum.Trim() == e.PunchCard).OrderBy(x => x.nDateTime).ToList(); Int32 pTime = 0; double differenceTime = 0; foreach (var vItem in q) { DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0); DateTime d = origin.AddSeconds(vItem.nDateTime); string date = d.ToShortDateString(); string time = d.ToShortTimeString(); if (pTime == 0) { pTime = vItem.nDateTime; } else { differenceTime = (vItem.nDateTime - pTime); pTime = vItem.nDateTime; } ATT_IO item = new ATT_IO(); item.EmpCode = e.EmpCode; item.WorkDate = date.ToDateTime(); item.PunchCardNo = vItem.CardNum; item.PunchType = ""; item.PTime = time.ToString(); item.AddedBy = CurrentUserSession.UserName; item.DateAdded = DateTime.Now; } } AttValidDataList = daoList; AttRejectedList = rejectList; } catch (Exception ex) { throw ex; } }
private void processList(List <ATT_IO_Temp> items) { try { CustomList <ATT_IO> daoList = new CustomList <ATT_IO>(); CustomList <ATT_IO> rejectList = new CustomList <ATT_IO>(); EmployeeManager empManager = new EmployeeManager(); CustomList <HRM_Emp> allEmp = empManager.GetEmpGeneralInfo(); foreach (HRM_Emp e in allEmp) { var q = items.FindAll(f => f.PunchCardNo == e.PunchCard).OrderBy(x => x.PTime).ToList(); string pTime = ""; double differenceTime = 0; foreach (var vItem in q) { if (pTime == "") { pTime = vItem.PTime; } else { TimeSpan punch1 = new TimeSpan(int.Parse(pTime.Substring(0, 2)), int.Parse(pTime.Substring(3, 2)), int.Parse(pTime.Substring(6, 2)));//pTime.ToDateTime(); TimeSpan punch2 = new TimeSpan(int.Parse(vItem.PTime.Substring(0, 2)), int.Parse(vItem.PTime.Substring(3, 2)), int.Parse(vItem.PTime.Substring(6, 2))); differenceTime = (punch2.TotalSeconds - punch1.TotalSeconds); pTime = vItem.PTime; } ATT_IO item = new ATT_IO(); item.EmpCode = e.EmpCode; item.WorkDate = vItem.WorkDate; item.PTime = vItem.PTime; item.PunchCardNo = vItem.PunchCardNo; item.DeviceID = vItem.DeviceID; item.AddedBy = CurrentUserSession.UserName; item.DateAdded = DateTime.Now; } } AttValidDataList = daoList; AttRejectedList = rejectList; } catch (Exception ex) { throw ex; } }
private void processList(List <DiviceData> items) { try { CustomList <ATT_IO> daoList = new CustomList <ATT_IO>(); CustomList <ATT_IO> rejectList = new CustomList <ATT_IO>(); EmployeeManager empManager = new EmployeeManager(); CustomList <HRM_Emp> allEmp = empManager.GetEmpGeneralInfo(); foreach (HRM_Emp e in allEmp) { var q = items.FindAll(f => f.CardNum == e.PunchCardNo).OrderBy(x => x.CTime).ToList(); string pTime = ""; double differenceTime = 0; foreach (var vItem in q) { if (pTime == "") { pTime = vItem.CTime; } else { TimeSpan punch1 = new TimeSpan(int.Parse(pTime.Substring(0, 2)), int.Parse(pTime.Substring(2, 2)), int.Parse(pTime.Substring(4, 2))); TimeSpan punch2 = new TimeSpan(int.Parse(vItem.CTime.Substring(0, 2)), int.Parse(vItem.CTime.Substring(2, 2)), int.Parse(vItem.CTime.Substring(4, 2))); differenceTime = (punch2.TotalSeconds - punch1.TotalSeconds); pTime = vItem.CTime; } ATT_IO item = new ATT_IO(); item.EmpCode = e.EmpCode; item.WorkDate = DateTime.ParseExact(vItem.CDate.Substring(0, 4) + "-" + vItem.CDate.Substring(4, 2) + "-" + vItem.CDate.Substring(6, 2), "yyyy-MM-dd", null); item.PunchCardNo = vItem.CardNum; item.PunchType = ""; item.PTime = new TimeSpan(int.Parse(vItem.CTime.Substring(0, 2)), int.Parse(vItem.CTime.Substring(2, 2)), int.Parse(vItem.CTime.Substring(4, 2))).ToString(); item.AddedBy = CurrentUserSession.UserName; item.DateAdded = DateTime.Now; if (differenceTime != 0) { if (differenceTime < txtTimeDiffToRejectData.Text.ToInt()) { rejectList.Add(item); } else { daoList.Add(item); } } else { daoList.Add(item); } } } AttValidDataList = daoList; AttRejectedList = rejectList; } catch (Exception ex) { throw ex; } }
public CustomList <ATT_IO> GetAllAttForManualProcess(string date) { return(ATT_IO.GetAllAttForManualProcess(date)); }