Solved time discrepancies in attendance/record #3
@ -219,6 +219,8 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
Attendance attendance = await _context.Attendes.FirstOrDefaultAsync(a => a.EmployeeID == recordAttendanceDot.EmployeeID &&
|
Attendance attendance = await _context.Attendes.FirstOrDefaultAsync(a => a.EmployeeID == recordAttendanceDot.EmployeeID &&
|
||||||
a.AttendanceDate.Date == recordAttendanceDot.Date.Date && a.TenantId == TenantId); ;
|
a.AttendanceDate.Date == recordAttendanceDot.Date.Date && a.TenantId == TenantId); ;
|
||||||
|
|
||||||
|
DateTime finalDateTime = GetDateFromTimeStamp(recordAttendanceDot, recordAttendanceDot.MarkTime);
|
||||||
|
|
||||||
|
|
||||||
if (attendance != null)
|
if (attendance != null)
|
||||||
{
|
{
|
||||||
@ -236,13 +238,13 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
|
|
||||||
//string timeString = "10:30 PM"; // Format: "hh:mm tt"
|
//string timeString = "10:30 PM"; // Format: "hh:mm tt"
|
||||||
|
|
||||||
DateTime finalDateTime = GetDateFromTimeStamp(recordAttendanceDot, recordAttendanceDot.MarkTime);
|
//DateTime finalDateTime = GetDateFromTimeStamp(recordAttendanceDot, recordAttendanceDot.MarkTime);
|
||||||
|
|
||||||
attendance.OutTime = finalDateTime;
|
attendance.OutTime = finalDateTime;
|
||||||
}
|
}
|
||||||
else if (recordAttendanceDot.Action == ATTENDANCE_MARK_TYPE.REQUEST_REGULARIZE)
|
else if (recordAttendanceDot.Action == ATTENDANCE_MARK_TYPE.REQUEST_REGULARIZE)
|
||||||
{
|
{
|
||||||
DateTime finalDateTime = GetDateFromTimeStamp(recordAttendanceDot, recordAttendanceDot.MarkTime);
|
//DateTime finalDateTime = GetDateFromTimeStamp(recordAttendanceDot, recordAttendanceDot.MarkTime);
|
||||||
|
|
||||||
attendance.OutTime = finalDateTime;
|
attendance.OutTime = finalDateTime;
|
||||||
attendance.Activity = ATTENDANCE_MARK_TYPE.REQUEST_REGULARIZE;
|
attendance.Activity = ATTENDANCE_MARK_TYPE.REQUEST_REGULARIZE;
|
||||||
@ -277,7 +279,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
attendance.Date = DateTime.UtcNow;
|
attendance.Date = DateTime.UtcNow;
|
||||||
|
|
||||||
|
|
||||||
DateTime finalDateTime = GetDateFromTimeStamp(recordAttendanceDot, recordAttendanceDot.MarkTime);
|
//DateTime finalDateTime = GetDateFromTimeStamp(recordAttendanceDot, recordAttendanceDot.MarkTime);
|
||||||
|
|
||||||
attendance.InTime = finalDateTime;
|
attendance.InTime = finalDateTime;
|
||||||
attendance.OutTime = null;
|
attendance.OutTime = null;
|
||||||
@ -295,7 +297,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
AttendanceId = attendance.Id, // Use existing or new AttendanceId
|
AttendanceId = attendance.Id, // Use existing or new AttendanceId
|
||||||
Activity = attendance.Activity,
|
Activity = attendance.Activity,
|
||||||
|
|
||||||
ActivityTime = recordAttendanceDot.Date,
|
ActivityTime = finalDateTime,
|
||||||
Comment = recordAttendanceDot.Comment,
|
Comment = recordAttendanceDot.Comment,
|
||||||
EmployeeID = recordAttendanceDot.EmployeeID,
|
EmployeeID = recordAttendanceDot.EmployeeID,
|
||||||
Latitude = recordAttendanceDot.Latitude,
|
Latitude = recordAttendanceDot.Latitude,
|
||||||
@ -303,7 +305,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
|
|
||||||
TenantId = TenantId,
|
TenantId = TenantId,
|
||||||
UpdatedBy = GetUserId(),
|
UpdatedBy = GetUserId(),
|
||||||
UpdatedOn = DateTime.UtcNow
|
UpdatedOn = recordAttendanceDot.Date
|
||||||
};
|
};
|
||||||
//if (recordAttendanceDot.Image != null && recordAttendanceDot.Image.Count > 0)
|
//if (recordAttendanceDot.Image != null && recordAttendanceDot.Image.Count > 0)
|
||||||
//{
|
//{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user