Add Field to Command Table
This commit is contained in:
parent
9a2e487d8d
commit
297b1efb57
6 changed files with 12061 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Domain.Models.Commands.Core;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Commands
|
||||
{
|
||||
|
|
@ -26,7 +27,26 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<List<CommandReceiver>> GetReceiverByCommmandIdAsync(Guid Id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var command = await _dbContext.Set<Command>()
|
||||
.Include(x => x.Receivers)
|
||||
.FirstOrDefaultAsync(x => x.Id == Id);
|
||||
|
||||
if(command == null)
|
||||
{
|
||||
return new List<CommandReceiver>();
|
||||
}
|
||||
else
|
||||
return command.Receivers;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -297,7 +297,16 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
{
|
||||
try
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var receivers = await _repository.GetReceiverByCommmandIdAsync(orderId);
|
||||
if (receivers.Count() > 0)
|
||||
{
|
||||
return Success(receivers);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ไม่เจอข้อมูลไปอ่านจากระบบสรรหาที่สง้รายชื่อมาแล้ว insert
|
||||
return Success();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -73,5 +73,8 @@ namespace BMA.EHR.Domain.Models.Commands.Core
|
|||
public virtual List<CommandReceiver> Receivers { get; set; }
|
||||
|
||||
public virtual List<CommandDeployment> Deployments { get; set; }
|
||||
|
||||
[Required, Comment("รหัสส่วนราชการผู้ออกคำสั่ง")]
|
||||
public virtual Guid OwnerGovId { get; set; } = Guid.Empty;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
11992
BMA.EHR.Infrastructure/Migrations/20230728035006_Add OwnerGovId to Command Table.Designer.cs
generated
Normal file
11992
BMA.EHR.Infrastructure/Migrations/20230728035006_Add OwnerGovId to Command Table.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddOwnerGovIdtoCommandTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "OwnerGovId",
|
||||
table: "Commands",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
comment: "รหัสส่วนราชการผู้ออกคำสั่ง",
|
||||
collation: "ascii_general_ci");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OwnerGovId",
|
||||
table: "Commands");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -145,6 +145,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<Guid>("OwnerGovId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("รหัสส่วนราชการผู้ออกคำสั่ง");
|
||||
|
||||
b.Property<string>("PositionName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue