diff --git a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs index 40991cff..9eed3f11 100644 --- a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs +++ b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs @@ -306,6 +306,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }); // check วันที่บรรจะต้องน้อยกว่า 29/5/ปี-8 ขอ บม. @@ -369,7 +370,8 @@ namespace BMA.EHR.Application.Repositories $"2.ได้รับอัตราค่าจ้างตั้งแต่อัตราเงินเดือนขั้นต่ำของข้าราขการพลเรือนระดับปฏิบัติการ (8,340) แต่ไม่ถึงขั้นต่ำของอัตราเงินเดือนข้าราชการพลเรือนระดับชำนาญการ (15,050)", Result = $"อัตราค่าจ้าง {p?.SalaryCondition?.ToString("#,##0")??""}" }, - } + }, + ProfileType = p.ProfileType })).ToList(); var bcpRoyal = await _dbContext.Set() @@ -448,6 +450,7 @@ namespace BMA.EHR.Application.Repositories .FirstOrDefault() == null ? 0 : p.ProfileInsignia.Where(x => x.InsigniaId.Value == bcmRoyal.Id).OrderBy(x => x.Year) .FirstOrDefault().Year, + ProfileType = p.ProfileType }) .ToList() .Where(x => (x.SalaryCondition >= 8340 && x.SalaryCondition < 10150) && !x.IsHigherLevel) @@ -506,7 +509,8 @@ namespace BMA.EHR.Application.Repositories $"2.ได้ บ.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้รับ บ.ม. ก่อนวันที่ {(new DateTime(period.Year - 5, 7, 28)).ToThaiFullDate3()})", Result = $"ได้รับ บ.ม. ในปี {p.FirstRecvInsigniaYear}" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -581,6 +585,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(x => (x.SalaryCondition >= 8340 && x.SalaryCondition < 10150) && !x.IsHigherLevel) @@ -640,6 +645,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList(); @@ -781,6 +787,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }); var s1 = ((from p in inst_profile @@ -842,7 +849,8 @@ namespace BMA.EHR.Application.Repositories $"2.ได้รับอัตราค่าจ้างตั้งแต่อัตราเงินเดือนขั้นต่ำของข้าราขการพลเรือนระดับชำนาญการขึ้นไป (15,050)", Result = $"อัตราค่าจ้าง {p?.SalaryCondition?.ToString("#,##0")??""}" }, - } + }, + ProfileType = p.ProfileType })).ToList(); var bcpRoyal = await _dbContext.Set() @@ -923,6 +931,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(x => (x.SalaryCondition >= 10150) && !x.IsHigherLevel) @@ -981,7 +990,8 @@ namespace BMA.EHR.Application.Repositories $"2.ได้ บ.ช. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้รับ บ.ช. ก่อนวันที่ {(new DateTime(period.Year - 5, 7, 28)).ToThaiFullDate3()})", Result = $"ได้รับ บ.ช. ในปี {p.FirstRecvInsigniaYear}" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -1053,6 +1063,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(x => (x.SalaryCondition >= 10150) && !x.IsHigherLevel) @@ -1111,7 +1122,8 @@ namespace BMA.EHR.Application.Repositories $"2.ได้ จ.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้รับ จ.ม. ก่อนวันที่ {(new DateTime(period.Year - 5, 7, 28)).ToThaiFullDate3()})", Result = $"ได้รับ จ.ม. ในปี {p.FirstRecvInsigniaYear}" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -1259,6 +1271,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }); // check วันที่บรรจะต้องน้อยกว่า 29/5/ปี-5 @@ -1316,7 +1329,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"1.รับราชการก่อน {new DateTime(period.Year - 5, 5, 29).ToThaiFullDate3()}", Result = $"วันที่บรรจุเข้ารับราชการ {p.ProfileDateAppoint.ToThaiFullDate3()}" } - } + }, + ProfileType = p.ProfileType })).ToList(); var s2 = (from p in allProfilesByRoot @@ -1392,6 +1406,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(x => x.SalaryCondition < 10190 && !x.IsHigherLevel) @@ -1450,7 +1465,8 @@ namespace BMA.EHR.Application.Repositories $"2.ดำรงตำแหน่งมาแล้วไม่น้อยกว่า 10 ปี บริบูรณ์ (รับราชการก่อน {new DateTime(period.Year - 10, 5, 29).ToThaiFullDate3()})", Result = $"วันที่บรรจุเข้ารับราชการ {p.ProfileDateAppoint.ToThaiFullDate3()}" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -1533,6 +1549,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(x => x.SalaryCondition >= 10190 && !x.IsHigherLevel) @@ -1584,7 +1601,8 @@ namespace BMA.EHR.Application.Repositories $"1.ได้รับเงินเดือนไม่ต่ำกว่าขั้นต่ำของระดับชำนาญงาน (เงินเดือน ณ วันที่ {(new DateTime(period.Year, 4, 29)).ToThaiFullDate3()} 10,190 บาทขึ้นไป)", Result = $"ได้รับเงินเดือน {p.SalaryCondition} บาท" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -1667,6 +1685,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(x => x.SalaryCondition >= 10190 && !x.IsHigherLevel) @@ -1725,7 +1744,8 @@ namespace BMA.EHR.Application.Repositories $"2.ดำรงตำแหน่งมาแล้วไม่น้อยกว่า 10 ปี บริบูรณ์ (รับราชการก่อน {new DateTime(period.Year - 10, 5, 29).ToThaiFullDate3()})", Result = $"วันที่บรรจุเข้ารับราชการ {p.ProfileDateAppoint.ToThaiFullDate3()}" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -1910,6 +1930,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Select(p => new InsigniaResultSet @@ -1959,7 +1980,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"1.เป็นระดับชำนาญงาน", Result = $"ตำแหน่ง {p.Position} ประเภท {p.PositionType} ระดับ {p.PositionLevel}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -2049,6 +2071,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(x => x.FirstPositonLevelDate < new DateTime(period.Year - 5, 5, 29)) @@ -2101,7 +2124,8 @@ namespace BMA.EHR.Application.Repositories Result = $"ดำรงตำแหน่ง {p.Position} ประเภท {p.PositionType} ระดับ {p.PositionLevel} ตั้งแต่วันที่ {(p.FirstPositonLevelDate == null ? "-" : p.FirstPositonLevelDate.Value.ToThaiFullDate3())}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -2255,6 +2279,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Select(p => new InsigniaResultSet @@ -2304,7 +2329,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"1.เป็นระดับอาวุโส", Result = $"ตำแหน่ง {p.Position} ประเภท {p.PositionType} ระดับ {p.PositionLevel}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -2394,6 +2420,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(x => x.FirstPositonLevelDate < new DateTime(period.Year - 5, 5, 29)) @@ -2446,7 +2473,8 @@ namespace BMA.EHR.Application.Repositories Result = $"ดำรงตำแหน่ง {p.Position} ประเภท {p.PositionType} ระดับ {p.PositionLevel} ตั้งแต่วันที่ {(p.FirstPositonLevelDate == null ? "-" : p.FirstPositonLevelDate.Value.ToThaiFullDate3())}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -2601,6 +2629,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Select(p => new InsigniaResultSet @@ -2650,7 +2679,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"1.เป็นระดับทักษะพิเศษ", Result = $"ตำแหน่ง {p.Position} ประเภท {p.PositionType} ระดับ {p.PositionLevel}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -2748,6 +2778,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(x => x.FirstRecvInsigniaYear != 0 && x.FirstRecvInsigniaYear <= period.Year - 3) @@ -2799,7 +2830,8 @@ namespace BMA.EHR.Application.Repositories $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้รับ ท.ช. ก่อนวันที่ {(new DateTime(period.Year - 3, 7, 28)).ToThaiFullDate3()})", Result = $"ได้รับ ท.ช. ในปี {p.FirstRecvInsigniaYear.Value.ToThaiYear()}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -2897,6 +2929,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(x => x.FirstRecvInsigniaYear != 0 && x.FirstRecvInsigniaYear <= period.Year - 5) @@ -2948,7 +2981,8 @@ namespace BMA.EHR.Application.Repositories $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้รับ ป.ม. ก่อนวันที่ {(new DateTime(period.Year - 5, 7, 28)).ToThaiFullDate3()})", Result = $"ได้รับ ป.ม. ในปี {p.FirstRecvInsigniaYear.Value.ToThaiYear()}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -3131,6 +3165,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Select(p => new InsigniaResultSet @@ -3180,7 +3215,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"1.รับราชการก่อน {new DateTime(period.Year - 5, 5, 29).ToThaiFullDate3()}", Result = $"วันที่บรรจุเข้ารับราชการ {p.ProfileDateAppoint.ToThaiFullDate3()}" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -3324,6 +3360,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Select(p => new InsigniaResultSet @@ -3373,7 +3410,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"1.เป็นระดับชำนาญการ", Result = $"ตำแหน่ง {p.Position} ประเภท {p.PositionType} ระดับ {p.PositionLevel}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -3470,6 +3508,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.SalaryCondition >= 22140) @@ -3522,7 +3561,8 @@ namespace BMA.EHR.Application.Repositories Result = $"เงินเดือน ณ วันที่ {(new DateTime(period.Year, 4, 29)).ToThaiFullDate3()} เป็นเงิน {p.SalaryCondition} บาท" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -3619,6 +3659,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.SalaryCondition >= 22140) @@ -3671,7 +3712,8 @@ namespace BMA.EHR.Application.Repositories Result = $"เงินเดือนก่อนวันที่ {(new DateTime(period.Year - 5, 4, 29)).ToThaiFullDate3()} เป็นเงิน {p.SalaryCondition} บาท" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -3852,6 +3894,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Select(p => new InsigniaResultSet @@ -3884,7 +3927,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"1.เป็นระดับชำนาญการพิเศษ", Result = $"ตำแหน่ง {p.Position} ประเภท {p.PositionType} ระดับ {p.PositionLevel}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -3982,6 +4026,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.SalaryCondition >= 58390) @@ -4041,7 +4086,8 @@ namespace BMA.EHR.Application.Repositories $"2.ได้ ท.ช. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ท.ช. วันที่ {(new DateTime(period.Year - 5, 7, 28)).ToThaiFullDate3()} หรือก่อนหน้านั้น)", Result = $"ได้รับ ท.ช. ในปี {p.FirstRecvInsigniaYear.Value.ToThaiYear()}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -4203,6 +4249,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Select(p => new InsigniaResultSet @@ -4252,7 +4299,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"1.เป็นระดับเชี่ยวชาญ", Result = $"ตำแหน่ง {p.Position} ประเภท {p.PositionType} ระดับ {p.PositionLevel}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -4351,6 +4399,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) @@ -4402,7 +4451,8 @@ namespace BMA.EHR.Application.Repositories $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ท.ช. ก่อนวันที่ {(new DateTime(period.Year - 3, 7, 28)).ToThaiFullDate3()})", Result = $"ได้รับ ท.ช. ในปี {p.FirstRecvInsigniaYear.Value.ToThaiYear()}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -4499,6 +4549,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 5) @@ -4550,7 +4601,8 @@ namespace BMA.EHR.Application.Repositories $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ท.ช. ก่อนวันที่ {(new DateTime(period.Year - 5, 7, 28)).ToThaiFullDate3()})", Result = $"ได้รับ ป.ม. ในปี {p.FirstRecvInsigniaYear.Value.ToThaiYear()}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -4731,6 +4783,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(x => x.FirstRecvInsigniaYear != 0 && x.FirstRecvInsigniaYear <= period.Year - 3) @@ -4788,7 +4841,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"ได้รับเงินประจำตำแหน่ง 13,000 บาท", Result = $"ได้รับเงินประจำตำแหน่ง {p.SalaryPosition} บาท" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -4886,6 +4940,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) @@ -4943,7 +4998,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"ได้รับเงินประจำตำแหน่ง 13,000 บาท", Result = $"ได้รับเงินประจำตำแหน่ง {p.SalaryPosition} บาท" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -5041,6 +5097,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 5) @@ -5098,7 +5155,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"ได้รับเงินประจำตำแหน่ง 13,000 บาท", Result = $"ได้รับเงินประจำตำแหน่ง {p.SalaryPosition} บาท" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -5277,6 +5335,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(x => x.FirstRecvInsigniaYear != 0 && x.FirstRecvInsigniaYear <= period.Year - 3) @@ -5334,7 +5393,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"ได้รับเงินประจำตำแหน่ง 15,600 บาท", Result = $"ได้รับเงินประจำตำแหน่ง {p.SalaryPosition} บาท" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -5432,6 +5492,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) @@ -5489,7 +5550,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"ได้รับเงินประจำตำแหน่ง 15,600 บาท", Result = $"ได้รับเงินประจำตำแหน่ง {p.SalaryPosition} บาท" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -5585,6 +5647,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) @@ -5642,7 +5705,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"ได้รับเงินประจำตำแหน่ง 15,600 บาท", Result = $"ได้รับเงินประจำตำแหน่ง {p.SalaryPosition} บาท" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -5818,6 +5882,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Select(p => new InsigniaResultSet @@ -5867,7 +5932,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"1.เป็นระดับอำนวยการ/ต้น", Result = $"ตำแหน่ง {p.Position} ประเภท {p.PositionType} ระดับ {p.PositionLevel}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -5965,6 +6031,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.SalaryCondition >= 58390) @@ -6024,7 +6091,8 @@ namespace BMA.EHR.Application.Repositories $"2.ได้ ท.ช. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ท.ช. วันที่ {(new DateTime(period.Year - 5, 7, 28)).ToThaiFullDate3()} หรือก่อนหน้านั้น)", Result = $"ได้รับ ท.ช. ในปี {p.FirstRecvInsigniaYear.Value.ToThaiYear()}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -6181,6 +6249,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) @@ -6232,7 +6301,8 @@ namespace BMA.EHR.Application.Repositories $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ท.ช. วันที่ {(new DateTime(period.Year - 3, 7, 28)).ToThaiFullDate3()} หรือก่อนหน้านั้น)", Result = $"ได้รับ ท.ช. ในปี {p.FirstRecvInsigniaYear.Value.ToThaiYear()}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -6330,6 +6400,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) @@ -6381,7 +6452,8 @@ namespace BMA.EHR.Application.Repositories $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. วันที่ {(new DateTime(period.Year - 3, 7, 28)).ToThaiFullDate3()} หรือก่อนหน้านั้น)", Result = $"ได้รับ ป.ม. ในปี {p.FirstRecvInsigniaYear.Value.ToThaiYear()}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -6480,6 +6552,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 5) @@ -6531,7 +6604,8 @@ namespace BMA.EHR.Application.Repositories $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ป.ช. วันที่ {(new DateTime(period.Year - 3, 7, 28)).ToThaiFullDate3()} หรือก่อนหน้านั้น)", Result = $"ได้รับ ป.ช. ในปี {p.FirstRecvInsigniaYear.Value.ToThaiYear()}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -6709,6 +6783,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) @@ -6760,7 +6835,8 @@ namespace BMA.EHR.Application.Repositories $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ท.ช. วันที่ {(new DateTime(period.Year - 3, 7, 28)).ToThaiFullDate3()} หรือก่อนหน้านั้น)", Result = $"ได้รับ ท.ช. ในปี {p.FirstRecvInsigniaYear.Value.ToThaiYear()}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -6858,6 +6934,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) @@ -6909,7 +6986,8 @@ namespace BMA.EHR.Application.Repositories $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. วันที่ {(new DateTime(period.Year - 3, 7, 28)).ToThaiFullDate3()} หรือก่อนหน้านั้น)", Result = $"ได้รับ ป.ม. ในปี {p.FirstRecvInsigniaYear.Value.ToThaiYear()}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -7007,6 +7085,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 5) @@ -7058,7 +7137,8 @@ namespace BMA.EHR.Application.Repositories $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ป.ช. วันที่ {(new DateTime(period.Year - 3, 7, 28)).ToThaiFullDate3()} หรือก่อนหน้านั้น)", Result = $"ได้รับ ป.ช. ในปี {p.FirstRecvInsigniaYear.Value.ToThaiYear()}" }, - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -7207,6 +7287,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) @@ -7264,7 +7345,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"ได้รับเงินประจำตำแหน่ง 14,500 บาท", Result = $"ได้รับเงินประจำตำแหน่ง {p.SalaryPosition} บาท" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -7362,6 +7444,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) @@ -7419,7 +7502,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"ได้รับเงินประจำตำแหน่ง 14,500 บาท", Result = $"ได้รับเงินประจำตำแหน่ง {p.SalaryPosition} บาท" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -7515,6 +7599,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }) .ToList() .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 5) @@ -7572,7 +7657,8 @@ namespace BMA.EHR.Application.Repositories Condition = $"ได้รับเงินประจำตำแหน่ง 14,500 บาท", Result = $"ได้รับเงินประจำตำแหน่ง {p.SalaryPosition} บาท" } - } + }, + ProfileType = p.ProfileType }) .ToList(); @@ -7886,6 +7972,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType }); // check วันที่บรรจะต้องมากกว่า 25 ปี @@ -7935,6 +8022,7 @@ namespace BMA.EHR.Application.Repositories Child4Id = p.Child4Id, Child4DnaId = p.Child4DnaId, Child4 = p.Child4, + ProfileType = p.ProfileType })).ToList(); diff --git a/BMA.EHR.Application/Responses/Profiles/GetProfileByRootIdDto.cs b/BMA.EHR.Application/Responses/Profiles/GetProfileByRootIdDto.cs index fa649550..4f9b753c 100644 --- a/BMA.EHR.Application/Responses/Profiles/GetProfileByRootIdDto.cs +++ b/BMA.EHR.Application/Responses/Profiles/GetProfileByRootIdDto.cs @@ -63,5 +63,7 @@ namespace BMA.EHR.Application.Responses.Profiles public Guid? Child4Id { get; set; } public Guid? Child4DnaId { get; set; } public string? Child4 { get; set; } + + public string? ProfileType { get; set; } } } diff --git a/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs b/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs index 014d9be4..56b05c71 100644 --- a/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs +++ b/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs @@ -4,6 +4,7 @@ using BMA.EHR.Application.Repositories.Reports; using BMA.EHR.Application.Requests; using BMA.EHR.Application.Responses.Insignias; using BMA.EHR.Application.Responses.Organizations; +using BMA.EHR.Application.Responses.Profiles; using BMA.EHR.Domain.Common; using BMA.EHR.Domain.Extensions; using BMA.EHR.Domain.Models.Insignias; @@ -20,6 +21,7 @@ using OfficeOpenXml; using RabbitMQ.Client; using Swashbuckle.AspNetCore.Annotations; using System.Security.Claims; +using System.Security.Cryptography; using System.Text; namespace BMA.EHR.Insignia.Service.Controllers @@ -391,13 +393,54 @@ namespace BMA.EHR.Insignia.Service.Controllers } - [HttpGet("cal-test/{period:guid}/{oc:guid}")] - public async Task> GetTestInsigniaRequest(Guid period, Guid oc) + [HttpGet("cal-test/{periodId:guid}")] + public async Task> GetTestInsigniaRequest(Guid periodId) { - var candidate = await _repository.GetInsigniaCandidateBKK(period, oc); - await _repository.InsertCandidate(period, oc, "สำนักงานเขตพระนคร", candidate); + //var candidate = await _repository.GetInsigniaCandidateBKK(period, oc); + //await _repository.InsertCandidate(period, oc, "สำนักงานเขตพระนคร", candidate); - return Success(candidate); + var selectPeriod = _context.InsigniaPeriods.AsNoTracking().Include(x => x.InsigniaEmployees) + .Where(x => x.Id == periodId).FirstOrDefault(); + if (selectPeriod == null) + throw new Exception(GlobalMessages.InsigniaPeriodNotFound); + + var organizations = await _userProfileRepository.GetActiveRootAsync(AccessToken, selectPeriod.RevisionId); + var allEmployeeProfileByRoot = new List(); + + foreach (var organization in organizations) + { + if (organization == null) + continue; + + if (selectPeriod != null && selectPeriod.InsigniaEmployees != null) + { + var emp = + await _userProfileRepository.GetEmployeeProfileByPositionAsync(organization.Id, selectPeriod.InsigniaEmployees.Select(x => x.RefId), AccessToken); + if (emp != null) + allEmployeeProfileByRoot.AddRange(emp); + } + } + + var resultData = allEmployeeProfileByRoot.Select(x => new + { + citizenId = x.CitizenId, + fullName = $"{x.Prefix}{x.FirstName} {x.LastName}", + root = x.Root, + dateAppoint = x.DateAppoint == null ? "" : x.DateAppoint.Value.ToThaiShortDate(), + salary = x.Amount, + salaryCondition = x.ProfileSalary == null || x.ProfileSalary.Count == 0 ? 0 : + x.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(selectPeriod.Year, 4, 29)) + .OrderByDescending(x => x.Order).FirstOrDefault() != null ? x.ProfileSalary + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(selectPeriod.Year, 4, 29)) + .OrderByDescending(x => x.Order).FirstOrDefault().Amount : + x.Amount, + insignias = x.ProfileInsignia.ToList(), + salaries = x.ProfileSalary.ToList(), + profileType = x.ProfileType + }).ToList(); + + + return Success(resultData); } /// @@ -2230,7 +2273,7 @@ namespace BMA.EHR.Insignia.Service.Controllers } return Success(_insigniaNoteProfiles); } - catch(Exception ex) + catch (Exception ex) { return Error(ex); }