Compare commits
1 Commits
main
...
Ashutosh_B
Author | SHA1 | Date | |
---|---|---|---|
499fc9e69e |
@ -336,8 +336,16 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
{
|
{
|
||||||
DateTime date = attendance.AttendanceDate;
|
DateTime date = attendance.AttendanceDate;
|
||||||
finalDateTime = GetDateFromTimeStamp(date.Date, recordAttendanceDot.MarkTime);
|
finalDateTime = GetDateFromTimeStamp(date.Date, recordAttendanceDot.MarkTime);
|
||||||
|
if (attendance.InTime < finalDateTime)
|
||||||
|
{
|
||||||
attendance.OutTime = finalDateTime;
|
attendance.OutTime = finalDateTime;
|
||||||
attendance.Activity = ATTENDANCE_MARK_TYPE.REQUEST_REGULARIZE;
|
attendance.Activity = ATTENDANCE_MARK_TYPE.REQUEST_REGULARIZE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogError("Employee {EmployeeId} sent regularization request but it check-out time is earlier than check-out");
|
||||||
|
return BadRequest(ApiResponse<object>.ErrorResponse("Check-out time must be later than check-in time", "Check-out time must be later than check-in time", 400));
|
||||||
|
}
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
else if (recordAttendanceDot.Action == ATTENDANCE_MARK_TYPE.REGULARIZE)
|
else if (recordAttendanceDot.Action == ATTENDANCE_MARK_TYPE.REGULARIZE)
|
||||||
@ -433,7 +441,13 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
{
|
{
|
||||||
await transaction.RollbackAsync(); // Rollback on failure
|
await transaction.RollbackAsync(); // Rollback on failure
|
||||||
_logger.LogError("{Error} while marking attendance", ex.Message);
|
_logger.LogError("{Error} while marking attendance", ex.Message);
|
||||||
return BadRequest(ApiResponse<object>.ErrorResponse(ex.Message, ex, 400));
|
var response = new
|
||||||
|
{
|
||||||
|
message = ex.Message,
|
||||||
|
detail = ex.StackTrace,
|
||||||
|
statusCode = StatusCodes.Status500InternalServerError
|
||||||
|
};
|
||||||
|
return BadRequest(ApiResponse<object>.ErrorResponse(ex.Message, response, 400));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -495,8 +509,16 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
{
|
{
|
||||||
DateTime date = attendance.AttendanceDate;
|
DateTime date = attendance.AttendanceDate;
|
||||||
finalDateTime = GetDateFromTimeStamp(date.Date, recordAttendanceDot.MarkTime);
|
finalDateTime = GetDateFromTimeStamp(date.Date, recordAttendanceDot.MarkTime);
|
||||||
|
if (attendance.InTime < finalDateTime)
|
||||||
|
{
|
||||||
attendance.OutTime = finalDateTime;
|
attendance.OutTime = finalDateTime;
|
||||||
attendance.Activity = ATTENDANCE_MARK_TYPE.REQUEST_REGULARIZE;
|
attendance.Activity = ATTENDANCE_MARK_TYPE.REQUEST_REGULARIZE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogError("Employee {EmployeeId} sent regularization request but it check-out time is earlier than check-out");
|
||||||
|
return BadRequest(ApiResponse<object>.ErrorResponse("Check-out time must be later than check-in time", "Check-out time must be later than check-in time", 400));
|
||||||
|
}
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
else if (recordAttendanceDot.Action == ATTENDANCE_MARK_TYPE.REGULARIZE)
|
else if (recordAttendanceDot.Action == ATTENDANCE_MARK_TYPE.REGULARIZE)
|
||||||
@ -668,7 +690,13 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
{
|
{
|
||||||
await transaction.RollbackAsync(); // Rollback on failure
|
await transaction.RollbackAsync(); // Rollback on failure
|
||||||
_logger.LogError("{Error} while marking attendance", ex.Message);
|
_logger.LogError("{Error} while marking attendance", ex.Message);
|
||||||
return BadRequest(ApiResponse<object>.ErrorResponse(ex.Message, ex, 400));
|
var response = new
|
||||||
|
{
|
||||||
|
message = ex.Message,
|
||||||
|
detail = ex.StackTrace,
|
||||||
|
statusCode = StatusCodes.Status500InternalServerError
|
||||||
|
};
|
||||||
|
return BadRequest(ApiResponse<object>.ErrorResponse(ex.Message, response, 400));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user