เพิ่มลูกจ้าง api อัพเดทสถานะ mark ระบบเครื่องราช (issue ##1344)
Some checks failed
release-dev / release-dev (push) Failing after 11s
Some checks failed
release-dev / release-dev (push) Failing after 11s
This commit is contained in:
parent
a2efb8d9af
commit
c832465e71
3 changed files with 60 additions and 53 deletions
|
|
@ -8868,48 +8868,44 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
public async Task UpdateInsigniaRequestProfile(string[] items, string type, Guid? periodId)
|
||||
public async Task UpdateInsigniaRequestProfile(string[] items, string type)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (type.Trim().ToUpper() == "OFFICER")
|
||||
var allProfiles = await _userProfileRepository.GetInsigniaRequestsProfileAsync(items, type, AccessToken);
|
||||
|
||||
if (allProfiles != null && allProfiles.Count > 0)
|
||||
{
|
||||
var allProfiles = await _userProfileRepository.GetInsigniaRequestsProfileAsync(items, type, AccessToken);
|
||||
var insigniaRequestProfiles = await _dbContext.Set<InsigniaRequestProfile>()
|
||||
.Where(x => allProfiles.Select(x => x.Id).ToList().Contains(x.ProfileId))
|
||||
.ToListAsync();
|
||||
|
||||
if (allProfiles != null && allProfiles.Count > 0)
|
||||
foreach (var insigniaRequestProfile in insigniaRequestProfiles)
|
||||
{
|
||||
var insigniaRequestProfiles = await _dbContext.Set<InsigniaRequestProfile>()
|
||||
.Where(x => allProfiles.Select(x => x.Id).ToList().Contains(x.ProfileId))
|
||||
.ToListAsync();
|
||||
var profile = allProfiles.FirstOrDefault(p => p.Id == insigniaRequestProfile.ProfileId);
|
||||
|
||||
foreach (var insigniaRequestProfile in insigniaRequestProfiles)
|
||||
if (profile != null)
|
||||
{
|
||||
var profile = allProfiles.FirstOrDefault(p => p.Id == insigniaRequestProfile.ProfileId);
|
||||
|
||||
if (profile != null)
|
||||
{
|
||||
insigniaRequestProfile.MarkDiscipline = profile?.MarkDiscipline;
|
||||
insigniaRequestProfile.MarkLeave = profile?.MarkLeave;
|
||||
insigniaRequestProfile.MarkRate = profile?.MarkRate;
|
||||
insigniaRequestProfile.MarkInsignia = profile?.MarkInsignia;
|
||||
}
|
||||
insigniaRequestProfile.MarkDiscipline = profile?.MarkDiscipline;
|
||||
insigniaRequestProfile.MarkLeave = profile?.MarkLeave;
|
||||
insigniaRequestProfile.MarkRate = profile?.MarkRate;
|
||||
insigniaRequestProfile.MarkInsignia = profile?.MarkInsignia;
|
||||
insigniaRequestProfile.APR1 = profile?.APR1;
|
||||
insigniaRequestProfile.APR2 = profile?.APR2;
|
||||
insigniaRequestProfile.APR3 = profile?.APR3;
|
||||
insigniaRequestProfile.APR4 = profile?.APR4;
|
||||
insigniaRequestProfile.APR5 = profile?.APR5;
|
||||
insigniaRequestProfile.OCT1 = profile?.OCT1;
|
||||
insigniaRequestProfile.OCT2 = profile?.OCT2;
|
||||
insigniaRequestProfile.OCT3 = profile?.OCT3;
|
||||
insigniaRequestProfile.OCT4 = profile?.OCT4;
|
||||
insigniaRequestProfile.OCT5 = profile?.OCT5;
|
||||
insigniaRequestProfile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
insigniaRequestProfile.LastUpdateUserId = UserId ?? "";
|
||||
insigniaRequestProfile.LastUpdatedAt = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
//else if (type.Trim().ToUpper() == "EMPLOYEE" && periodId != null)
|
||||
//{
|
||||
// var insigniaRequests = await _dbContext.Set<InsigniaRequest>()
|
||||
// .Where(x => x.Period.Id == periodId)
|
||||
// .ToListAsync();
|
||||
|
||||
// var allEmpProfileIds = new List<string>();
|
||||
// foreach (var insigniaRequest in insigniaRequests)
|
||||
// {
|
||||
// var orgRootId = insigniaRequest.Id.ToString();
|
||||
// var allEmpProfiles = await _userProfileRepository.GetInsigniaRequestsProfileEmpAsync(items, orgRootId, AccessToken);
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
|
|
|
|||
|
|
@ -8,16 +8,16 @@
|
|||
public bool? MarkRate { get; set; } = false;
|
||||
public bool? MarkInsignia { get; set; } = false;
|
||||
|
||||
public string? Apr1 { get; set; }
|
||||
public string? Apr2 { get; set; }
|
||||
public string? Apr3 { get; set; }
|
||||
public string? Apr4 { get; set; }
|
||||
public string? Apr5 { get; set; }
|
||||
public string? APR1 { get; set; }
|
||||
public string? APR2 { get; set; }
|
||||
public string? APR3 { get; set; }
|
||||
public string? APR4 { get; set; }
|
||||
public string? APR5 { get; set; }
|
||||
|
||||
public string? Oct1 { get; set; }
|
||||
public string? Oct2 { get; set; }
|
||||
public string? Oct3 { get; set; }
|
||||
public string? Oct4 { get; set; }
|
||||
public string? Oct5 { get; set; }
|
||||
public string? OCT1 { get; set; }
|
||||
public string? OCT2 { get; set; }
|
||||
public string? OCT3 { get; set; }
|
||||
public string? OCT4 { get; set; }
|
||||
public string? OCT5 { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2728,28 +2728,39 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
if (insigniaPeriod.InsigniaRequests.Count > 0)
|
||||
{
|
||||
var allProfileIds = new List<string>();
|
||||
//var allProfileIds = new List<string>();
|
||||
//var allProfileEmpIds = new List<string>();
|
||||
foreach (var InsigniaRequest in insigniaPeriod.InsigniaRequests)
|
||||
{
|
||||
var profiles = await _context.Set<InsigniaRequestProfile>()
|
||||
.Where(p => p.Request.Id == InsigniaRequest.Id && p.ProfileType.Trim().ToUpper() == "OFFICER").Select(x => x.ProfileId.ToString()).ToListAsync();
|
||||
|
||||
if (profiles != null && profiles.Count > 0)
|
||||
var profileEmps = await _context.Set<InsigniaRequestProfile>()
|
||||
.Where(p => p.Request.Id == InsigniaRequest.Id && p.ProfileType.Trim().ToUpper() == "EMPLOYEE").Select(x => x.ProfileId.ToString()).ToListAsync();
|
||||
|
||||
if (profiles.Count > 0)
|
||||
{
|
||||
allProfileIds.AddRange(profiles);
|
||||
//allProfileIds.AddRange(profiles);
|
||||
await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(profiles.ToArray(), "OFFICER");
|
||||
}
|
||||
|
||||
if (profileEmps.Count > 0)
|
||||
{
|
||||
//allProfileEmpIds.AddRange(profileEmps);
|
||||
await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(profileEmps.ToArray(), "EMPLOYEE");
|
||||
}
|
||||
}
|
||||
|
||||
if (allProfileIds.Count > 0)
|
||||
{
|
||||
await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(allProfileIds.ToArray(), "OFFICER", null);
|
||||
}
|
||||
}
|
||||
//if (allProfileIds.Count > 0)
|
||||
//{
|
||||
// await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(allProfileIds.ToArray(), "OFFICER");
|
||||
//}
|
||||
|
||||
//if (insigniaPeriod.InsigniaEmployees.Count > 0)
|
||||
//{
|
||||
// await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(insigniaPeriod.InsigniaEmployees.Select(x => x.RefId!.ValueOrBlank()).ToArray(), "EMPLOYEE", insigniaPeriod.Id);
|
||||
//}
|
||||
//if (allProfileEmpIds.Count > 0)
|
||||
//{
|
||||
// await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(allProfileEmpIds.ToArray(), "EMPLOYEE");
|
||||
//}
|
||||
}
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue