fix : Insignia Request Controlle

(แสดงข้อมูลของผู้ขอ)
This commit is contained in:
Suphonchai Phoonsawat 2024-06-30 14:23:23 +07:00
parent cdfb282c32
commit da6e4acc52
2 changed files with 457 additions and 432 deletions

View file

@ -971,7 +971,7 @@ namespace BMA.EHR.Application.Repositories
var s2 = (from p in allProfilesByRoot
where p.PosType.PosTypeName == "ทั่วไป"
&& p.PosLevel.PosLevelName == "ปฏิบัติงาน"
&& p.ProfileInsignia != null
&& p.ProfileInsignia != null
&& p.ProfileInsignia.Count > 0
&& p.ProfileInsignia.Where(x => x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา").Id)
.OrderByDescending(x => x.Year)
@ -1521,7 +1521,7 @@ namespace BMA.EHR.Application.Repositories
PosNo = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? "" : p.ProfileSalary!.OrderByDescending(x => x.Order).FirstOrDefault()!.PosNo,
Gender = p.Gender == null ? null : p.Gender,
IsHigherLevel = p.ProfileInsignia.Where(x => x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา").Id).FirstOrDefault() == null ? true :
IsHigherLevel = p.ProfileInsignia.Where(x => x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา").Id).FirstOrDefault() == null ? true :
IsHigherLevel(GetInsigniaById(p.ProfileInsignia
.Where(x => x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา").Id)
.OrderByDescending(x => x.Year)
@ -1532,7 +1532,7 @@ namespace BMA.EHR.Application.Repositories
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "อาวุโส").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "อาวุโส").OrderBy(p => p.Date).FirstOrDefault().Date
p.ProfileSalary.Where(x => x.PositionLevel == "อาวุโส").OrderBy(p => p.Date).FirstOrDefault().Date
})
.ToList()
.Select(p => new InsigniaResultSet
@ -1741,7 +1741,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "อาวุโส").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "อาวุโส").OrderBy(p => p.Date).FirstOrDefault().Date
})
@ -2173,7 +2173,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ชำนาญการ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ชำนาญการ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ชำนาญการ").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ประถมาภรณ์มงกุฎไทย").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -2560,7 +2560,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ชำนาญการพิเศษ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ชำนาญการพิเศษ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ชำนาญการพิเศษ").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ทวีติยาภรณ์ช้างเผือก").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -2785,7 +2785,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "เชี่ยวชาญ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "เชี่ยวชาญ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "เชี่ยวชาญ").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ทวีติยาภรณ์ช้างเผือก").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -2862,7 +2862,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "เชี่ยวชาญ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "เชี่ยวชาญ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "เชี่ยวชาญ").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ประถมาภรณ์ช้างเผือก").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -3106,7 +3106,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ทรงคุณวุฒิ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ทรงคุณวุฒิ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ทรงคุณวุฒิ").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ประถมาภรณ์ช้างเผือก").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -3357,7 +3357,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ทรงคุณวุฒิ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ทรงคุณวุฒิ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ทรงคุณวุฒิ").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ประถมาภรณ์มงกุฎไทย").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -3439,7 +3439,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "อาวุโส").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "อาวุโส").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "อาวุโส").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ประถมาภรณ์ช้างเผือก").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -3762,7 +3762,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ต้น" && x.PositionType == "อำนวยการ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ต้น" && x.PositionType == "อำนวยการ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ต้น" && x.PositionType == "อำนวยการ").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ทวีติยาภรณ์ช้างเผือก").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -3907,7 +3907,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "อำนวยการ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "อำนวยการ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "อำนวยการ").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ทวีติยาภรณ์ช้างเผือก").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -3984,7 +3984,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "อำนวยการ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "อำนวยการ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "อำนวยการ").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ประถมาภรณ์มงกุฎไทย").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -4062,7 +4062,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "อำนวยการ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "อำนวยการ").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "อำนวยการ").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ประถมาภรณ์ช้างเผือก").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -4223,7 +4223,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ต้น" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ต้น" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ต้น" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ทวีติยาภรณ์ช้างเผือก").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -4300,7 +4300,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ต้น" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ต้น" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ต้น" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ประถมาภรณ์มงกุฎไทย").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -4377,7 +4377,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ต้น" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ต้น" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "ต้น" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ประถมาภรณ์ช้างเผือก").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -4507,7 +4507,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ประถมาภรณ์มงกุฎไทย").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -4589,7 +4589,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("ประถมาภรณ์ช้างเผือก").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -4671,7 +4671,7 @@ namespace BMA.EHR.Application.Repositories
PositionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
PositionType = p.PosType == null ? "" : p.PosType.PosTypeName,
FirstPositonLevelDate = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault() == null ? null :
p.ProfileSalary.Where(x => x.PositionLevel == "สูง" && x.PositionType == "บริหาร").OrderBy(p => p.Date).FirstOrDefault().Date,
FirstRecvInsigniaYear = p.ProfileInsignia.Count == 0 ? 0 :
p.ProfileInsignia.Where(x => x.InsigniaId.Value == GetInsigniaByName("มหาวชิรมงกุฎ").Id).OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
@ -5288,7 +5288,7 @@ namespace BMA.EHR.Application.Repositories
var result_candidate = new List<InsigniaResultSet>();
if (ocId != Guid.Parse("e8493cd1-d371-402e-add6-566e68d5d1b3")) return result_candidate;
//if (ocId != Guid.Parse("e8493cd1-d371-402e-add6-566e68d5d1b3")) return result_candidate;
var type_coin = await GetCoinCandidate(periodId, ocId);
var employee_type1 = await GetEmployeeInsignia_Type1(periodId, ocId);
@ -5528,11 +5528,11 @@ namespace BMA.EHR.Application.Repositories
GetInsigniaById(p.ProfileInsignia.Where(x => x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา").Id).OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId.Value).Id,
Salary = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : p.ProfileSalary!.OrderByDescending(x => x.Order).FirstOrDefault()!.Amount,
//SalaryCondition = p.ProfileSalary == null ? 0 : p.ProfileSalary.Amount,
SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 :
SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 :
p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault() != null ?
p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount :
p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount :
p.ProfileSalary.OrderBy(x => x.Order).FirstOrDefault().Amount,
PostionSalaryAmount = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 :
PostionSalaryAmount = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 :
p.ProfileSalary!.OrderByDescending(x => x.Order).FirstOrDefault()!.PositionSalaryAmount,
});
@ -5768,46 +5768,20 @@ namespace BMA.EHR.Application.Repositories
var id = await GetRequestId(period, ocId);
if (id != null)
{
var result = (_dbContext.Set<InsigniaRequestProfile>()
.Include(x => x.Request)
.Include(x => x.RequestInsignia)
.ThenInclude(x => x.InsigniaType)
//.Include(x => x.Profile)
//.ThenInclude(x => x.Salaries)
//.Include(x => x.Profile)
//.ThenInclude(x => x.Position)
//.Include(x => x.Profile)
//.ThenInclude(x => x.PositionEmployeePosition)
//.Include(x => x.Profile)
//.ThenInclude(x => x.PosNo)
//.Include(x => x.Profile)
//.ThenInclude(x => x.PositionLevel)
//.Include(x => x.Profile)
//.ThenInclude(x => x.PositionType)
//.Include(x => x.Profile)
//.ThenInclude(x => x.Prefix)
////.Include(x => x.Profile)
////.ThenInclude(x => x.OrganizationOrganization)
//.Include(x => x.Profile)
//.ThenInclude(x => x.PositionLevel)
//.Include(x => x.Profile)
//.ThenInclude(x => x.Insignias)
//.ThenInclude(x => x.Insignia)
.Where(h => status.Trim().ToUpper() == "ALL" ? h.Status != null : h.Status == status.Trim().ToUpper())
.Where(h => h.Request.Id == id)
.ToList()
.Select(h => new InsigniaRequestItem
var raw_result = _dbContext.Set<InsigniaRequestProfile>()
.Include(x => x.Request)
.Include(x => x.RequestInsignia)
.ThenInclude(x => x.InsigniaType)
.Where(h => status.Trim().ToUpper() == "ALL" ? h.Status != null : h.Status == status.Trim().ToUpper())
.Where(h => h.Request.Id == id)
.ToList();
var pre_result = raw_result
.Select(h => new
{
Id = h.Id,
CitizenId = _userProfileRepository.GetOfficerProfileById(h.ProfileId, AccessToken).CitizenId,
ProfileId = _userProfileRepository.GetOfficerProfileById(h.ProfileId, AccessToken).Id,
ProfileType = _userProfileRepository.GetOfficerProfileById(h.ProfileId, AccessToken).ProfileType,
FullName = $"{_userProfileRepository.GetOfficerProfileById(h.ProfileId, AccessToken).Prefix}{_userProfileRepository.GetOfficerProfileById(h.ProfileId, AccessToken).FirstName} {_userProfileRepository.GetOfficerProfileById(h.ProfileId, AccessToken).LastName}",
Position = _userProfileRepository.GetOfficerProfileById(h.ProfileId, AccessToken).Position,
PosNo = _userProfileRepository.GetOfficerProfileById(h.ProfileId, AccessToken).ProfileSalary.OrderByDescending(x => x.Order).FirstOrDefault().PosNo,
Rank = _userProfileRepository.GetOfficerProfileById(h.ProfileId, AccessToken).ProfileSalary.OrderByDescending(x => x.Order).FirstOrDefault().PositionLevel,
Salary = _userProfileRepository.GetOfficerProfileById(h.ProfileId, AccessToken).ProfileSalary.OrderByDescending(x => x.Order).FirstOrDefault().Amount.ToString(),
LastInsignia = GetInsigniaById(_userProfileRepository.GetOfficerProfileById(h.ProfileId, AccessToken).ProfileInsignia.OrderByDescending(x => x.Year).FirstOrDefault().Id.Value).Name,
Profile = _userProfileRepository.GetOfficerProfileById(h.ProfileId, AccessToken),
RequestInsignia = h.RequestInsignia.Name,
RequestInsigniaShortName = h.RequestInsignia.ShortName,
Level = h.RequestInsignia.InsigniaType.Name,
@ -5820,7 +5794,40 @@ namespace BMA.EHR.Application.Repositories
MarkLeave = h.MarkLeave,
MarkRate = h.MarkRate,
// Docs = GetDocFile(h.Profile.Id),
MatchingConditions = h.MatchingConditions == null ? null : JsonConvert.DeserializeObject<List<MatchingCondition>>(h.MatchingConditions)
MatchingConditions = h.MatchingConditions == null || h.MatchingConditions == "" ? null : JsonConvert.DeserializeObject<List<MatchingCondition>>(h.MatchingConditions)
})
.ToList();
var result = (pre_result
.Select(h => new InsigniaRequestItem
{
Id = h.Id,
CitizenId = h.Profile.CitizenId,
ProfileId = h.Profile.Id,
ProfileType = h.Profile.ProfileType,
FullName = $"{h.Profile.Prefix}{h.Profile.FirstName} {h.Profile.LastName}",
Position = h.Profile.Position,
PosNo = h.Profile.ProfileSalary == null || h.Profile.ProfileSalary.Count == 0 ? "" :
h.Profile.ProfileSalary.OrderByDescending(x => x.Order).FirstOrDefault().PosNo,
Rank = h.Profile.PosLevel.PosLevelName,
Salary = h.Profile.ProfileSalary == null || h.Profile.ProfileSalary.Count == 0 ? "0" :
h.Profile.ProfileSalary.OrderByDescending(x => x.Order).FirstOrDefault().Amount.ToString(),
LastInsignia = h.Profile.ProfileInsignia == null || h.Profile.ProfileInsignia.Count == 0 ? "" :
GetInsigniaById(h.Profile.ProfileInsignia.OrderByDescending(x => x.Year).FirstOrDefault().Id.Value).Name,
RequestInsignia = h.RequestInsignia,
RequestInsigniaShortName = h.RequestInsigniaShortName,
Level = h.Level,
IsApprove = h.IsApprove,
RequestDate = h.RequestDate,
Status = h.Status,
RequestNote = h.RequestNote,
Reason = h.Reason,
MarkDiscipline = h.MarkDiscipline,
MarkLeave = h.MarkLeave,
MarkRate = h.MarkRate,
// Docs = GetDocFile(h.Profile.Id),
MatchingConditions = h.MatchingConditions
})).ToList();
return result;