Merge branch 'develop' into work
This commit is contained in:
commit
cee561e5cc
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,
|
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
||||||
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
||||||
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.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()
|
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3()
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
@ -363,7 +363,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
||||||
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
||||||
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.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()
|
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3()
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
@ -485,7 +485,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
||||||
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
||||||
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.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()
|
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3()
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
@ -649,7 +649,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
||||||
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
||||||
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.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()
|
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3()
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
|
||||||
|
|
@ -5897,6 +5897,19 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
#region " Override "
|
#region " Override "
|
||||||
|
|
||||||
public override async Task<Command?> GetByIdAsync(Guid id)
|
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>()
|
return await _dbContext.Set<Command>()
|
||||||
.Include(x => x.Placement)
|
.Include(x => x.Placement)
|
||||||
|
|
@ -5906,7 +5919,6 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
.Include(x => x.Receivers)
|
.Include(x => x.Receivers)
|
||||||
.Include(x => x.CommandStatus)
|
.Include(x => x.CommandStatus)
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<IReadOnlyList<Command>> GetAllAsync()
|
public override async Task<IReadOnlyList<Command>> GetAllAsync()
|
||||||
|
|
@ -5975,14 +5987,35 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var command = await _dbContext.Set<Command>()
|
Command command = null;
|
||||||
.Include(x => x.Receivers)
|
|
||||||
|
var c = await _dbContext.Set<Command>()
|
||||||
.Include(x => x.CommandType)
|
.Include(x => x.CommandType)
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
|
||||||
if (command == null)
|
if (c == null)
|
||||||
throw new Exception(GlobalMessages.CommandNotFound);
|
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 ap = (await GetReceiverForByCommndTypeAsync(command, token)).Where(x => selected.Contains(x.RefPlacementProfileId!.Value));
|
||||||
|
|
||||||
//var appointPeople = await _dbContext.Set<PlacementProfile>()
|
//var appointPeople = await _dbContext.Set<PlacementProfile>()
|
||||||
|
|
@ -6511,21 +6544,25 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
var profile = await _dbContext.Set<Profile>()
|
var profile = await _dbContext.Set<Profile>()
|
||||||
.Include(x => x.Salaries)
|
.Include(x => x.Salaries)
|
||||||
.FirstOrDefaultAsync(p => p.CitizenId == cmdReceiver.CitizenId);
|
.FirstOrDefaultAsync(p => p.CitizenId == cmdReceiver.CitizenId);
|
||||||
Double SalaryAmount = 0;
|
double? SalaryAmount = 0;
|
||||||
Double PositionSalaryAmount = 0;
|
double? PositionSalaryAmount = 0;
|
||||||
Double MonthSalaryAmount = 0;
|
double? MonthSalaryAmount = 0;
|
||||||
|
|
||||||
if (profile != null && profile.Salaries.Count() > 0)
|
if (profile != null && profile.Salaries.Count() > 0)
|
||||||
{
|
{
|
||||||
SalaryAmount = cmdReceiver.Amount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0;
|
SalaryAmount = cmdReceiver.Amount == null ? profile.Salaries == null ? 0 :
|
||||||
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0;
|
profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0 : 0;
|
||||||
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 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
|
return new PlacementSalaryResponse
|
||||||
{
|
{
|
||||||
SalaryAmount = cmdReceiver.Amount != null ? cmdReceiver.Amount.Value : SalaryAmount,
|
SalaryAmount = cmdReceiver.Amount != null ? cmdReceiver.Amount.Value : SalaryAmount ?? 0,
|
||||||
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount != null ? cmdReceiver.PositionSalaryAmount.Value : PositionSalaryAmount,
|
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount != null ? cmdReceiver.PositionSalaryAmount.Value : PositionSalaryAmount ?? 0,
|
||||||
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount != null ? cmdReceiver.MouthSalaryAmount.Value : MonthSalaryAmount,
|
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount != null ? cmdReceiver.MouthSalaryAmount.Value : MonthSalaryAmount ?? 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch
|
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