From 509aefabffcb81eca7604494e55055106c468a80 Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Tue, 2 Jul 2024 05:37:00 +0700 Subject: [PATCH] fix preview invoice api --- .../Controllers/InsigniaRequestController.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs b/BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs index 5eb000a7..34b490f8 100644 --- a/BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs +++ b/BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs @@ -2228,6 +2228,8 @@ namespace BMA.EHR.Insignia.Service.Controllers { if (item.CitizanId == null) continue; var pf = _userProfileRepository.GetOfficerProfileByCitizenId(item.CitizanId, AccessToken); + + if (pf == null) continue; var profile = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.ProfileId == pf.Id); if (profile == null) continue; @@ -2243,11 +2245,11 @@ namespace BMA.EHR.Insignia.Service.Controllers new { profile.Id, - Prefix = _userProfileRepository.GetOfficerProfileById(profile.Id, AccessToken).Prefix, - Position = _userProfileRepository.GetOfficerProfileById(profile.Id, AccessToken).Position, - _userProfileRepository.GetOfficerProfileById(profile.Id, AccessToken).CitizenId, - _userProfileRepository.GetOfficerProfileById(profile.Id, AccessToken).ProfileType, - FullName = $"{_userProfileRepository.GetOfficerProfileById(profile.Id, AccessToken).Prefix}{_userProfileRepository.GetOfficerProfileById(profile.Id, AccessToken).FirstName} {_userProfileRepository.GetOfficerProfileById(profile.Id, AccessToken).LastName}", + Prefix = pf.Prefix, + Position = pf.Position, + pf.CitizenId, + pf.ProfileType, + FullName = $"{pf.Prefix}{pf.FirstName} {pf.LastName}", RequestInsignia = profile.RequestInsignia == null ? null : profile.RequestInsignia.Name, RequestInsigniaId = profile.RequestInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : profile.RequestInsignia.Id, RequestInsigniaShortName = profile.RequestInsignia == null ? null : profile.RequestInsignia.ShortName,