fix : Insignia Request Controlle
(แสดงข้อมูลของผู้ขอ)
This commit is contained in:
parent
cdfb282c32
commit
da6e4acc52
2 changed files with 457 additions and 432 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -422,10 +422,12 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
var result = await _repository.GetInsigniaRequest(insigniaPeriodId, ocId);
|
||||
if (result != null)
|
||||
{
|
||||
// Guid period = result.PeriodId;
|
||||
// var periodName = result.Name;
|
||||
// string requestStatus = result.RequestStatus;
|
||||
// string requestNote = result.RequestNote;
|
||||
Guid period = result.PeriodId;
|
||||
var periodName = result.Name;
|
||||
string requestStatus = result.RequestStatus;
|
||||
string requestNote = result.RequestNote;
|
||||
|
||||
|
||||
var resend = new InsigniaResults
|
||||
{
|
||||
PeriodId = result.PeriodId,
|
||||
|
|
@ -444,14 +446,16 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
return Success(resend);
|
||||
if (RoleInsignia2 == true && (result.RequestStatus == "st1" || result.RequestStatus == "st2"))
|
||||
return Success(resend);
|
||||
// var candidate = await _repository.GetInsigniaCandidateBKK(period, ocId);
|
||||
|
||||
// // ตรวจสอบว่ารายการอยู่ใน table insignia_request_new
|
||||
// if (requestStatus == null)
|
||||
// {
|
||||
// // บันทึกรายชื่อ
|
||||
// await _repository.InsertCandidate(period, ocId, candidate);
|
||||
// }
|
||||
// Jack Remark Remove เพื่อให้เรียกขข้อมูลออกมาเร็สวขึ้น
|
||||
//var candidate = await _repository.GetInsigniaCandidateBKK(period, ocId);
|
||||
|
||||
//// ตรวจสอบว่ารายการอยู่ใน table insignia_request_new
|
||||
//if (requestStatus == null)
|
||||
//{
|
||||
// // บันทึกรายชื่อ
|
||||
// await _repository.InsertCandidate(period, ocId, candidate);
|
||||
//}
|
||||
if (role.Trim().ToUpper() == "OFFICER")
|
||||
{
|
||||
resend.Items = await _repository.InsigniaHasProfile(result.PeriodId, ocId, status);
|
||||
|
|
@ -459,132 +463,136 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
}
|
||||
else
|
||||
{
|
||||
// var passData = _context.InsigniaRequests.AsQueryable()
|
||||
// .Include(x => x.Organization)
|
||||
// .Include(x => x.RequestProfiles)
|
||||
// .Where(x => x.Organization.Id == ocId)
|
||||
// .Where(x => x.Period.Id == period)
|
||||
// .Select(ir => new
|
||||
// {
|
||||
// requstID = ir.Id,
|
||||
// requstStatus = ir.RequestStatus,
|
||||
// requstStatusName = GetRequestlStatusText(ir.RequestStatus),
|
||||
// fkInstituteId = -1,
|
||||
// // fkDivisionId = ir.Organization.Id,
|
||||
// // fkDivision = ir.Organization.Name,
|
||||
// fkInstitute = "",
|
||||
// fkPeriodId = ir.Period.Id,
|
||||
// insigniaRequestHasProfile = ir.RequestProfiles.AsQueryable()
|
||||
// .Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.Position)
|
||||
// .Include(x => x.Profile)
|
||||
// // .ThenInclude(x => x.PositionNumber)
|
||||
// .Include(x => x.Profile)
|
||||
// // .ThenInclude(x => x.AcademicStanding)
|
||||
// .Include(x => x.RequestInsignia)
|
||||
// .ThenInclude(x => x.InsigniaType)
|
||||
// .Select(irp => new
|
||||
// {
|
||||
// request_id = irp.Request.Id,
|
||||
// isApprove = irp.IsApprove,
|
||||
// statusInstitute = irp.IsApprove.ToString(),
|
||||
// request_date = irp.RequestDate,
|
||||
// profileId = irp.Profile.Id,
|
||||
// // prefix = irp.Profile.Prefix,
|
||||
// firstname = irp.Profile.FirstName,
|
||||
// lastname = irp.Profile.LastName,
|
||||
// // posno = irp.Profile.PositionNumber.Id,
|
||||
// type = irp.Profile.ProfileType,
|
||||
// // position = irp.Profile.Position.Name,
|
||||
// // rank = $"{irp.Profile.PositionType.Name}/{irp.Profile.PositionLevel.Name}",
|
||||
// instituteName = "",
|
||||
// instituteId = -1,
|
||||
// // divisionName = irp.Profile.OrganizationOrganization.Name,
|
||||
// // divisionId = irp.Profile.OrganizationOrganization.Id,
|
||||
// lastInsigniaName = "",
|
||||
// requestInsigniaLevel = irp.RequestInsignia.InsigniaType.Name,
|
||||
// requestInsigniaName = irp.RequestInsignia.Name,
|
||||
// requestQua = irp.QualificationStatus,
|
||||
// requestDoc = irp.DocumentStatus,
|
||||
// requestNote = irp.Note,
|
||||
// requestSalary = irp.Salary,
|
||||
// matchingConditions = JsonConvert.DeserializeObject<List<MatchingCondition>>(irp.MatchingConditions)
|
||||
// })
|
||||
// .Where(x => x.isApprove)
|
||||
// .OrderBy(y => y.profileId)
|
||||
// .ToList()
|
||||
// })
|
||||
// .ToList()
|
||||
// .FirstOrDefault();
|
||||
var passData = _context.InsigniaRequests.AsQueryable()
|
||||
//.Include(x => x.Organization)
|
||||
.Include(x => x.RequestProfiles)
|
||||
.Where(x => x.OrganizationId == ocId)
|
||||
.Where(x => x.Period.Id == period)
|
||||
.Select(ir => new
|
||||
{
|
||||
requstID = ir.Id,
|
||||
requstStatus = ir.RequestStatus,
|
||||
requstStatusName = GetRequestlStatusText(ir.RequestStatus),
|
||||
fkInstituteId = -1,
|
||||
// fkDivisionId = ir.Organization.Id,
|
||||
// fkDivision = ir.Organization.Name,
|
||||
fkInstitute = "",
|
||||
fkPeriodId = ir.Period.Id,
|
||||
insigniaRequestHasProfile = ir.RequestProfiles.AsQueryable()
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.Position)
|
||||
//.Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.PositionNumber)
|
||||
//.Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.AcademicStanding)
|
||||
.Include(x => x.RequestInsignia)
|
||||
.ThenInclude(x => x.InsigniaType)
|
||||
.Select(irp => new
|
||||
{
|
||||
request_id = irp.Request.Id,
|
||||
isApprove = irp.IsApprove,
|
||||
statusInstitute = irp.IsApprove.ToString(),
|
||||
request_date = irp.RequestDate,
|
||||
profileId = irp.ProfileId,
|
||||
prefix = _userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).Prefix, //irp.Profile.Prefix,
|
||||
firstname = _userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).FirstName, //irp.Profile.FirstName,
|
||||
lastname = _userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).LastName, //irp.Profile.LastName,
|
||||
posno = _userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).ProfileSalary.Count == 0 ||
|
||||
_userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).ProfileSalary == null ? "" :
|
||||
_userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).ProfileSalary.OrderByDescending(x => x.Order).FirstOrDefault().PosNo,// irp.Profile.PositionNumber.Id,
|
||||
type = _userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).ProfileType, //irp.Profile.ProfileType,
|
||||
position = _userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).Position, // irp.Profile.Position.Name,
|
||||
rank = $"{_userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).PosType.PosTypeName}/{_userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).PosLevel.PosLevelName}", // $"{irp.Profile.PositionType.Name}/{irp.Profile.PositionLevel.Name}",
|
||||
instituteName = "",
|
||||
instituteId = -1,
|
||||
// divisionName = irp.Profile.OrganizationOrganization.Name,
|
||||
// divisionId = irp.Profile.OrganizationOrganization.Id,
|
||||
lastInsigniaName = "",
|
||||
requestInsigniaLevel = irp.RequestInsignia.InsigniaType.Name,
|
||||
requestInsigniaName = irp.RequestInsignia.Name,
|
||||
requestQua = "",// irp.QualificationStatus,
|
||||
requestDoc = "", //irp.DocumentStatus,
|
||||
requestNote = "", // irp.Note,
|
||||
requestSalary = irp.Salary,
|
||||
matchingConditions = JsonConvert.DeserializeObject<List<MatchingCondition>>(irp.MatchingConditions)
|
||||
})
|
||||
.Where(x => x.isApprove)
|
||||
.OrderBy(y => y.profileId)
|
||||
.ToList()
|
||||
})
|
||||
.ToList()
|
||||
.FirstOrDefault();
|
||||
|
||||
// var failData = _context.InsigniaRequests.AsQueryable()
|
||||
// .Include(x => x.Organization)
|
||||
// .Include(x => x.RequestProfiles)
|
||||
// .Where(x => x.Organization.Id == ocId)
|
||||
// .Where(x => x.Period.Id == period)
|
||||
// .Select(ir => new
|
||||
// {
|
||||
// requstID = ir.Id,
|
||||
// requstStatus = ir.RequestStatus,
|
||||
// requstStatusName = GetRequestlStatusText(ir.RequestStatus),
|
||||
// fkInstituteId = -1,
|
||||
// // fkDivisionId = ir.Organization.Id,
|
||||
// // fkDivision = ir.Organization.Name,
|
||||
// fkInstitute = "",
|
||||
// fkPeriodId = ir.Period.Id,
|
||||
// insigniaRequestHasProfile = ir.RequestProfiles.AsQueryable()
|
||||
// .Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.Position)
|
||||
// .Include(x => x.Profile)
|
||||
// // .ThenInclude(x => x.PositionNumber)
|
||||
// .Include(x => x.Profile)
|
||||
// // .ThenInclude(x => x.AcademicStanding)
|
||||
// .Include(x => x.RequestInsignia)
|
||||
// .ThenInclude(x => x.InsigniaType)
|
||||
// .Select(irp => new
|
||||
// {
|
||||
// request_id = irp.Request.Id,
|
||||
// isApprove = irp.IsApprove,
|
||||
// statusInstitute = irp.IsApprove.ToString(),
|
||||
// request_date = irp.RequestDate,
|
||||
// profileId = irp.Profile.Id,
|
||||
// // prefix = irp.Profile.Prefix,
|
||||
// firstname = irp.Profile.FirstName,
|
||||
// lastname = irp.Profile.LastName,
|
||||
// // posno = irp.Profile.PositionNumber.Id,
|
||||
// type = irp.Profile.ProfileType,
|
||||
// // position = irp.Profile.Position.Name,
|
||||
// // rank = irp.Profile.AcademicStanding.Name,
|
||||
// instituteName = "",
|
||||
// instituteId = -1,
|
||||
// // divisionName = irp.Profile.OrganizationOrganization.Name,
|
||||
// // divisionId = irp.Profile.OrganizationOrganization.Id,
|
||||
// lastInsigniaName = "",
|
||||
// requestInsigniaLevel = irp.RequestInsignia.InsigniaType.Name,
|
||||
// requestInsigniaName = irp.RequestInsignia.Name,
|
||||
// requestQua = irp.QualificationStatus,
|
||||
// requestDoc = irp.DocumentStatus,
|
||||
// requestNote = irp.Note,
|
||||
// requestSalary = irp.Salary,
|
||||
// matchingConditions = JsonConvert.DeserializeObject<List<MatchingCondition>>(irp.MatchingConditions)
|
||||
// })
|
||||
// .Where(x => !x.isApprove)
|
||||
// .OrderBy(y => y.profileId)
|
||||
// .ToList()
|
||||
// })
|
||||
// .ToList()
|
||||
// .FirstOrDefault();
|
||||
var failData = _context.InsigniaRequests.AsQueryable()
|
||||
//.Include(x => x.Organization)
|
||||
.Include(x => x.RequestProfiles)
|
||||
.Where(x => x.OrganizationId == ocId)
|
||||
.Where(x => x.Period.Id == period)
|
||||
.Select(ir => new
|
||||
{
|
||||
requstID = ir.Id,
|
||||
requstStatus = ir.RequestStatus,
|
||||
requstStatusName = GetRequestlStatusText(ir.RequestStatus),
|
||||
fkInstituteId = -1,
|
||||
// fkDivisionId = ir.Organization.Id,
|
||||
// fkDivision = ir.Organization.Name,
|
||||
fkInstitute = "",
|
||||
fkPeriodId = ir.Period.Id,
|
||||
insigniaRequestHasProfile = ir.RequestProfiles.AsQueryable()
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.Position)
|
||||
//.Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.PositionNumber)
|
||||
//.Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.AcademicStanding)
|
||||
.Include(x => x.RequestInsignia)
|
||||
.ThenInclude(x => x.InsigniaType)
|
||||
.Select(irp => new
|
||||
{
|
||||
request_id = irp.Request.Id,
|
||||
isApprove = irp.IsApprove,
|
||||
statusInstitute = irp.IsApprove.ToString(),
|
||||
request_date = irp.RequestDate,
|
||||
profileId = irp.ProfileId,
|
||||
prefix = _userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).Prefix, //irp.Profile.Prefix,
|
||||
firstname = _userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).FirstName, //irp.Profile.FirstName,
|
||||
lastname = _userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).LastName, //irp.Profile.LastName,
|
||||
posno = _userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).ProfileSalary.Count == 0 ||
|
||||
_userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).ProfileSalary == null ? "" :
|
||||
_userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).ProfileSalary.OrderByDescending(x => x.Order).FirstOrDefault().PosNo,// irp.Profile.PositionNumber.Id,
|
||||
type = _userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).ProfileType, //irp.Profile.ProfileType,
|
||||
position = _userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).Position, // irp.Profile.Position.Name,
|
||||
rank = $"{_userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).PosType.PosTypeName}/{_userProfileRepository.GetOfficerProfileById(irp.ProfileId, AccessToken).PosLevel.PosLevelName}", // $"{irp.Profile.PositionType.Name}/{irp.Profile.PositionLevel.Name}",
|
||||
instituteName = "",
|
||||
instituteId = -1,
|
||||
// divisionName = irp.Profile.OrganizationOrganization.Name,
|
||||
// divisionId = irp.Profile.OrganizationOrganization.Id,
|
||||
lastInsigniaName = "",
|
||||
requestInsigniaLevel = irp.RequestInsignia.InsigniaType.Name,
|
||||
requestInsigniaName = irp.RequestInsignia.Name,
|
||||
requestQua = "", //irp.QualificationStatus,
|
||||
requestDoc = "", //irp.DocumentStatus,
|
||||
requestNote = "", //irp.Note,
|
||||
requestSalary = irp.Salary,
|
||||
matchingConditions = JsonConvert.DeserializeObject<List<MatchingCondition>>(irp.MatchingConditions)
|
||||
})
|
||||
.Where(x => !x.isApprove)
|
||||
.OrderBy(y => y.profileId)
|
||||
.ToList()
|
||||
})
|
||||
.ToList()
|
||||
.FirstOrDefault();
|
||||
|
||||
// var period_data = (from p in _context.InsigniaPeriods.AsQueryable()
|
||||
// where p.Id == period
|
||||
// select new
|
||||
// {
|
||||
// periodName = p.Name,
|
||||
// periodYear = p.Year,
|
||||
// }).FirstOrDefault();
|
||||
var period_data = (from p in _context.InsigniaPeriods.AsQueryable()
|
||||
where p.Id == period
|
||||
select new
|
||||
{
|
||||
periodName = p.Name,
|
||||
periodYear = p.Year,
|
||||
}).FirstOrDefault();
|
||||
|
||||
// return Success(new { passData = passData, failData = failData, period = period_data });
|
||||
return Success();
|
||||
return Success(new { passData = passData, failData = failData, period = period_data });
|
||||
//return Success();
|
||||
}
|
||||
// select data to display
|
||||
}
|
||||
|
|
@ -635,34 +643,34 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
#endregion
|
||||
|
||||
// #region " บันทึกหมายเหตุ "
|
||||
#region " บันทึกหมายเหตุ "
|
||||
|
||||
// [HttpPut("note/{profileId}")]
|
||||
// public async Task<ActionResult<ResponseObject>> SaveNote(Guid profileId, SaveRequsetNote items)
|
||||
// {
|
||||
// var id = await _repository.GetRequestId(items.PeriodId, items.OcId);
|
||||
// var note = _context.InsigniaRequestProfiles.AsQueryable()
|
||||
// .Where(d => d.Profile.Id == profileId && d.Request.Id == id).FirstOrDefault();
|
||||
// if (note != null)
|
||||
// note.Note = items.Note;
|
||||
// _context.SaveChanges();
|
||||
// return Success();
|
||||
// }
|
||||
[HttpPut("note/{profileId}")]
|
||||
public async Task<ActionResult<ResponseObject>> SaveNote(Guid profileId, SaveRequsetNote items)
|
||||
{
|
||||
var id = await _repository.GetRequestId(items.PeriodId, items.OcId);
|
||||
var note = _context.InsigniaRequestProfiles.AsQueryable()
|
||||
.Where(d => d.ProfileId == profileId && d.Request.Id == id).FirstOrDefault();
|
||||
//if (note != null)
|
||||
// note.Note = items.Note;
|
||||
_context.SaveChanges();
|
||||
return Success();
|
||||
}
|
||||
|
||||
// #endregion
|
||||
#endregion
|
||||
|
||||
// #region " บันทึกรายชื่อครูในการขอยื่นเครื่องราชฯ เเต่ยังไม่ส่งไปยัง ผอ.โรงเรียน "
|
||||
#region " บันทึกรายชื่อครูในการขอยื่นเครื่องราชฯ เเต่ยังไม่ส่งไปยัง ผอ.โรงเรียน "
|
||||
|
||||
// [HttpPut("approve/{ocId:length(36)}")]
|
||||
// public async Task<ActionResult<ResponseObject>> SaveRequestList(Guid id, Guid ocId, InsigniaApproveRequest items)
|
||||
// {
|
||||
// var result = await _repository.GetInsigniaRequest(id, ocId);
|
||||
// if (result != null)
|
||||
// await _repository.SaveAprove(result.PeriodId, ocId, items);
|
||||
// return Success();
|
||||
// }
|
||||
[HttpPut("approve/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> SaveRequestList(Guid id, Guid ocId, InsigniaApproveRequest items)
|
||||
{
|
||||
var result = await _repository.GetInsigniaRequest(id, ocId);
|
||||
if (result != null)
|
||||
await _repository.SaveAprove(result.PeriodId, ocId);
|
||||
return Success();
|
||||
}
|
||||
|
||||
// #endregion
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// เปลี่ยน status เป็น st3 การเจ้าหน้าที่อนุมัติ "
|
||||
|
|
@ -845,48 +853,49 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
// #endregion
|
||||
|
||||
// #region " เปลี่ยน status สำหรับ ผอ.สำนัก "
|
||||
#region " เปลี่ยน status สำหรับ ผอ.สำนัก "
|
||||
|
||||
// [HttpPost("status/director/approve/{ocId:length(36)}")]
|
||||
// public async Task<ActionResult<ResponseObject>> ChangeStatusToSt5p(Guid id, Guid ocId)
|
||||
// {
|
||||
// var result = await _repository.GetInsigniaRequest(id, ocId);
|
||||
// if (result == null)
|
||||
// return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
// var requestId = await _repository.GetRequestId(result.PeriodId, ocId);
|
||||
// if (requestId == null)
|
||||
// return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
// var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||
// if (requestNew != null)
|
||||
// {
|
||||
// requestNew.RequestStatus = "st5p";
|
||||
// _context.SaveChanges();
|
||||
// return Success();
|
||||
// }
|
||||
// else
|
||||
// return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
// }
|
||||
[HttpPost("status/director/approve/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> ChangeStatusToSt5p(Guid id, Guid ocId)
|
||||
{
|
||||
var result = await _repository.GetInsigniaRequest(id, ocId);
|
||||
if (result == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
var requestId = await _repository.GetRequestId(result.PeriodId, ocId);
|
||||
if (requestId == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||
if (requestNew != null)
|
||||
{
|
||||
requestNew.RequestStatus = "st5p";
|
||||
_context.SaveChanges();
|
||||
return Success();
|
||||
}
|
||||
else
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
}
|
||||
|
||||
// [HttpPost("status/director/reject/{ocId:length(36)}")]
|
||||
// public async Task<ActionResult<ResponseObject>> ChangeStatusToSt1(Guid id, Guid ocId)
|
||||
// {
|
||||
// var result = await _repository.GetInsigniaRequest(id, ocId);
|
||||
// if (result == null)
|
||||
// return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
// var requestId = await _repository.GetRequestId(result.PeriodId, ocId);
|
||||
// if (requestId == null)
|
||||
// return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
// var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||
// if (requestNew != null)
|
||||
// {
|
||||
// requestNew.RequestStatus = "st1";
|
||||
// _context.SaveChanges();
|
||||
// return Success();
|
||||
// }
|
||||
// else
|
||||
// return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
// }
|
||||
// #endregion
|
||||
[HttpPost("status/director/reject/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> ChangeStatusToSt1(Guid id, Guid ocId)
|
||||
{
|
||||
var result = await _repository.GetInsigniaRequest(id, ocId);
|
||||
if (result == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
var requestId = await _repository.GetRequestId(result.PeriodId, ocId);
|
||||
if (requestId == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||
if (requestNew != null)
|
||||
{
|
||||
requestNew.RequestStatus = "st1";
|
||||
_context.SaveChanges();
|
||||
return Success();
|
||||
}
|
||||
else
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// ย้ายขอมูลไปเป็น คนที่ไม่ยื่นขอ
|
||||
|
|
@ -1061,7 +1070,9 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
var insigniaRequestProfile = await _context.InsigniaRequestProfiles.FirstOrDefaultAsync(x => x.ProfileId == profile.Id && x.Request.Period == insigniaPeriod);
|
||||
if (insigniaRequestProfile != null)
|
||||
return Error(GlobalMessages.InsigniaRequestProfileDupicate);
|
||||
// var insigniaRequest = await _context.InsigniaRequests.FirstOrDefaultAsync(x => x.Period == insigniaPeriod);
|
||||
|
||||
//var insigniaRequest = await _context.InsigniaRequests.FirstOrDefaultAsync(x => x.Period == insigniaPeriod);
|
||||
|
||||
//var _orgProfile = await _context.ProfilePositions
|
||||
// .Where(x => x.ProfileId == profile.Id)
|
||||
// .Where(x => x.OrganizationPosition != null)
|
||||
|
|
@ -1071,7 +1082,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
// .FirstOrDefaultAsync();
|
||||
//var _org = await _context.Organizations
|
||||
// .FirstOrDefaultAsync(x => x.Id == _orgProfile);
|
||||
var insigniaRequest = await _context.InsigniaRequests.FirstOrDefaultAsync(x => x.Period == insigniaPeriod); // && x.OrganizationId == _org);
|
||||
var insigniaRequest = await _context.InsigniaRequests.FirstOrDefaultAsync(x => x.Period == insigniaPeriod && x.OrganizationId == insigniaRequestProfile!.Request.OrganizationId);
|
||||
if (insigniaRequest == null)
|
||||
{
|
||||
//var orgProfile = await _context.ProfilePositions
|
||||
|
|
@ -1086,43 +1097,46 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
//var org = await _context.Organizations
|
||||
// .FirstOrDefaultAsync(x => x.Id == orgProfile);
|
||||
|
||||
// var org = _userProfileRepository.GetOc(orgProfile.Value, 0, AccessToken);
|
||||
var org = _userProfileRepository.GetOc(insigniaRequestProfile!.Request.OrganizationId, 0, AccessToken);
|
||||
|
||||
// if (org == null)
|
||||
// return Error(GlobalMessages.OrganizationNotFound);
|
||||
// insigniaRequest = new InsigniaRequest
|
||||
// {
|
||||
// Period = insigniaPeriod,
|
||||
// OrganizationId = org.RootId.Value,
|
||||
// RequestStatus = "st1",
|
||||
// RequestNote = "",
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// CreatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
// };
|
||||
if (org == null)
|
||||
return Error(GlobalMessages.OrganizationNotFound);
|
||||
insigniaRequest = new InsigniaRequest
|
||||
{
|
||||
Period = insigniaPeriod,
|
||||
OrganizationId = org!.RootId.Value,
|
||||
RequestStatus = "st1",
|
||||
RequestNote = "",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
}
|
||||
|
||||
//await _context.AddAsync(new InsigniaRequestProfile
|
||||
//{
|
||||
// Status = "PENDING",
|
||||
// Profile = profile,
|
||||
// RequestInsignia = insignia,
|
||||
// Request = insigniaRequest,
|
||||
// Reason = req.Reason,
|
||||
// RequestDate = DateTime.Now,
|
||||
// MatchingConditions = System.Text.Json.JsonSerializer.Serialize(new List<dynamic>()), // serialize to string
|
||||
// Salary = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// CreatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
//});
|
||||
//await _context.SaveChangesAsync();
|
||||
|
||||
await _context.AddAsync(new InsigniaRequestProfile
|
||||
{
|
||||
Status = "PENDING",
|
||||
ProfileId = profile.Id,
|
||||
RequestInsignia = insignia,
|
||||
Request = insigniaRequest,
|
||||
Reason = req.Reason,
|
||||
RequestDate = DateTime.Now,
|
||||
MatchingConditions = System.Text.Json.JsonSerializer.Serialize(new List<dynamic>()), // serialize to string
|
||||
Salary = profile.ProfileSalary == null || profile.ProfileSalary.Count == 0 ? 0 :
|
||||
profile.ProfileSalary.OrderByDescending(x => x.Order).FirstOrDefault().Amount, //profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
|
|
@ -1265,26 +1279,26 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
return Success();
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// รายชื่อผู้ได้รับเครื่องราชส่งข้อมูลไปบันทึกผลได้รับเครื่องราช(อัพเดทstatus)
|
||||
// /// </summary>
|
||||
// /// <param name="insigniaPeriodId">Id รอบการยื่นขอ</param>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpGet("send/note/{insigniaPeriodId:length(36)}")]
|
||||
// public async Task<ActionResult<ResponseObject>> SendPeriodToNoteUpdateStatus(Guid insigniaPeriodId)
|
||||
// {
|
||||
// var insigniaPeriod = await _context.InsigniaPeriods
|
||||
// .FirstOrDefaultAsync(x => x.Id == insigniaPeriodId);
|
||||
// if (insigniaPeriod == null)
|
||||
// return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
// insigniaPeriod.IsLock = true;
|
||||
// await _context.SaveChangesAsync();
|
||||
// return Success();
|
||||
// }
|
||||
/// <summary>
|
||||
/// รายชื่อผู้ได้รับเครื่องราชส่งข้อมูลไปบันทึกผลได้รับเครื่องราช(อัพเดทstatus)
|
||||
/// </summary>
|
||||
/// <param name="insigniaPeriodId">Id รอบการยื่นขอ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("send/note/{insigniaPeriodId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> SendPeriodToNoteUpdateStatus(Guid insigniaPeriodId)
|
||||
{
|
||||
var insigniaPeriod = await _context.InsigniaPeriods
|
||||
.FirstOrDefaultAsync(x => x.Id == insigniaPeriodId);
|
||||
if (insigniaPeriod == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
insigniaPeriod.IsLock = true;
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// list รอบบันทึกผลการได้รับพระราชทานเครื่องราชอิสริยสภรณ์/การจ่ายใบกำกับ
|
||||
|
|
@ -1517,16 +1531,18 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
[HttpPut("note/{insigniaNoteId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> AddNoteProfile([FromBody] InsigniaNoteRequest req, Guid insigniaNoteId)
|
||||
{
|
||||
var profile = await _context.Profiles
|
||||
.Include(x => x.Salaries)
|
||||
.FirstOrDefaultAsync(x => x.CitizenId == req.CitizanId);
|
||||
var profile = _userProfileRepository.GetOfficerProfileByCitizenId(req.CitizanId, AccessToken);
|
||||
|
||||
|
||||
if (profile == null)
|
||||
return Error(GlobalMessages.DataNotFound);
|
||||
|
||||
var insignia = await _context.Insignias
|
||||
.Include(x => x.InsigniaType)
|
||||
.FirstOrDefaultAsync(x => x.Id == req.InsigniaId);
|
||||
if (insignia == null)
|
||||
return Error(GlobalMessages.InsigniaNotFound);
|
||||
|
||||
var insigniaNote = await _context.InsigniaNotes
|
||||
.Include(x => x.InsigniaNoteProfiles)
|
||||
//.ThenInclude(x => x.Profile)
|
||||
|
|
@ -1534,118 +1550,120 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
if (insigniaNote == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
|
||||
//var profileInsignia = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.Profile.CitizenId == req.CitizanId);
|
||||
//if (profileInsignia == null)
|
||||
//{
|
||||
// var insigniaNoteProfile = new InsigniaNoteProfile
|
||||
// {
|
||||
// Salary = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
// IsApprove = true,
|
||||
// Status = "PENDING",
|
||||
// Profile = profile,
|
||||
// Issue = req.Issue,
|
||||
// Number = req.Number,
|
||||
// DateReceive = req.DateReceive,
|
||||
// Date = req.Date,
|
||||
// VolumeNo = req.VolumeNo,
|
||||
// Section = req.Section,
|
||||
// Page = req.Page,
|
||||
// No = req.No,
|
||||
// DatePayment = req.DatePayment,
|
||||
// TypePayment = req.TypePayment,
|
||||
// Address = req.Address,
|
||||
// RequestInsignia = insignia,
|
||||
// OrganizationOrganizationReceive = req.OrganizationOrganizationReceive,
|
||||
// OrganizationOrganizationSend = req.OrganizationOrganizationSend,
|
||||
// InsigniaNote = insigniaNote,
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// CreatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
// };
|
||||
// if (req.DateReceive != null && req.Date != null)
|
||||
// {
|
||||
// insigniaNoteProfile.Status = "DONE";
|
||||
// await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||
// {
|
||||
// Year = insigniaNote.Year,
|
||||
// No = req.No,
|
||||
// Issue = req.VolumeNo,
|
||||
// VolumeNo = req.VolumeNo,
|
||||
// // Volume = req.Volume,
|
||||
// Section = req.Section,
|
||||
// Page = req.Page,
|
||||
// DateAnnounce = req.Date,
|
||||
// ReceiveDate = req.DateReceive,
|
||||
// InsigniaType = insignia.InsigniaType == null ? null : insignia.InsigniaType.Name,
|
||||
// Insignia = insignia,
|
||||
// // RefCommandNo = req.RefCommandNo,
|
||||
// // RefCommandDate = req.RefCommandDate,
|
||||
// Profile = profile,
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// CreatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
// });
|
||||
// }
|
||||
// await _context.InsigniaNoteProfiles.AddAsync(insigniaNoteProfile);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// profileInsignia.DatePayment = req.DatePayment;
|
||||
// profileInsignia.TypePayment = req.TypePayment;
|
||||
// profileInsignia.Address = req.Address;
|
||||
// if (profileInsignia.Status != "DONE")
|
||||
// {
|
||||
// profileInsignia.Issue = req.Issue;
|
||||
// profileInsignia.Number = req.Number;
|
||||
// profileInsignia.DateReceive = req.DateReceive;
|
||||
// profileInsignia.Date = req.Date;
|
||||
// profileInsignia.VolumeNo = req.VolumeNo;
|
||||
// profileInsignia.Section = req.Section;
|
||||
// profileInsignia.Page = req.Page;
|
||||
// profileInsignia.No = req.No;
|
||||
// // profileInsignia.DatePayment = req.DatePayment;
|
||||
// // profileInsignia.TypePayment = req.TypePayment;
|
||||
// // profileInsignia.Address = req.Address;
|
||||
// profileInsignia.RequestInsignia = insignia;
|
||||
// profileInsignia.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
// profileInsignia.LastUpdateUserId = UserId ?? "";
|
||||
// profileInsignia.LastUpdatedAt = DateTime.Now;
|
||||
// if (req.DateReceive != null && req.Date != null)
|
||||
// {
|
||||
// profileInsignia.Status = "DONE";
|
||||
// await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||
// {
|
||||
// Year = insigniaNote.Year,
|
||||
// No = req.No,
|
||||
// Issue = req.VolumeNo,
|
||||
// VolumeNo = req.VolumeNo,
|
||||
// // Volume = req.Volume,
|
||||
// Section = req.Section,
|
||||
// Page = req.Page,
|
||||
// DateAnnounce = req.Date,
|
||||
// ReceiveDate = req.DateReceive,
|
||||
// InsigniaType = insignia.InsigniaType == null ? null : insignia.InsigniaType.Name,
|
||||
// Insignia = insignia,
|
||||
// // RefCommandNo = req.RefCommandNo,
|
||||
// // RefCommandDate = req.RefCommandDate,
|
||||
// ProfileId = profile.Id,
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// CreatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//await _context.SaveChangesAsync();
|
||||
var profileInsignia = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.ProfileId == profile.Id);
|
||||
|
||||
if (profileInsignia == null)
|
||||
{
|
||||
var insigniaNoteProfile = new InsigniaNoteProfile
|
||||
{
|
||||
Salary = profile.ProfileSalary == null || profile.ProfileSalary.Count() == 0 ? null : profile.ProfileSalary.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
IsApprove = true,
|
||||
Status = "PENDING",
|
||||
ProfileId = profile.Id,
|
||||
Issue = req.Issue,
|
||||
Number = req.Number,
|
||||
DateReceive = req.DateReceive,
|
||||
Date = req.Date,
|
||||
VolumeNo = req.VolumeNo,
|
||||
Section = req.Section,
|
||||
Page = req.Page,
|
||||
No = req.No,
|
||||
DatePayment = req.DatePayment,
|
||||
TypePayment = req.TypePayment,
|
||||
Address = req.Address,
|
||||
RequestInsignia = insignia,
|
||||
OrganizationOrganizationReceive = req.OrganizationOrganizationReceive,
|
||||
OrganizationOrganizationSend = req.OrganizationOrganizationSend,
|
||||
InsigniaNote = insigniaNote,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
if (req.DateReceive != null && req.Date != null)
|
||||
{
|
||||
insigniaNoteProfile.Status = "DONE";
|
||||
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||
{
|
||||
Year = insigniaNote.Year,
|
||||
No = req.No,
|
||||
Issue = req.VolumeNo,
|
||||
VolumeNo = req.VolumeNo,
|
||||
// Volume = req.Volume,
|
||||
Section = req.Section,
|
||||
Page = req.Page,
|
||||
DateAnnounce = req.Date,
|
||||
ReceiveDate = req.DateReceive,
|
||||
InsigniaType = insignia.InsigniaType == null ? null : insignia.InsigniaType.Name,
|
||||
Insignia = insignia,
|
||||
// RefCommandNo = req.RefCommandNo,
|
||||
// RefCommandDate = req.RefCommandDate,
|
||||
ProfileId = profile.Id,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
await _context.InsigniaNoteProfiles.AddAsync(insigniaNoteProfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
profileInsignia.DatePayment = req.DatePayment;
|
||||
profileInsignia.TypePayment = req.TypePayment;
|
||||
profileInsignia.Address = req.Address;
|
||||
if (profileInsignia.Status != "DONE")
|
||||
{
|
||||
profileInsignia.Issue = req.Issue;
|
||||
profileInsignia.Number = req.Number;
|
||||
profileInsignia.DateReceive = req.DateReceive;
|
||||
profileInsignia.Date = req.Date;
|
||||
profileInsignia.VolumeNo = req.VolumeNo;
|
||||
profileInsignia.Section = req.Section;
|
||||
profileInsignia.Page = req.Page;
|
||||
profileInsignia.No = req.No;
|
||||
// profileInsignia.DatePayment = req.DatePayment;
|
||||
// profileInsignia.TypePayment = req.TypePayment;
|
||||
// profileInsignia.Address = req.Address;
|
||||
profileInsignia.RequestInsignia = insignia;
|
||||
profileInsignia.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profileInsignia.LastUpdateUserId = UserId ?? "";
|
||||
profileInsignia.LastUpdatedAt = DateTime.Now;
|
||||
if (req.DateReceive != null && req.Date != null)
|
||||
{
|
||||
profileInsignia.Status = "DONE";
|
||||
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||
{
|
||||
Year = insigniaNote.Year,
|
||||
No = req.No,
|
||||
Issue = req.VolumeNo,
|
||||
VolumeNo = req.VolumeNo,
|
||||
//Volume = req.Volume,
|
||||
Section = req.Section,
|
||||
Page = req.Page,
|
||||
DateAnnounce = req.Date,
|
||||
ReceiveDate = req.DateReceive,
|
||||
InsigniaType = insignia.InsigniaType == null ? null : insignia.InsigniaType.Name,
|
||||
Insignia = insignia,
|
||||
// RefCommandNo = req.RefCommandNo,
|
||||
// RefCommandDate = req.RefCommandDate,
|
||||
ProfileId = profile.Id,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue