Merge branch 'develop' of github.com:Frappet/BMA-EHR-BackEnd into develop

This commit is contained in:
Kittapath 2023-12-24 15:06:11 +07:00
commit 1e574fcdee
4 changed files with 92 additions and 59 deletions

View file

@ -56,6 +56,23 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
#region " Methods " #region " Methods "
public async Task<List<Guid>> GetCheckInKeycloakId()
{
try
{
var data = await _dbContext.Set<ProcessUserTimeStamp>()
.Select(x => x.KeycloakUserId)
.Distinct()
.ToListAsync();
return data;
}
catch
{
throw;
}
}
public bool IsEditRequest(Guid userId, DateTime checkDate) public bool IsEditRequest(Guid userId, DateTime checkDate)
{ {
try try

View file

@ -80,6 +80,23 @@ namespace BMA.EHR.Application.Repositories
} }
} }
public async Task<List<Profile>> GetProfileWithKeycloak()
{
try
{
var data = await _dbContext.Set<Profile>().AsQueryable()
.Where(x => x.ProfileType == "officer")
.Where(x => x.KeycloakId != null)
.ToListAsync();
return data;
}
catch
{
throw;
}
}
public async Task<List<Profile>> SearchProfile(string? citizenId, string? firstName, string? lastName) public async Task<List<Profile>> SearchProfile(string? citizenId, string? firstName, string? lastName)
{ {
try try

View file

@ -698,7 +698,9 @@ namespace BMA.EHR.Leave.Service.Controllers
{ {
try try
{ {
var profile = await _userProfileRepository.SearchProfile(null, null, null); //var profile = await _userProfileRepository.SearchProfile(null, null, null);
var profile = await _userProfileRepository.GetProfileWithKeycloak();
var count = 1; var count = 1;
var employees = new List<dynamic>(); var employees = new List<dynamic>();
@ -1083,12 +1085,10 @@ namespace BMA.EHR.Leave.Service.Controllers
{ {
try try
{ {
var profile = await _userProfileRepository.SearchProfile(null, null, null); //var profile = await _userProfileRepository.SearchProfile(null, null, null);
var profile = await _userProfileRepository.GetProfileWithKeycloak();
var date = req.StartDate.Date;
var data = new List<dynamic>();
for (DateTime date = req.StartDate.Date; date.Date <= req.EndDate.Date; date = date.AddDays(1))
{
var employees = new List<dynamic>(); var employees = new List<dynamic>();
var count = 1; var count = 1;
foreach (var p in profile) foreach (var p in profile)
@ -1146,14 +1146,13 @@ namespace BMA.EHR.Leave.Service.Controllers
employees = employees employees = employees
}; };
data.Add(item);
}
var result = new var result = new
{ {
template = "TimeStamp", template = "TimeStamp",
reportName = "TimeStamp", reportName = "TimeStamp",
data = data data = item
}; };
return Success(result); return Success(result);

View file

@ -4,7 +4,7 @@ namespace BMA.EHR.Leave.Service.DTOs.Reports
{ {
public DateTime StartDate { get; set; } = DateTime.MinValue; public DateTime StartDate { get; set; } = DateTime.MinValue;
public DateTime EndDate { get; set; } = DateTime.MinValue; //public DateTime EndDate { get; set; } = DateTime.MinValue;
} }
} }