From 5b0fcd0680d8257652a34b2e645a58fa273facd8 Mon Sep 17 00:00:00 2001 From: harid Date: Fri, 1 May 2026 11:20:15 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B9=83?= =?UTF-8?q?=E0=B8=AB=E0=B9=89=E0=B9=80=E0=B8=9B=E0=B9=87=E0=B8=99=20proces?= =?UTF-8?q?s=20=E0=B8=97=E0=B8=B5=E0=B9=88=E0=B8=84=E0=B8=A7=E0=B8=A3?= =?UTF-8?q?=E0=B8=9A=E0=B8=B1=E0=B8=99=E0=B8=97=E0=B8=B6=E0=B8=81=E0=B8=95?= =?UTF-8?q?=E0=B8=B2=E0=B8=A1=E0=B8=A5=E0=B8=B3=E0=B8=94=E0=B8=B1=E0=B8=9A?= =?UTF-8?q?=20#224?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/DisciplineResultController.cs | 154 ++++++++++++------ .../Controllers/PlacementController.cs | 51 ++++-- .../Controllers/PlacementOfficerController.cs | 32 ++-- .../Controllers/PlacementReceiveController.cs | 16 +- .../PlacementRepatriationController.cs | 16 +- .../PlacementTransferController.cs | 16 +- .../Controllers/RetirementOtherController.cs | 32 ++-- .../Controllers/RetirementOutController.cs | 16 +- .../Controllers/RetirementResignController.cs | 35 ++-- .../RetirementResignEmployeeController.cs | 35 ++-- 10 files changed, 260 insertions(+), 143 deletions(-) diff --git a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs index 85388209..5301a5ae 100644 --- a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs +++ b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs @@ -1013,6 +1013,11 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers .Include(x => x.DisciplineDisciplinary) .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => { profile.Status = "REPORTED"; profile.CommandTypeId = null; }); + await _context.SaveChangesAsync(); + var resultData = (from p in data join r in req.refIds on p.Id.ToString() equals r.refId @@ -1061,8 +1066,8 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers var _result = await _res.Content.ReadAsStringAsync(); if (_res.IsSuccessStatusCode) { - // คำสั่งไล่ออก หรือ ปลดออก Status หลังออกคำสั่งใช้ "REPORTED" เพื่อไม่ให้ส่งรายชื่อไปออกคำสั่งซ้ำได้ - data.ForEach(profile => { profile.Status = "REPORTED"; profile.CommandTypeId = null; }); + //// คำสั่งไล่ออก หรือ ปลดออก Status หลังออกคำสั่งใช้ "REPORTED" เพื่อไม่ให้ส่งรายชื่อไปออกคำสั่งซ้ำได้ + // data.ForEach(profile => { profile.Status = "REPORTED"; profile.CommandTypeId = null; }); var _profile = new List(); DateTime _date = DateTime.Now; foreach (var item in data) @@ -1150,6 +1155,11 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers .Include(x => x.DisciplineDisciplinary) .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => { profile.Status = "REPORTED"; profile.CommandTypeId = null; }); + await _context.SaveChangesAsync(); + var resultData = (from p in data join r in req.refIds on p.Id.ToString() equals r.refId @@ -1198,8 +1208,8 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers var _result = await _res.Content.ReadAsStringAsync(); if (_res.IsSuccessStatusCode) { - // คำสั่งไล่ออก หรือ ปลดออก Status หลังออกคำสั่งใช้ "REPORTED" เพื่อไม่ให้ส่งรายชื่อไปออกคำสั่งซ้ำได้ - data.ForEach(profile => { profile.Status = "REPORTED"; profile.CommandTypeId = null; }); + //// คำสั่งไล่ออก หรือ ปลดออก Status หลังออกคำสั่งใช้ "REPORTED" เพื่อไม่ให้ส่งรายชื่อไปออกคำสั่งซ้ำได้ + // data.ForEach(profile => { profile.Status = "REPORTED"; profile.CommandTypeId = null; }); var _profile = new List(); DateTime _date = DateTime.Now; foreach (var item in data) @@ -1379,6 +1389,11 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers // .Where(x => x.Status == "REPORT") .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.Status = "DONE"); + await _context.SaveChangesAsync(); + var resultData = (from p in data join r in req.refIds on p.Id.ToString() equals r.refId @@ -1424,12 +1439,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.Status = "DONE"); - await _context.SaveChangesAsync(); - } + //// var _result = await _res.Content.ReadAsStringAsync(); + //// if (_res.IsSuccessStatusCode) + //// { + //// data.ForEach(profile => profile.Status = "DONE"); + //// await _context.SaveChangesAsync(); + //// } } return Success(); } @@ -1518,6 +1533,11 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers // .Where(x => x.Status == "REPORT") .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.Status = "DONE"); + await _context.SaveChangesAsync(); + var resultData = (from p in data join r in req.refIds on p.Id.ToString() equals r.refId @@ -1563,12 +1583,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.Status = "DONE"); - await _context.SaveChangesAsync(); - } + //// var _result = await _res.Content.ReadAsStringAsync(); + //// if (_res.IsSuccessStatusCode) + //// { + //// data.ForEach(profile => profile.Status = "DONE"); + //// await _context.SaveChangesAsync(); + //// } } return Success(); } @@ -1641,6 +1661,11 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers .Include(x => x.DisciplineDisciplinary) .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; }); + await _context.SaveChangesAsync(); + string? _null = null; var resultData = (from p in data join r in req.refIds @@ -1686,12 +1711,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; }); - await _context.SaveChangesAsync(); - } + //// var _result = await _res.Content.ReadAsStringAsync(); + //// if (_res.IsSuccessStatusCode) + //// { + //// data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; }); + //// await _context.SaveChangesAsync(); + //// } } return Success(); } @@ -1764,6 +1789,11 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers .Include(x => x.DisciplineDisciplinary) .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; }); + await _context.SaveChangesAsync(); + string? _null = null; var resultData = (from p in data join r in req.refIds @@ -1809,12 +1839,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; }); - await _context.SaveChangesAsync(); - } + //// var _result = await _res.Content.ReadAsStringAsync(); + //// if (_res.IsSuccessStatusCode) + //// { + //// data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; }); + //// await _context.SaveChangesAsync(); + //// } } return Success(); } @@ -1887,6 +1917,11 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers .Include(x => x.DisciplineDisciplinary) .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; }); + await _context.SaveChangesAsync(); + string? _null = null; var resultData = (from p in data join r in req.refIds @@ -1932,12 +1967,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; }); - await _context.SaveChangesAsync(); - } + //// var _result = await _res.Content.ReadAsStringAsync(); + //// if (_res.IsSuccessStatusCode) + //// { + //// data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; }); + //// await _context.SaveChangesAsync(); + //// } } return Success(); } @@ -2010,6 +2045,11 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers .Include(x => x.DisciplineDisciplinary) .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; }); + await _context.SaveChangesAsync(); + string? _null = null; var resultData = (from p in data join r in req.refIds @@ -2055,12 +2095,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; }); - await _context.SaveChangesAsync(); - } + //// var _result = await _res.Content.ReadAsStringAsync(); + //// if (_res.IsSuccessStatusCode) + //// { + //// data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; }); + //// await _context.SaveChangesAsync(); + //// } } return Success(); } @@ -2133,6 +2173,11 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers .Include(x => x.DisciplineDisciplinary) .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; }); + await _context.SaveChangesAsync(); + string? _null = null; var resultData = (from p in data join r in req.refIds @@ -2178,12 +2223,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; }); - await _context.SaveChangesAsync(); - } + //// var _result = await _res.Content.ReadAsStringAsync(); + //// if (_res.IsSuccessStatusCode) + //// { + //// data.ForEach(profile => { profile.Status = "NEW"; profile.CommandTypeId = null; }); + //// await _context.SaveChangesAsync(); + //// } } return Success(); } @@ -2272,6 +2317,11 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers // .Where(x => x.IsReport == "REPORT") .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.IsReport = "DONE"); + await _context.SaveChangesAsync(); + string? _null = null; var resultData = (from p in data join r in req.refIds @@ -2317,12 +2367,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.IsReport = "DONE"); - await _context.SaveChangesAsync(); - } + //// var _result = await _res.Content.ReadAsStringAsync(); + //// if (_res.IsSuccessStatusCode) + //// { + //// data.ForEach(profile => profile.IsReport = "DONE"); + //// await _context.SaveChangesAsync(); + //// } } var data1 = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs index fbb6e2de..39b7fc63 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs @@ -2541,6 +2541,11 @@ namespace BMA.EHR.Placement.Service.Controllers var data = await _context.PlacementProfiles .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.PlacementStatus = "DONE"); + await _context.SaveChangesAsync(); + var resultData = (from p in data join r in req.refIds on p.Id.ToString() equals r.refId @@ -2590,12 +2595,12 @@ namespace BMA.EHR.Placement.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.PlacementStatus = "DONE"); - await _context.SaveChangesAsync(); - } + //// var _result = await _res.Content.ReadAsStringAsync(); + //// if (_res.IsSuccessStatusCode) + //// { + //// data.ForEach(profile => profile.PlacementStatus = "DONE"); + //// await _context.SaveChangesAsync(); + //// } } return Success(); } @@ -2777,6 +2782,11 @@ namespace BMA.EHR.Placement.Service.Controllers var data = await _context.PlacementProfiles .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.PlacementStatus = "DONE"); + await _context.SaveChangesAsync(); + var resultData = (from p in data join r in req.refIds on p.Id.ToString() equals r.refId @@ -2826,12 +2836,12 @@ namespace BMA.EHR.Placement.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.PlacementStatus = "DONE"); - await _context.SaveChangesAsync(); - } + //// var _result = await _res.Content.ReadAsStringAsync(); + //// if (_res.IsSuccessStatusCode) + //// { + //// data.ForEach(profile => profile.PlacementStatus = "DONE"); + //// await _context.SaveChangesAsync(); + //// } } return Success(); } @@ -2998,6 +3008,11 @@ namespace BMA.EHR.Placement.Service.Controllers var data = await _context.PlacementProfiles .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.PlacementStatus = "DONE"); + await _context.SaveChangesAsync(); + var resultData = (from p in data join r in req.refIds on p.Id.ToString() equals r.refId @@ -3047,12 +3062,12 @@ namespace BMA.EHR.Placement.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.PlacementStatus = "DONE"); - await _context.SaveChangesAsync(); - } + //// var _result = await _res.Content.ReadAsStringAsync(); + //// if (_res.IsSuccessStatusCode) + //// { + //// data.ForEach(profile => profile.PlacementStatus = "DONE"); + //// await _context.SaveChangesAsync(); + //// } } return Success(); } diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs index c2033280..e05f03f3 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs @@ -758,6 +758,17 @@ namespace BMA.EHR.Placement.Service.Controllers var data = await _context.PlacementOfficers .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + var firstRef = req.refIds.FirstOrDefault(); + var commandNoText = firstRef != null ? $"{firstRef.commandNo}/{firstRef.commandYear.ToThaiYear()}" : null; + foreach (var profile in data) + { + profile.Status = "DONE"; + profile.commandNo = commandNoText; + } + await _context.SaveChangesAsync(); + var resultData = (from p in data join r in req.refIds on p.Id.ToString() equals r.refId @@ -809,17 +820,16 @@ namespace BMA.EHR.Placement.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - //data.ForEach(profile => profile.Status = "DONE"); - foreach (var profile in data) - { - profile.Status = "DONE"; - profile.commandNo = resultData.Count > 0 ? $"{resultData[0].commandNo}/{resultData[0].commandYear.ToThaiYear()}" : null; - } - await _context.SaveChangesAsync(); - } + //// var _result = await _res.Content.ReadAsStringAsync(); + //// if (_res.IsSuccessStatusCode) + //// { + //// foreach (var profile in data) + //// { + //// profile.Status = "DONE"; + //// profile.commandNo = resultData.Count > 0 ? $"{resultData[0].commandNo}/{resultData[0].commandYear.ToThaiYear()}" : null; + //// } + //// await _context.SaveChangesAsync(); + //// } } return Success(); } diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs index ab8a508e..87d7b68a 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs @@ -1124,6 +1124,10 @@ namespace BMA.EHR.Placement.Service.Controllers .Include(x => x.Avatar) .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.Status = "DONE"); + await _context.SaveChangesAsync(); + var resultData = (from p in data join r in req.refIds on p.Id.ToString() equals r.refId @@ -1223,12 +1227,12 @@ namespace BMA.EHR.Placement.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.Status = "DONE"); - await _context.SaveChangesAsync(); - } + // // var _result = await _res.Content.ReadAsStringAsync(); + // // if (_res.IsSuccessStatusCode) + // // { + // // data.ForEach(profile => profile.Status = "DONE"); + // // await _context.SaveChangesAsync(); + // // } } return Success(); } diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs index 5f5668b7..26da4786 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs @@ -623,6 +623,10 @@ namespace BMA.EHR.Placement.Service.Controllers var data = await _context.PlacementRepatriations .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.Status = "DONE"); + await _context.SaveChangesAsync(); + string? _null = null; var resultData = (from p in data join r in req.refIds @@ -675,12 +679,12 @@ namespace BMA.EHR.Placement.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.Status = "DONE"); - await _context.SaveChangesAsync(); - } + // // var _result = await _res.Content.ReadAsStringAsync(); + // // if (_res.IsSuccessStatusCode) + // // { + // // data.ForEach(profile => profile.Status = "DONE"); + // // await _context.SaveChangesAsync(); + // // } } return Success(); } diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs index 3514e4a5..d7e62306 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs @@ -1094,6 +1094,10 @@ namespace BMA.EHR.Placement.Service.Controllers var data = await _context.PlacementTransfers .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.Status = "DONE"); + await _context.SaveChangesAsync(); + var resultData = (from p in data join r in req.refIds on p.Id.ToString() equals r.refId @@ -1146,12 +1150,12 @@ namespace BMA.EHR.Placement.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.Status = "DONE"); - await _context.SaveChangesAsync(); - } + // // var _result = await _res.Content.ReadAsStringAsync(); + // // if (_res.IsSuccessStatusCode) + // // { + // // data.ForEach(profile => profile.Status = "DONE"); + // // await _context.SaveChangesAsync(); + // // } } return Success(); } diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs index 04a01f77..588ccabe 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs @@ -845,6 +845,10 @@ namespace BMA.EHR.Retirement.Service.Controllers var data = await _context.RetirementOthers .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.Status = "DONE"); + await _context.SaveChangesAsync(); + string? _null = null; var resultData = (from p in data join r in req.refIds @@ -914,12 +918,12 @@ namespace BMA.EHR.Retirement.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.Status = "DONE"); - await _context.SaveChangesAsync(); - } + // // var _result = await _res.Content.ReadAsStringAsync(); + // // if (_res.IsSuccessStatusCode) + // // { + // // data.ForEach(profile => profile.Status = "DONE"); + // // await _context.SaveChangesAsync(); + // // } } return Success(); } @@ -1090,6 +1094,10 @@ namespace BMA.EHR.Retirement.Service.Controllers var data = await _context.RetirementOthers .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.Status = "DONE"); + await _context.SaveChangesAsync(); + string? _null = null; var resultData = (from p in data join r in req.refIds @@ -1159,12 +1167,12 @@ namespace BMA.EHR.Retirement.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.Status = "DONE"); - await _context.SaveChangesAsync(); - } + // // var _result = await _res.Content.ReadAsStringAsync(); + // // if (_res.IsSuccessStatusCode) + // // { + // // data.ForEach(profile => profile.Status = "DONE"); + // // await _context.SaveChangesAsync(); + // // } } return Success(); } diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementOutController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementOutController.cs index ce8b0452..a8c9d8e2 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementOutController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementOutController.cs @@ -642,6 +642,10 @@ namespace BMA.EHR.Retirement.Service.Controllers var data = await _context.RetirementOuts .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.Status = "DONE"); + await _context.SaveChangesAsync(); + var resultData = (from p in data join r in req.refIds on p.Id.ToString() equals r.refId @@ -701,12 +705,12 @@ namespace BMA.EHR.Retirement.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.Status = "DONE"); - await _context.SaveChangesAsync(); - } + // // var _result = await _res.Content.ReadAsStringAsync(); + // // if (_res.IsSuccessStatusCode) + // // { + // // data.ForEach(profile => profile.Status = "DONE"); + // // await _context.SaveChangesAsync(); + // // } } return Success(); } diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs index 147f1adb..ea791129 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs @@ -2861,6 +2861,10 @@ namespace BMA.EHR.Retirement.Service.Controllers var data = await _context.RetirementResigns .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.Status = "DONE"); + await _context.SaveChangesAsync(); + var resultData = (from p in data join r in req.refIds on p.Id.ToString() equals r.refId @@ -2915,12 +2919,12 @@ namespace BMA.EHR.Retirement.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.Status = "DONE"); - await _context.SaveChangesAsync(); - } + // // var _result = await _res.Content.ReadAsStringAsync(); + // // if (_res.IsSuccessStatusCode) + // // { + // // data.ForEach(profile => profile.Status = "DONE"); + // // await _context.SaveChangesAsync(); + // // } } return Success(); } @@ -3060,6 +3064,11 @@ namespace BMA.EHR.Retirement.Service.Controllers .Include(x => x.RetirementResign) .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.Status = "DONE"); + data.ForEach(profile => profile.RetirementResign.Status = "CANCEL"); + await _context.SaveChangesAsync(); + string? _null = null; var resultData = (from p in data join r in req.refIds @@ -3120,13 +3129,13 @@ namespace BMA.EHR.Retirement.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.Status = "DONE"); - data.ForEach(profile => profile.RetirementResign.Status = "CANCEL"); - await _context.SaveChangesAsync(); - } + // // var _result = await _res.Content.ReadAsStringAsync(); + // // if (_res.IsSuccessStatusCode) + // // { + // // data.ForEach(profile => profile.Status = "DONE"); + // // data.ForEach(profile => profile.RetirementResign.Status = "CANCEL"); + // // await _context.SaveChangesAsync(); + // // } } //} //else diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs index 5ad00538..7db20848 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs @@ -2361,6 +2361,10 @@ namespace BMA.EHR.Retirement.Service.Controllers var data = await _context.RetirementResignEmployees .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.Status = "DONE"); + await _context.SaveChangesAsync(); + var resultData = (from p in data join r in req.refIds on p.Id.ToString() equals r.refId @@ -2413,12 +2417,12 @@ namespace BMA.EHR.Retirement.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.Status = "DONE"); - await _context.SaveChangesAsync(); - } + // // var _result = await _res.Content.ReadAsStringAsync(); + // // if (_res.IsSuccessStatusCode) + // // { + // // data.ForEach(profile => profile.Status = "DONE"); + // // await _context.SaveChangesAsync(); + // // } } return Success(); } @@ -2556,6 +2560,11 @@ namespace BMA.EHR.Retirement.Service.Controllers .Include(x => x.RetirementResignEmployee) .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) .ToListAsync(); + // Task #224 ปรับให้เป็น process ที่ควรบันทึกตามลำดับ + data.ForEach(profile => profile.Status = "DONE"); + data.ForEach(profile => profile.RetirementResignEmployee.Status = "CANCEL"); + await _context.SaveChangesAsync(); + string? _null = null; var resultData = (from p in data join r in req.refIds @@ -2615,13 +2624,13 @@ namespace BMA.EHR.Retirement.Service.Controllers { data = resultData, }); - var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) - { - data.ForEach(profile => profile.Status = "DONE"); - data.ForEach(profile => profile.RetirementResignEmployee.Status = "CANCEL"); - await _context.SaveChangesAsync(); - } + // // var _result = await _res.Content.ReadAsStringAsync(); + // // if (_res.IsSuccessStatusCode) + // // { + // // data.ForEach(profile => profile.Status = "DONE"); + // // data.ForEach(profile => profile.RetirementResignEmployee.Status = "CANCEL"); + // // await _context.SaveChangesAsync(); + // // } } //} //else