report leave

This commit is contained in:
kittapath 2024-12-13 11:52:58 +07:00
parent 12448ba0a4
commit 771b9b940a
17 changed files with 2109 additions and 305 deletions

View file

@ -635,14 +635,11 @@ namespace BMA.EHR.Leave.Service.Controllers
// validate duplicate check in
var currentCheckIn = await _userTimeStampRepository.GetTimestampByDateAsync(userId, currentDate);
if (currentCheckIn != null)
{
return Error(new Exception("ไม่สามารถลงเวลาได้ เนื่องจากมีการลงเวลาในวันนี้แล้ว!"), StatusCodes.Status400BadRequest);
}
var checkin = new UserTimeStamp
{
KeycloakUserId = userId,
@ -657,6 +654,23 @@ namespace BMA.EHR.Leave.Service.Controllers
Prefix = profile.Prefix,
FirstName = profile.FirstName,
LastName = profile.LastName,
CitizenId = profile.CitizenId,
Root = profile.Root,
Child1 = profile.Child1,
Child2 = profile.Child2,
Child3 = profile.Child3,
Child4 = profile.Child4,
RootId = profile.RootId,
Child1Id = profile.Child1Id,
Child2Id = profile.Child2Id,
Child3Id = profile.Child3Id,
Child4Id = profile.Child4Id,
Gender = profile.Gender,
ProfileId = profile.Id,
ProfileType = profile.ProfileType,
};
var checkInStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >
@ -684,6 +698,23 @@ namespace BMA.EHR.Leave.Service.Controllers
Prefix = profile.Prefix,
FirstName = profile.FirstName,
LastName = profile.LastName,
CitizenId = profile.CitizenId,
Root = profile.Root,
Child1 = profile.Child1,
Child2 = profile.Child2,
Child3 = profile.Child3,
Child4 = profile.Child4,
RootId = profile.RootId,
Child1Id = profile.Child1Id,
Child2Id = profile.Child2Id,
Child3Id = profile.Child3Id,
Child4Id = profile.Child4Id,
Gender = profile.Gender,
ProfileId = profile.Id,
ProfileType = profile.ProfileType,
};
await _userTimeStampRepository.AddAsync(checkin);