แก้api เกษียญอื่นๆให้เหมือนรับโอน

This commit is contained in:
Kittapath 2023-08-16 02:35:43 +07:00
parent 243700bd53
commit 1b70ad6816
22 changed files with 15373 additions and 389 deletions

View file

@ -200,7 +200,7 @@ namespace BMA.EHR.Application.Repositories
#region " ทั่วไป "
/// <summary>
/// Gets the insignia candidate ประเภททั่วไป ระดับปิบัติงาน.
/// Gets the insignia candidate ประเภททั่วไป ระดับปิบัติงาน.
/// </summary>
/// <param name="periodId">The period identifier.</param>
/// <param name="ocId">The oc identifier.</param>
@ -240,31 +240,31 @@ namespace BMA.EHR.Application.Repositories
p.PositionType.Name == "ทั่วไป" //
)
.Select(p => new
{
ProfileId = p.Id,
Prefix = p.Prefix == null ? null : p.Prefix.Name,
FullName = $"{p.FirstName} {p.LastName}",
Position = p.Position == null ? null : p.Position.Name,
Rank = p.PositionLevel.Name,
ProfileDateAppoint = p.DateAppoint.Value,
GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0),
PosNo = p.PosNo == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PosNo.Id,
PositionLevelId = p.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLevel.Id,
PositionLevelName = p.PositionLevel == null ? null : p.PositionLevel.Name,
PositionTypeId = p.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionType.Id,
PositionTypeName = p.PositionType == null ? null : p.PositionType.Name,
Gender = p.Gender == null ? null : p.Gender.Name,
LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name,
LastInsigniaId = p.Insignias.Count == 0 ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id,
Salary = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PostionSalaryAmount = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount
});
{
ProfileId = p.Id,
Prefix = p.Prefix == null ? null : p.Prefix.Name,
FullName = $"{p.FirstName} {p.LastName}",
Position = p.Position == null ? null : p.Position.Name,
Rank = p.PositionLevel.Name,
ProfileDateAppoint = p.DateAppoint.Value,
GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0),
PosNo = p.PosNo == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PosNo.Id,
PositionLevelId = p.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLevel.Id,
PositionLevelName = p.PositionLevel == null ? null : p.PositionLevel.Name,
PositionTypeId = p.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionType.Id,
PositionTypeName = p.PositionType == null ? null : p.PositionType.Name,
Gender = p.Gender == null ? null : p.Gender.Name,
LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name,
LastInsigniaId = p.Insignias.Count == 0 ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id,
Salary = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PostionSalaryAmount = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount
});
// check วันที่บรรจะต้องน้อยกว่า 29/5/ปี-5
var s1 = ((from p in inst_profile
where p.ProfileDateAppoint <= new DateTime(period.Year - 5, 5, 29)
&& p.LastInsigniaId == Guid.Parse("00000000-0000-0000-0000-000000000000")
&& p.PositionLevelName == "ปฏิบัติงาน" // ปิบัติงาน
&& p.LastInsigniaId == Guid.Parse("00000000-0000-0000-0000-000000000000")
&& p.PositionLevelName == "ปฏิบัติงาน" // ปิบัติงาน
select p)
.ToList()
.Select(p => new InsigniaResultSet
@ -286,7 +286,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.รับราชการก่อน { new DateTime(period.Year - 5, 5, 29).ToThaiFullDate3() }",
Condition = $"1.รับราชการก่อน { new DateTime(period.Year - 5, 5, 29).ToThaiFullDate3() }xxx1",
Result = $"วันที่บรรจุเข้ารับราชการ { p.ProfileDateAppoint.ToThaiFullDate3() }"
}
}
@ -307,7 +307,7 @@ namespace BMA.EHR.Application.Repositories
&& p.PositionType != null
&& p.PositionLevel != null
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
&& p.PositionLevel.Name == "ปฎิบัติงาน" // ปฎิบัติงาน
&& p.PositionLevel.Name == "ปฏิบัติงาน" // ปฏิบัติงาน
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
.OrderByDescending(x => x.Year)
.FirstOrDefault().Insignia.Name.Contains("เบญจมาภรณ์ช้างเผือก")
@ -354,7 +354,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้รับเงินเดือนต่ำกว่าขั้นต่ำของระดับชำนาญงาน (เงินเดือนน้อยกว่า 10,190 บาท)",
Condition = $"1.ได้รับเงินเดือนต่ำกว่าขั้นต่ำของระดับชำนาญงาน (เงินเดือนน้อยกว่า 10,190 บาท)xxx2",
Result = $"ได้รับเงินเดือน { p.SalaryCondition } บาท"
},
new MatchingCondition
@ -381,7 +381,7 @@ namespace BMA.EHR.Application.Repositories
&& p.PositionType != null
&& p.PositionLevel != null
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป1
&& p.PositionLevel.Name == "ปฎิบัติงาน" // ปฎิบัติงาน1
&& p.PositionLevel.Name == "ปฏิบัติงาน" // ปฏิบัติงาน1
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
.OrderByDescending(x => x.Year)
.FirstOrDefault().Insignia.Name.Contains("จัตุรถาภรณ์มงกุฎไทย")
@ -427,7 +427,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้รับเงินเดือนไม่ต่ำกว่าขั้นต่ำของระดับชำนาญงาน (เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } 10,190 บาทขึ้นไป)",
Condition = $"1.ได้รับเงินเดือนไม่ต่ำกว่าขั้นต่ำของระดับชำนาญงาน (เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } 10,190 บาทขึ้นไป)xxx3",
Result = $"ได้รับเงินเดือน { p.SalaryCondition } บาท"
}
}
@ -449,7 +449,7 @@ namespace BMA.EHR.Application.Repositories
&& p.PositionType != null
&& p.PositionLevel != null
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป1
&& p.PositionLevel.Name == "ปฎิบัติงาน" // ปฎิบัติงาน1
&& p.PositionLevel.Name == "ปฏิบัติงาน" // ปฏิบัติงาน1
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
.OrderByDescending(x => x.Year)
.FirstOrDefault().Insignia.Name.Contains("จัตุรถาภรณ์ช้างเผือก")
@ -496,7 +496,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้รับเงินเดือนไม่ต่ำกว่าขั้นต่ำของระดับชำนาญงาน (เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } 10,190 บาทขึ้นไป)",
Condition = $"1.ได้รับเงินเดือนไม่ต่ำกว่าขั้นต่ำของระดับชำนาญงาน (เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } 10,190 บาทขึ้นไป)xxx4",
Result = $"ได้รับเงินเดือน { p.SalaryCondition } บาท"
},
new MatchingCondition
@ -677,7 +677,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.เป็นระดับชำนาญงาน",
Condition = $"1.เป็นระดับชำนาญงานxxx5",
Result = $"ตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel }"
},
@ -728,11 +728,11 @@ namespace BMA.EHR.Application.Repositories
.OrderByDescending(x => x.Year)
.FirstOrDefault().Insignia.Name,
"ตริตาภรณ์ช้างเผือก"),
// FirstPositonLevelDate = p.Salaries.Count == 0 ? null :
// p.Salaries.Where(x => x.SalaryPositionLevel.PositionLevel.Id == 2).OrderBy(p => p.SalaryDateAnnounce).FirstOrDefault().SalaryDateAnnounce
FirstPositonLevelDate = p.Salaries.Count == 0 ? null :
p.Salaries.Where(x => x.PositionLevel.Name == "ชำนาญงาน").OrderBy(p => p.Date).FirstOrDefault().Date
})
.ToList()
// .Where(x => x.FirstPositonLevelDate < new DateTime(period.Year - 5, 5, 29))
.Where(x => x.FirstPositonLevelDate < new DateTime(period.Year - 5, 5, 29))
.Select(p => new InsigniaResultSet
{
ProfileId = p.ProfileId,
@ -752,8 +752,8 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ดำรงตำแหน่งมาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (เป็นระดับชำนาญงาน ก่อนวันที่ {(new DateTime(period.Year - 5, 5, 29)).ToThaiFullDate3()})",
// Result = $"ดำรงตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel } ตั้งแต่วันที่ { (p.FirstPositonLevelDate == null ? "-" : p.FirstPositonLevelDate.Value.ToThaiFullDate3()) }"
Condition = $"1.ดำรงตำแหน่งมาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (เป็นระดับชำนาญงาน ก่อนวันที่ {(new DateTime(period.Year - 5, 5, 29)).ToThaiFullDate3()})xxx6",
Result = $"ดำรงตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel } ตั้งแต่วันที่ { (p.FirstPositonLevelDate == null ? "-" : p.FirstPositonLevelDate.Value.ToThaiFullDate3()) }"
},
}
@ -893,7 +893,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.เป็นระดับอาวุโส",
Condition = $"1.เป็นระดับอาวุโสxxx7",
Result = $"ตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel }"
},
@ -945,11 +945,11 @@ namespace BMA.EHR.Application.Repositories
.FirstOrDefault().Insignia.Name,
"ทวีติยาภรณ์ช้างเผือก"),
// FirstPositonLevelDate = p.Salaries.Count == 0 ? null :
// p.Salaries.Where(x => x.SalaryPositionLevel.PositionLevel.Id == 3).OrderBy(p => p.SalaryDateAnnounce).FirstOrDefault().SalaryDateAnnounce
FirstPositonLevelDate = p.Salaries.Count == 0 ? null :
p.Salaries.Where(x => x.PositionLevel.Name == "อาวุโส").OrderBy(p => p.Date).FirstOrDefault().Date
})
.ToList()
// .Where(x => x.FirstPositonLevelDate < new DateTime(period.Year - 5, 5, 29))
.Where(x => x.FirstPositonLevelDate < new DateTime(period.Year - 5, 5, 29))
.Select(p => new InsigniaResultSet
{
ProfileId = p.ProfileId,
@ -969,8 +969,8 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ดำรงตำแหน่งมาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (เป็นระดับอาวุโส ก่อนวันที่ {(new DateTime(period.Year - 5, 5, 29)).ToThaiFullDate3()})",
// Result = $"ดำรงตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel } ตั้งแต่วันที่ { (p.FirstPositonLevelDate == null ? "-" : p.FirstPositonLevelDate.Value.ToThaiFullDate3()) }"
Condition = $"1.ดำรงตำแหน่งมาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (เป็นระดับอาวุโส ก่อนวันที่ {(new DateTime(period.Year - 5, 5, 29)).ToThaiFullDate3()})xxx8",
Result = $"ดำรงตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel } ตั้งแต่วันที่ { (p.FirstPositonLevelDate == null ? "-" : p.FirstPositonLevelDate.Value.ToThaiFullDate3()) }"
},
}
@ -1110,7 +1110,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.เป็นระดับทักษะพิเศษ",
Condition = $"1.เป็นระดับทักษะพิเศษxxx9",
Result = $"ตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel }"
},
@ -1164,11 +1164,11 @@ namespace BMA.EHR.Application.Repositories
FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 :
p.Insignias.Where(x => x.Insignia.Name == "ทวีติยาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
p.Insignias.Where(x => x.Insignia.Name == "ทวีติยาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault().Year,
// FirstPositonLevelDate = p.Salaries.Count == 0 ? null :
// p.Salaries.Where(x => x.SalaryPositionLevel.PositionLevel.Id == 3).OrderBy(p => p.SalaryDateAnnounce).FirstOrDefault().SalaryDateAnnounce
FirstPositonLevelDate = p.Salaries.Count == 0 ? null :
p.Salaries.Where(x => x.PositionLevel.Name == "อาวุโส").OrderBy(p => p.Date).FirstOrDefault().Date
})
.ToList()
// .Where(x => x.FirstRecvInsigniaYear != 0 && x.FirstRecvInsigniaYear <= period.Year - 3)
.Where(x => x.FirstRecvInsigniaYear != 0 && x.FirstRecvInsigniaYear <= period.Year - 3)
.Select(p => new InsigniaResultSet
{
ProfileId = p.ProfileId,
@ -1188,7 +1188,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้รับ ท.ช. ก่อนวันที่ {(new DateTime(period.Year - 3, 7, 28)).ToThaiFullDate3()})",
Condition = $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้รับ ท.ช. ก่อนวันที่ {(new DateTime(period.Year - 3, 7, 28)).ToThaiFullDate3()})xxx10",
Result = $"ได้รับ ท.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
@ -1242,11 +1242,11 @@ namespace BMA.EHR.Application.Repositories
FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 :
p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault().Year,
// FirstPositonLevelDate = p.Salaries.Count == 0 ? null :
// p.Salaries.Where(x => x.SalaryPositionLevel.PositionLevel.Id == 3).OrderBy(p => p.SalaryDateAnnounce).FirstOrDefault().SalaryDateAnnounce
FirstPositonLevelDate = p.Salaries.Count == 0 ? null :
p.Salaries.Where(x => x.PositionLevel.Name == "อาวุโส").OrderBy(p => p.Date).FirstOrDefault().Date
})
.ToList()
// .Where(x => x.FirstRecvInsigniaYear != 0 && x.FirstRecvInsigniaYear <= period.Year - 5)
.Where(x => x.FirstRecvInsigniaYear != 0 && x.FirstRecvInsigniaYear <= period.Year - 5)
.Select(p => new InsigniaResultSet
{
ProfileId = p.ProfileId,
@ -1266,7 +1266,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้รับ ป.ม. ก่อนวันที่ {(new DateTime(period.Year - 5, 7, 28)).ToThaiFullDate3()})",
Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้รับ ป.ม. ก่อนวันที่ {(new DateTime(period.Year - 5, 7, 28)).ToThaiFullDate3()})xxx11",
Result = $"ได้รับ ป.ม. ในปี { p.FirstRecvInsigniaYear }"
},
@ -1344,7 +1344,7 @@ namespace BMA.EHR.Application.Repositories
/// <summary>
/// Gets the insignia candidate ประเภทวิชาการ ระดับปิบัติการ.
/// Gets the insignia candidate ประเภทวิชาการ ระดับปิบัติการ.
/// </summary>
/// <param name="periodId">The period identifier.</param>
/// <param name="ocId">The oc identifier.</param>
@ -1384,31 +1384,31 @@ namespace BMA.EHR.Application.Repositories
p.PositionType.Name == "วิชาการ" // ประเภทวิชาการ
)
.Select(p => new
{
ProfileId = p.Id,
Prefix = p.Prefix == null ? null : p.Prefix.Name,
FullName = $"{p.FirstName} {p.LastName}",
Position = p.Position.Name,
Rank = p.PositionLevel.Name,
ProfileDateAppoint = p.DateAppoint.Value,
GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0),
PosNo = p.PosNo == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PosNo.Id,
PositionLevelId = p.PositionLevel.Id,
PositionLevelName = p.PositionLevel.Name,
PositionTypeId = p.PositionType.Id,
PositionTypeName = p.PositionType.Name,
Gender = p.Gender == null ? null : p.Gender.Name,
LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name,
LastInsigniaId = p.Insignias.Count == 0 ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id,
Salary = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PostionSalaryAmount = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount
});
{
ProfileId = p.Id,
Prefix = p.Prefix == null ? null : p.Prefix.Name,
FullName = $"{p.FirstName} {p.LastName}",
Position = p.Position.Name,
Rank = p.PositionLevel.Name,
ProfileDateAppoint = p.DateAppoint.Value,
GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0),
PosNo = p.PosNo == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PosNo.Id,
PositionLevelId = p.PositionLevel.Id,
PositionLevelName = p.PositionLevel.Name,
PositionTypeId = p.PositionType.Id,
PositionTypeName = p.PositionType.Name,
Gender = p.Gender == null ? null : p.Gender.Name,
LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name,
LastInsigniaId = p.Insignias.Count == 0 ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id,
Salary = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PostionSalaryAmount = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount
});
// check วันที่บรรจะต้องน้อยกว่า 29/5/ปี-5
var s1 = ((from p in inst_profile
where p.ProfileDateAppoint <= new DateTime(period.Year - 5, 5, 29)
&& p.LastInsigniaId == Guid.Parse("00000000-0000-0000-0000-000000000000")
&& p.PositionLevelName == "ปฎิบัติการ" // ปฎิบัติการ
&& p.PositionLevelName == "ปฏิบัติการ" // ปฏิบัติการ
select p)
.ToList()
.Select(p => new InsigniaResultSet
@ -1430,7 +1430,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.รับราชการก่อน { new DateTime(period.Year - 5, 5, 29).ToThaiFullDate3() }",
Condition = $"1.รับราชการก่อน { new DateTime(period.Year - 5, 5, 29).ToThaiFullDate3() }xxx12",
Result = $"วันที่บรรจุเข้ารับราชการ { p.ProfileDateAppoint.ToThaiFullDate3() }"
}
}
@ -1552,7 +1552,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.เป็นระดับชำนาญการ",
Condition = $"1.เป็นระดับชำนาญการxxx13",
Result = $"ตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel }"
},
@ -1593,7 +1593,7 @@ namespace BMA.EHR.Application.Repositories
LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name,
LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id,
Salary = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
SalaryCondition = p.Salaries.Count() == 0 ? null : p.Salaries.Where(x => x.Date <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount,
SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.Date <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PosNo = p.PosNo == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PosNo.Id,
Gender = p.Gender == null ? null : p.Gender.Name,
IsHigherLevel = IsHigherLevel(p.Insignias
@ -1623,8 +1623,8 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้รับเงินเดือนไม่ต่ำกว่าขั้นต่ำของระดับชำนาญการพิเศษ (เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } 22,140 บาท)",
// Result = $"เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } เป็นเงิน { p.SalaryCondition.ToNumericText() } บาท"
Condition = $"1.ได้รับเงินเดือนไม่ต่ำกว่าขั้นต่ำของระดับชำนาญการพิเศษ (เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } 22,140 บาท)xxx14",
Result = $"เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } เป็นเงิน { p.SalaryCondition } บาท"
},
}
@ -1664,7 +1664,7 @@ namespace BMA.EHR.Application.Repositories
LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name,
LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id,
Salary = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
SalaryCondition = p.Salaries.Count() == 0 ? null : p.Salaries.Where(x => x.Date < new DateTime(period.Year - 5, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount,
SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.Date < new DateTime(period.Year - 5, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PosNo = p.PosNo == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PosNo.Id,
Gender = p.Gender == null ? null : p.Gender.Name,
IsHigherLevel = IsHigherLevel(p.Insignias
@ -1694,8 +1694,8 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้รับเงินเดือนไม่ต่ำกว่าขั้นต่ำของระดับชำนาญการพิเศษมาแล้วไม่น้อยกว่า 5 ปี (เงินเดือนก่อนวันที่ { (new DateTime(period.Year-5, 4, 29)).ToThaiFullDate3() } 22,140 บาท)",
// Result = $"เงินเดือนก่อนวันที่ { (new DateTime(period.Year-5, 4, 29)).ToThaiFullDate3() } เป็นเงิน { p.SalaryCondition.ToNumericText() } บาท"
Condition = $"1.ได้รับเงินเดือนไม่ต่ำกว่าขั้นต่ำของระดับชำนาญการพิเศษมาแล้วไม่น้อยกว่า 5 ปี (เงินเดือนก่อนวันที่ { (new DateTime(period.Year-5, 4, 29)).ToThaiFullDate3() } 22,140 บาท)xxx15",
Result = $"เงินเดือนก่อนวันที่ { (new DateTime(period.Year-5, 4, 29)).ToThaiFullDate3() } เป็นเงิน { p.SalaryCondition } บาท"
},
}
@ -1853,7 +1853,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.เป็นระดับชำนาญการพิเศษ",
Condition = $"1.เป็นระดับชำนาญการพิเศษxxx16",
Result = $"ตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel }"
},
@ -1894,7 +1894,7 @@ namespace BMA.EHR.Application.Repositories
LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name,
LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id,
Salary = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
SalaryCondition = p.Salaries.Count() == 0 ? null : p.Salaries.Where(x => x.Date <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount,
SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.Date <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PosNo = p.PosNo == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PosNo.Id,
Gender = p.Gender == null ? null : p.Gender.Name,
IsHigherLevel = IsHigherLevel(p.Insignias
@ -1928,8 +1928,8 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้รับเงินเดือนขั้นสูง (เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } 58,390 บาท)",
// Result = $"เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } เป็นเงิน { p.SalaryCondition.ToNumericText() } บาท"
Condition = $"1.ได้รับเงินเดือนขั้นสูง (เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } 58,390 บาท)xxx17",
Result = $"เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } เป็นเงิน { p.SalaryCondition } บาท"
},
new MatchingCondition
{
@ -2075,7 +2075,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.เป็นระดับเชี่ยวชาญ",
Condition = $"1.เป็นระดับเชี่ยวชาญxxx18",
Result = $"ตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel }"
},
@ -2150,7 +2150,7 @@ namespace BMA.EHR.Application.Repositories
new MatchingCondition
{
Condition = $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ท.ช. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })",
Condition = $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ท.ช. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })xxx19",
Result = $"ได้รับ ท.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
@ -2225,7 +2225,7 @@ namespace BMA.EHR.Application.Repositories
new MatchingCondition
{
Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ท.ช. ก่อนวันที่ { (new DateTime(period.Year-5, 7, 28)).ToThaiFullDate3() })",
Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ท.ช. ก่อนวันที่ { (new DateTime(period.Year-5, 7, 28)).ToThaiFullDate3() })xxx20",
Result = $"ได้รับ ป.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
@ -2393,13 +2393,13 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })",
Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })xxx21",
Result = $"ได้รับ ป.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
new MatchingCondition
{
Condition = $"ได้รับเงินประจำตำแหน่ง 13,000 บาท",
// Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท"
Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition } บาท"
}
}
})
@ -2477,13 +2477,13 @@ namespace BMA.EHR.Application.Repositories
new MatchingCondition
{
Condition = $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ช. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })",
Condition = $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ช. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })xxx22",
Result = $"ได้รับ ป.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
new MatchingCondition
{
Condition = $"ได้รับเงินประจำตำแหน่ง 13,000 บาท",
// Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท"
Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition } บาท"
}
}
@ -2561,13 +2561,13 @@ namespace BMA.EHR.Application.Repositories
new MatchingCondition
{
Condition = $"1.ได้ ม.ว.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ม.ว.ม. ก่อนวันที่ { (new DateTime(period.Year-5, 7, 28)).ToThaiFullDate3() })",
Condition = $"1.ได้ ม.ว.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ม.ว.ม. ก่อนวันที่ { (new DateTime(period.Year-5, 7, 28)).ToThaiFullDate3() })xxx23",
Result = $"ได้รับ ม.ว.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
new MatchingCondition
{
Condition = $"ได้รับเงินประจำตำแหน่ง 13,000 บาท",
// Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท"
Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition } บาท"
}
}
@ -2733,13 +2733,13 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })",
Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })xxx24",
Result = $"ได้รับ ป.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
new MatchingCondition
{
Condition = $"ได้รับเงินประจำตำแหน่ง 15,600 บาท",
// Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท"
Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition } บาท"
}
}
})
@ -2817,13 +2817,13 @@ namespace BMA.EHR.Application.Repositories
new MatchingCondition
{
Condition = $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ช. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })",
Condition = $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ช. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })xxx25",
Result = $"ได้รับ ป.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
new MatchingCondition
{
Condition = $"ได้รับเงินประจำตำแหน่ง 15,600 บาท",
// Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท"
Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition } บาท"
}
}
})
@ -2899,13 +2899,13 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้ ม.ว.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ม.ว.ม. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })",
Condition = $"1.ได้ ม.ว.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ม.ว.ม. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })xxx26",
Result = $"ได้รับ ม.ว.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
new MatchingCondition
{
Condition = $"ได้รับเงินประจำตำแหน่ง 15,600 บาท",
// Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท"
Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition } บาท"
}
}
})
@ -3013,7 +3013,7 @@ namespace BMA.EHR.Application.Repositories
&& p.PositionType != null
&& p.PositionLevel != null
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
&& p.PositionLevel.Name == "ระดับต้น" // ระดับต้น
&& p.PositionLevel.Name == "ต้น" // ต้น
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
.OrderByDescending(x => x.Year)
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
@ -3060,7 +3060,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.เป็นระดับอำนวยการ/ต้น",
Condition = $"1.เป็นระดับอำนวยการ/ต้นxxx27",
Result = $"ตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel }"
},
@ -3101,7 +3101,7 @@ namespace BMA.EHR.Application.Repositories
LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name,
LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id,
Salary = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
SalaryCondition = p.Salaries.Count() == 0 ? null : p.Salaries.Where(x => x.Date <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount,
SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.Date <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PosNo = p.PosNo == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PosNo.Id,
Gender = p.Gender == null ? null : p.Gender.Name,
IsHigherLevel = IsHigherLevel(p.Insignias
@ -3135,8 +3135,8 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้รับเงินเดือนขั้นสูง (เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } 58,390 บาท)",
// Result = $"เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } เป็นเงิน { p.SalaryCondition.ToNumericText() } บาท"
Condition = $"1.ได้รับเงินเดือนขั้นสูง (เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } 58,390 บาท)xxx28",
Result = $"เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } เป็นเงิน { p.SalaryCondition } บาท"
},
new MatchingCondition
{
@ -3228,7 +3228,7 @@ namespace BMA.EHR.Application.Repositories
&& p.PositionType != null
&& p.PositionLevel != null
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
&& p.PositionLevel.Name == "ระดับสูง" // ระดับสูง
&& p.PositionLevel.Name == "สูง" // สูง
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
.OrderByDescending(x => x.Year)
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
@ -3279,7 +3279,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ท.ช. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)",
Condition = $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ท.ช. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)xxx29",
Result = $"ได้รับ ท.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
@ -3302,7 +3302,7 @@ namespace BMA.EHR.Application.Repositories
&& p.PositionType != null
&& p.PositionLevel != null
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
&& p.PositionLevel.Name == "ระดับสูง" // ระดับสูง
&& p.PositionLevel.Name == "สูง" // สูง
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
.OrderByDescending(x => x.Year)
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")
@ -3353,7 +3353,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)",
Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)xxx30",
Result = $"ได้รับ ป.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
@ -3376,7 +3376,7 @@ namespace BMA.EHR.Application.Repositories
&& p.PositionType != null
&& p.PositionLevel != null
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
&& p.PositionLevel.Name == "ระดับสูง" // ระดับสูง
&& p.PositionLevel.Name == "สูง" // สูง
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
.OrderByDescending(x => x.Year)
.FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ")
@ -3427,7 +3427,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ป.ช. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)",
Condition = $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ป.ช. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)xxx31",
Result = $"ได้รับ ป.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
@ -3538,7 +3538,7 @@ namespace BMA.EHR.Application.Repositories
&& p.PositionType != null
&& p.PositionLevel != null
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
&& p.PositionLevel.Name == "ระดับต้น" // ระดับต้น
&& p.PositionLevel.Name == "ต้น" // ต้น
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
.OrderByDescending(x => x.Year)
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
@ -3589,7 +3589,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ท.ช. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)",
Condition = $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ท.ช. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)xxx32",
Result = $"ได้รับ ท.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
@ -3612,7 +3612,7 @@ namespace BMA.EHR.Application.Repositories
&& p.PositionType != null
&& p.PositionLevel != null
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
&& p.PositionLevel.Name == "ระดับต้น" // ระดับต้น
&& p.PositionLevel.Name == "ต้น" // ต้น
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
.OrderByDescending(x => x.Year)
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")
@ -3663,7 +3663,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)",
Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)xxx33",
Result = $"ได้รับ ป.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
@ -3686,7 +3686,7 @@ namespace BMA.EHR.Application.Repositories
&& p.PositionType != null
&& p.PositionLevel != null
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
&& p.PositionLevel.Name == "ระดับต้น" // ระดับต้น
&& p.PositionLevel.Name == "ต้น" // ต้น
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
.OrderByDescending(x => x.Year)
.FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ")
@ -3737,7 +3737,7 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ป.ช. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)",
Condition = $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ป.ช. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)xxx34",
Result = $"ได้รับ ป.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
@ -3820,7 +3820,7 @@ namespace BMA.EHR.Application.Repositories
&& p.PositionType != null
&& p.PositionLevel != null
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
&& p.PositionLevel.Name == "ระดับสูง" // ระดับสูง
&& p.PositionLevel.Name == "สูง" // สูง
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
.OrderByDescending(x => x.Year)
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")
@ -3875,13 +3875,13 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)",
Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)xxx35",
Result = $"ได้รับ ป.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
new MatchingCondition
{
Condition = $"ได้รับเงินประจำตำแหน่ง 14,500 บาท",
// Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท"
Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition } บาท"
}
}
})
@ -3902,7 +3902,7 @@ namespace BMA.EHR.Application.Repositories
&& p.PositionType != null
&& p.PositionLevel != null
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
&& p.PositionLevel.Name == "ระดับสูง" // ระดับสูง
&& p.PositionLevel.Name == "สูง" // สูง
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
.OrderByDescending(x => x.Year)
.FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ")
@ -3957,13 +3957,13 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ช. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)",
Condition = $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ช. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)xxx36",
Result = $"ได้รับ ป.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
new MatchingCondition
{
Condition = $"ได้รับเงินประจำตำแหน่ง 14,500 บาท",
// Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท"
Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition } บาท"
}
}
})
@ -3984,7 +3984,7 @@ namespace BMA.EHR.Application.Repositories
&& p.PositionType != null
&& p.PositionLevel != null
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
&& p.PositionLevel.Name == "ระดับสูง" // ระดับสูง
&& p.PositionLevel.Name == "สูง" // สูง
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
.OrderByDescending(x => x.Year)
.FirstOrDefault().Insignia.Name.Contains("มหาปรมาภรณ์ช้างเผือก")
@ -4039,13 +4039,13 @@ namespace BMA.EHR.Application.Repositories
{
new MatchingCondition
{
Condition = $"1.ได้ ม.ว.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ม.ว.ม. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)",
Condition = $"1.ได้ ม.ว.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ม.ว.ม. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)xxx37",
Result = $"ได้รับ ม.ว.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }"
},
new MatchingCondition
{
Condition = $"ได้รับเงินประจำตำแหน่ง 14,500 บาท",
// Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท"
Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition } บาท"
}
}
})
@ -4136,20 +4136,20 @@ namespace BMA.EHR.Application.Repositories
p.DateAppoint != null
)
.Select(p => new
{
ProfileId = p.Id,
Prefix = p.Prefix == null ? null : p.Prefix.Name,
FullName = $"{p.FirstName} {p.LastName}",
Position = p.Position == null ? null : p.Position.Name,
Rank = p.PositionLevel.Name,
ProfileDateAppoint = p.DateAppoint.Value,
GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0),
PosNo = p.PosNo == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PosNo.Id,
Gender = p.Gender == null ? null : p.Gender.Name,
LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name,
LastInsigniaId = p.Insignias.Count == 0 ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id,
Salary = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
});
{
ProfileId = p.Id,
Prefix = p.Prefix == null ? null : p.Prefix.Name,
FullName = $"{p.FirstName} {p.LastName}",
Position = p.Position == null ? null : p.Position.Name,
Rank = p.PositionLevel.Name,
ProfileDateAppoint = p.DateAppoint.Value,
GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0),
PosNo = p.PosNo == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PosNo.Id,
Gender = p.Gender == null ? null : p.Gender.Name,
LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name,
LastInsigniaId = p.Insignias.Count == 0 ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id,
Salary = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
});
// check วันที่บรรจะต้องน้อยกว่า 29/5/ปี-5
var s1 = ((from p in inst_profile
@ -4613,22 +4613,91 @@ namespace BMA.EHR.Application.Repositories
var type4_level10 = await GetInsigniaCandidate_Type4_Level10(periodId, ocId);
var type4_level11 = await GetInsigniaCandidate_Type4_Level11(periodId, ocId);
// union result
result_candidate.AddRange(type1_level1);
result_candidate.AddRange(type1_level2);
result_candidate.AddRange(type1_level3);
result_candidate.AddRange(type1_level4);
result_candidate.AddRange(type2_level5);
result_candidate.AddRange(type2_level6);
result_candidate.AddRange(type2_level7);
result_candidate.AddRange(type2_level8);
result_candidate.AddRange(type2_level9_1);
result_candidate.AddRange(type2_level9_2);
result_candidate.AddRange(type3_level10);
result_candidate.AddRange(type3_level11);
result_candidate.AddRange(type4_level10);
result_candidate.AddRange(type4_level11);
foreach (var r in type4_level11)
{
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
if (old == null)
result_candidate.Add(r);
}
foreach (var r in type4_level10)
{
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
if (old == null)
result_candidate.Add(r);
}
foreach (var r in type3_level11)
{
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
if (old == null)
result_candidate.Add(r);
}
foreach (var r in type3_level10)
{
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
if (old == null)
result_candidate.Add(r);
}
foreach (var r in type2_level9_2)
{
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
if (old == null)
result_candidate.Add(r);
}
foreach (var r in type2_level9_1)
{
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
if (old == null)
result_candidate.Add(r);
}
foreach (var r in type2_level8)
{
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
if (old == null)
result_candidate.Add(r);
}
foreach (var r in type2_level7)
{
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
if (old == null)
result_candidate.Add(r);
}
foreach (var r in type2_level6)
{
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
if (old == null)
result_candidate.Add(r);
}
foreach (var r in type2_level5)
{
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
if (old == null)
result_candidate.Add(r);
}
foreach (var r in type1_level4)
{
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
if (old == null)
result_candidate.Add(r);
}
foreach (var r in type1_level3)
{
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
if (old == null)
result_candidate.Add(r);
}
foreach (var r in type1_level2)
{
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
if (old == null)
result_candidate.Add(r);
}
foreach (var r in type1_level1)
{
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
if (old == null)
result_candidate.Add(r);
}
return result_candidate.OrderBy(x => x.Seq).ThenBy(x => x.Gender).ThenBy(x => x.ProfileId).ToList();
}

View file

@ -57,6 +57,8 @@ namespace BMA.EHR.Domain.Models.Placement
[Comment("Id ระดับ")]
public PositionLevel? PositionLevel { get; set; }
[Comment("เงินเดือน")]
public double? Amount { get; set; }
[Comment("เหตุผลที่รับย้ายราชการ")]
public string? Reason { get; set; }
[Comment("วุฒิ/สาขาเดิม")]

View file

@ -36,6 +36,8 @@ namespace BMA.EHR.Domain.Models.Placement
public string Status { get; set; } = "WAITTING";
[Comment("Id เลขที่ตำแหน่ง")]
public OrganizationPositionEntity? OrganizationPosition { get; set; }
[Comment("เงินเดือน")]
public double? Amount { get; set; }
[Comment("วันที่บรรจุ")]
public DateTime? RecruitDate { get; set; }

View file

@ -36,6 +36,8 @@ namespace BMA.EHR.Domain.Models.Placement
public string Status { get; set; } = "WAITTING";
[Comment("Id เลขที่ตำแหน่ง")]
public OrganizationPositionEntity? OrganizationPosition { get; set; }
[Comment("เงินเดือน")]
public double? Amount { get; set; }
[Comment("วันที่บรรจุ")]
public DateTime? RecruitDate { get; set; }

View file

@ -10,16 +10,62 @@ namespace BMA.EHR.Domain.Models.Retirement
{
public class RetirementOther : EntityBase
{
[Required, Comment("Id User")]
public Profile Profile { get; set; }
[Comment("หน่วยงานที่อื่นๆไป")]
public string? Organization { get; set; } = string.Empty;
[Comment("เหตุผล")]
public string? Reason { get; set; } = string.Empty;
[Comment("สังกัด")]
[Required, MaxLength(20), Comment("เลขประจำตัวประชาชน")]
public string? CitizenId { get; set; }
[Required, Comment("คำนำหน้า")]
public Prefix? Prefix { get; set; }
[Required, Comment("ชื่อ")]
public string? Firstname { get; set; }
[Required, Comment("นามสกุล")]
public string? Lastname { get; set; }
[MaxLength(40), Comment("วันเกิด")]
public DateTime DateOfBirth { get; set; }
[Comment("Id เพศ")]
public Gender? Gender { get; set; }
[MaxLength(100), Comment("สัญชาติ")]
public string? Nationality { get; set; }
[MaxLength(100), Comment("เชื้อชาติ")]
public string? Race { get; set; }
[Comment("Id ศาสนา")]
public Religion? Religion { get; set; }
[Comment("Id กลุ่มเลือด")]
public BloodGroup? BloodGroup { get; set; }
[Comment("Id สถานะภาพ")]
public Relationship? Relationship { get; set; }
[MaxLength(50), Comment("เบอร์โทร")]
public string? TelephoneNumber { get; set; }
[Comment("สถานะคำขอ")]
public string Status { get; set; } = "WAITTING";
[Comment("Id เลขที่ตำแหน่ง")]
public OrganizationPositionEntity? OrganizationPosition { get; set; }
[Comment("วันที่บรรจุ")]
public DateTime? RecruitDate { get; set; }
[Comment("Id ตำแหน่งเลขที่")]
public PositionNumberEntity? PositionNumber { get; set; }
[Comment("Id ตำแหน่ง")]
public PositionPath? PositionPath { get; set; }
[Comment("Id ด้าน/สาขา")]
public PositionPathSide? PositionPathSide { get; set; }
[Comment("Id ประเภทตำแหน่ง")]
public PositionType? PositionType { get; set; }
[Comment("Id สายงาน")]
public PositionLine? PositionLine { get; set; }
[Comment("Id ระดับ")]
public PositionLevel? PositionLevel { get; set; }
[Comment("เงินเดือน")]
public double? Amount { get; set; }
[Comment("เหตุผลที่รับย้ายราชการ")]
public string? Reason { get; set; }
[Comment("วุฒิ/สาขาเดิม")]
public string? EducationOld { get; set; }
[Comment("สังกัดเดิม")]
public string? OrganizationPositionOld { get; set; }
[Comment("ตั้งแต่วันที่")]
public DateTime? Date { get; set; }
[Comment("ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท")]
public string? PositionTypeOld { get; set; }
[Comment("ข้อมูลหน่วยงานเดิม ระดับ")]
@ -28,11 +74,12 @@ namespace BMA.EHR.Domain.Models.Retirement
public string? PositionNumberOld { get; set; }
[Comment("ข้อมูลหน่วยงานเดิม เงินเดือน")]
public double? AmountOld { get; set; }
[Comment("สถานะคำขอ")]
public string Status { get; set; } = "WAITTING";
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
[Comment("ประเภทคำสั่ง")]
public CommandType? CommandType { get; set; }
[Comment("ดำรงตำแหน่งในระดับปัจจุบันเมื่อ")]
public DateTime? PositionDate { get; set; }
public virtual List<RetirementOtherDoc> RetirementOtherDocs { get; set; } = new List<RetirementOtherDoc>();
}
}

View file

@ -0,0 +1,15 @@
using BMA.EHR.Domain.Models.Base;
using BMA.EHR.Domain.Models.Documents;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
namespace BMA.EHR.Domain.Models.Retirement
{
public class RetirementOtherDoc : EntityBase
{
[Required, Comment("อ้างอิงรหัสเอกสาร")]
public Document Document { get; set; }
[Required, Comment("อ้างอิงรับย้าย")]
public virtual RetirementOther RetirementOther { get; set; }
}
}

View file

@ -0,0 +1,51 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetablePlacementAppointmentsaddAmount : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<double>(
name: "Amount",
table: "PlacementRelocations",
type: "double",
nullable: true,
comment: "เงินเดือน");
migrationBuilder.AddColumn<double>(
name: "Amount",
table: "PlacementReceives",
type: "double",
nullable: true,
comment: "เงินเดือน");
migrationBuilder.AddColumn<double>(
name: "Amount",
table: "PlacementAppointments",
type: "double",
nullable: true,
comment: "เงินเดือน");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Amount",
table: "PlacementRelocations");
migrationBuilder.DropColumn(
name: "Amount",
table: "PlacementReceives");
migrationBuilder.DropColumn(
name: "Amount",
table: "PlacementAppointments");
}
}
}

View file

@ -322,6 +322,7 @@ namespace BMA.EHR.Infrastructure.Persistence
public DbSet<RetirementDischarge> RetirementDischarges { get; set; }
public DbSet<RetirementExpulsion> RetirementExpulsions { get; set; }
public DbSet<RetirementOther> RetirementOthers { get; set; }
public DbSet<RetirementOtherDoc> RetirementOtherDocs { get; set; }
#endregion

View file

@ -70,6 +70,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.DateOfBirth,
Gender = p.Gender == null ? null : p.Gender.Name,
p.Status,
p.Amount,
p.RecruitDate,
PositionNumber = p.PositionNumber == null ? null : p.PositionNumber.Name,
PositionPath = p.PositionPath == null ? null : p.PositionPath.Name,
@ -122,7 +123,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
p.Id,
p.CitizenId,
Prefix = p.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Prefix.Id,
Prefix = p.Prefix == null ? null : p.Prefix.Name,
PrefixId = p.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Prefix.Id,
p.Firstname,
p.Lastname,
p.DateOfBirth,
@ -134,6 +136,7 @@ namespace BMA.EHR.Placement.Service.Controllers
Relationship = p.Relationship == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Relationship.Id,
p.TelephoneNumber,
p.Status,
p.Amount,
p.RecruitDate,
PosNoId = p.PositionNumber == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionNumber.Id,
PositionId = p.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPath.Id,
@ -172,6 +175,7 @@ namespace BMA.EHR.Placement.Service.Controllers
data.Id,
data.CitizenId,
data.Prefix,
data.PrefixId,
data.Firstname,
data.Lastname,
data.DateOfBirth,
@ -183,6 +187,7 @@ namespace BMA.EHR.Placement.Service.Controllers
data.Relationship,
data.TelephoneNumber,
data.Status,
data.Amount,
data.RecruitDate,
data.PosNoId,
data.PositionId,
@ -361,6 +366,7 @@ namespace BMA.EHR.Placement.Service.Controllers
uppdated.PositionType = save;
}
uppdated.Amount = req.Amount;
uppdated.RecruitDate = req.RecruitDate;
uppdated.Status = "PENDING";
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
@ -385,7 +391,7 @@ namespace BMA.EHR.Placement.Service.Controllers
var uppdated = await _context.PlacementAppointments
.FirstOrDefaultAsync(x => x.Id == id);
if (uppdated == null)
return Error(GlobalMessages.PlacementTransferNotFound, 404);
return Error(GlobalMessages.PlacementAppointmentNotFound, 404);
if (req.PrefixId != null)

View file

@ -70,6 +70,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.DateOfBirth,
Gender = p.Gender == null ? null : p.Gender.Name,
p.Status,
p.Amount,
p.RecruitDate,
PositionNumber = p.PositionNumber == null ? null : p.PositionNumber.Name,
PositionPath = p.PositionPath == null ? null : p.PositionPath.Name,
@ -121,7 +122,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
p.Id,
p.CitizenId,
Prefix = p.Prefix.Id,
Prefix = p.Prefix.Name,
PrefixId = p.Prefix.Id,
p.Firstname,
p.Lastname,
p.DateOfBirth,
@ -133,6 +135,7 @@ namespace BMA.EHR.Placement.Service.Controllers
Relationship = p.Relationship == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Relationship.Id,
p.TelephoneNumber,
p.Status,
p.Amount,
p.RecruitDate,
PosNoId = p.PositionNumber == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionNumber.Id,
PositionId = p.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPath.Id,
@ -170,6 +173,7 @@ namespace BMA.EHR.Placement.Service.Controllers
data.Id,
data.CitizenId,
data.Prefix,
data.PrefixId,
data.Firstname,
data.Lastname,
data.DateOfBirth,
@ -181,6 +185,7 @@ namespace BMA.EHR.Placement.Service.Controllers
data.Relationship,
data.TelephoneNumber,
data.Status,
data.Amount,
data.RecruitDate,
data.PosNoId,
data.PositionId,
@ -360,6 +365,7 @@ namespace BMA.EHR.Placement.Service.Controllers
uppdated.PositionType = save;
}
uppdated.Amount = req.Amount;
uppdated.RecruitDate = req.RecruitDate;
uppdated.Status = "PENDING";
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
@ -384,7 +390,7 @@ namespace BMA.EHR.Placement.Service.Controllers
var uppdated = await _context.PlacementReceives
.FirstOrDefaultAsync(x => x.Id == id);
if (uppdated == null)
return Error(GlobalMessages.PlacementTransferNotFound, 404);
return Error(GlobalMessages.PlacementReceiveNotFound, 404);
if (req.PrefixId != null)

View file

@ -70,6 +70,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.DateOfBirth,
Gender = p.Gender == null ? null : p.Gender.Name,
p.Status,
p.Amount,
p.RecruitDate,
PositionNumber = p.PositionNumber == null ? null : p.PositionNumber.Name,
PositionPath = p.PositionPath == null ? null : p.PositionPath.Name,
@ -121,7 +122,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
p.Id,
p.CitizenId,
Prefix = p.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Prefix.Id,
Prefix = p.Prefix == null ? null : p.Prefix.Name,
PrefixId = p.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Prefix.Id,
p.Firstname,
p.Lastname,
p.DateOfBirth,
@ -133,6 +135,7 @@ namespace BMA.EHR.Placement.Service.Controllers
Relationship = p.Relationship == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Relationship.Id,
p.TelephoneNumber,
p.Status,
p.Amount,
p.RecruitDate,
PosNoId = p.PositionNumber == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionNumber.Id,
PositionId = p.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPath.Id,
@ -170,6 +173,7 @@ namespace BMA.EHR.Placement.Service.Controllers
data.Id,
data.CitizenId,
data.Prefix,
data.PrefixId,
data.Firstname,
data.Lastname,
data.DateOfBirth,
@ -181,6 +185,7 @@ namespace BMA.EHR.Placement.Service.Controllers
data.Relationship,
data.TelephoneNumber,
data.Status,
data.Amount,
data.RecruitDate,
data.PosNoId,
data.PositionId,
@ -358,6 +363,7 @@ namespace BMA.EHR.Placement.Service.Controllers
uppdated.PositionType = save;
}
uppdated.Amount = req.Amount;
uppdated.RecruitDate = req.RecruitDate;
uppdated.Status = "PENDING";
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
@ -382,7 +388,7 @@ namespace BMA.EHR.Placement.Service.Controllers
var uppdated = await _context.PlacementRelocations
.FirstOrDefaultAsync(x => x.Id == id);
if (uppdated == null)
return Error(GlobalMessages.PlacementTransferNotFound, 404);
return Error(GlobalMessages.PlacementRelocationNotFound, 404);
if (req.PrefixId != null)

View file

@ -12,5 +12,6 @@ namespace BMA.EHR.Placement.Service.Requests
public Guid? PositionLineId { get; set; }
public Guid? PositionPathSideId { get; set; }
public Guid? PositionTypeId { get; set; }
public double? Amount { get; set; }
}
}

View file

@ -12,5 +12,6 @@ namespace BMA.EHR.Placement.Service.Requests
public Guid? PositionLineId { get; set; }
public Guid? PositionPathSideId { get; set; }
public Guid? PositionTypeId { get; set; }
public double? Amount { get; set; }
}
}

View file

@ -12,5 +12,6 @@ namespace BMA.EHR.Placement.Service.Requests
public Guid? PositionLineId { get; set; }
public Guid? PositionPathSideId { get; set; }
public Guid? PositionTypeId { get; set; }
public double? Amount { get; set; }
}
}

View file

@ -25,6 +25,5 @@ namespace BMA.EHR.Placement.Service.Requests
public string? PositionNumberOld { get; set; }
public double? AmountOld { get; set; }
public DateTime? PositionDate { get; set; }
public List<FormFile>? File { get; set; }
}
}

View file

@ -24,6 +24,5 @@ namespace BMA.EHR.Placement.Service.Requests
public string? PositionLevelOld { get; set; }
public string? PositionNumberOld { get; set; }
public double? AmountOld { get; set; }
public List<FormFile>? File { get; set; }
}
}

View file

@ -24,6 +24,5 @@ namespace BMA.EHR.Placement.Service.Requests
public string? PositionLevelOld { get; set; }
public string? PositionNumberOld { get; set; }
public double? AmountOld { get; set; }
public List<FormFile>? File { get; set; }
}
}

View file

@ -47,7 +47,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
#endregion
/// <summary>
/// list รายการอื่นๆของ Admin
/// list รายการอื่นๆ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
@ -63,33 +63,50 @@ namespace BMA.EHR.Retirement.Service.Controllers
.Select(p => new
{
p.Id,
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
p.Profile.FirstName,
p.Profile.LastName,
position = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.Position == null ? null : p.Profile.Position.Name) : p.Profile.PositionEmployeePosition,
posNo = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PosNo == null ? null : p.Profile.PosNo.Name) : p.Profile.PosNoEmployee,
positionLevel = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name) : p.Profile.PositionEmployeeLevel,
p.CreatedAt,
p.Organization,
p.Reason,
p.CitizenId,
Prefix = p.Prefix == null ? null : p.Prefix.Name,
p.Firstname,
p.Lastname,
p.DateOfBirth,
Gender = p.Gender == null ? null : p.Gender.Name,
p.Status,
p.Date,
p.Amount,
p.RecruitDate,
PositionNumber = p.PositionNumber == null ? null : p.PositionNumber.Name,
PositionPath = p.PositionPath == null ? null : p.PositionPath.Name,
PositionPathSide = p.PositionPathSide == null ? null : p.PositionPathSide.Name,
PositionType = p.PositionType == null ? null : p.PositionType.Name,
PositionLine = p.PositionLine == null ? null : p.PositionLine.Name,
PositionLevel = p.PositionLevel == null ? null : p.PositionLevel.Name,
PosNoId = p.PositionNumber == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionNumber.Id,
PositionId = p.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPath.Id,
PositionPathSideId = p.PositionPathSide == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPathSide.Id,
PositionTypeId = p.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionType.Id,
PositionLineId = p.PositionLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLine.Id,
PositionLevelId = p.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLevel.Id,
OrganizationPositionId = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
OrganizationName = p.OrganizationPosition == null ? null : (p.OrganizationPosition.Organization == null ? null : (p.OrganizationPosition.Organization.OrganizationOrganization == null ? null : p.OrganizationPosition.Organization.OrganizationOrganization.Name)),////
OrganizationShortName = p.OrganizationPosition == null ? null : (p.OrganizationPosition.Organization == null ? null : (p.OrganizationPosition.Organization.OrganizationShortName == null ? null : p.OrganizationPosition.Organization.OrganizationShortName.Name)),////
p.IsActive,
p.PositionDate,
p.Reason,
p.EducationOld,
salary = p.AmountOld,
p.PositionTypeOld,
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.IsActive,
p.CreatedAt,
})
.ToListAsync();
if (RetirementAdmin == true)
retirementOthers.Where(x => x.Status.Trim().ToUpper().Contains("APPROVE"));
retirementOthers.Where(x => x.Status.Trim().ToUpper().Contains("PENDING"));
return Success(retirementOthers);
}
/// <summary>
/// get รายละเอียดอื่นๆเจ้าหน้าที่
/// get รายละเอียดอื่นๆ
/// </summary>
/// <param name="id">Id อื่นๆ</param>
/// <returns></returns>
@ -98,39 +115,100 @@ namespace BMA.EHR.Retirement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> GetDetailAdmin(Guid id)
public async Task<ActionResult<ResponseObject>> GetDetailByUser(Guid id)
{
var data = await _context.RetirementOthers.AsQueryable()
.Where(x => x.Id == id)
.Where(x => x.Profile != null)
.Select(p => new
{
p.Id,
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
p.Profile.FirstName,
p.Profile.LastName,
ProfileId = p.Profile.Id,
position = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.Position == null ? null : p.Profile.Position.Name) : p.Profile.PositionEmployeePosition,
posNo = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PosNo == null ? null : p.Profile.PosNo.Name) : p.Profile.PosNoEmployee,
positionLevel = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name) : p.Profile.PositionEmployeeLevel,
organizationOrganization = p.Profile.OrganizationOrganization,
p.Reason,
p.CitizenId,
Prefix = p.Prefix == null ? null : p.Prefix.Name,
PrefixId = p.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Prefix.Id,
p.Firstname,
p.Lastname,
p.DateOfBirth,
Gender = p.Gender == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Gender.Id,
p.Nationality,
p.Race,
Religion = p.Religion == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Religion.Id,
BloodGroup = p.BloodGroup == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.BloodGroup.Id,
Relationship = p.Relationship == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Relationship.Id,
p.TelephoneNumber,
p.Status,
p.Organization,
p.Date,
salary = p.AmountOld,
p.Amount,
p.RecruitDate,
PosNoId = p.PositionNumber == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionNumber.Id,
PositionId = p.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPath.Id,
PositionPathSideId = p.PositionPathSide == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPathSide.Id,
PositionTypeId = p.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionType.Id,
PositionLineId = p.PositionLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLine.Id,
PositionLevelId = p.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLevel.Id,
OrganizationPositionId = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
p.CreatedAt,
p.Reason,
p.EducationOld,
salary = p.AmountOld,
p.PositionTypeOld,
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.PositionDate,
RetirementOtherDocs = p.RetirementOtherDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
})
.FirstOrDefaultAsync();
if (data == null)
return Error(GlobalMessages.DataNotFound, 404);
return Success(data);
var retirementOtherDocs = new List<dynamic>();
foreach (var doc in data.RetirementOtherDocs)
{
var _doc = new
{
doc.FileName,
PathName = await _documentService.ImagesPath(doc.Id)
};
retirementOtherDocs.Add(_doc);
}
var _data = new
{
data.Id,
data.CitizenId,
data.Prefix,
data.PrefixId,
data.Firstname,
data.Lastname,
data.DateOfBirth,
data.Gender,
data.Nationality,
data.Race,
data.Religion,
data.BloodGroup,
data.Relationship,
data.TelephoneNumber,
data.Status,
data.Amount,
data.RecruitDate,
data.PosNoId,
data.PositionId,
data.PositionPathSideId,
data.PositionTypeId,
data.PositionLineId,
data.PositionLevelId,
data.OrganizationPositionId,
data.CreatedAt,
data.Reason,
data.EducationOld,
data.salary,
data.PositionTypeOld,
data.PositionLevelOld,
data.PositionNumberOld,
data.OrganizationPositionOld,
data.PositionDate,
Docs = retirementOtherDocs,
};
return Success(_data);
}
/// <summary>
@ -149,17 +227,29 @@ namespace BMA.EHR.Retirement.Service.Controllers
.Include(x => x.PositionType)
.Include(x => x.PosNo)
.Include(x => x.Salaries)
.Include(x => x.Educations)
.Include(x => x.Position)
.Include(x => x.Gender)
.Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == req.Id);
if (profile == null)
return Error(GlobalMessages.DataNotFound, 404);
var retirementOther = new RetirementOther
{
Profile = profile,
Organization = Request.Form.ContainsKey("Organization") ? Request.Form["Organization"] : "",
Reason = Request.Form.ContainsKey("Reason") ? Request.Form["Reason"] : "",
// Date = req.Date,
CitizenId = profile.CitizenId,
Prefix = profile.Prefix,
Firstname = profile.FirstName,
Lastname = profile.LastName,
DateOfBirth = profile.BirthDate,
Gender = profile.Gender,
Nationality = profile.Nationality,
Race = profile.Race,
Religion = await _context.Religions.FindAsync(profile.ReligionId),
BloodGroup = await _context.BloodGroups.FindAsync(profile.BloodGroupId),
Relationship = await _context.Relationships.FindAsync(profile.RelationshipId),
TelephoneNumber = profile.TelephoneNumber,
EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}",
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
@ -175,6 +265,114 @@ namespace BMA.EHR.Retirement.Service.Controllers
};
await _context.RetirementOthers.AddAsync(retirementOther);
await _context.SaveChangesAsync();
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
{
foreach (var file in Request.Form.Files)
{
var fileExtension = Path.GetExtension(file.FileName);
var doc = await _documentService.UploadFileAsync(file, file.FileName);
var _doc = await _context.Documents.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == doc.Id);
if (_doc != null)
{
var retirementOtherDoc = new RetirementOtherDoc
{
RetirementOther = retirementOther,
Document = _doc,
CreatedUserId = FullName ?? "",
CreatedFullName = UserId ?? "System Administrator",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
};
await _context.RetirementOtherDocs.AddAsync(retirementOtherDoc);
}
}
}
await _context.SaveChangesAsync();
return Success();
}
/// <summary>
/// เลือกหน่วยงาน
/// </summary>
/// <param name="id">Id อื่นๆ</param>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("position/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> UpdatePositionRetirementOther([FromBody] PersonSelectPositionOtherRequest req, Guid id)
{
var uppdated = await _context.RetirementOthers
.FirstOrDefaultAsync(x => x.Id == id);
if (uppdated == null)
return Error(GlobalMessages.RetirementOtherNotFound, 404);
if (req.PosNoId != null)
{
var save_posNo = await _context.PositionNumbers.FindAsync(req.PosNoId);
if (save_posNo == null)
return Error(GlobalMessages.PositionPosNoNotFound, 404);
uppdated.PositionNumber = save_posNo;
var save_orgPosition = await _context.OrganizationPositions.FirstOrDefaultAsync(x => x.PositionNumber == save_posNo);
if (save_orgPosition == null)
return Error(GlobalMessages.PositionPosNoNotFound, 404);
uppdated.OrganizationPosition = save_orgPosition;
}
if (req.PositionId != null)
{
var save = await _context.PositionPaths.FindAsync(req.PositionId);
if (save == null)
return Error(GlobalMessages.PositionPathNotFound, 404);
uppdated.PositionPath = save;
}
if (req.PositionLevelId != null)
{
var save = await _context.PositionLevels.FindAsync(req.PositionLevelId);
if (save == null)
return Error(GlobalMessages.PositionLevelNotFound, 404);
uppdated.PositionLevel = save;
}
if (req.PositionLineId != null)
{
var save = await _context.PositionLines.FindAsync(req.PositionLineId);
if (save == null)
return Error(GlobalMessages.PositionLineNotFound, 404);
uppdated.PositionLine = save;
}
if (req.PositionPathSideId != null)
{
var save = await _context.PositionPathSides.FindAsync(req.PositionPathSideId);
if (save == null)
return Error(GlobalMessages.PositionPathSideNotFound, 404);
uppdated.PositionPathSide = save;
}
if (req.PositionTypeId != null)
{
var save = await _context.PositionTypes.FindAsync(req.PositionTypeId);
if (save == null)
return Error(GlobalMessages.PositionTypeNotFound, 404);
uppdated.PositionType = save;
}
uppdated.Amount = req.Amount;
uppdated.RecruitDate = req.RecruitDate;
uppdated.Status = "PENDING";
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
await _context.SaveChangesAsync();
return Success();
}
@ -195,40 +393,61 @@ namespace BMA.EHR.Retirement.Service.Controllers
if (uppdated == null)
return Error(GlobalMessages.RetirementOtherNotFound, 404);
uppdated.PositionNumberOld = req.PositionNumberOld;
uppdated.OrganizationPositionOld = req.OrganizationPositionOld;
uppdated.PositionLevelOld = req.PositionLevelOld;
uppdated.PositionTypeOld = req.PositionTypeOld;
uppdated.AmountOld = req.AmountOld;
uppdated.Organization = req.Organization;
if (req.PrefixId != null)
{
var save = await _context.Prefixes.FindAsync(req.PrefixId);
if (save == null)
return Error(GlobalMessages.PrefixNotFound, 404);
uppdated.Prefix = save;
}
if (req.RelationshipId != null)
{
var save = await _context.Relationships.FindAsync(req.RelationshipId);
if (save == null)
return Error(GlobalMessages.RelationshipNotFound, 404);
uppdated.Relationship = save;
}
if (req.ReligionId != null)
{
var save = await _context.Religions.FindAsync(req.ReligionId);
if (save == null)
return Error(GlobalMessages.ReligionNotFound, 404);
uppdated.Religion = save;
}
if (req.BloodGroupId != null)
{
var save = await _context.BloodGroups.FindAsync(req.BloodGroupId);
if (save == null)
return Error(GlobalMessages.BloodGroupNotFound, 404);
uppdated.BloodGroup = save;
}
if (req.GenderId != null)
{
var save = await _context.Genders.FindAsync(req.GenderId);
if (save == null)
return Error(GlobalMessages.GenderNotFound, 404);
uppdated.Gender = save;
}
uppdated.CitizenId = req.CitizenId;
uppdated.Firstname = req.Firstname;
uppdated.Lastname = req.Lastname;
uppdated.DateOfBirth = req.DateOfBirth;
uppdated.Nationality = req.Nationality;
uppdated.Race = req.Race;
uppdated.TelephoneNumber = req.TelephoneNumber;
uppdated.EducationOld = req.EducationOld;
uppdated.Reason = req.Reason;
uppdated.Date = req.Date;
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
await _context.SaveChangesAsync();
return Success();
}
/// <summary>
/// อนุมัติอื่นๆ
/// </summary>
/// <param name="id">Id อื่นๆ</param>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("confirm/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> AdminConfirm(Guid id)
{
var uppdated = await _context.RetirementOthers
.FirstOrDefaultAsync(x => x.Id == id);
if (uppdated == null)
return Error(GlobalMessages.RetirementOtherNotFound, 404);
uppdated.Status = "APPROVE";
uppdated.OrganizationPositionOld = req.OrganizationPositionOld;
uppdated.PositionTypeOld = req.PositionTypeOld;
uppdated.PositionLevelOld = req.PositionLevelOld;
uppdated.PositionNumberOld = req.PositionNumberOld;
uppdated.AmountOld = req.AmountOld;
uppdated.PositionDate = req.PositionDate;
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
@ -250,10 +469,25 @@ namespace BMA.EHR.Retirement.Service.Controllers
public async Task<ActionResult<ResponseObject>> Delete(Guid id)
{
var deleted = await _context.RetirementOthers.AsQueryable()
.Include(x => x.RetirementOtherDocs)
.ThenInclude(x => x.Document)
.FirstOrDefaultAsync(x => x.Id == id);
if (deleted == null)
return NotFound();
var retirementOtherDocs = new List<dynamic>();
foreach (var doc in deleted.RetirementOtherDocs)
{
if (doc.Document != null)
retirementOtherDocs.Add(doc.Document.Id);
}
_context.RetirementOtherDocs.RemoveRange(deleted.RetirementOtherDocs);
await _context.SaveChangesAsync();
_context.RetirementOthers.Remove(deleted);
foreach (var doc in retirementOtherDocs)
{
if (doc != null)
await _documentService.DeleteFileAsync(doc);
}
await _context.SaveChangesAsync();
return Success();

View file

@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Retirement.Service.Requests
{
public class PersonSelectPositionReceiveRequest
public class PersonSelectPositionOtherRequest
{
public DateTime? RecruitDate { get; set; }
public Guid? PosNoId { get; set; }
@ -12,5 +12,6 @@ namespace BMA.EHR.Retirement.Service.Requests
public Guid? PositionLineId { get; set; }
public Guid? PositionPathSideId { get; set; }
public Guid? PositionTypeId { get; set; }
public double? Amount { get; set; }
}
}

View file

@ -5,13 +5,25 @@ namespace BMA.EHR.Retirement.Service.Requests
{
public class RetirementOtherEditRequest
{
public string Organization { get; set; }
public string Reason { get; set; }
public string CitizenId { get; set; }
public Guid PrefixId { get; set; }
public string Firstname { get; set; }
public string Lastname { get; set; }
public DateTime DateOfBirth { get; set; }
public Guid? GenderId { get; set; }
public string? Nationality { get; set; }
public string? Race { get; set; }
public Guid? ReligionId { get; set; }
public Guid? BloodGroupId { get; set; }
public Guid? RelationshipId { get; set; }
public string? TelephoneNumber { get; set; }
public string? Reason { get; set; }
public string? EducationOld { get; set; }
public string? OrganizationPositionOld { get; set; }
public DateTime? Date { get; set; }
public string? PositionTypeOld { get; set; }
public string? PositionLevelOld { get; set; }
public string? PositionNumberOld { get; set; }
public double? AmountOld { get; set; }
public DateTime? PositionDate { get; set; }
}
}