From 7edd71e4046b05d61ffbae00198a90144083b125 Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Sat, 2 Sep 2023 21:11:42 +0700 Subject: [PATCH] fix Bug Get Receiver Salary --- .../Repositories/Commands/CommandRepository.cs | 7 ++++++- BMA.EHR.Command.Service/Controllers/OrderController.cs | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs index f51fbfdf..1807cf3f 100644 --- a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs +++ b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs @@ -2421,7 +2421,12 @@ namespace BMA.EHR.Application.Repositories.Commands .FirstOrDefaultAsync(x => x.Id == recordId); if (cmdReceiver == null) - throw new Exception($"Invalid command receiver: {recordId}"); + return new PlacementSalaryResponse + { + SalaryAmount = 0, + PositionSalaryAmount = 0, + MonthSalaryAmount = 0 + }; return new PlacementSalaryResponse { diff --git a/BMA.EHR.Command.Service/Controllers/OrderController.cs b/BMA.EHR.Command.Service/Controllers/OrderController.cs index 3cbcc9ab..6de87780 100644 --- a/BMA.EHR.Command.Service/Controllers/OrderController.cs +++ b/BMA.EHR.Command.Service/Controllers/OrderController.cs @@ -2643,7 +2643,7 @@ namespace BMA.EHR.Command.Service.Controllers { foreach (var r in receivers) { - var salary = await _repository.GetCommandReceiverSalary(r.RefRecordId); + var salary = await _repository.GetCommandReceiverSalary(r.PersonalId); r.SalaryAmount = salary.SalaryAmount; r.PositionSalaryAmount = salary.PositionSalaryAmount; r.MonthSalaryAmount = salary.MonthSalaryAmount; @@ -2715,7 +2715,7 @@ namespace BMA.EHR.Command.Service.Controllers { foreach (var r in receivers) { - var salary = await _repository.GetCommandReceiverSalary(r.RefRecordId); + var salary = await _repository.GetCommandReceiverSalary(r.PersonalId); r.SalaryAmount = salary.SalaryAmount; r.PositionSalaryAmount = salary.PositionSalaryAmount; r.MonthSalaryAmount = salary.MonthSalaryAmount;