Add API Create command For C-PM-10 to C-PM-17
This commit is contained in:
parent
ec53034b4d
commit
ab5afff6e0
9 changed files with 1032 additions and 0 deletions
|
|
@ -1295,6 +1295,794 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-10 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-10
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-10/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType10Async([FromBody] CreateCommandGroup6Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
PlacementCommandIssuer = req.placementCommandIssuer,
|
||||
PlacementCommandNo = req.placementCommandNo,
|
||||
PlacementCommandDate = req.placementCommandDate,
|
||||
PlacementPositionName = req.placementPositionName,
|
||||
PlacementOrganizationName = req.placementOrganizationName,
|
||||
ProbationStartDate = req.probationStartDate,
|
||||
ProbationEndDate = req.probationEndDate,
|
||||
ChairManFullName = req.chairManFullName,
|
||||
Member1FullName = req.member1FullName,
|
||||
Member2FullName = req.member2FullName,
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-10
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-10/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType10Async(Guid orderId, [FromBody] CreateCommandGroup6Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
order.PlacementCommandIssuer = req.placementCommandIssuer;
|
||||
order.PlacementCommandNo = req.placementCommandNo;
|
||||
order.PlacementCommandDate = req.placementCommandDate;
|
||||
order.PlacementPositionName = req.placementPositionName;
|
||||
order.PlacementOrganizationName = req.placementOrganizationName;
|
||||
order.ProbationStartDate = req.probationStartDate;
|
||||
order.ProbationEndDate = req.probationEndDate;
|
||||
order.ChairManFullName = req.chairManFullName;
|
||||
order.Member1FullName = req.member1FullName;
|
||||
order.Member2FullName = req.member2FullName;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-11 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-11
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-11/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType11Async([FromBody] CreateCommandGroup7Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
PlacementCommandIssuer = req.placementCommandIssuer,
|
||||
PlacementCommandNo = req.placementCommandNo,
|
||||
PlacementCommandDate = req.placementCommandDate,
|
||||
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-11
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-11/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType11Async(Guid orderId, [FromBody] CreateCommandGroup7Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
order.PlacementCommandIssuer = req.placementCommandIssuer;
|
||||
order.PlacementCommandNo = req.placementCommandNo;
|
||||
order.PlacementCommandDate = req.placementCommandDate;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-12 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-12
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-12/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType12Async([FromBody] CreateCommandGroup7Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
PlacementCommandIssuer = req.placementCommandIssuer,
|
||||
PlacementCommandNo = req.placementCommandNo,
|
||||
PlacementCommandDate = req.placementCommandDate,
|
||||
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-12
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-12/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType12Async(Guid orderId, [FromBody] CreateCommandGroup7Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
order.PlacementCommandIssuer = req.placementCommandIssuer;
|
||||
order.PlacementCommandNo = req.placementCommandNo;
|
||||
order.PlacementCommandDate = req.placementCommandDate;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-13 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-13
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-13/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType13Async([FromBody] CreateCommandGroup8Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
ReceiveOrganizationName = req.receiveOrganizationName,
|
||||
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-13
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-13/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType13Async(Guid orderId, [FromBody] CreateCommandGroup8Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
order.ReceiveOrganizationName = req.receiveOrganizationName;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-14 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-14
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-14/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType14Async([FromBody] CreateCommandGroup9Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
TransferOrganizationName = req.transferOrganizationName,
|
||||
ConclusionReceiveNo = req.conclusionReceiveNo,
|
||||
ConclusionReceiveDate = req.conclusionReceiveDate,
|
||||
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-14
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-14/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType14Async(Guid orderId, [FromBody] CreateCommandGroup9Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
order.TransferOrganizationName = req.transferOrganizationName;
|
||||
order.ConclusionReceiveNo = req.conclusionReceiveNo;
|
||||
order.ConclusionReceiveDate = req.conclusionReceiveDate;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-15 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-15
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-15/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType15Async([FromBody] CreateCommandGroup0Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-15
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-15/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType15Async(Guid orderId, [FromBody] CreateCommandGroup0Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-16 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-16
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-16/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType16Async([FromBody] CreateCommandGroup10Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
|
||||
GovAidCommandNo = req.govAidCommandNo,
|
||||
GovAidCommandDate = req.govAidCommandDate,
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-16
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-16/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType16Async(Guid orderId, [FromBody] CreateCommandGroup10Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
order.GovAidCommandNo = req.govAidCommandNo;
|
||||
order.GovAidCommandDate = req.govAidCommandDate;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-17 "
|
||||
|
||||
/// <summary>
|
||||
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-17
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("c-pm-17/detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostType17Async([FromBody] CreateCommandGroup0Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
|
||||
var inserted = new Domain.Models.Commands.Core.Command
|
||||
{
|
||||
CommandNo = req.orderNo,
|
||||
CommandYear = req.orderYear.ToString(),
|
||||
CommandSubject = req.orderTitle,
|
||||
CommandTypeId = req.orderTypeValue,
|
||||
IssuerOrganizationId = req.orderBy,
|
||||
IssuerOrganizationName = req.orderByOrganizationName,
|
||||
AuthorizedUserFullName = req.signatoryBy,
|
||||
AuthorizedPosition = req.signatoryPosition,
|
||||
|
||||
CommandAffectDate = req.orderDate,
|
||||
OwnerGovId = OcId,
|
||||
};
|
||||
|
||||
var result = await _repository.AddAsync(inserted);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-17
|
||||
/// </summary>
|
||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("c-pm-17/detail/{orderId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PutType17Async(Guid orderId, [FromBody] CreateCommandGroup0Request req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var order = await _repository.GetByIdAsync(orderId);
|
||||
if (order == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
|
||||
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
|
||||
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
|
||||
|
||||
order.CommandNo = req.orderNo;
|
||||
order.CommandYear = req.orderYear.ToString();
|
||||
order.CommandSubject = req.orderTitle;
|
||||
order.CommandType = commandType!;
|
||||
order.IssuerOrganizationId = req.orderBy;
|
||||
order.IssuerOrganizationName = req.orderByOrganizationName;
|
||||
order.AuthorizedUserFullName = req.signatoryBy;
|
||||
order.AuthorizedPosition = req.signatoryPosition;
|
||||
order.CommandStatus = status!;
|
||||
order.CommandAffectDate = req.orderDate;
|
||||
|
||||
var result = await _repository.UpdateAsync(order);
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue