insignia note

This commit is contained in:
Suphonchai Phoonsawat 2024-10-16 10:47:06 +07:00
parent 15cb83db64
commit 6b680cb9dd

View file

@ -8,6 +8,7 @@ using BMA.EHR.Domain.Models.Insignias;
using BMA.EHR.Domain.Models.MetaData; using BMA.EHR.Domain.Models.MetaData;
using BMA.EHR.Domain.Shared; using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.MessageQueue; using BMA.EHR.Infrastructure.MessageQueue;
using BMA.EHR.Infrastructure.Migrations.LeaveDb;
using BMA.EHR.Infrastructure.Persistence; using BMA.EHR.Infrastructure.Persistence;
using BMA.EHR.Insignia.Service.Requests; using BMA.EHR.Insignia.Service.Requests;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
@ -1164,7 +1165,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
LastUpdatedAt = DateTime.Now, LastUpdatedAt = DateTime.Now,
// Add Information for reused in API Call // Add Information for reused in API Call
ProfileType = "officer", ProfileType = profile.ProfileType ?? "officer",
Prefix = profile.Prefix, Prefix = profile.Prefix,
FirstName = profile.FirstName, FirstName = profile.FirstName,
LastName = profile.LastName, LastName = profile.LastName,
@ -1316,6 +1317,24 @@ namespace BMA.EHR.Insignia.Service.Controllers
LastUpdateFullName = FullName ?? "System Administrator", LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "", LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now, LastUpdatedAt = DateTime.Now,
// Add Information for reused in API Call
ProfileType = profileOld.ProfileType ?? "officer",
Prefix = profileOld.Prefix,
FirstName = profileOld.FirstName,
LastName = profileOld.LastName,
CitizenId = profileOld.CitizenId,
BirthDate = profileOld.BirthDate,
DateAppoint = profileOld.DateAppoint,
Position = profileOld.Position,
Gender = profileOld.Gender,
PosTypeName = profileOld.PosTypeName,
PosLevelName = profileOld.PosLevelName,
PosNo = profileOld.PosNo,
Amount = profileOld.Amount,
PositionSalaryAmount = profileOld.PositionSalaryAmount,
}); });
} }
} }
@ -1769,12 +1788,20 @@ namespace BMA.EHR.Insignia.Service.Controllers
.Select(x => new .Select(x => new
{ {
Id = x.Id, Id = x.Id,
Profile = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken),
Prefix = x.Prefix,
FirstName = x.FirstName,
LastName = x.LastName,
CitizenId = x.CitizenId,
Positon = x.Position ?? "",
ProfileType = x.ProfileType,
//Profile = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken),
//Prefix = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).Prefix, //Prefix = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).Prefix,
//Position = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).Position, //Position = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).Position,
//ProfileType = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).ProfileType, //ProfileType = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).ProfileType,
OcId = Guid.Empty, OcId = Guid.Empty,
CitizenId = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).CitizenId, //CitizenId = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).CitizenId,
//FullName = $"{_userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).Prefix}{_userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).FirstName} {_userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).LastName}", //FullName = $"{_userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).Prefix}{_userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).FirstName} {_userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).LastName}",
RequestInsignia = x.RequestInsignia.Name, RequestInsignia = x.RequestInsignia.Name,
RequestInsigniaId = x.RequestInsignia.Id, RequestInsigniaId = x.RequestInsignia.Id,
@ -1798,11 +1825,11 @@ namespace BMA.EHR.Insignia.Service.Controllers
var _insigniaNoteProfile = new var _insigniaNoteProfile = new
{ {
insigniaNoteProfile.Id, insigniaNoteProfile.Id,
Prefix = insigniaNoteProfile.Profile is not null ? insigniaNoteProfile.Profile.Prefix : "", Prefix = insigniaNoteProfile.Prefix ?? "",
Position = insigniaNoteProfile.Profile is not null ? insigniaNoteProfile.Profile.Position : "", Position = insigniaNoteProfile.Positon,
insigniaNoteProfile.CitizenId, insigniaNoteProfile.CitizenId,
ProfileType = insigniaNoteProfile.Profile is not null ? insigniaNoteProfile.Profile.ProfileType : "", ProfileType = insigniaNoteProfile.ProfileType ?? "",
FullName = insigniaNoteProfile.Profile is not null ? $"{insigniaNoteProfile.Profile.Prefix}{insigniaNoteProfile.Profile.FirstName} {insigniaNoteProfile.Profile.LastName}" : "", FullName = $"{insigniaNoteProfile.Prefix ?? ""}{insigniaNoteProfile.FirstName ?? ""} {insigniaNoteProfile.LastName ?? ""}",
insigniaNoteProfile.RequestInsignia, insigniaNoteProfile.RequestInsignia,
insigniaNoteProfile.RequestInsigniaId, insigniaNoteProfile.RequestInsigniaId,
insigniaNoteProfile.RequestInsigniaShortName, insigniaNoteProfile.RequestInsigniaShortName,