fix defect

This commit is contained in:
Suphonchai Phoonsawat 2023-11-16 13:42:49 +07:00
parent 5cd20a0b47
commit b59d00925f

View file

@ -343,7 +343,7 @@ namespace BMA.EHR.Leave.Service.Controllers
EndTimeAfternoon = duty == null ? "00:00" : duty.EndTimeAfternoon,
Description = duty == null ? "-" : duty.Description,
CheckInTime = data.CheckIn,
CheckInId = data.Id,
CheckInId = data.CheckOut == null ? data.Id : null,
};
}
@ -382,7 +382,7 @@ namespace BMA.EHR.Leave.Service.Controllers
var currentCheckIn = await _userTimeStampRepository.GetTimestampByDateAsync(Guid.Parse(UserId), currentDate);
if (currentCheckIn != null)
{
throw new Exception("ไม่สามารถลงเวลาได้ เนืองจากมีการลงเวลาในวันนี้แล้ว!");
return Error(new Exception("ไม่สามารถลงเวลาได้ เนืองจากมีการลงเวลาในวันนี้แล้ว!"), (int)StatusCodes.Status400BadRequest);
}
@ -419,7 +419,7 @@ namespace BMA.EHR.Leave.Service.Controllers
}
else
{
throw new Exception(GlobalMessages.DataNotFound);
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
}
}
@ -447,7 +447,7 @@ namespace BMA.EHR.Leave.Service.Controllers
if (duty == null)
{
throw new Exception(GlobalMessages.DataNotFound);
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
}
var checkin_base = DateTime.Parse($"{DateTime.Now.ToString("yyyy-MM-dd")} {duty.StartTimeMorning}");