บันทึกวันที่ส่งตัวกลับ

This commit is contained in:
Kittapath 2023-09-28 12:51:36 +07:00
parent ca7c06d583
commit b63b31608d
2 changed files with 28 additions and 23 deletions

View file

@ -84,6 +84,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.PositionNumberOld, p.PositionNumberOld,
p.OrganizationPositionOld, p.OrganizationPositionOld,
p.IsActive, p.IsActive,
p.DateRepatriation,
}) })
.ToListAsync(); .ToListAsync();
if (PlacementAdmin == true) if (PlacementAdmin == true)
@ -129,6 +130,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.PositionLevelOld, p.PositionLevelOld,
p.PositionNumberOld, p.PositionNumberOld,
p.OrganizationPositionOld, p.OrganizationPositionOld,
p.DateRepatriation,
Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id, Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
}) })
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
@ -156,6 +158,7 @@ namespace BMA.EHR.Placement.Service.Controllers
data.PositionLevelOld, data.PositionLevelOld,
data.PositionNumberOld, data.PositionNumberOld,
data.OrganizationPositionOld, data.OrganizationPositionOld,
data.DateRepatriation,
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar), Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
}; };
@ -225,6 +228,7 @@ namespace BMA.EHR.Placement.Service.Controllers
return Error(GlobalMessages.PlacementRepatriationNotFound, 404); return Error(GlobalMessages.PlacementRepatriationNotFound, 404);
uppdated.PositionNumberOld = req.PositionNumberOld; uppdated.PositionNumberOld = req.PositionNumberOld;
uppdated.DateRepatriation = req.DateRepatriation;
uppdated.OrganizationPositionOld = req.OrganizationPositionOld; uppdated.OrganizationPositionOld = req.OrganizationPositionOld;
uppdated.PositionLevelOld = req.PositionLevelOld; uppdated.PositionLevelOld = req.PositionLevelOld;
uppdated.PositionTypeOld = req.PositionTypeOld; uppdated.PositionTypeOld = req.PositionTypeOld;
@ -316,30 +320,30 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success(); return Success();
} }
/// <summary> // /// <summary>
/// วันที่ส่งตัวกลับ // /// วันที่ส่งตัวกลับ
/// </summary> // /// </summary>
/// <param name="id">Id ส่งตัวกลับ</param> // /// <param name="id">Id ส่งตัวกลับ</param>
/// <returns></returns> // /// <returns></returns>
/// <response code="200"></response> // /// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response> // /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response> // /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response> // /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("date/{id:length(36)}")] // [HttpPut("date/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> UpdateDateRepatriation([FromBody] PlacementRepatriationDateRequest req, Guid id) // public async Task<ActionResult<ResponseObject>> UpdateDateRepatriation([FromBody] PlacementRepatriationDateRequest req, Guid id)
{ // {
var uppdated = await _context.PlacementRepatriations // var uppdated = await _context.PlacementRepatriations
.FirstOrDefaultAsync(x => x.Id == id); // .FirstOrDefaultAsync(x => x.Id == id);
if (uppdated == null) // if (uppdated == null)
return Error(GlobalMessages.PlacementRepatriationNotFound, 404); // return Error(GlobalMessages.PlacementRepatriationNotFound, 404);
uppdated.DateRepatriation = req.Date; // uppdated.DateRepatriation = req.Date;
uppdated.LastUpdateFullName = FullName ?? "System Administrator"; // uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? ""; // uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now; // uppdated.LastUpdatedAt = DateTime.Now;
await _context.SaveChangesAsync(); // await _context.SaveChangesAsync();
return Success(); // return Success();
} // }
} }
} }

View file

@ -9,6 +9,7 @@ namespace BMA.EHR.Placement.Service.Requests
public string Reason { get; set; } public string Reason { get; set; }
public string? OrganizationPositionOld { get; set; } public string? OrganizationPositionOld { get; set; }
public DateTime? Date { get; set; } public DateTime? Date { get; set; }
public DateTime? DateRepatriation { get; set; }
public string? PositionTypeOld { get; set; } public string? PositionTypeOld { get; set; }
public string? PositionLevelOld { get; set; } public string? PositionLevelOld { get; set; }
public string? PositionNumberOld { get; set; } public string? PositionNumberOld { get; set; }