public void GetAttendRecord() { try { if (clientAtt == null) clientAtt = new AttendRecordImportHelper.AttendanceWS.AttendanceServiceClient(); DateTime From = new DateTime(); DateTime To = new DateTime(); DateTime.TryParse(dtFrom.Text, out From); DateTime.TryParse(dtTo.Text, out To); entTempList.Clear(); using (hrEntities db = new hrEntities()) { var data = from ent in db.kqjl where ent.checktime >= From && ent.checktime <= To select ent; foreach (var item in data) { T_HR_EMPLOYEECLOCKINRECORD entTemp = new T_HR_EMPLOYEECLOCKINRECORD(); entTemp.CLOCKINRECORDID = System.Guid.NewGuid().ToString().ToUpper(); entTemp.FINGERPRINTID = item.badgenumber; entTemp.CLOCKID = item.machine_sn.ToString(); entTemp.PUNCHDATE = item.checktime; entTemp.PUNCHTIME = item.checktime.Value.Hour.ToString() + ":" + item.checktime.Value.Minute.ToString(); entTempList.Add(entTemp); } } }catch(Exception ex) { Tracer.Debug("导入打卡记录失败,失败原因为:" + ex.ToString()); } }
public void GetAttendRecord() { try { if (clientAtt == null) { clientAtt = new AttendRecordImportHelper.AttendanceWS.AttendanceServiceClient(); } DateTime From = new DateTime(); DateTime To = new DateTime(); DateTime.TryParse(dtFrom.Text, out From); DateTime.TryParse(dtTo.Text, out To); entTempList.Clear(); using (hrEntities db = new hrEntities()) { var data = from ent in db.kqjl where ent.checktime >= From && ent.checktime <= To select ent; foreach (var item in data) { T_HR_EMPLOYEECLOCKINRECORD entTemp = new T_HR_EMPLOYEECLOCKINRECORD(); entTemp.CLOCKINRECORDID = System.Guid.NewGuid().ToString().ToUpper(); entTemp.FINGERPRINTID = item.badgenumber; entTemp.CLOCKID = item.machine_sn.ToString(); entTemp.PUNCHDATE = item.checktime; entTemp.PUNCHTIME = item.checktime.Value.Hour.ToString() + ":" + item.checktime.Value.Minute.ToString(); entTempList.Add(entTemp); } } }catch (Exception ex) { Tracer.Debug("导入打卡记录失败,失败原因为:" + ex.ToString()); } }