Merge branch 'develop' into develop-tee
This commit is contained in:
commit
c9ac388249
30 changed files with 12329 additions and 469 deletions
|
|
@ -7,9 +7,15 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AWSSDK.S3" Version="3.7.107.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
11
BMA.EHR.API.Command/FileDownloadResponse.cs
Normal file
11
BMA.EHR.API.Command/FileDownloadResponse.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
namespace BMA.EHR.API.Command
|
||||
{
|
||||
public class FileDownloadResponse
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
|
||||
public string FileType { get; set; } = string.Empty;
|
||||
|
||||
public byte[] FileContent { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,208 +0,0 @@
|
|||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
namespace BMA.EHR.API.Command
|
||||
{
|
||||
public class MinIOService
|
||||
{
|
||||
// #region " Fields "
|
||||
|
||||
// private readonly ApplicationDBContext _context;
|
||||
// private readonly IConfiguration _configuration;
|
||||
// private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
// private readonly AmazonS3Client _s3Client;
|
||||
// private string _bucketName = string.Empty;
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region " Constructors "
|
||||
|
||||
// public MinIOService(ApplicationDBContext context,
|
||||
// IConfiguration configuration,
|
||||
// IWebHostEnvironment webHostEnvironment)
|
||||
// {
|
||||
// _context = context;
|
||||
// _configuration = configuration;
|
||||
// _webHostEnvironment = webHostEnvironment;
|
||||
|
||||
// var config = new AmazonS3Config
|
||||
// {
|
||||
// ServiceURL = _configuration["MinIO:Endpoint"],
|
||||
// ForcePathStyle = true
|
||||
// };
|
||||
|
||||
// _s3Client = new AmazonS3Client(_configuration["MinIO:AccessKey"], _configuration["MinIO:SecretKey"], config);
|
||||
// this._bucketName = _configuration["MinIO:BucketName"] ?? "bma-recruit";
|
||||
// }
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region " Methods "
|
||||
|
||||
// public async Task<Document> UploadFileAsync(IFormFile file, string newFileName = "")
|
||||
// {
|
||||
// var fileName = "";
|
||||
// var fileExt = Path.GetExtension(file.FileName);
|
||||
// if (newFileName != "")
|
||||
// fileName = $"{newFileName}";
|
||||
// else
|
||||
// fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');
|
||||
|
||||
|
||||
// var tmpDir = Path.Combine(_webHostEnvironment.ContentRootPath, "tmp");
|
||||
// if (!Directory.Exists(tmpDir))
|
||||
// Directory.CreateDirectory(tmpDir);
|
||||
|
||||
// var tmpFile = Path.Combine(tmpDir, $"tmp_{DateTime.Now.ToString("ddMMyyyyHHmmss")}{fileExt}");
|
||||
|
||||
// try
|
||||
// {
|
||||
// using (var ms = new MemoryStream())
|
||||
// {
|
||||
// var id = Guid.NewGuid();
|
||||
// file.CopyTo(ms);
|
||||
// var fileBytes = ms.ToArray();
|
||||
// System.IO.MemoryStream filestream = new System.IO.MemoryStream(fileBytes);
|
||||
|
||||
// var request = new PutObjectRequest
|
||||
// {
|
||||
// BucketName = _bucketName,
|
||||
// Key = id.ToString("D"),
|
||||
// InputStream = filestream,
|
||||
// ContentType = file.ContentType,
|
||||
// CannedACL = S3CannedACL.PublicRead
|
||||
// };
|
||||
|
||||
// await _s3Client.PutObjectAsync(request);
|
||||
|
||||
// // create document object
|
||||
// var doc = new Document()
|
||||
// {
|
||||
// FileName = fileName,
|
||||
// FileType = file.ContentType,
|
||||
// FileSize = Convert.ToInt32(file.Length),
|
||||
// ObjectRefId = id,
|
||||
// CreatedDate = DateTime.Now
|
||||
// };
|
||||
|
||||
// await _context.Documents.AddAsync(doc);
|
||||
// await _context.SaveChangesAsync();
|
||||
|
||||
// return doc;
|
||||
// }
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// throw;
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// File.Delete(tmpFile);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public async Task<FileDownloadResponse> DownloadFileAsync(Guid fileId)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// var doc = await _context.Documents.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.Id == fileId);
|
||||
|
||||
// if (doc == null)
|
||||
// throw new Exception(GlobalMessages.FileNotFoundOnServer);
|
||||
|
||||
// using (var memoryStream = new MemoryStream())
|
||||
// {
|
||||
// GetObjectRequest request = new GetObjectRequest
|
||||
// {
|
||||
// BucketName = _bucketName,
|
||||
// Key = doc.ObjectRefId.ToString("D")
|
||||
// };
|
||||
|
||||
// using (GetObjectResponse response = await _s3Client.GetObjectAsync(request))
|
||||
// {
|
||||
// using (Stream responseStream = response.ResponseStream)
|
||||
// {
|
||||
// responseStream.CopyTo(memoryStream);
|
||||
// }
|
||||
// }
|
||||
|
||||
// var fileContent = memoryStream.ToArray();
|
||||
|
||||
// return new FileDownloadResponse
|
||||
// {
|
||||
// FileName = doc.FileName,
|
||||
// FileType = doc.FileType,
|
||||
// FileContent = fileContent
|
||||
// };
|
||||
// };
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// throw;
|
||||
// }
|
||||
// }
|
||||
|
||||
// public async Task DeleteFileAsync(Guid fileId)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// var doc = await _context.Documents.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.Id == fileId);
|
||||
|
||||
// if (doc == null)
|
||||
// throw new Exception(GlobalMessages.FileNotFoundOnServer);
|
||||
// else
|
||||
// {
|
||||
// DeleteObjectRequest request = new DeleteObjectRequest
|
||||
// {
|
||||
// BucketName = _bucketName,
|
||||
// Key = doc?.ObjectRefId.ToString("D")
|
||||
// };
|
||||
|
||||
// // delete from minio
|
||||
// await _s3Client.DeleteObjectAsync(request);
|
||||
|
||||
|
||||
// _context.Documents.Remove(doc);
|
||||
// await _context.SaveChangesAsync();
|
||||
// }
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// throw;
|
||||
// }
|
||||
// }
|
||||
|
||||
// public async Task<string> ImagesPath(Guid fileId)
|
||||
// {
|
||||
// if (fileId == null)
|
||||
// return "";
|
||||
|
||||
// var doc = await _context.Documents.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.Id == fileId);
|
||||
|
||||
// if (doc == null)
|
||||
// throw new Exception(GlobalMessages.FileNotFoundOnServer);
|
||||
// var config = new AmazonS3Config
|
||||
// {
|
||||
// ServiceURL = _configuration.GetValue<string>("MinIO:Endpoint"),
|
||||
// ForcePathStyle = true
|
||||
// };
|
||||
|
||||
// DateTime expires = DateTime.UtcNow.AddHours(6);
|
||||
// GetPreSignedUrlRequest request = new GetPreSignedUrlRequest
|
||||
// {
|
||||
// BucketName = _bucketName,
|
||||
// Key = doc?.ObjectRefId.ToString("D"),
|
||||
// Expires = expires,
|
||||
// };
|
||||
// string path = _s3Client.GetPreSignedURL(request);
|
||||
|
||||
// return path;
|
||||
// }
|
||||
|
||||
// #endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AWSSDK.S3" Version="3.7.107.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.8" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
|
|
|
|||
11
BMA.EHR.Application/Repositories/FileDownloadResponse.cs
Normal file
11
BMA.EHR.Application/Repositories/FileDownloadResponse.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
namespace BMA.EHR.Application.Repositories
|
||||
{
|
||||
public class FileDownloadResponse
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
|
||||
public string FileType { get; set; } = string.Empty;
|
||||
|
||||
public byte[] FileContent { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
|
@ -8,17 +9,13 @@ namespace BMA.EHR.Domain.Models.Organizations
|
|||
public class AvailablePositionLevelEntity : EntityBase
|
||||
{
|
||||
|
||||
[ForeignKey("PositionMasterId")]
|
||||
public PositionMasterEntity? PositionMaster_PositionMasterId { get; set; }
|
||||
// [ForeignKey("PositionMasterId")]
|
||||
// public PositionMasterEntity? PositionMaster_PositionMasterId { get; set; }
|
||||
|
||||
[Column(Order = 2), Comment("PositionMasterId")]
|
||||
public Guid? PositionMasterId { get; set; }
|
||||
public PositionMasterEntity? PositionMaster { get; set; }
|
||||
|
||||
[Column(Order = 3), Comment("PositionLevelId")]
|
||||
public Guid? PositionLevelId { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
public PositionLevel? PositionLevel { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,65 +2,44 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using BMA.EHR.Domain.Models.Base;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Organizations
|
||||
{
|
||||
public class OrganizationEntity : EntityBase
|
||||
{
|
||||
|
||||
//[ForeignKey("OrganizationOrganizationId")]
|
||||
//public OrganizationOrganization? OrganizationOrganization_OrganizationOrganizationId { get; set; }
|
||||
|
||||
[Column(Order = 2), Comment("OrganizationOrganizationId")]
|
||||
public Guid? OrganizationOrganizationId { get; set; }
|
||||
|
||||
//[ForeignKey("OrganizationShortNameId")]
|
||||
//public OrganizationShortName? OrganizationShortName_OrganizationShortNameId { get; set; }
|
||||
public OrganizationOrganization? OrganizationOrganization { get; set; }
|
||||
|
||||
[Column(Order = 3), Comment("OrganizationShortNameId")]
|
||||
public Guid? OrganizationShortNameId { get; set; }
|
||||
|
||||
//[ForeignKey("OrganizationTypeId")]
|
||||
//public OrganizationType? OrganizationType_OrganizationTypeId { get; set; }
|
||||
public OrganizationShortName? OrganizationShortName { get; set; }
|
||||
|
||||
[Column(Order = 4), Comment("OrganizationTypeId")]
|
||||
public Guid? OrganizationTypeId { get; set; }
|
||||
|
||||
//[ForeignKey("OrganizationLevelId")]
|
||||
//public OrganizationLevel? OrganizationLevel_OrganizationLevelId { get; set; }
|
||||
public OrganizationType? OrganizationType { get; set; }
|
||||
|
||||
[Column(Order = 5), Comment("OrganizationLevelId")]
|
||||
public Guid? OrganizationLevelId { get; set; }
|
||||
|
||||
//[ForeignKey("OrganizationTelExternalId")]
|
||||
//public OrganizationTelExternal? OrganizationTelExternal_OrganizationTelExternalId { get; set; }
|
||||
public OrganizationLevel? OrganizationLevel { get; set; }
|
||||
|
||||
[Column(Order = 6), Comment("OrganizationTelExternalId")]
|
||||
public Guid? OrganizationTelExternalId { get; set; }
|
||||
|
||||
//[ForeignKey("OrganizationTelInternalId")]
|
||||
//public OrganizationTelInternal? OrganizationTelInternal_OrganizationTelInternalId { get; set; }
|
||||
public OrganizationTelExternal? OrganizationTelExternal { get; set; }
|
||||
|
||||
[Column(Order = 7), Comment("OrganizationTelInternalId")]
|
||||
public Guid? OrganizationTelInternalId { get; set; }
|
||||
|
||||
//[ForeignKey("OrganizationFaxId")]
|
||||
//public OrganizationFax? OrganizationFax_OrganizationFaxId { get; set; }
|
||||
public OrganizationTelInternal? OrganizationTelInternal { get; set; }
|
||||
|
||||
[Column(Order = 8), Comment("OrganizationFaxId")]
|
||||
public Guid? OrganizationFaxId { get; set; }
|
||||
public OrganizationFax? OrganizationFax { get; set; }
|
||||
|
||||
[ForeignKey("ParentId")]
|
||||
public OrganizationEntity? Organization_ParentId { get; set; }
|
||||
// [ForeignKey("ParentId")]
|
||||
// public OrganizationEntity? Organization_ParentId { get; set; }
|
||||
|
||||
[Column(Order = 9), Comment("ParentId")]
|
||||
public Guid? ParentId { get; set; }
|
||||
public OrganizationEntity? Parent { get; set; }
|
||||
|
||||
[Column(Order = 10), Comment("OrganizationAgencyId")]
|
||||
public Guid? OrganizationAgencyId { get; set; }
|
||||
// [Column(Order = 10), Comment("OrganizationAgencyId")]
|
||||
// public OrganizationAgency? OrganizationAgency { get; set; }
|
||||
|
||||
[Column(Order = 11), Comment("OrganizationGovernmentAgencyId")]
|
||||
public Guid? OrganizationGovernmentAgencyId { get; set; }
|
||||
// [Column(Order = 11), Comment("OrganizationGovernmentAgencyId")]
|
||||
// public OrganizationGovernmentAgency? OrganizationGovernmentAgency { get; set; }
|
||||
|
||||
[Column(Order = 12), Comment("OrganizationOrder")]
|
||||
public int? OrganizationOrder { get; set; }
|
||||
|
|
@ -80,7 +59,7 @@ namespace BMA.EHR.Domain.Models.Organizations
|
|||
[Column(Order = 17), Comment("กอง")]
|
||||
public string? Pile { get; set; }
|
||||
|
||||
public Guid? OrganizationStatusId { get; set; }
|
||||
public OrganizationStatus? OrganizationStatus { get; set; }
|
||||
|
||||
public List<OrganizationEntity> Organizations { get; } = new();
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ namespace BMA.EHR.Domain.Models.Organizations
|
|||
public class OrganizationPositionEntity : EntityBase
|
||||
{
|
||||
|
||||
[ForeignKey("PositionMasterId")]
|
||||
public PositionMasterEntity? PositionMaster_PositionMasterId { get; set; }
|
||||
// [ForeignKey("PositionMasterId")]
|
||||
// public PositionMasterEntity? PositionMaster_PositionMasterId { get; set; }
|
||||
|
||||
[Column(Order = 2), Comment("Position Master")]
|
||||
public Guid? PositionMasterId { get; set; }
|
||||
public PositionMasterEntity? PositionMaster { get; set; }
|
||||
|
||||
[Column(Order = 3), Comment("Is Director")]
|
||||
public bool? IsDirector { get; set; }
|
||||
|
|
@ -20,14 +20,14 @@ namespace BMA.EHR.Domain.Models.Organizations
|
|||
[Column(Order = 4), Comment("positionUserNote")]
|
||||
public string? PositionUserNote { get; set; }
|
||||
|
||||
[ForeignKey("OrganizationId")]
|
||||
public OrganizationEntity? Organization_OrganizationId { get; set; }
|
||||
// [ForeignKey("OrganizationId")]
|
||||
// public OrganizationEntity? Organization_OrganizationId { get; set; }
|
||||
|
||||
[Column(Order = 5), Comment("OrganizationId")]
|
||||
public Guid? OrganizationId { get; set; }
|
||||
public OrganizationEntity? Organization { get; set; }
|
||||
|
||||
[Column(Order = 6), Comment("PositionNumberId")]
|
||||
public Guid? PositionNumberId { get; set; }
|
||||
public PositionNumberEntity? PositionNumber { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,63 +2,39 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using BMA.EHR.Domain.Models.Base;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Organizations
|
||||
{
|
||||
public class PositionMasterEntity : EntityBase
|
||||
{
|
||||
|
||||
//[ForeignKey("PositionId")]
|
||||
//public Position? Position_PositionId { get; set; }
|
||||
|
||||
[Column(Order = 2), Comment("PositionId")]
|
||||
public Guid? PositionId { get; set; }
|
||||
|
||||
//[ForeignKey("PositionPathId")]
|
||||
//public PositionPath? PositionPath_PositionPathId { get; set; }
|
||||
|
||||
[Column(Order = 3), Comment("PositionPathId")]
|
||||
public Guid? PositionPathId { get; set; }
|
||||
|
||||
//[ForeignKey("PositionTypeId")]
|
||||
//public PositionType? PositionType_PositionTypeId { get; set; }
|
||||
public PositionPath? PositionPath { get; set; }
|
||||
|
||||
[Column(Order = 4), Comment("PositionTypeId")]
|
||||
public Guid? PositionTypeId { get; set; }
|
||||
|
||||
//[ForeignKey("PositionExecutiveId")]
|
||||
//public PositionExecutive? PositionExecutive_PositionExecutiveId { get; set; }
|
||||
public PositionType? PositionType { get; set; }
|
||||
|
||||
[Column(Order = 5), Comment("PositionExecutiveId")]
|
||||
public Guid? PositionExecutiveId { get; set; }
|
||||
|
||||
//[ForeignKey("ExcutiveSideId")]
|
||||
//public PositionExecutiveSide? PositionExecutiveSide_ExcutiveSideId { get; set; }
|
||||
public PositionExecutive? PositionExecutive { get; set; }
|
||||
|
||||
[Column(Order = 6), Comment("PositionExecutiveSideId")]
|
||||
public Guid? PositionExecutiveSideId { get; set; }
|
||||
|
||||
//[ForeignKey("PathSideId")]
|
||||
//public PositionPathSide? PositionPathSide_PathSideId { get; set; }
|
||||
public PositionExecutiveSide? PositionExecutiveSide { get; set; }
|
||||
|
||||
[Column(Order = 7), Comment("PositionPathSideId")]
|
||||
public Guid? PositionPathSideId { get; set; }
|
||||
public PositionPathSide? PositionPathSide { get; set; }
|
||||
|
||||
[Column(Order = 8), Comment("PositionLineId")]
|
||||
public Guid? PositionLineId { get; set; }
|
||||
|
||||
//[Column(Order = 9), Comment("PositionLevelId")]
|
||||
//public Guid? PositionLevelId { get; set; }
|
||||
public PositionLine? PositionLine { get; set; }
|
||||
|
||||
[Column(Order = 10), Comment("PositionStatusId")]
|
||||
public Guid? PositionStatusId { get; set; }
|
||||
public PositionStatus? PositionStatus { get; set; }
|
||||
|
||||
[Column(Order = 11), Comment("PositionCondition")]
|
||||
public string? PositionCondition { get; set; }
|
||||
|
||||
[Column(Order = 12), Comment("PositionStatus")]
|
||||
public Guid? PositionStatus { get; set; }
|
||||
|
||||
[Column(Order = 13), Comment("PositionMasterUserNote")]
|
||||
public string? PositionMasterUserNote { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using BMA.EHR.Domain.Models.Base;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Organizations
|
||||
{
|
||||
|
|
@ -11,14 +12,7 @@ namespace BMA.EHR.Domain.Models.Organizations
|
|||
[MaxLength(300), Column(Order = 2), Comment("ชื่อ")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
//[ForeignKey("OrganizationShortNameId")]
|
||||
//public OrganizationShortName? OrganizationShortName_OrganizationShortNameId { get; set; }
|
||||
|
||||
[Column(Order = 3), Comment("Shortname")]
|
||||
public Guid? OrganizationShortNameId { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
public OrganizationShortName? OrganizationShortName { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Organizations
|
||||
{
|
||||
|
|
@ -7,10 +8,8 @@ namespace BMA.EHR.Domain.Models.Organizations
|
|||
/// </summary>
|
||||
public class ProfilePosition : EntityBase
|
||||
{
|
||||
public OrganizationPositionEntity OrganizationPosition { get; set; }
|
||||
public OrganizationPositionEntity? OrganizationPosition { get; set; }
|
||||
|
||||
public Guid OrganizationPositionId { get; set; }
|
||||
|
||||
public Guid? ProfileId { get; set; }
|
||||
public Profile? Profile { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,12 +56,18 @@ namespace BMA.EHR.Domain.Models.Placement
|
|||
|
||||
[MaxLength(40), Comment("สัญชาติ")]
|
||||
public string? Nationality { get; set; }
|
||||
[MaxLength(40), Comment("เชื้อชาติ")]
|
||||
public string? Race { get; set; }
|
||||
|
||||
[MaxLength(40), Comment("วันเกิด")]
|
||||
public DateTime? DateOfBirth { get; set; }
|
||||
|
||||
[Comment("Id สถานภาพ")]
|
||||
public Relationship? Relationship { get; set; }
|
||||
[Comment("Id กลุ่มเลือด")]
|
||||
public BloodGroup? BloodGroup { get; set; }
|
||||
[Comment("Id ศาสนา")]
|
||||
public Religion? Religion { get; set; }
|
||||
|
||||
[MaxLength(200), Comment("อีเมล")]
|
||||
public string? Email { get; set; }
|
||||
|
|
|
|||
|
|
@ -1,33 +1,58 @@
|
|||
namespace BMA.EHR.Domain.Shared
|
||||
{
|
||||
public class GlobalMessages
|
||||
{
|
||||
public static readonly string Success = "สำเร็จ";
|
||||
public class GlobalMessages
|
||||
{
|
||||
public static readonly string Success = "สำเร็จ";
|
||||
|
||||
public static readonly string Error = "เกิดข้อผิดพลาด";
|
||||
public static readonly string Error = "เกิดข้อผิดพลาด";
|
||||
|
||||
public static readonly string DataNotFound = "ไม่พบข้อมูลในระบบ";
|
||||
public static readonly string DataNotFound = "ไม่พบข้อมูลในระบบ";
|
||||
|
||||
public static readonly string NotAuthorized = "กรุณาเข้าสู่ระบบก่อนใช้งาน!";
|
||||
public static readonly string NotAuthorized = "กรุณาเข้าสู่ระบบก่อนใช้งาน!";
|
||||
|
||||
public static readonly string ForbiddenAccess = "คุณไม่ได้รับอนุญาติให้เข้าใช้งาน!";
|
||||
public static readonly string ForbiddenAccess = "คุณไม่ได้รับอนุญาติให้เข้าใช้งาน!";
|
||||
|
||||
public static readonly string ExceptionOccured = "เกิดข้อผิดพลาดขึ้นในระบบ กรุณาติดต่อผู้ดูแลระบบ!";
|
||||
public static readonly string ExceptionOccured = "เกิดข้อผิดพลาดขึ้นในระบบ กรุณาติดต่อผู้ดูแลระบบ!";
|
||||
|
||||
public static readonly string FileNotFoundOnServer = "ไม่พบไฟล์ในระบบ!!";
|
||||
|
||||
#region " Meta Data "
|
||||
|
||||
public static readonly string DataExist5 = "เนื่องจากมีการกำหนดวันหยุดในการทำงาน 5 วันอยู่";
|
||||
|
||||
public static readonly string DataExist6 = "เนื่องจากมีการกำหนดวันหยุดในการทำงาน 6 วันอยู่";
|
||||
public static readonly string DataExist6 = "เนื่องจากมีการกำหนดวันหยุดในการทำงาน 6 วันอยู่";
|
||||
|
||||
public static readonly string NameDupicate = "ชื่อวันหยุดนี้มีอยู่ในระบบอยู่แล้ว";
|
||||
public static readonly string NameDupicate = "ชื่อวันหยุดนี้มีอยู่ในระบบอยู่แล้ว";
|
||||
|
||||
public static readonly string HolidayOfYearNotFound = "ไม่พบข้อมูลวันหยุดในปีที่คุณระบุ";
|
||||
public static readonly string HolidayOfYearNotFound = "ไม่พบข้อมูลวันหยุดในปีที่คุณระบุ";
|
||||
|
||||
public static readonly string HolidayOfYearNotCopy = "ไม่สามารถคัดลอกวันหยุดย้อนหลังได้";
|
||||
public static readonly string HolidayOfYearNotCopy = "ไม่สามารถคัดลอกวันหยุดย้อนหลังได้";
|
||||
|
||||
public static readonly string DestinationHolidayIsExist = "ข้อมูลวันหยุดในปีที่ระบุมีอยู่แล้ว";
|
||||
public static readonly string DestinationHolidayIsExist = "ข้อมูลวันหยุดในปีที่ระบุมีอยู่แล้ว";
|
||||
public static readonly string ProvinceNotFound = "ไม่พบข้อมูลจังหวัด";
|
||||
public static readonly string DistrictNotFound = "ไม่พบข้อมูลเขต";
|
||||
public static readonly string SubDistrictNotFound = "ไม่พบข้อมูลแขวง";
|
||||
public static readonly string PrefixNotFound = "ไม่พบข้อมูลคำนำหน้า";
|
||||
public static readonly string GenderNotFound = "ไม่พบข้อมูลเพศ";
|
||||
public static readonly string RelationshipNotFound = "ไม่พบข้อมูลความสัมพันธ์";
|
||||
public static readonly string BloodGroupNotFound = "ไม่พบข้อมูลกลุ่มเลือก";
|
||||
public static readonly string ReligionNotFound = "ไม่พบข้อมูลศาสนา";
|
||||
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region " Organization "
|
||||
public static readonly string PositionPosNoNotFound = "ไม่พบข้อมูลเลขที่ตำแหน่ง";
|
||||
public static readonly string PositionPathNotFound = "ไม่พบข้อมูลตำแหน่ง";
|
||||
public static readonly string PositionLineNotFound = "ไม่พบข้อมูลสายงาน";
|
||||
public static readonly string PositionPathSideNotFound = "ไม่พบข้อมูลด้าน/สาขา";
|
||||
public static readonly string PositionTypeNotFound = "ไม่พบข้อมูลประเภทตำแหน่ง";
|
||||
public static readonly string PositionLevelNotFound = "ไม่พบข้อมูลอันดับ/ระดับ";
|
||||
public static readonly string PositionExecutiveNotFound = "ไม่พบข้อมูลตำแหน่งทางการบริหาร";
|
||||
public static readonly string PositionExecutiveSideNotFound = "ไม่พบข้อมูลด้านทางการบริหาร";
|
||||
public static readonly string PositionEmployeeGroupNotFound = "ไม่พบข้อมูลกลุ่มงาน";
|
||||
public static readonly string PositionEmployeeLevelNotFound = "ไม่พบข้อมูลระดับชั้นงาน";
|
||||
public static readonly string PositionEmployeePositionSideNotFound = "ไม่พบข้อมูลด้านของตำแหน่ง";
|
||||
public static readonly string PositionEmployeePositionNotFound = "ไม่พบข้อมูลตำแหน่ง";
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
|
@ -10,8 +11,10 @@ namespace BMA.EHR.Infrastructure
|
|||
{
|
||||
public static IServiceCollection AddPersistence(this IServiceCollection services,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
var connectionString = configuration.GetConnectionString("DefaultConnection");
|
||||
{
|
||||
services.AddTransient<MinIOService>();
|
||||
|
||||
var connectionString = configuration.GetConnectionString("DefaultConnection");
|
||||
|
||||
services.AddDbContext<ApplicationDBContext>(options =>
|
||||
options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString),
|
||||
|
|
|
|||
10312
BMA.EHR.Infrastructure/Migrations/20230705060909_Update table Org link table.Designer.cs
generated
Normal file
10312
BMA.EHR.Infrastructure/Migrations/20230705060909_Update table Org link table.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -7371,17 +7371,15 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<Guid?>("PositionLevelId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(3)
|
||||
.HasComment("PositionLevelId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("PositionMasterId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(2)
|
||||
.HasComment("PositionMasterId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PositionLevelId");
|
||||
|
||||
b.HasIndex("PositionMasterId");
|
||||
|
||||
b.ToTable("AvailablePositionLevels");
|
||||
|
|
@ -7449,25 +7447,11 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<Guid?>("OrganizationAgencyId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(10)
|
||||
.HasComment("OrganizationAgencyId");
|
||||
|
||||
b.Property<Guid?>("OrganizationFaxId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(8)
|
||||
.HasComment("OrganizationFaxId");
|
||||
|
||||
b.Property<Guid?>("OrganizationGovernmentAgencyId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(11)
|
||||
.HasComment("OrganizationGovernmentAgencyId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("OrganizationLevelId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(5)
|
||||
.HasComment("OrganizationLevelId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<int?>("OrganizationOrder")
|
||||
.HasColumnType("int")
|
||||
|
|
@ -7475,32 +7459,22 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasComment("OrganizationOrder");
|
||||
|
||||
b.Property<Guid?>("OrganizationOrganizationId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(2)
|
||||
.HasComment("OrganizationOrganizationId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("OrganizationShortNameId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(3)
|
||||
.HasComment("OrganizationShortNameId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("OrganizationStatusId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("OrganizationTelExternalId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(6)
|
||||
.HasComment("OrganizationTelExternalId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("OrganizationTelInternalId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(7)
|
||||
.HasComment("OrganizationTelInternalId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("OrganizationTypeId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(4)
|
||||
.HasComment("OrganizationTypeId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("OrganizationUserNote")
|
||||
.HasColumnType("longtext")
|
||||
|
|
@ -7508,9 +7482,7 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasComment("OrganizationUserNote");
|
||||
|
||||
b.Property<Guid?>("ParentId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(9)
|
||||
.HasComment("ParentId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Pile")
|
||||
.HasColumnType("longtext")
|
||||
|
|
@ -7519,6 +7491,22 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrganizationFaxId");
|
||||
|
||||
b.HasIndex("OrganizationLevelId");
|
||||
|
||||
b.HasIndex("OrganizationOrganizationId");
|
||||
|
||||
b.HasIndex("OrganizationShortNameId");
|
||||
|
||||
b.HasIndex("OrganizationStatusId");
|
||||
|
||||
b.HasIndex("OrganizationTelExternalId");
|
||||
|
||||
b.HasIndex("OrganizationTelInternalId");
|
||||
|
||||
b.HasIndex("OrganizationTypeId");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.ToTable("Organizations");
|
||||
|
|
@ -7577,19 +7565,13 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<Guid?>("OrganizationId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(5)
|
||||
.HasComment("OrganizationId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("PositionMasterId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(2)
|
||||
.HasComment("Position Master");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("PositionNumberId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(6)
|
||||
.HasComment("PositionNumberId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("PositionUserNote")
|
||||
.HasColumnType("longtext")
|
||||
|
|
@ -7602,6 +7584,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.HasIndex("PositionMasterId");
|
||||
|
||||
b.HasIndex("PositionNumberId");
|
||||
|
||||
b.ToTable("OrganizationPositions");
|
||||
});
|
||||
|
||||
|
|
@ -7727,14 +7711,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasComment("PositionCondition");
|
||||
|
||||
b.Property<Guid?>("PositionExecutiveId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(5)
|
||||
.HasComment("PositionExecutiveId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("PositionExecutiveSideId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(6)
|
||||
.HasComment("PositionExecutiveSideId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("PositionExecutiveSideObject")
|
||||
.HasColumnType("longtext");
|
||||
|
|
@ -7745,9 +7725,7 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasComment("PositionId");
|
||||
|
||||
b.Property<Guid?>("PositionLineId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(8)
|
||||
.HasComment("PositionLineId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("PositionMasterUserNote")
|
||||
.HasColumnType("longtext")
|
||||
|
|
@ -7755,32 +7733,19 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasComment("PositionMasterUserNote");
|
||||
|
||||
b.Property<Guid?>("PositionPathId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(3)
|
||||
.HasComment("PositionPathId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("PositionPathSideId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(7)
|
||||
.HasComment("PositionPathSideId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("PositionPathSideObject")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid?>("PositionStatus")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(12)
|
||||
.HasComment("PositionStatus");
|
||||
|
||||
b.Property<Guid?>("PositionStatusId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(10)
|
||||
.HasComment("PositionStatusId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("PositionTypeId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(4)
|
||||
.HasComment("PositionTypeId");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Qualification")
|
||||
.HasColumnType("longtext")
|
||||
|
|
@ -7789,6 +7754,20 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PositionExecutiveId");
|
||||
|
||||
b.HasIndex("PositionExecutiveSideId");
|
||||
|
||||
b.HasIndex("PositionLineId");
|
||||
|
||||
b.HasIndex("PositionPathId");
|
||||
|
||||
b.HasIndex("PositionPathSideId");
|
||||
|
||||
b.HasIndex("PositionStatusId");
|
||||
|
||||
b.HasIndex("PositionTypeId");
|
||||
|
||||
b.ToTable("PositionMasters");
|
||||
});
|
||||
|
||||
|
|
@ -7974,12 +7953,12 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasComment("ชื่อ");
|
||||
|
||||
b.Property<Guid?>("OrganizationShortNameId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(3)
|
||||
.HasComment("Shortname");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrganizationShortNameId");
|
||||
|
||||
b.ToTable("PositionNumbers");
|
||||
});
|
||||
|
||||
|
|
@ -8030,7 +8009,7 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<Guid>("OrganizationPositionId")
|
||||
b.Property<Guid?>("OrganizationPositionId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("ProfileId")
|
||||
|
|
@ -8040,6 +8019,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.HasIndex("OrganizationPositionId");
|
||||
|
||||
b.HasIndex("ProfileId");
|
||||
|
||||
b.ToTable("ProfilePositions");
|
||||
});
|
||||
|
||||
|
|
@ -9786,35 +9767,140 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMaster_PositionMasterId")
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionLevelId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMaster")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionMasterId");
|
||||
|
||||
b.Navigation("PositionMaster_PositionMasterId");
|
||||
b.Navigation("PositionLevel");
|
||||
|
||||
b.Navigation("PositionMaster");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "Organization_ParentId")
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationFax", "OrganizationFax")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationFaxId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationLevel", "OrganizationLevel")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationLevelId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrganizationOrganization")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationOrganizationId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", "OrganizationShortName")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationShortNameId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationStatus", "OrganizationStatus")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationStatusId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelExternal", "OrganizationTelExternal")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationTelExternalId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelInternal", "OrganizationTelInternal")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationTelInternalId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationType", "OrganizationType")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationTypeId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "Parent")
|
||||
.WithMany("Organizations")
|
||||
.HasForeignKey("ParentId");
|
||||
|
||||
b.Navigation("Organization_ParentId");
|
||||
b.Navigation("OrganizationFax");
|
||||
|
||||
b.Navigation("OrganizationLevel");
|
||||
|
||||
b.Navigation("OrganizationOrganization");
|
||||
|
||||
b.Navigation("OrganizationShortName");
|
||||
|
||||
b.Navigation("OrganizationStatus");
|
||||
|
||||
b.Navigation("OrganizationTelExternal");
|
||||
|
||||
b.Navigation("OrganizationTelInternal");
|
||||
|
||||
b.Navigation("OrganizationType");
|
||||
|
||||
b.Navigation("Parent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "Organization_OrganizationId")
|
||||
b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "Organization")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMaster_PositionMasterId")
|
||||
b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMaster")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionMasterId");
|
||||
|
||||
b.Navigation("Organization_OrganizationId");
|
||||
b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", "PositionNumber")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionNumberId");
|
||||
|
||||
b.Navigation("PositionMaster_PositionMasterId");
|
||||
b.Navigation("Organization");
|
||||
|
||||
b.Navigation("PositionMaster");
|
||||
|
||||
b.Navigation("PositionNumber");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionExecutive", "PositionExecutive")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionExecutiveId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionExecutiveSide", "PositionExecutiveSide")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionExecutiveSideId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLine", "PositionLine")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionLineId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionPathId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPathSide", "PositionPathSide")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionPathSideId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionStatus", "PositionStatus")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionStatusId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionType", "PositionType")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionTypeId");
|
||||
|
||||
b.Navigation("PositionExecutive");
|
||||
|
||||
b.Navigation("PositionExecutiveSide");
|
||||
|
||||
b.Navigation("PositionLine");
|
||||
|
||||
b.Navigation("PositionPath");
|
||||
|
||||
b.Navigation("PositionPathSide");
|
||||
|
||||
b.Navigation("PositionStatus");
|
||||
|
||||
b.Navigation("PositionType");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterHistoryEntity", b =>
|
||||
|
|
@ -9826,15 +9912,28 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Navigation("PositionMasterEntity");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", "OrganizationShortName")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationShortNameId");
|
||||
|
||||
b.Navigation("OrganizationShortName");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.ProfilePosition", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", "OrganizationPosition")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationPositionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("OrganizationPositionId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProfileId");
|
||||
|
||||
b.Navigation("OrganizationPosition");
|
||||
|
||||
b.Navigation("Profile");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2History", b =>
|
||||
|
|
|
|||
214
BMA.EHR.Infrastructure/Storage/MinIOService.cs
Normal file
214
BMA.EHR.Infrastructure/Storage/MinIOService.cs
Normal file
|
|
@ -0,0 +1,214 @@
|
|||
using Amazon.S3;
|
||||
using Amazon.S3.Model;
|
||||
using BMA.EHR.Domain.Models.Documents;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Net.Http.Headers;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories
|
||||
{
|
||||
public class MinIOService
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly AmazonS3Client _s3Client;
|
||||
private string _bucketName = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructors "
|
||||
|
||||
public MinIOService(ApplicationDBContext context,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
_context = context;
|
||||
_configuration = configuration;
|
||||
|
||||
var config = new AmazonS3Config
|
||||
{
|
||||
ServiceURL = _configuration["MinIO:Endpoint"],
|
||||
ForcePathStyle = true
|
||||
};
|
||||
|
||||
_s3Client = new AmazonS3Client(_configuration["MinIO:AccessKey"], _configuration["MinIO:SecretKey"], config);
|
||||
this._bucketName = _configuration["MinIO:BucketName"] ?? "bma-recruit";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<Document> UploadFileAsync(IFormFile file, string newFileName = "")
|
||||
{
|
||||
var fileName = "";
|
||||
var fileExt = Path.GetExtension(file.FileName);
|
||||
if (newFileName != "")
|
||||
fileName = $"{newFileName}";
|
||||
else
|
||||
fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');
|
||||
|
||||
|
||||
var tmpDir = Path.Combine("tmp");
|
||||
if (!Directory.Exists(tmpDir))
|
||||
Directory.CreateDirectory(tmpDir);
|
||||
|
||||
var tmpFile = Path.Combine(tmpDir, $"tmp_{DateTime.Now.ToString("ddMMyyyyHHmmss")}{fileExt}");
|
||||
|
||||
try
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
var id = Guid.NewGuid();
|
||||
file.CopyTo(ms);
|
||||
var fileBytes = ms.ToArray();
|
||||
System.IO.MemoryStream filestream = new System.IO.MemoryStream(fileBytes);
|
||||
|
||||
var request = new PutObjectRequest
|
||||
{
|
||||
BucketName = _bucketName,
|
||||
Key = id.ToString("D"),
|
||||
InputStream = filestream,
|
||||
ContentType = file.ContentType,
|
||||
CannedACL = S3CannedACL.PublicRead
|
||||
};
|
||||
|
||||
await _s3Client.PutObjectAsync(request);
|
||||
|
||||
// create document object
|
||||
var doc = new Document()
|
||||
{
|
||||
FileName = fileName,
|
||||
FileType = file.ContentType,
|
||||
FileSize = Convert.ToInt32(file.Length),
|
||||
ObjectRefId = id,
|
||||
CreatedDate = DateTime.Now
|
||||
};
|
||||
|
||||
await _context.Documents.AddAsync(doc);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return doc;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
File.Delete(tmpFile);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<FileDownloadResponse> DownloadFileAsync(Guid fileId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var doc = await _context.Documents.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == fileId);
|
||||
|
||||
if (doc == null)
|
||||
throw new Exception(GlobalMessages.FileNotFoundOnServer);
|
||||
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
GetObjectRequest request = new GetObjectRequest
|
||||
{
|
||||
BucketName = _bucketName,
|
||||
Key = doc.ObjectRefId.ToString("D")
|
||||
};
|
||||
|
||||
using (GetObjectResponse response = await _s3Client.GetObjectAsync(request))
|
||||
{
|
||||
using (Stream responseStream = response.ResponseStream)
|
||||
{
|
||||
responseStream.CopyTo(memoryStream);
|
||||
}
|
||||
}
|
||||
|
||||
var fileContent = memoryStream.ToArray();
|
||||
|
||||
return new FileDownloadResponse
|
||||
{
|
||||
FileName = doc.FileName,
|
||||
FileType = doc.FileType,
|
||||
FileContent = fileContent
|
||||
};
|
||||
};
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DeleteFileAsync(Guid fileId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var doc = await _context.Documents.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == fileId);
|
||||
|
||||
if (doc == null)
|
||||
throw new Exception(GlobalMessages.FileNotFoundOnServer);
|
||||
else
|
||||
{
|
||||
DeleteObjectRequest request = new DeleteObjectRequest
|
||||
{
|
||||
BucketName = _bucketName,
|
||||
Key = doc?.ObjectRefId.ToString("D")
|
||||
};
|
||||
|
||||
// delete from minio
|
||||
await _s3Client.DeleteObjectAsync(request);
|
||||
|
||||
|
||||
_context.Documents.Remove(doc);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<string> ImagesPath(Guid? fileId)
|
||||
{
|
||||
if (fileId == null)
|
||||
return "";
|
||||
|
||||
var doc = await _context.Documents.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == fileId);
|
||||
|
||||
if (doc == null)
|
||||
throw new Exception(GlobalMessages.FileNotFoundOnServer);
|
||||
var config = new AmazonS3Config
|
||||
{
|
||||
ServiceURL = _configuration["MinIO:Endpoint"],
|
||||
ForcePathStyle = true
|
||||
};
|
||||
|
||||
DateTime expires = DateTime.UtcNow.AddHours(6);
|
||||
var _protocol = _configuration["Protocol"];
|
||||
GetPreSignedUrlRequest request = new GetPreSignedUrlRequest
|
||||
{
|
||||
BucketName = _bucketName,
|
||||
Key = doc?.ObjectRefId.ToString("D"),
|
||||
Expires = expires,
|
||||
Protocol = _protocol =="HTTPS"?Protocol.HTTPS: Protocol.HTTP
|
||||
};
|
||||
string path = _s3Client.GetPreSignedURL(request);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +1,29 @@
|
|||
{
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Information",
|
||||
"Override": {
|
||||
"Microsoft": "Information",
|
||||
"System": "Warning"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ElasticConfiguration": {
|
||||
"Uri": "http://localhost:9200"
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
},
|
||||
"Jwt": {
|
||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
|
||||
},
|
||||
"EPPlus": {
|
||||
"ExcelPackage": {
|
||||
"LicenseContext": "NonCommercial"
|
||||
}
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Information",
|
||||
"Override": {
|
||||
"Microsoft": "Information",
|
||||
"System": "Warning"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ElasticConfiguration": {
|
||||
"Uri": "http://localhost:9200"
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
},
|
||||
"Jwt": {
|
||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
|
||||
},
|
||||
"EPPlus": {
|
||||
"ExcelPackage": {
|
||||
"LicenseContext": "NonCommercial"
|
||||
}
|
||||
},
|
||||
"Protocol": "HTTPS"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BMA.EHR.API.Command\BMA.EHR.API.Command.csproj" />
|
||||
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,10 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using BMA.EHR.Placement.Service.Requests;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Sentry;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Security.Claims;
|
||||
|
||||
|
|
@ -26,14 +19,17 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
{
|
||||
private readonly PlacementRepository _repository;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public PlacementController(PlacementRepository repository,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
|
|
@ -100,8 +96,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
FullName = x.Prefix == null ? null : x.Prefix.Name + $"{x.Firstname} {x.Lastname}",
|
||||
IdCard = x.CitizenId,
|
||||
ProfilePhoto = x.Id,
|
||||
OrganizationName = x.OrganizationPosition == null ? null : x.OrganizationPosition.OrganizationId,////
|
||||
OrganizationShortName = x.OrganizationPosition == null ? null : x.OrganizationPosition.OrganizationId,////
|
||||
OrganizationName = x.OrganizationPosition == null ? null : (x.OrganizationPosition.Organization == null ? null : (x.OrganizationPosition.Organization.OrganizationOrganization == null ? null : x.OrganizationPosition.Organization.OrganizationOrganization.Name)),////
|
||||
OrganizationShortName = x.OrganizationPosition == null ? null : (x.OrganizationPosition.Organization == null ? null : (x.OrganizationPosition.Organization.OrganizationShortName == null ? null : x.OrganizationPosition.Organization.OrganizationShortName.Name)),////
|
||||
PositionNumber = x.PositionNumber == null ? null : x.PositionNumber.Name,
|
||||
PositionPath = x.PositionPath == null ? null : x.PositionPath.Name,
|
||||
ReportingDate = x.ReportingDate,
|
||||
|
|
@ -206,17 +202,24 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
return Success(placement);
|
||||
}
|
||||
|
||||
[HttpPost("pass/deferment")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdatePersonDeferment([FromBody] PersonDefermentRequest req)
|
||||
[HttpPost("pass/deferment"), DisableRequestSizeLimit]
|
||||
public async Task<ActionResult<ResponseObject>> UpdatePersonDeferment()
|
||||
{
|
||||
var person = await _context.PlacementProfiles.FindAsync(req.PersonalId);
|
||||
var person = await _context.PlacementProfiles.FindAsync(Request.Form.ContainsKey("personalId") ? Guid.Parse(Request.Form["personalId"]) : Guid.Parse("00000000-0000-0000-0000-000000000000"));
|
||||
if (person == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
person.IsRelief = true;
|
||||
person.ReliefReason = req.Note;
|
||||
person.ReliefReason = Request.Form.ContainsKey("note") ? Request.Form["note"] : "";
|
||||
person.PlacementStatus = "UN-CONTAIN";
|
||||
//person.ReliefDoc = req.UploadFile;xxxxxxxxxxxxxx
|
||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||
{
|
||||
var file = Request.Form.Files[0];
|
||||
var fileExtension = Path.GetExtension(file.FileName);
|
||||
|
||||
var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||
person.ReliefDoc = doc;
|
||||
}
|
||||
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
person.LastUpdateUserId = UserId ?? "";
|
||||
person.LastUpdatedAt = DateTime.Now;
|
||||
|
|
@ -245,14 +248,13 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
[HttpGet("pass/deferment/{personalId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetPersonDeferment(Guid personalId)
|
||||
{
|
||||
var person = await _context.PlacementProfiles.FindAsync(personalId);
|
||||
var person = await _context.PlacementProfiles.Include(x => x.ReliefDoc).FirstOrDefaultAsync(x => x.Id == personalId);
|
||||
if (person == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
var data = new
|
||||
{
|
||||
ReliefReason = person.ReliefReason,
|
||||
ReliefDoc = person.ReliefReason,
|
||||
//ReliefDoc = person.ReliefDoc == null ? null : await _documentService.ImagesPath(person.ReliefDoc.Id),xxxxxxxxxxxxxx
|
||||
ReliefDoc = person.ReliefDoc == null ? null : await _documentService.ImagesPath(person.ReliefDoc.Id),
|
||||
};
|
||||
|
||||
return Success(data);
|
||||
|
|
@ -272,14 +274,302 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
return Success(data);
|
||||
}
|
||||
|
||||
[HttpPost("pass/stat/{personalId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdatePositionByPerson(Guid personalId)
|
||||
[HttpPost("pass")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdatePositionByPerson([FromBody] PersonSelectPositionRequest req)
|
||||
{
|
||||
var person = await _context.PlacementProfiles.FindAsync(req.PersonalId);
|
||||
if (person == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
if (req.PosNoId != null)
|
||||
{
|
||||
var save_posNo = await _context.PositionNumbers.FindAsync(req.PosNoId);
|
||||
if (save_posNo == null)
|
||||
return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
||||
person.PositionNumber = save_posNo;
|
||||
|
||||
var save_orgPosition = await _context.OrganizationPositions.FirstOrDefaultAsync(x => x.PositionNumber == save_posNo);
|
||||
if (save_orgPosition == null)
|
||||
return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
||||
person.OrganizationPosition = save_orgPosition;
|
||||
}
|
||||
|
||||
if (req.PositionId != null)
|
||||
{
|
||||
var save = await _context.PositionPaths.FindAsync(req.PositionId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PositionPathNotFound, 404);
|
||||
person.PositionPath = save;
|
||||
}
|
||||
|
||||
if (req.PositionLevelId != null)
|
||||
{
|
||||
var save = await _context.PositionLevels.FindAsync(req.PositionLevelId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PositionLevelNotFound, 404);
|
||||
person.PositionLevel = save;
|
||||
}
|
||||
|
||||
if (req.PositionLineId != null)
|
||||
{
|
||||
var save = await _context.PositionLines.FindAsync(req.PositionLineId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PositionLineNotFound, 404);
|
||||
person.PositionLine = save;
|
||||
}
|
||||
|
||||
if (req.PositionPathSideId != null)
|
||||
{
|
||||
var save = await _context.PositionPathSides.FindAsync(req.PositionPathSideId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PositionPathSideNotFound, 404);
|
||||
person.PositionPathSide = save;
|
||||
}
|
||||
|
||||
if (req.PositionTypeId != null)
|
||||
{
|
||||
var save = await _context.PositionTypes.FindAsync(req.PositionTypeId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PositionTypeNotFound, 404);
|
||||
person.PositionType = save;
|
||||
}
|
||||
person.Amount = req.SalaryAmount;
|
||||
person.MouthSalaryAmount = req.MouthSalaryAmount;
|
||||
person.PositionSalaryAmount = req.PositionSalaryAmount;
|
||||
person.RecruitDate = req.ContainDate;
|
||||
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
person.LastUpdateUserId = UserId ?? "";
|
||||
person.LastUpdatedAt = DateTime.Now;
|
||||
_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
[HttpGet("information/{personalId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateInformation([FromBody] PersonInformationRequest req, Guid personalId)
|
||||
{
|
||||
var person = await _context.PlacementProfiles.FindAsync(personalId);
|
||||
if (person == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
if (req.PrefixId != null)
|
||||
{
|
||||
var save = await _context.Prefixes
|
||||
.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == req.PrefixId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PrefixNotFound, 404);
|
||||
person.Prefix = save;
|
||||
}
|
||||
if (req.GenderId != null)
|
||||
{
|
||||
var save = await _context.Genders
|
||||
.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == req.GenderId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.GenderNotFound, 404);
|
||||
person.Gender = save;
|
||||
}
|
||||
if (req.RelationshipId != null)
|
||||
{
|
||||
var save = await _context.Relationships
|
||||
.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == req.RelationshipId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.RelationshipNotFound, 404);
|
||||
person.Relationship = save;
|
||||
}
|
||||
if (req.BloodGroupId != null)
|
||||
{
|
||||
var save = await _context.BloodGroups
|
||||
.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == req.BloodGroupId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.BloodGroupNotFound, 404);
|
||||
person.BloodGroup = save;
|
||||
}
|
||||
if (req.ReligionId != null)
|
||||
{
|
||||
var save = await _context.Religions
|
||||
.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == req.ReligionId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.ReligionNotFound, 404);
|
||||
person.Religion = save;
|
||||
}
|
||||
|
||||
person.CitizenId = req.CitizenId;
|
||||
person.Firstname = req.FirstName;
|
||||
person.Lastname = req.LastName;
|
||||
person.Nationality = req.Nationality;
|
||||
person.Race = req.Race;
|
||||
person.DateOfBirth = req.BirthDate;
|
||||
person.Telephone = req.TelephoneNumber;
|
||||
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
person.LastUpdateUserId = UserId ?? "";
|
||||
person.LastUpdatedAt = DateTime.Now;
|
||||
_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
[HttpGet("address/{personalId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateAddress([FromBody] PersonAddressRequest req, Guid personalId)
|
||||
{
|
||||
var person = await _context.PlacementProfiles.FindAsync(personalId);
|
||||
if (person == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
if (req.RegistrationSubDistrictId != null)
|
||||
{
|
||||
var save = await _context.SubDistricts.FindAsync(req.RegistrationSubDistrictId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.SubDistrictNotFound, 404);
|
||||
person.RegistSubDistrict = save;
|
||||
person.RegistZipCode = save.ZipCode;
|
||||
}
|
||||
|
||||
if (req.RegistrationDistrictId != null)
|
||||
{
|
||||
var save = await _context.Districts.FindAsync(req.RegistrationDistrictId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.DistrictNotFound, 404);
|
||||
person.RegistDistrict = save;
|
||||
}
|
||||
|
||||
if (req.RegistrationProvinceId != null)
|
||||
{
|
||||
var save = await _context.Provinces.FindAsync(req.RegistrationProvinceId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.ProvinceNotFound, 404);
|
||||
person.RegistProvince = save;
|
||||
}
|
||||
|
||||
if (req.CurrentSubDistrictId != null)
|
||||
{
|
||||
var save = await _context.SubDistricts.FindAsync(req.CurrentSubDistrictId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.SubDistrictNotFound, 404);
|
||||
person.CurrentSubDistrict = save;
|
||||
person.CurrentZipCode = save.ZipCode;
|
||||
}
|
||||
|
||||
if (req.CurrentDistrictId != null)
|
||||
{
|
||||
var save = await _context.Districts.FindAsync(req.CurrentDistrictId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.DistrictNotFound, 404);
|
||||
person.CurrentDistrict = save;
|
||||
}
|
||||
|
||||
if (req.CurrentProvinceId != null)
|
||||
{
|
||||
var save = await _context.Provinces.FindAsync(req.CurrentProvinceId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.ProvinceNotFound, 404);
|
||||
person.CurrentProvince = save;
|
||||
}
|
||||
|
||||
person.RegistSame = req.RegistrationSame;
|
||||
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
person.LastUpdateUserId = UserId ?? "";
|
||||
person.LastUpdatedAt = DateTime.Now;
|
||||
_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
[HttpGet("family/{personalId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateFamily([FromBody] PersonFamilyRequest req, Guid personalId)
|
||||
{
|
||||
var person = await _context.PlacementProfiles.FindAsync(personalId);
|
||||
if (person == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
if (req.Couple == true && req.CouplePrefixId != null)
|
||||
{
|
||||
var save_prefix = await _context.Prefixes
|
||||
.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == req.CouplePrefixId);
|
||||
if (save_prefix == null)
|
||||
return Error(GlobalMessages.PrefixNotFound, 404);
|
||||
person.MarryPrefix = save_prefix;
|
||||
}
|
||||
|
||||
if (req.FatherPrefixId != null)
|
||||
{
|
||||
var save_prefix = await _context.Prefixes
|
||||
.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == req.FatherPrefixId);
|
||||
if (save_prefix == null)
|
||||
return Error(GlobalMessages.PrefixNotFound, 404);
|
||||
person.FatherPrefix = save_prefix;
|
||||
}
|
||||
|
||||
if (req.MotherPrefixId != null)
|
||||
{
|
||||
var save_prefix = await _context.Prefixes
|
||||
.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == req.MotherPrefixId);
|
||||
if (save_prefix == null)
|
||||
return Error(GlobalMessages.PrefixNotFound, 404);
|
||||
person.MotherPrefix = save_prefix;
|
||||
}
|
||||
|
||||
person.Marry = req.Couple;
|
||||
person.MarryFirstName = req.CoupleFirstName;
|
||||
person.MarryLastName = req.CoupleLastName;
|
||||
// person.MarryLastNameOld = req.CoupleLastNameOld;
|
||||
person.MarryOccupation = req.CoupleCareer;
|
||||
// person.MarryCitizenId = req.CoupleCitizenId;
|
||||
// person.MarryLive = req.CoupleLive;
|
||||
person.FatherFirstName = req.FatherFirstName;
|
||||
person.FatherLastName = req.FatherLastName;
|
||||
person.FatherOccupation = req.FatherCareer;
|
||||
// person.FatherCitizenId = req.FatherCitizenId;
|
||||
// person.FatherLive = req.FatherLive;
|
||||
person.MotherFirstName = req.MotherFirstName;
|
||||
person.MotherLastName = req.MotherLastName;
|
||||
person.MotherOccupation = req.MotherCareer;
|
||||
// person.MotherCitizenId = req.MotherCitizenId;
|
||||
// person.MotherLive = req.MotherLive;
|
||||
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
person.LastUpdateUserId = UserId ?? "";
|
||||
person.LastUpdatedAt = DateTime.Now;
|
||||
_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
[HttpGet("certificate/{personalId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateCertificate([FromBody] PersonCertificateRequest req, Guid personalId)
|
||||
{
|
||||
var person = await _context.PlacementProfiles.FindAsync(personalId);
|
||||
if (person == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
person.LastUpdateUserId = UserId ?? "";
|
||||
person.LastUpdatedAt = DateTime.Now;
|
||||
_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
[HttpGet("education/{personalId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateEducation([FromBody] PersonEducationRequest req, Guid personalId)
|
||||
{
|
||||
var person = await _context.PlacementProfiles.FindAsync(personalId);
|
||||
if (person == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
person.LastUpdateUserId = UserId ?? "";
|
||||
person.LastUpdatedAt = DateTime.Now;
|
||||
_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
20
BMA.EHR.Placement.Service/Requests/PersonAddressRequest.cs
Normal file
20
BMA.EHR.Placement.Service/Requests/PersonAddressRequest.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Placement.Service.Requests
|
||||
{
|
||||
public class PersonAddressRequest
|
||||
{
|
||||
public bool? RegistrationSame { get; set; }
|
||||
public string? RegistrationAddress { get; set; }
|
||||
public Guid? RegistrationSubDistrictId { get; set; }
|
||||
public Guid? RegistrationDistrictId { get; set; }
|
||||
public Guid? RegistrationProvinceId { get; set; }
|
||||
public string? RegistrationZipCode { get; set; }
|
||||
public string? CurrentAddress { get; set; }
|
||||
public Guid? CurrentSubDistrictId { get; set; }
|
||||
public Guid? CurrentDistrictId { get; set; }
|
||||
public Guid? CurrentProvinceId { get; set; }
|
||||
public string? CurrentZipCode { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Placement.Service.Requests
|
||||
{
|
||||
public class PersonCertificateRequest
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool Value { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Placement.Service.Requests
|
||||
{
|
||||
public class PersonDefermentRequest
|
||||
{
|
||||
public Guid PersonalId { get; set; }
|
||||
public string Note { get; set; }
|
||||
public bool UploadFile { get; set; }
|
||||
}
|
||||
}
|
||||
11
BMA.EHR.Placement.Service/Requests/PersonEducationRequest.cs
Normal file
11
BMA.EHR.Placement.Service/Requests/PersonEducationRequest.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Placement.Service.Requests
|
||||
{
|
||||
public class PersonEducationRequest
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool Value { get; set; }
|
||||
}
|
||||
}
|
||||
41
BMA.EHR.Placement.Service/Requests/PersonFamilyRequest.cs
Normal file
41
BMA.EHR.Placement.Service/Requests/PersonFamilyRequest.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Placement.Service.Requests
|
||||
{
|
||||
public class PersonFamilyRequest
|
||||
{
|
||||
public bool? Couple { get; set; }
|
||||
public Guid? CouplePrefixId { get; set; }
|
||||
public string? CoupleFirstName { get; set; }
|
||||
public string? CoupleLastName { get; set; }
|
||||
public string? CoupleLastNameOld { get; set; }
|
||||
public string? CoupleCareer { get; set; }
|
||||
public string? CoupleCitizenId { get; set; }
|
||||
public bool CoupleLive { get; set; }
|
||||
|
||||
public Guid? FatherPrefixId { get; set; }
|
||||
public string? FatherFirstName { get; set; }
|
||||
public string? FatherLastName { get; set; }
|
||||
public string? FatherCareer { get; set; }
|
||||
public string? FatherCitizenId { get; set; }
|
||||
public bool FatherLive { get; set; }
|
||||
|
||||
public Guid? MotherPrefixId { get; set; }
|
||||
public string? MotherFirstName { get; set; }
|
||||
public string? MotherLastName { get; set; }
|
||||
public string? MotherCareer { get; set; }
|
||||
public string? MotherCitizenId { get; set; }
|
||||
public bool MotherLive { get; set; }
|
||||
public virtual List<ProfileChildrenRequest> Childrens { get; set; } = new List<ProfileChildrenRequest>();
|
||||
}
|
||||
public class ProfileChildrenRequest
|
||||
{
|
||||
public Guid? ChildrenPrefixId { get; set; }
|
||||
public string? ChildrenFirstName { get; set; }
|
||||
public string? ChildrenLastName { get; set; }
|
||||
public string? ChildrenCareer { get; set; }
|
||||
public string? ChildrenCitizenId { get; set; }
|
||||
public string ChildrenLive { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Placement.Service.Requests
|
||||
{
|
||||
public class PersonInformationRequest
|
||||
{
|
||||
public string? CitizenId { get; set; }
|
||||
public Guid? PrefixId { get; set; }
|
||||
public string? FirstName { get; set; }
|
||||
public string? LastName { get; set; }
|
||||
public Guid? GenderId { get; set; }
|
||||
public string? Nationality { get; set; }
|
||||
public string? Race { get; set; }
|
||||
public Guid? ReligionId { get; set; }
|
||||
public DateTime? BirthDate { get; set; }
|
||||
public Guid? BloodGroupId { get; set; }
|
||||
public Guid? RelationshipId { get; set; }
|
||||
public string? TelephoneNumber { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Placement.Service.Requests
|
||||
{
|
||||
public class PersonSelectPositionRequest
|
||||
{
|
||||
public Guid? PersonalId { get; set; }
|
||||
public DateTime? ContainDate { get; set; }
|
||||
public Guid? PosNoId { get; set; }
|
||||
public Guid? PositionId { get; set; }
|
||||
public Guid? PositionLevelId { get; set; }
|
||||
public Guid? PositionLineId { get; set; }
|
||||
public Guid? PositionPathSideId { get; set; }
|
||||
public Guid? PositionTypeId { get; set; }
|
||||
public double? SalaryAmount { get; set; }
|
||||
public double? MouthSalaryAmount { get; set; }
|
||||
public double? PositionSalaryAmount { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -31,5 +31,6 @@
|
|||
"AccessKey": "frappet",
|
||||
"SecretKey": "P@ssw0rd",
|
||||
"BucketName": "bma-recruit"
|
||||
}
|
||||
},
|
||||
"Protocol": "HTTPS"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue