แก้ไขหมาย้หตุคำสั่ง

This commit is contained in:
Kittapath 2023-10-02 19:51:38 +07:00
parent a76ba4270f
commit ccf19c5683
21 changed files with 16530 additions and 70 deletions

View file

@ -202,7 +202,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
};
seq++;
result.Add(receiver);
@ -267,7 +267,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
};
seq++;
@ -333,7 +333,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
};
seq++;
@ -398,7 +398,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
};
seq++;
@ -459,7 +459,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -519,7 +520,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -579,7 +581,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -639,7 +642,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -699,7 +703,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -751,7 +756,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = p1.prefix!,
FirstName = p1.firstName!,
LastName = p1.lastName!,
RefPlacementProfileId = p1.profileId
RefPlacementProfileId = p1.profileId,
};
seq++;
result.Add(receiver);
@ -780,7 +785,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = p2.prefix!,
FirstName = p2.firstName!,
LastName = p2.lastName!,
RefPlacementProfileId = p2.profileId
RefPlacementProfileId = p2.profileId,
};
seq++;
result.Add(receiver);
@ -809,7 +814,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = p3.prefix!,
FirstName = p3.firstName!,
LastName = p3.lastName!,
RefPlacementProfileId = p3.profileId
RefPlacementProfileId = p3.profileId,
};
seq++;
result.Add(receiver);
@ -862,7 +867,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = pf.Prefix!.Name,
FirstName = pf.FirstName!,
LastName = pf.LastName!,
RefPlacementProfileId = pf.Id
RefPlacementProfileId = pf.Id,
};
seq++;
@ -920,7 +925,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = pf.Prefix!.Name,
FirstName = pf.FirstName!,
LastName = pf.LastName!,
RefPlacementProfileId = pf.Id
RefPlacementProfileId = pf.Id,
};
seq++;
@ -979,7 +984,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1037,7 +1043,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1094,7 +1101,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1151,7 +1159,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1208,7 +1217,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1265,7 +1275,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1322,7 +1333,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1379,7 +1391,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1436,7 +1449,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
};
seq++;
@ -6644,21 +6657,18 @@ namespace BMA.EHR.Application.Repositories.Commands
double? PositionSalaryAmount = 0;
double? MonthSalaryAmount = 0;
if (profile != null && profile.Salaries.Count() > 0)
if (profile != null && profile.Salaries != null && profile.Salaries.Count() > 0)
{
SalaryAmount = cmdReceiver.Amount == null ? profile.Salaries == null ? 0 :
profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0 : 0;
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount == null ? profile.Salaries == null ? 0 :
profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0 : 0;
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount == null ? profile.Salaries == null ? 0 :
profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 0 : 0;
SalaryAmount = profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0;
PositionSalaryAmount = profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0;
MonthSalaryAmount = profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 0;
}
return new PlacementSalaryResponse
{
SalaryAmount = cmdReceiver.Amount != null ? cmdReceiver.Amount.Value : SalaryAmount ?? 0,
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount != null ? cmdReceiver.PositionSalaryAmount.Value : PositionSalaryAmount ?? 0,
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount != null ? cmdReceiver.MouthSalaryAmount.Value : MonthSalaryAmount ?? 0,
SalaryAmount = cmdReceiver.Amount != null && cmdReceiver.Amount != 0 ? cmdReceiver.Amount.Value : SalaryAmount ?? 0,
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount != null && cmdReceiver.PositionSalaryAmount != 0 ? cmdReceiver.PositionSalaryAmount.Value : PositionSalaryAmount ?? 0,
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount != null && cmdReceiver.MouthSalaryAmount != 0 ? cmdReceiver.MouthSalaryAmount.Value : MonthSalaryAmount ?? 0,
};
}
catch
@ -6685,16 +6695,16 @@ namespace BMA.EHR.Application.Repositories.Commands
Double MonthSalaryAmount = 0;
if (profile != null && profile.Salaries.Count() > 0)
{
SalaryAmount = placementProfile.Amount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0;
PositionSalaryAmount = placementProfile.PositionSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0;
MonthSalaryAmount = placementProfile.MouthSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 0;
SalaryAmount = placementProfile.Amount == null || placementProfile.Amount == 0 ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0;
PositionSalaryAmount = placementProfile.PositionSalaryAmount == null || placementProfile.PositionSalaryAmount == 0 ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0;
MonthSalaryAmount = placementProfile.MouthSalaryAmount == null || placementProfile.MouthSalaryAmount == 0 ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 0;
}
return new PlacementSalaryResponse
{
SalaryAmount = placementProfile.Amount != null ? placementProfile.Amount.Value : SalaryAmount,
PositionSalaryAmount = placementProfile.PositionSalaryAmount != null ? placementProfile.PositionSalaryAmount.Value : PositionSalaryAmount,
MonthSalaryAmount = placementProfile.MouthSalaryAmount != null ? placementProfile.MouthSalaryAmount.Value : MonthSalaryAmount,
SalaryAmount = placementProfile.Amount != null && placementProfile.Amount != 0 ? placementProfile.Amount.Value : SalaryAmount,
PositionSalaryAmount = placementProfile.PositionSalaryAmount != null && placementProfile.PositionSalaryAmount != 0 ? placementProfile.PositionSalaryAmount.Value : PositionSalaryAmount,
MonthSalaryAmount = placementProfile.MouthSalaryAmount != null && placementProfile.MouthSalaryAmount != 0 ? placementProfile.MouthSalaryAmount.Value : MonthSalaryAmount,
};
}