diff --git a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs
index 5301a5ae..35a9dfa2 100644
--- a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs
+++ b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs
@@ -968,12 +968,20 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// ไม่ได้ Login เข้าระบบ
/// เมื่อเกิดข้อผิดพลาดในการทำงาน
[HttpPost("command19/report")]
- public async Task> PostReportCommand19([FromBody] ReportPersonRequest req)
+ public async Task> PostReportCommand19([FromBody] ReportPersonAndCommandRequest req)
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
- data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
+ // data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
+ data.ForEach(profile =>
+ {
+ profile.Status = !string.IsNullOrEmpty(req.status)
+ ? req.status.Trim().ToUpper() : null;
+ profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
+ ? cmdTypeId : null;
+ profile.CommandCode = req.commandCode ?? null;
+ });
await _context.SaveChangesAsync();
return Success();
}
@@ -993,7 +1001,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
- data.ForEach(profile => profile.Status = "NEW");
+ // data.ForEach(profile => profile.Status = "NEW");
+ data.ForEach(profile =>
+ {
+ profile.Status = "NEW";
+ profile.CommandTypeId = null;
+ profile.CommandCode = null;
+ });
await _context.SaveChangesAsync();
return Success();
}
@@ -1110,12 +1124,20 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// ไม่ได้ Login เข้าระบบ
/// เมื่อเกิดข้อผิดพลาดในการทำงาน
[HttpPost("command20/report")]
- public async Task> PostReportcommand20([FromBody] ReportPersonRequest req)
+ public async Task> PostReportcommand20([FromBody] ReportPersonAndCommandRequest req)
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
- data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
+ // data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
+ data.ForEach(profile =>
+ {
+ profile.Status = !string.IsNullOrEmpty(req.status)
+ ? req.status.Trim().ToUpper() : null;
+ profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
+ ? cmdTypeId : null;
+ profile.CommandCode = req.commandCode ?? null;
+ });
await _context.SaveChangesAsync();
return Success();
}
@@ -1135,7 +1157,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
- data.ForEach(profile => profile.Status = "NEW");
+ // data.ForEach(profile => profile.Status = "NEW");
+ data.ForEach(profile =>
+ {
+ profile.Status = "NEW";
+ profile.CommandTypeId = null;
+ profile.CommandCode = null;
+ });
await _context.SaveChangesAsync();
return Success();
}
@@ -1602,14 +1630,22 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// ไม่ได้ Login เข้าระบบ
/// เมื่อเกิดข้อผิดพลาดในการทำงาน
[HttpPost("command27/report")]
- public async Task> PostReportCommand27([FromBody] ReportPersonRequest req)
+ public async Task> PostReportCommand27([FromBody] ReportPersonAndCommandRequest req)
{
try
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
- data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
+ // data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
+ data.ForEach(profile =>
+ {
+ profile.Status = !string.IsNullOrEmpty(req.status)
+ ? req.status.Trim().ToUpper() : null;
+ profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
+ ? cmdTypeId : null;
+ profile.CommandCode = req.commandCode ?? null;
+ });
await _context.SaveChangesAsync();
return Success();
}
@@ -1636,7 +1672,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
- data.ForEach(profile => profile.Status = "NEW");
+ // data.ForEach(profile => profile.Status = "NEW");
+ data.ForEach(profile =>
+ {
+ profile.Status = "NEW";
+ profile.CommandTypeId = null;
+ profile.CommandCode = null;
+ });
await _context.SaveChangesAsync();
return Success();
}
@@ -1730,14 +1772,22 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// ไม่ได้ Login เข้าระบบ
/// เมื่อเกิดข้อผิดพลาดในการทำงาน
[HttpPost("command28/report")]
- public async Task> PostReportCommand28([FromBody] ReportPersonRequest req)
+ public async Task> PostReportCommand28([FromBody] ReportPersonAndCommandRequest req)
{
try
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
- data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
+ // data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
+ data.ForEach(profile =>
+ {
+ profile.Status = !string.IsNullOrEmpty(req.status)
+ ? req.status.Trim().ToUpper() : null;
+ profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
+ ? cmdTypeId : null;
+ profile.CommandCode = req.commandCode ?? null;
+ });
await _context.SaveChangesAsync();
return Success();
}
@@ -1764,7 +1814,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
- data.ForEach(profile => profile.Status = "NEW");
+ // data.ForEach(profile => profile.Status = "NEW");
+ data.ForEach(profile =>
+ {
+ profile.Status = "NEW";
+ profile.CommandTypeId = null;
+ profile.CommandCode = null;
+ });
await _context.SaveChangesAsync();
return Success();
}
@@ -1858,14 +1914,22 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// ไม่ได้ Login เข้าระบบ
/// เมื่อเกิดข้อผิดพลาดในการทำงาน
[HttpPost("command29/report")]
- public async Task> PostReportCommand29([FromBody] ReportPersonRequest req)
+ public async Task> PostReportCommand29([FromBody] ReportPersonAndCommandRequest req)
{
try
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
- data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
+ // data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
+ data.ForEach(profile =>
+ {
+ profile.Status = !string.IsNullOrEmpty(req.status)
+ ? req.status.Trim().ToUpper() : null;
+ profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
+ ? cmdTypeId : null;
+ profile.CommandCode = req.commandCode ?? null;
+ });
await _context.SaveChangesAsync();
return Success();
}
@@ -1892,7 +1956,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
- data.ForEach(profile => profile.Status = "NEW");
+ // data.ForEach(profile => profile.Status = "NEW");
+ data.ForEach(profile =>
+ {
+ profile.Status = "NEW";
+ profile.CommandTypeId = null;
+ profile.CommandCode = null;
+ });
await _context.SaveChangesAsync();
return Success();
}
@@ -1986,14 +2056,22 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// ไม่ได้ Login เข้าระบบ
/// เมื่อเกิดข้อผิดพลาดในการทำงาน
[HttpPost("command30/report")]
- public async Task> PostReportCommand30([FromBody] ReportPersonRequest req)
+ public async Task> PostReportCommand30([FromBody] ReportPersonAndCommandRequest req)
{
try
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
- data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
+ // data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
+ data.ForEach(profile =>
+ {
+ profile.Status = !string.IsNullOrEmpty(req.status)
+ ? req.status.Trim().ToUpper() : null;
+ profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
+ ? cmdTypeId : null;
+ profile.CommandCode = req.commandCode ?? null;
+ });
await _context.SaveChangesAsync();
return Success();
}
@@ -2020,7 +2098,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
- data.ForEach(profile => profile.Status = "NEW");
+ // data.ForEach(profile => profile.Status = "NEW");
+ data.ForEach(profile =>
+ {
+ profile.Status = "NEW";
+ profile.CommandTypeId = null;
+ profile.CommandCode = null;
+ });
await _context.SaveChangesAsync();
return Success();
}
@@ -2114,14 +2198,22 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// ไม่ได้ Login เข้าระบบ
/// เมื่อเกิดข้อผิดพลาดในการทำงาน
[HttpPost("command31/report")]
- public async Task> PostReportCommand31([FromBody] ReportPersonRequest req)
+ public async Task> PostReportCommand31([FromBody] ReportPersonAndCommandRequest req)
{
try
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
- data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
+ // data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
+ data.ForEach(profile =>
+ {
+ profile.Status = !string.IsNullOrEmpty(req.status)
+ ? req.status.Trim().ToUpper() : null;
+ profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
+ ? cmdTypeId : null;
+ profile.CommandCode = req.commandCode ?? null;
+ });
await _context.SaveChangesAsync();
return Success();
}
@@ -2148,7 +2240,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
- data.ForEach(profile => profile.Status = "NEW");
+ // data.ForEach(profile => profile.Status = "NEW");
+ data.ForEach(profile =>
+ {
+ profile.Status = "NEW";
+ profile.CommandTypeId = null;
+ profile.CommandCode = null;
+ });
await _context.SaveChangesAsync();
return Success();
}
@@ -2242,7 +2340,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// ไม่ได้ Login เข้าระบบ
/// เมื่อเกิดข้อผิดพลาดในการทำงาน
[HttpPost("command32/report")]
- public async Task> PostReportCommand32([FromBody] ReportPersonRequest req)
+ public async Task> PostReportCommand32([FromBody] ReportPersonAndCommandRequest req)
{
try
{
@@ -2255,7 +2353,15 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
- data2.ForEach(profile => profile.IsReport = req.status.Trim().ToUpper());
+ // data2.ForEach(profile => profile.IsReport = req.status.Trim().ToUpper());
+ data2.ForEach(profile =>
+ {
+ profile.Status = !string.IsNullOrEmpty(req.status)
+ ? req.status.Trim().ToUpper() : null;
+ profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
+ ? cmdTypeId : null;
+ profile.CommandCode = req.commandCode ?? null;
+ });
await _context.SaveChangesAsync();
return Success();
@@ -2290,7 +2396,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
// .Where(x => x.IsReport == "REPORT")
.ToListAsync();
- data2.ForEach(profile => profile.IsReport = "NEW");
+ // data2.ForEach(profile => profile.IsReport = "NEW");
+ data2.ForEach(profile =>
+ {
+ profile.Status = "NEW";
+ profile.CommandTypeId = null;
+ profile.CommandCode = null;
+ });
await _context.SaveChangesAsync();
return Success();