public void PunchCard(int cardNo) { if (cardNo != 0) { //get userdetals from card number var attendUserDetails = new HR_AttendUserBL().GetAttendUserByCardNo(cardNo); if (attendUserDetails == null) { throw new Exception(SLIITCommonResource.ERROR_HR_CARD_NOT_FOUND.ToString()); } //get the last time log var lastAttenednceLog = new HR_AttendanceLogBL().GetLastLogByAttendUser(attendUserDetails.RnAttendUserID); //if the lastAttenednceLog is empty, user is new //if last punch was IN, then set OUT, else do the opposite //true = IN //false = OUT TB_HR_AttendanceLog log = new TB_HR_AttendanceLog(); if (lastAttenednceLog == null) { log.Type = true; } else if (lastAttenednceLog.Type == true)//if last was IN { log.Type = false; } else//if last log was OUT { log.Type = true; } log.UserID = attendUserDetails.RnAttendUserID; log.LogTime = DateTime.Now; //save in db new HR_AttendanceLogBL().Insert(log); } }
private void detach_TB_HR_AttendanceLogs(TB_HR_AttendanceLog entity) { this.SendPropertyChanging(); entity.TB_HR_AttendUser = null; }
partial void DeleteTB_HR_AttendanceLog(TB_HR_AttendanceLog instance);
partial void UpdateTB_HR_AttendanceLog(TB_HR_AttendanceLog instance);
partial void InsertTB_HR_AttendanceLog(TB_HR_AttendanceLog instance);