Merge branch 'develop' into work
This commit is contained in:
commit
90f7c20688
8 changed files with 54 additions and 17 deletions
|
|
@ -306,7 +306,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
||||
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
||||
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name,
|
||||
NewSalary = p.Amount == null ? 0 : p.Amount.Value,
|
||||
NewSalary = r.Amount == null ? 0 : r.Amount.Value,
|
||||
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3()
|
||||
})
|
||||
.ToList();
|
||||
|
|
@ -363,7 +363,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
||||
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
||||
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name,
|
||||
NewSalary = p.Amount == null ? 0 : p.Amount.Value,
|
||||
NewSalary = r.Amount == null ? 0 : r.Amount.Value,
|
||||
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3()
|
||||
})
|
||||
.ToList();
|
||||
|
|
@ -485,7 +485,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
||||
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
||||
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name,
|
||||
NewSalary = p.Amount == null ? 0 : p.Amount.Value,
|
||||
NewSalary = r.Amount == null ? 0 : r.Amount.Value,
|
||||
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3()
|
||||
})
|
||||
.ToList();
|
||||
|
|
@ -649,7 +649,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
||||
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
||||
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name,
|
||||
NewSalary = p.Amount == null ? 0 : p.Amount.Value,
|
||||
NewSalary = r.Amount == null ? 0 : r.Amount.Value,
|
||||
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3()
|
||||
})
|
||||
.ToList();
|
||||
|
|
|
|||
|
|
@ -5897,6 +5897,19 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
#region " Override "
|
||||
|
||||
public override async Task<Command?> GetByIdAsync(Guid id)
|
||||
{
|
||||
return await _dbContext.Set<Command>()
|
||||
.Include(x => x.Placement)
|
||||
.Include(x => x.CommandType)
|
||||
//.Include(x => x.Documents)
|
||||
//.ThenInclude(x => x.Document) //--REmove
|
||||
.Include(x => x.Receivers)
|
||||
.Include(x => x.CommandStatus)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
}
|
||||
|
||||
public async Task<Command?> GetByIdWithPlacementAsync(Guid id)
|
||||
{
|
||||
return await _dbContext.Set<Command>()
|
||||
.Include(x => x.Placement)
|
||||
|
|
@ -5906,7 +5919,6 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
.Include(x => x.Receivers)
|
||||
.Include(x => x.CommandStatus)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
}
|
||||
|
||||
public override async Task<IReadOnlyList<Command>> GetAllAsync()
|
||||
|
|
@ -5975,14 +5987,35 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
try
|
||||
{
|
||||
var command = await _dbContext.Set<Command>()
|
||||
.Include(x => x.Receivers)
|
||||
Command command = null;
|
||||
|
||||
var c = await _dbContext.Set<Command>()
|
||||
.Include(x => x.CommandType)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
if (command == null)
|
||||
if (c == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
switch (c.CommandType.CommandCode.ToUpper())
|
||||
{
|
||||
case "C-PM-01":
|
||||
case "C-PM-02":
|
||||
case "C-PM-03":
|
||||
case "C-PM-04":
|
||||
command = await _dbContext.Set<Command>()
|
||||
.Include(x => x.Placement)
|
||||
.Include(x => x.Receivers)
|
||||
.Include(x => x.CommandType)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
break;
|
||||
default:
|
||||
command = await _dbContext.Set<Command>()
|
||||
.Include(x => x.Receivers)
|
||||
.Include(x => x.CommandType)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
break;
|
||||
}
|
||||
|
||||
var ap = (await GetReceiverForByCommndTypeAsync(command, token)).Where(x => selected.Contains(x.RefPlacementProfileId!.Value));
|
||||
|
||||
//var appointPeople = await _dbContext.Set<PlacementProfile>()
|
||||
|
|
@ -6511,21 +6544,25 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var profile = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Salaries)
|
||||
.FirstOrDefaultAsync(p => p.CitizenId == cmdReceiver.CitizenId);
|
||||
Double SalaryAmount = 0;
|
||||
Double PositionSalaryAmount = 0;
|
||||
Double MonthSalaryAmount = 0;
|
||||
double? SalaryAmount = 0;
|
||||
double? PositionSalaryAmount = 0;
|
||||
double? MonthSalaryAmount = 0;
|
||||
|
||||
if (profile != null && profile.Salaries.Count() > 0)
|
||||
{
|
||||
SalaryAmount = cmdReceiver.Amount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0;
|
||||
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0;
|
||||
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 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;
|
||||
}
|
||||
|
||||
return new PlacementSalaryResponse
|
||||
{
|
||||
SalaryAmount = cmdReceiver.Amount != null ? cmdReceiver.Amount.Value : SalaryAmount,
|
||||
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount != null ? cmdReceiver.PositionSalaryAmount.Value : PositionSalaryAmount,
|
||||
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount != null ? cmdReceiver.MouthSalaryAmount.Value : MonthSalaryAmount,
|
||||
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,
|
||||
};
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue