ดิงข้อมูลหลักจาก dbกลาง

This commit is contained in:
Kittapath 2023-04-10 16:28:05 +07:00
parent 2f292d25ca
commit 4e8520eb01
44 changed files with 4642 additions and 2590 deletions

View file

@ -78,6 +78,7 @@
<PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
<PackageReference Include="System.Xml.XPath" Version="4.3.0" />
<PackageReference Include="System.Xml.XPath.XmlDocument" Version="4.3.0" />
<!-- <PackageReference Include="Telerik.Reporting" Version="15.1.21.616" /> -->
</ItemGroup>
<ItemGroup>
<None Update="SeedPeriodExam.xlsx">

View file

@ -155,7 +155,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateBannerAsync(CMSCandidate banner)
public async Task<ActionResult<ResponseObject>> UpdateBannerAsync()
{
try
{

View file

@ -1,63 +0,0 @@
using BMA.EHR.Recurit.Exam.Service.Response;
using BMA.EHR.Recurit.Exam.Service.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
[Route("api/v{version:apiVersion}/district")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("จัดการข้อมูลอำเภอ เพื่อนำไปใช้งานในระบบ")]
public class DistrictController : BaseController
{
#region " Fields "
private readonly DistrictService _districtService;
#endregion
#region " Constructor and Destructor "
public DistrictController(DistrictService districtService)
{
_districtService = districtService;
}
#endregion
#region " Methods "
/// <summary>
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น
/// </summary>
/// <param name="province">รหัสจังหวัด</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("{province:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsync(string province)
{
try
{
var items = await _districtService.GetsAsync(provinceId: province, showAll: false);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
#endregion
}
}

View file

@ -1,61 +0,0 @@
using BMA.EHR.Recurit.Exam.Service.Response;
using BMA.EHR.Recurit.Exam.Service.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
[Route("api/v{version:apiVersion}/education-level")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("จัดการข้อมูลระดับการศึกษา เพื่อนำไปใช้งานในระบบ")]
public class EducationLevelController : BaseController
{
#region " Fields "
private readonly EducationLevelService _educationLevelService;
#endregion
#region " Constructor and Destructor "
public EducationLevelController(EducationLevelService educationLevelService)
{
_educationLevelService = educationLevelService;
}
#endregion
#region " Methods "
/// <summary>
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsync()
{
try
{
var items = await _educationLevelService.GetsAsync(showAll: false);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
#endregion
}
}

View file

@ -1,61 +0,0 @@
using BMA.EHR.Recurit.Exam.Service.Response;
using BMA.EHR.Recurit.Exam.Service.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
[Route("api/v{version:apiVersion}/prefix")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("จัดการข้อมูลคำนำหน้า เพื่อนำไปใช้งานในระบบ")]
public class PrefixController : BaseController
{
#region " Fields "
private readonly PrefixService _prefixService;
#endregion
#region " Constructor and Destructor "
public PrefixController(PrefixService prefixService)
{
_prefixService = prefixService;
}
#endregion
#region " Methods "
/// <summary>
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะ ข้อมูลที่ Active เท่านั้น
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsync()
{
try
{
var items = await _prefixService.GetsAsync(showAll: false);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
#endregion
}
}

View file

@ -1,62 +0,0 @@
using BMA.EHR.Recurit.Exam.Service.Response;
using BMA.EHR.Recurit.Exam.Service.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
[Route("api/v{version:apiVersion}/province")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("จัดการข้อมูลจังหวัด เพื่อนำไปใช้งานในระบบ")]
public class ProvinceController : BaseController
{
#region " Fields "
private readonly ProvinceService _provinceService;
#endregion
#region " Constructor and Destructor "
public ProvinceController(ProvinceService provinceService)
{
_provinceService = provinceService;
}
#endregion
#region " Methods "
/// <summary>
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsync()
{
try
{
var items = await _provinceService.GetsAsync(showAll: false);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
#endregion
}
}

View file

@ -1,61 +0,0 @@
using BMA.EHR.Recurit.Exam.Service.Response;
using BMA.EHR.Recurit.Exam.Service.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
[Route("api/v{version:apiVersion}/relationship")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("จัดการข้อมูลสถานะภาพ เพื่อนำไปใช้งานในระบบ")]
public class RelationshipController : BaseController
{
#region " Fields "
private readonly RelationshipService _relationshipService;
#endregion
#region " Constructor and Destructor "
public RelationshipController(RelationshipService relationshipService)
{
_relationshipService = relationshipService;
}
#endregion
#region " Methods "
/// <summary>
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsync()
{
try
{
var items = await _relationshipService.GetsAsync(showAll: false);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
#endregion
}
}

View file

@ -1,61 +0,0 @@
using BMA.EHR.Recurit.Exam.Service.Response;
using BMA.EHR.Recurit.Exam.Service.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
[Route("api/v{version:apiVersion}/religion")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("จัดการข้อมูลศาสนา เพื่อนำไปใช้งานในระบบ")]
public class ReligionController : BaseController
{
#region " Fields "
private readonly ReligionService _religionService;
#endregion
#region " Constructor and Destructor "
public ReligionController(ReligionService religionService)
{
_religionService = religionService;
}
#endregion
#region " Methods "
/// <summary>
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsync()
{
try
{
var items = await _religionService.GetsAsync(showAll: false);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
#endregion
}
}

View file

@ -0,0 +1,120 @@
// using BMA.EHR.Recurit.Exam.Service.Core;
// using BMA.EHR.Recurit.Exam.Service.Data;
// using BMA.EHR.Recurit.Exam.Service.Models;
// using BMA.EHR.Recurit.Exam.Service.Request;
// using BMA.EHR.Recurit.Exam.Service.Response;
// using BMA.EHR.Recurit.Exam.Service.Services;
// using Microsoft.AspNetCore.Authorization;
// using Microsoft.AspNetCore.Mvc;
// using Microsoft.EntityFrameworkCore;
// using Swashbuckle.AspNetCore.Annotations;
// using Telerik.Reporting;
// using Telerik.Reporting.Processing;
// namespace BMA.EHR.Recurit.Exam.Service.Controllers
// {
// [Route("api/v{version:apiVersion}/report")]
// [ApiVersion("1.0")]
// [ApiController]
// [Produces("application/json")]
// [Authorize]
// [SwaggerTag("จัดการข้อมูลหน้าเว็บสมัครสอบ เพื่อนำไปใช้งานในระบบ")]
// public class ReportController : BaseController
// {
// #region " Fields "
// private readonly ApplicationDbContext _context;
// private readonly CMSCandidateService _cmsCandidateService;
// private readonly IWebHostEnvironment _hostingEnvironment;
// #endregion
// #region " Constructor and Destructor "
// public ReportController(ApplicationDbContext context, CMSCandidateService cmsCandidateService, IWebHostEnvironment hostingEnvironment)
// {
// _context = context;
// _cmsCandidateService = cmsCandidateService;
// _hostingEnvironment = hostingEnvironment;
// }
// #endregion
// public static IConfigurationRoot Configuration
// {
// get
// {
// return new ConfigurationBuilder()
// .SetBasePath(Directory.GetCurrentDirectory())
// .AddJsonFile("appsettings.json")
// .Build();
// }
// }
// #region " Methods "
// /// <summary>
// /// ใบเสร็จผู้สมัครสอบ
// /// </summary>
// /// <param name="candidateId">รหัสใบสมัคร</param>
// /// <returns></returns>
// /// <response code="200">เมื่อทำการอ่านใบเสร็จผู้สมัครสอบสำเร็จ</response>
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
// [HttpGet]
// [ProducesResponseType(StatusCodes.Status200OK)]
// [ProducesResponseType(StatusCodes.Status401Unauthorized)]
// [ProducesResponseType(StatusCodes.Status500InternalServerError)]
// public async Task<ActionResult<ResponseObject>> GetsAsync(string candidateId)
// {
// try
// {
// return Success("ยังใช้ไม่ได้จ้าา");
// var candidate = await _context.Candidates.AsQueryable()
// .Where(x => x.Id == Guid.Parse(candidateId))
// .Select(x => new
// {
// Fee = x.PeriodExam == null ? 0 : x.PeriodExam.Fee,
// // DateBill = DateTime.now,
// })
// .FirstOrDefaultAsync();
// if (candidate == null)
// throw new Exception(GlobalMessages.CandidateNotFound);
// var rptFile = "";
// rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "rptBillPayment.trdp");
// ReportPackager reportPackager = new ReportPackager();
// Telerik.Reporting.Report? report = null;
// using (var sourceStream = System.IO.File.OpenRead(rptFile))
// {
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
// }
// report.DataSource = candidate;
// System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
// InstanceReportSource instanceReportSource = new InstanceReportSource()
// {
// ReportDocument = report
// };
// ReportProcessor reportProcessor = new ReportProcessor(Configuration);
// RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
// var outputfile = $"DoctorOrderSheet_.pdf";
// return File(result.DocumentBytes, "application/pdf", outputfile);
// }
// catch (Exception ex)
// {
// return Error(ex);
// }
// }
// #endregion
// }
// }

View file

@ -1,62 +0,0 @@
using BMA.EHR.Recurit.Exam.Service.Response;
using BMA.EHR.Recurit.Exam.Service.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
[Route("api/v{version:apiVersion}/sub-district")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("จัดการข้อมูลตำบล เพื่อนำไปใช้งานในระบบ")]
public class SubDistrictController : BaseController
{
#region " Fields "
private readonly SubDistrictService _subDistrictService;
#endregion
#region " Constructor and Destructor "
public SubDistrictController(SubDistrictService subDistrictService)
{
_subDistrictService = subDistrictService;
}
#endregion
#region " Methods "
/// <summary>
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น
/// </summary>
/// <param name="district">รหัสอำเภอ</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("{district:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsync(string district)
{
try
{
var items = await _subDistrictService.GetsAsync(districtId: district, showAll: false);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
#endregion
}
}

View file

@ -15,19 +15,19 @@ namespace BMA.EHR.Recurit.Exam.Service.Data
{
}
public DbSet<Prefix> Prefixes { get; set; }
// public DbSet<Prefix> Prefixes { get; set; }
public DbSet<Religion> Religions { get; set; }
// public DbSet<Religion> Religions { get; set; }
public DbSet<Relationship> Relationships { get; set; }
// public DbSet<Relationship> Relationships { get; set; }
public DbSet<EducationLevel> EducationLevels { get; set; }
// public DbSet<EducationLevel> EducationLevels { get; set; }
public DbSet<Province> Provinces { get; set; }
// public DbSet<Province> Provinces { get; set; }
public DbSet<District> Districts { get; set; }
// public DbSet<District> Districts { get; set; }
public DbSet<SubDistrict> SubDistricts { get; set; }
// public DbSet<SubDistrict> SubDistricts { get; set; }
public DbSet<PeriodExam> PeriodExams { get; set; }

View file

@ -13,302 +13,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data
#region " Seed Metadata "
public static async Task SeedPrefixAsync(WebApplication app)
{
using var scope = app.Services.CreateScope();
var service = scope.ServiceProvider.GetRequiredService<PrefixService>();
var insertedPrefix = new List<Prefix>();
if ((await service.GetsAsync()).Count() == 0)
{
// read excels into object
var excelFile = "SeedPerson.xlsx";
using (var excel = new ExcelPackage(new FileInfo(excelFile)))
{
// 1. Seed PrefixAsync
var workSheet = excel.Workbook.Worksheets.FirstOrDefault(x => x.Name.ToLower() == "prefix");
var totalRows = workSheet?.Dimension.Rows;
int row = 1;
while (row <= totalRows)
{
var cell1 = workSheet?.Cells[row, 1]?.GetValue<string>();
if (cell1 == "" || cell1 == null) break;
var prefix = insertedPrefix.Where(x => x.Name == (workSheet?.Cells[row, 1]?.GetValue<string>() ?? "")).FirstOrDefault();
if (prefix == null)
{
var inserted = new Prefix
{
Id = Guid.NewGuid(),
Name = workSheet?.Cells[row, 1]?.GetValue<string>() ?? "",
IsActive = true,
CreatedFullName = "System Administrator",
CreatedAt = DateTime.Now
};
insertedPrefix.Add(inserted);
await service.CreateAsync(inserted);
}
row++;
}
}
}
}
public static async Task SeedReligionAsync(WebApplication app)
{
using var scope = app.Services.CreateScope();
var service = scope.ServiceProvider.GetRequiredService<ReligionService>();
var insertedReligion = new List<Religion>();
if ((await service.GetsAsync()).Count() == 0)
{
// read excels into object
var excelFile = "SeedPerson.xlsx";
using (var excel = new ExcelPackage(new FileInfo(excelFile)))
{
// 1. Seed Religion
var workSheet = excel.Workbook.Worksheets.FirstOrDefault(x => x.Name.ToLower() == "religion");
var totalRows = workSheet?.Dimension.Rows;
int row = 1;
while (row <= totalRows)
{
var cell1 = workSheet?.Cells[row, 1]?.GetValue<string>();
if (cell1 == "" || cell1 == null) break;
var religion = insertedReligion.Where(x => x.Name == (workSheet?.Cells[row, 1]?.GetValue<string>() ?? "")).FirstOrDefault();
if (religion == null)
{
var inserted = new Religion
{
Id = Guid.NewGuid(),
Name = workSheet?.Cells[row, 1]?.GetValue<string>() ?? "",
IsActive = true,
CreatedFullName = "System Administrator",
CreatedAt = DateTime.Now
};
insertedReligion.Add(inserted);
await service.CreateAsync(inserted);
}
row++;
}
}
}
}
public static async Task SeedRelationshipAsync(WebApplication app)
{
using var scope = app.Services.CreateScope();
var service = scope.ServiceProvider.GetRequiredService<RelationshipService>();
var insertedRelationship = new List<Relationship>();
if ((await service.GetsAsync()).Count() == 0)
{
// read excels into object
var excelFile = "SeedPerson.xlsx";
using (var excel = new ExcelPackage(new FileInfo(excelFile)))
{
// 1. Seed Relationship
var workSheet = excel.Workbook.Worksheets.FirstOrDefault(x => x.Name.ToLower() == "relationship");
var totalRows = workSheet?.Dimension.Rows;
int row = 1;
while (row <= totalRows)
{
var cell1 = workSheet?.Cells[row, 1]?.GetValue<string>();
if (cell1 == "" || cell1 == null) break;
var relationship = insertedRelationship.Where(x => x.Name == (workSheet?.Cells[row, 1]?.GetValue<string>() ?? "")).FirstOrDefault();
if (relationship == null)
{
var inserted = new Relationship
{
Id = Guid.NewGuid(),
Name = workSheet?.Cells[row, 1]?.GetValue<string>() ?? "",
IsActive = true,
CreatedFullName = "System Administrator",
CreatedAt = DateTime.Now
};
insertedRelationship.Add(inserted);
await service.CreateAsync(inserted);
}
row++;
}
}
}
}
public static async Task SeedEducationLevelAsync(WebApplication app)
{
using var scope = app.Services.CreateScope();
var service = scope.ServiceProvider.GetRequiredService<EducationLevelService>();
var insertedEducationLevel = new List<EducationLevel>();
if ((await service.GetsAsync()).Count() == 0)
{
// read excels into object
var excelFile = "SeedPerson.xlsx";
using (var excel = new ExcelPackage(new FileInfo(excelFile)))
{
// 1. Seed EducationLevel
var workSheet = excel.Workbook.Worksheets.FirstOrDefault(x => x.Name.ToLower() == "educationlevel");
var totalRows = workSheet?.Dimension.Rows;
int row = 1;
while (row <= totalRows)
{
var cell1 = workSheet?.Cells[row, 1]?.GetValue<string>();
if (cell1 == "" || cell1 == null) break;
var educationLevel = insertedEducationLevel.Where(x => x.Name == (workSheet?.Cells[row, 1]?.GetValue<string>() ?? "")).FirstOrDefault();
if (educationLevel == null)
{
var inserted = new EducationLevel
{
Id = Guid.NewGuid(),
Name = workSheet?.Cells[row, 1]?.GetValue<string>() ?? "",
IsActive = true,
CreatedFullName = "System Administrator",
CreatedAt = DateTime.Now
};
insertedEducationLevel.Add(inserted);
await service.CreateAsync(inserted);
}
row++;
}
}
}
}
public static async Task SeedProvinceAsync(WebApplication app)
{
using var scope = app.Services.CreateScope();
var service = scope.ServiceProvider.GetRequiredService<ProvinceService>();
var districtService = scope.ServiceProvider.GetRequiredService<DistrictService>();
var subDistrictService = scope.ServiceProvider.GetRequiredService<SubDistrictService>();
var serializeOption = new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore };
var insertedProvince = new List<Province>();
if ((await service.GetsAsync()).Count() == 0)
{
// read excels into object
var excelFile = "SeedPerson.xlsx";
using (var excel = new ExcelPackage(new FileInfo(excelFile)))
{
// 1. Seed Province
var workSheet = excel.Workbook.Worksheets.FirstOrDefault(x => x.Name.ToLower() == "province");
var totalRows = workSheet?.Dimension.Rows;
int row = 2;
while (row <= totalRows)
{
var cell1 = workSheet?.Cells[row, 1]?.GetValue<string>();
if (cell1 == "" || cell1 == null) break;
var inserted = new Province
{
Id = Guid.NewGuid(),
Name = workSheet?.Cells[row, 1]?.GetValue<string>() ?? "",
IsActive = true,
CreatedFullName = "System Administrator",
CreatedAt = DateTime.Now,
Districts = new List<District>()
};
insertedProvince.Add(inserted);
await service.CreateAsync(inserted);
row++;
}
// 2. Seed District
var d_workSheet = excel.Workbook.Worksheets.FirstOrDefault(x => x.Name.ToLower() == "district");
var d_totalRows = d_workSheet?.Dimension.Rows;
int d_row = 2;
while (d_row <= d_totalRows)
{
var cell1 = d_workSheet?.Cells[d_row, 1]?.GetValue<string>();
if (cell1 == "" || cell1 == null) break;
var province = insertedProvince.Where(x => x.Name == cell1).FirstOrDefault();
var inserted = new District
{
Id = Guid.NewGuid(),
Name = d_workSheet?.Cells[d_row, 2]?.GetValue<string>() ?? "",
IsActive = true,
CreatedFullName = "System Administrator",
CreatedAt = DateTime.Now,
SubDistricts = new List<SubDistrict>()
};
province?.Districts.Add(inserted);
var provinceId = province == null ? Guid.NewGuid() : province.Id;
var jsonString = JsonConvert.SerializeObject(inserted, serializeOption);
await districtService.CreateAsync(inserted, provinceId.ToString("D"));
d_row++;
}
// 3. Seed SubDistrict
var s_workSheet = excel.Workbook.Worksheets.FirstOrDefault(x => x.Name.ToLower() == "subdistrict");
var s_totalRows = s_workSheet?.Dimension.Rows;
int s_row = 2;
var zipcodes = new List<string>();
while (s_row <= s_totalRows)
{
var cell1 = s_workSheet?.Cells[s_row, 1]?.GetValue<string>();
var cell2 = s_workSheet?.Cells[s_row, 2]?.GetValue<string>();
if (cell1 == "" || cell1 == null) break;
var province = insertedProvince.Where(x => x.Name == cell1).FirstOrDefault();
var district = province?.Districts.Where(x => x.Name == cell2).FirstOrDefault();
var inserted = new SubDistrict
{
Id = Guid.NewGuid(),
Name = s_workSheet?.Cells[s_row, 3]?.GetValue<string>() ?? "",
ZipCode = s_workSheet?.Cells[s_row, 4]?.GetValue<string>() ?? "",
IsActive = true,
CreatedFullName = "System Administrator",
CreatedAt = DateTime.Now,
};
if (!zipcodes.Contains(inserted.ZipCode))
zipcodes.Add(inserted.ZipCode);
district?.SubDistricts.Add(inserted);
var districtId = district == null ? Guid.NewGuid() : district.Id;
var jsonString = JsonConvert.SerializeObject(inserted, serializeOption);
await subDistrictService.CreateAsync(inserted, districtId.ToString("D"));
s_row++;
}
}
}
}
public static async Task SeedPeriodExamAsync(WebApplication app)
{
// using var scope = app.Services.CreateScope();

55
Data/MetadataDbContext.cs Normal file
View file

@ -0,0 +1,55 @@
using BMA.EHR.Recurit.Exam.Service.Models;
using BMA.EHR.Recurit.Exam.Service.Models.Documents;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Recurit.Exam.Service.Data
{
public class MetadataDbContext : DbContext
{
public MetadataDbContext(DbContextOptions<MetadataDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
}
// The following configures EF to create a Sqlite database file in the
// special "local" folder for your platform.
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
if (!options.IsConfigured)
{
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production";
var configurationBuilder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: true, true)
.AddJsonFile($"appsettings.{environment}.json", true, true)
.AddEnvironmentVariables()
.Build();
var historyConnection = configurationBuilder.GetConnectionString("HistoryConnection");
options.UseMySql(historyConnection, ServerVersion.AutoDetect(historyConnection));
}
}
public DbSet<Prefix> Prefixes { get; set; }
public DbSet<Religion> Religions { get; set; }
public DbSet<EducationLevel> EducationLevels { get; set; }
public DbSet<Relationship> Relationships { get; set; }
public DbSet<Province> Provinces { get; set; }
public DbSet<District> Districts { get; set; }
public DbSet<SubDistrict> SubDistricts { get; set; }
public DbSet<OrganizationOrganization> OrganizationOrganizations { get; set; }
public DbSet<OrganizationShortName> OrganizationShortNames { get; set; }
}
}

View file

@ -168,7 +168,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Property<string>("Address")
.HasColumnType("longtext")
.HasComment("ที่อยู่");
.HasComment("ที่อยู่ปัจจุบัน");
b.Property<Guid?>("BannerImgId")
.HasColumnType("char(36)");
@ -197,7 +197,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasComment("ข้อมูลเว็บโดยย่อ");
b.Property<Guid?>("DistrictId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id อำเภอ");
b.Property<string>("DistrictName")
.HasColumnType("longtext")
.HasComment("อำเภอ");
b.Property<string>("LastUpdateFullName")
.IsRequired()
@ -230,14 +235,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasComment("ชื่อเว็บภาษาไทย");
b.Property<Guid?>("ProvinceId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id จังหวัด");
b.Property<string>("ProvinceName")
.HasColumnType("longtext")
.HasComment("จังหวัด");
b.Property<string>("ShortName")
.HasColumnType("longtext")
.HasComment("ชื่อย่อ");
b.Property<Guid?>("SubDistrictId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id ตำบล");
b.Property<string>("SubDistrictName")
.HasColumnType("longtext")
.HasComment("ตำบล");
b.Property<string>("Telephone")
.HasMaxLength(20)
@ -253,14 +268,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.HasIndex("BannerImgId");
b.HasIndex("DistrictId");
b.HasIndex("LogoImgId");
b.HasIndex("ProvinceId");
b.HasIndex("SubDistrictId");
b.ToTable("CMSCandidates");
});
@ -343,7 +352,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasComment("วันที่ออกบัตร");
b.Property<Guid?>("CitizenDistrictId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id เขตที่ออกบัตรประชาชน");
b.Property<string>("CitizenDistrictName")
.HasColumnType("longtext")
.HasComment("เขตที่ออกบัตรประชาชน");
b.Property<string>("CitizenId")
.HasMaxLength(20)
@ -351,7 +365,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasComment("เลขประจำตัวประชาชน");
b.Property<Guid?>("CitizenProvinceId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id จังหวัดที่ออกบัตรประชาชน");
b.Property<string>("CitizenProvinceName")
.HasColumnType("longtext")
.HasComment("จังหวัดที่ออกบัตรประชาชน");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
@ -377,13 +396,28 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasComment("ที่อยู่ปัจจุบัน");
b.Property<Guid?>("CurrentDistrictId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id อำเภอที่อยู่ปัจจุบัน");
b.Property<string>("CurrentDistrictName")
.HasColumnType("longtext")
.HasComment("อำเภอที่อยู่ปัจจุบัน");
b.Property<Guid?>("CurrentProvinceId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id จังหวัดที่อยู่ปัจจุบัน");
b.Property<string>("CurrentProvinceName")
.HasColumnType("longtext")
.HasComment("จังหวัดที่อยู่ปัจจุบัน");
b.Property<Guid?>("CurrentSubDistrictId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id ตำบลที่อยู่ปัจจุบัน");
b.Property<string>("CurrentSubDistrictName")
.HasColumnType("longtext")
.HasComment("ตำบลที่อยู่ปัจจุบัน");
b.Property<string>("CurrentZipCode")
.HasMaxLength(10)
@ -425,7 +459,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasComment("อาชีพบิดา");
b.Property<Guid?>("FatherPrefixId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id คำนำหน้าชื่อบิดา");
b.Property<string>("FatherPrefixName")
.HasColumnType("longtext")
.HasComment("คำนำหน้าชื่อบิดา");
b.Property<string>("FirstName")
.HasMaxLength(100)
@ -487,7 +526,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasComment("อาชีพคู่สมรส");
b.Property<Guid?>("MarryPrefixId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id คำนำหน้าชื่อคู่สมรส");
b.Property<string>("MarryPrefixName")
.HasColumnType("longtext")
.HasComment("คำนำหน้าชื่อคู่สมรส");
b.Property<string>("MobilePhone")
.HasMaxLength(20)
@ -515,7 +559,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasComment("อาชีพมารดา");
b.Property<Guid?>("MotherPrefixId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id คำนำหน้าชื่อมารดา");
b.Property<string>("MotherPrefixName")
.HasColumnType("longtext")
.HasComment("คำนำหน้าชื่อมารดา");
b.Property<string>("Nationality")
.HasMaxLength(40)
@ -563,7 +612,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("char(36)");
b.Property<Guid?>("PrefixId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id คำนำหน้าชื่อ");
b.Property<string>("PrefixName")
.HasColumnType("longtext")
.HasComment("คำนำหน้าชื่อ");
b.Property<Guid?>("ProfileImgId")
.HasColumnType("char(36)");
@ -573,17 +627,32 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasComment("ที่อยู่ตามทะเบียนบ้าน");
b.Property<Guid?>("RegistDistrictId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id อำเภอที่อยู่ตามทะเบียนบ้าน");
b.Property<string>("RegistDistrictName")
.HasColumnType("longtext")
.HasComment("อำเภอที่อยู่ตามทะเบียนบ้าน");
b.Property<Guid?>("RegistProvinceId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id จังหวัดที่อยู่ตามทะเบียนบ้าน");
b.Property<string>("RegistProvinceName")
.HasColumnType("longtext")
.HasComment("จังหวัดที่อยู่ตามทะเบียนบ้าน");
b.Property<bool?>("RegistSame")
.HasColumnType("tinyint(1)")
.HasComment("ที่อยู่ปัจจุบันเหมือนที่อยู่ตามทะเบียนบ้าน");
b.Property<Guid?>("RegistSubDistrictId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id ตำบลที่อยู่ตามทะเบียนบ้าน");
b.Property<string>("RegistSubDistrictName")
.HasColumnType("longtext")
.HasComment("ตำบลที่อยู่ตามทะเบียนบ้าน");
b.Property<string>("RegistZipCode")
.HasMaxLength(10)
@ -595,7 +664,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasComment("เหตุผลการไม่อนุมัติ");
b.Property<Guid?>("RelationshipId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Id ศาสนา");
b.Property<string>("RelationshipName")
.HasColumnType("longtext")
.HasComment("ศาสนา");
b.Property<string>("SeatNumber")
.HasColumnType("longtext")
@ -620,40 +694,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.HasKey("Id");
b.HasIndex("CitizenDistrictId");
b.HasIndex("CitizenProvinceId");
b.HasIndex("CurrentDistrictId");
b.HasIndex("CurrentProvinceId");
b.HasIndex("CurrentSubDistrictId");
b.HasIndex("FatherPrefixId");
b.HasIndex("MarryPrefixId");
b.HasIndex("MotherPrefixId");
b.HasIndex("PaymentImgId");
b.HasIndex("PeriodExamId");
b.HasIndex("PositionExamId");
b.HasIndex("PrefixId");
b.HasIndex("ProfileImgId");
b.HasIndex("RegistDistrictId");
b.HasIndex("RegistProvinceId");
b.HasIndex("RegistSubDistrictId");
b.HasIndex("RelationshipId");
b.ToTable("Candidates");
});
@ -810,75 +858,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.ToTable("Careers");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.District", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(2)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("varchar(150)")
.HasColumnOrder(1)
.HasComment("เขต/อำเภอ");
b.Property<Guid?>("ProvinceId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("ProvinceId");
b.ToTable("Districts");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Documents.Document", b =>
{
b.Property<Guid>("Id")
@ -954,8 +933,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(1)
.HasComment("ระยะเวลาเริ่ม");
b.Property<Guid>("EducationLevelId")
.HasColumnType("char(36)");
b.Property<Guid?>("EducationLevelId")
.HasColumnType("char(36)")
.HasComment("Idวุฒิที่ได้รับ");
b.Property<string>("EducationLevelName")
.HasColumnType("longtext")
.HasComment("วุฒิที่ได้รับ");
b.Property<string>("LastUpdateFullName")
.IsRequired()
@ -998,75 +982,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.HasIndex("CandidateId");
b.HasIndex("EducationLevelId");
b.ToTable("Educations");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.EducationLevel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(2)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnOrder(1)
.HasComment("ระดับการศึกษา");
b.HasKey("Id");
b.ToTable("EducationLevels");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PeriodExam", b =>
{
b.Property<Guid>("Id")
@ -1414,338 +1332,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.ToTable("PositionExams");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Prefix", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(3)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnOrder(2)
.HasComment("รายละเอียดคำนำหน้า");
b.HasKey("Id");
b.ToTable("Prefixes");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Province", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(2)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("varchar(150)")
.HasColumnOrder(1)
.HasComment("จังหวัด");
b.HasKey("Id");
b.ToTable("Provinces");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Relationship", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(2)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnOrder(1)
.HasComment("ชื่อความสัมพันธ์");
b.HasKey("Id");
b.ToTable("Relationships");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Religion", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(2)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnOrder(1)
.HasComment("ศาสนา");
b.HasKey("Id");
b.ToTable("Religions");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.SubDistrict", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<Guid?>("DistrictId")
.HasColumnType("char(36)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(3)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("varchar(150)")
.HasColumnOrder(1)
.HasComment("เขต/อำเภอ");
b.Property<string>("ZipCode")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("varchar(10)")
.HasColumnOrder(2)
.HasComment("รหัสไปรษณีย์");
b.HasKey("Id");
b.HasIndex("DistrictId");
b.ToTable("SubDistricts");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.BankExam", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.PeriodExam", "PeriodExam")
@ -1774,31 +1360,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.WithMany()
.HasForeignKey("BannerImgId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "District")
.WithMany()
.HasForeignKey("DistrictId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Documents.Document", "LogoImg")
.WithMany()
.HasForeignKey("LogoImgId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Province", "Province")
.WithMany()
.HasForeignKey("ProvinceId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.SubDistrict", "SubDistrict")
.WithMany()
.HasForeignKey("SubDistrictId");
b.Navigation("BannerImg");
b.Navigation("District");
b.Navigation("LogoImg");
b.Navigation("Province");
b.Navigation("SubDistrict");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.CMSGovernment", b =>
@ -1814,38 +1382,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Candidate", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "CitizenDistrict")
.WithMany()
.HasForeignKey("CitizenDistrictId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Province", "CitizenProvince")
.WithMany()
.HasForeignKey("CitizenProvinceId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "CurrentDistrict")
.WithMany()
.HasForeignKey("CurrentDistrictId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Province", "CurrentProvince")
.WithMany()
.HasForeignKey("CurrentProvinceId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.SubDistrict", "CurrentSubDistrict")
.WithMany()
.HasForeignKey("CurrentSubDistrictId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Prefix", "FatherPrefix")
.WithMany()
.HasForeignKey("FatherPrefixId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Prefix", "MarryPrefix")
.WithMany()
.HasForeignKey("MarryPrefixId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Prefix", "MotherPrefix")
.WithMany()
.HasForeignKey("MotherPrefixId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Documents.Document", "PaymentImg")
.WithMany()
.HasForeignKey("PaymentImgId");
@ -1860,63 +1396,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.WithMany()
.HasForeignKey("PositionExamId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Prefix", "Prefix")
.WithMany()
.HasForeignKey("PrefixId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Documents.Document", "ProfileImg")
.WithMany()
.HasForeignKey("ProfileImgId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "RegistDistrict")
.WithMany()
.HasForeignKey("RegistDistrictId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Province", "RegistProvince")
.WithMany()
.HasForeignKey("RegistProvinceId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.SubDistrict", "RegistSubDistrict")
.WithMany()
.HasForeignKey("RegistSubDistrictId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Relationship", "Relationship")
.WithMany()
.HasForeignKey("RelationshipId");
b.Navigation("CitizenDistrict");
b.Navigation("CitizenProvince");
b.Navigation("CurrentDistrict");
b.Navigation("CurrentProvince");
b.Navigation("CurrentSubDistrict");
b.Navigation("FatherPrefix");
b.Navigation("MarryPrefix");
b.Navigation("MotherPrefix");
b.Navigation("PaymentImg");
b.Navigation("PeriodExam");
b.Navigation("PositionExam");
b.Navigation("Prefix");
b.Navigation("ProfileImg");
b.Navigation("RegistDistrict");
b.Navigation("RegistProvince");
b.Navigation("RegistSubDistrict");
b.Navigation("Relationship");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.CandidateDocument", b =>
@ -1949,15 +1439,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Navigation("Candidate");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.District", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Province", "Province")
.WithMany("Districts")
.HasForeignKey("ProvinceId");
b.Navigation("Province");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Education", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Candidate", "Candidate")
@ -1966,15 +1447,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.EducationLevel", "EducationLevel")
.WithMany()
.HasForeignKey("EducationLevelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Candidate");
b.Navigation("EducationLevel");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PeriodExamDocument", b =>
@ -2026,15 +1499,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Navigation("PeriodExam");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.SubDistrict", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "District")
.WithMany("SubDistricts")
.HasForeignKey("DistrictId");
b.Navigation("District");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.CMSCandidate", b =>
{
b.Navigation("CMSAgencys");
@ -2042,11 +1506,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Navigation("CMSGovernments");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.District", b =>
{
b.Navigation("SubDistricts");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PeriodExam", b =>
{
b.Navigation("BankExam");
@ -2059,11 +1518,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Navigation("PositionExam");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Province", b =>
{
b.Navigation("Districts");
});
#pragma warning restore 612, 618
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -31,17 +31,26 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("ข้อมูลเกี่ยวกับเรา")]
public string? About { get; set; }
[Comment("ที่อยู่")]
[Comment("ที่อยู่ปัจจุบัน")]
public string? Address { get; set; }
[Comment("Id จังหวัด")]
public Guid? ProvinceId { get; set; }
[Comment("จังหวัด")]
public virtual Province? Province { get; set; }
public string? ProvinceName { get; set; }
[Comment("Id อำเภอ")]
public Guid? DistrictId { get; set; }
[Comment("อำเภอ")]
public virtual District? District { get; set; }
public string? DistrictName { get; set; }
[Comment("Id ตำบล")]
public Guid? SubDistrictId { get; set; }
[Comment("ตำบล")]
public virtual SubDistrict? SubDistrict { get; set; }
public string? SubDistrictName { get; set; }
[MaxLength(10), Comment("รหัสไปรษณีย์")]
public string? ZipCode { get; set; }

View file

@ -36,8 +36,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("Id คำนำหน้าชื่อ")]
public Guid? PrefixId { get; set; }
[Comment("คำนำหน้าชื่อ")]
public virtual Prefix? Prefix { get; set; }
public string? PrefixName { get; set; }
[MaxLength(100), Column(Order = 1), Comment("ชื่อจริง")]
public string? FirstName { get; set; }
@ -51,8 +54,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[MaxLength(40), Comment("วันเกิด")]
public DateTime? DateOfBirth { get; set; }
[Comment("Id ศาสนา")]
public Guid? RelationshipId { get; set; }
[Comment("ศาสนา")]
public virtual Relationship? Relationship { get; set; }
public string? RelationshipName { get; set; }
[MaxLength(200), Comment("อีเมล")]
public string? Email { get; set; }
@ -60,11 +66,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[MaxLength(20), Comment("เลขประจำตัวประชาชน")]
public string? CitizenId { get; set; }
[Comment("Id เขตที่ออกบัตรประชาชน")]
public Guid? CitizenDistrictId { get; set; }
[Comment("เขตที่ออกบัตรประชาชน")]
public virtual District? CitizenDistrict { get; set; }
public string? CitizenDistrictName { get; set; }
[Comment("Id จังหวัดที่ออกบัตรประชาชน")]
public Guid? CitizenProvinceId { get; set; }
[Comment("จังหวัดที่ออกบัตรประชาชน")]
public virtual Province? CitizenProvince { get; set; }
public string? CitizenProvinceName { get; set; }
[Comment("วันที่ออกบัตร")]
public DateTime? CitizenDate { get; set; }
@ -84,14 +96,23 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("ที่อยู่ตามทะเบียนบ้าน")]
public string? RegistAddress { get; set; }
[Comment("Id จังหวัดที่อยู่ตามทะเบียนบ้าน")]
public Guid? RegistProvinceId { get; set; }
[Comment("จังหวัดที่อยู่ตามทะเบียนบ้าน")]
public virtual Province? RegistProvince { get; set; }
public string? RegistProvinceName { get; set; }
[Comment("Id อำเภอที่อยู่ตามทะเบียนบ้าน")]
public Guid? RegistDistrictId { get; set; }
[Comment("อำเภอที่อยู่ตามทะเบียนบ้าน")]
public virtual District? RegistDistrict { get; set; }
public string? RegistDistrictName { get; set; }
[Comment("Id ตำบลที่อยู่ตามทะเบียนบ้าน")]
public Guid? RegistSubDistrictId { get; set; }
[Comment("ตำบลที่อยู่ตามทะเบียนบ้าน")]
public virtual SubDistrict? RegistSubDistrict { get; set; }
public string? RegistSubDistrictName { get; set; }
[MaxLength(10), Comment("รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน")]
public string? RegistZipCode { get; set; }
@ -102,14 +123,23 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("ที่อยู่ปัจจุบัน")]
public string? CurrentAddress { get; set; }
[Comment("Id จังหวัดที่อยู่ปัจจุบัน")]
public Guid? CurrentProvinceId { get; set; }
[Comment("จังหวัดที่อยู่ปัจจุบัน")]
public virtual Province? CurrentProvince { get; set; }
public string? CurrentProvinceName { get; set; }
[Comment("Id อำเภอที่อยู่ปัจจุบัน")]
public Guid? CurrentDistrictId { get; set; }
[Comment("อำเภอที่อยู่ปัจจุบัน")]
public virtual District? CurrentDistrict { get; set; }
public string? CurrentDistrictName { get; set; }
[Comment("Id ตำบลที่อยู่ปัจจุบัน")]
public Guid? CurrentSubDistrictId { get; set; }
[Comment("ตำบลที่อยู่ปัจจุบัน")]
public virtual SubDistrict? CurrentSubDistrict { get; set; }
public string? CurrentSubDistrictName { get; set; }
[MaxLength(10), Comment("รหัสไปรษณีย์ที่อยู่ปัจจุบัน")]
public string? CurrentZipCode { get; set; }
@ -119,8 +149,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("คู่สมรส")]
public bool? Marry { get; set; }
[Comment("Id คำนำหน้าชื่อคู่สมรส")]
public Guid? MarryPrefixId { get; set; }
[Comment("คำนำหน้าชื่อคู่สมรส")]
public virtual Prefix? MarryPrefix { get; set; }
public string? MarryPrefixName { get; set; }
[MaxLength(100), Comment("ชื่อจริงคู่สมรส")]
public string? MarryFirstName { get; set; }
@ -134,8 +167,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[MaxLength(100), Comment("สัญชาติคู่สมรส")]
public string? MarryNationality { get; set; }
[Comment("Id คำนำหน้าชื่อบิดา")]
public Guid? FatherPrefixId { get; set; }
[Comment("คำนำหน้าชื่อบิดา")]
public virtual Prefix? FatherPrefix { get; set; }
public string? FatherPrefixName { get; set; }
[MaxLength(100), Comment("ชื่อจริงบิดา")]
public string? FatherFirstName { get; set; }
@ -149,8 +185,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[MaxLength(100), Comment("สัญชาติบิดา")]
public string? FatherNationality { get; set; }
[Comment("Id คำนำหน้าชื่อมารดา")]
public Guid? MotherPrefixId { get; set; }
[Comment("คำนำหน้าชื่อมารดา")]
public virtual Prefix? MotherPrefix { get; set; }
public string? MotherPrefixName { get; set; }
[MaxLength(100), Comment("ชื่อจริงมารดา")]
public string? MotherFirstName { get; set; }

View file

@ -9,8 +9,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Required, Column(Order = 7), Comment("Id ผู้สมัคร")]
public virtual Candidate? Candidate { get; set; }
[Required, Column(Order = 5), Comment("วุฒิที่ได้รับ")]
public virtual EducationLevel? EducationLevel { get; set; }
[Comment("Idวุฒิที่ได้รับ")]
public Guid? EducationLevelId { get; set; }
[Comment("วุฒิที่ได้รับ")]
public string? EducationLevelName { get; set; }
[Required, Column(Order = 4), Comment("สาขาวิชา/วิชาเอก")]
public string Major { get; set; } = string.Empty;

View file

@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace BMA.EHR.Recurit.Exam.Service.Models
{
public class OrganizationOrganization : EntityBase
{
[Required, MaxLength(100), Column(Order = 1), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ หน่วยงาน")]
public string Name { get; set; } = string.Empty;
[Column(Order = 2), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
}
}

View file

@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace BMA.EHR.Recurit.Exam.Service.Models
{
public class OrganizationShortName : EntityBase
{
[Required, MaxLength(100), Column(Order = 1), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสหน่วยงาน")]
public string AgencyCode { get; set; } = string.Empty;
[Required, MaxLength(100), Column(Order = 2), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสส่วนราชการ")]
public string GovernmentCode { get; set; } = string.Empty;
[Required, MaxLength(100), Column(Order = 3), Comment("ข้อมูลโครงสร้างหน่วยงานชื่อ ตัวย่อหน่วยงาน")]
public string Name { get; set; } = string.Empty;
[Column(Order = 4), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
}
}

View file

@ -65,6 +65,9 @@ builder.Host.UseSerilog();
var defaultConnection = builder.Configuration.GetConnectionString("DefaultConnection");
builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseMySql(defaultConnection, ServerVersion.AutoDetect(defaultConnection)));
var metadataConnection = builder.Configuration.GetConnectionString("MetadataConnection");
builder.Services.AddDbContext<MetadataDbContext>(options =>
options.UseMySql(metadataConnection, ServerVersion.AutoDetect(metadataConnection)));
// Add config CORS
builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
@ -78,13 +81,6 @@ builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
}));
// Register Service
builder.Services.AddTransient<PrefixService>();
builder.Services.AddTransient<ReligionService>();
builder.Services.AddTransient<EducationLevelService>();
builder.Services.AddTransient<RelationshipService>();
builder.Services.AddTransient<ProvinceService>();
builder.Services.AddTransient<DistrictService>();
builder.Services.AddTransient<SubDistrictService>();
builder.Services.AddTransient<CandidateService>();
builder.Services.AddTransient<PeriodExamService>();
builder.Services.AddTransient<MinIOService>();
@ -136,11 +132,6 @@ await using var db = scope.ServiceProvider.GetRequiredService<ApplicationDbConte
await db.Database.MigrateAsync();
// seed default data
await DatabaseSeeder.SeedPrefixAsync(app);
await DatabaseSeeder.SeedEducationLevelAsync(app);
await DatabaseSeeder.SeedReligionAsync(app);
await DatabaseSeeder.SeedRelationshipAsync(app);
await DatabaseSeeder.SeedProvinceAsync(app);
await DatabaseSeeder.SeedPeriodExamAsync(app);
app.Run();

BIN
Report/rptBillPayment.trdp Normal file

Binary file not shown.

View file

@ -4,21 +4,27 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public class CandidateAddressResponseItem
{
public string? RegistAddress { get; set; }
public Models.Province? RegistProvince { get; set; }
// public Models.Province? RegistProvince { get; set; }
public string? RegistProvinceId { get; set; }
public Models.District? RegistDistrict { get; set; }
public string? RegistProvince { get; set; }
// public Models.District? RegistDistrict { get; set; }
public string? RegistDistrictId { get; set; }
public Models.SubDistrict? RegistSubDistrict { get; set; }
public string? RegistDistrict { get; set; }
// public Models.SubDistrict? RegistSubDistrict { get; set; }
public string? RegistSubDistrictId { get; set; }
public string? RegistSubDistrict { get; set; }
public string? RegistZipCode { get; set; }
public bool? RegistSame { get; set; }
public string? CurrentAddress { get; set; }
public Models.Province? CurrentProvince { get; set; }
// public Models.Province? CurrentProvince { get; set; }
public string? CurrentProvinceId { get; set; }
public Models.District? CurrentDistrict { get; set; }
public string? CurrentProvince { get; set; }
// public Models.District? CurrentDistrict { get; set; }
public string? CurrentDistrictId { get; set; }
public Models.SubDistrict? CurrentSubDistrict { get; set; }
public string? CurrentDistrict { get; set; }
// public Models.SubDistrict? CurrentSubDistrict { get; set; }
public string? CurrentSubDistrictId { get; set; }
public string? CurrentSubDistrict { get; set; }
public string? CurrentZipCode { get; set; }
}

View file

@ -4,20 +4,23 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public class CandidateFamilyResponseItem
{
public bool? Marry { get; set; }
public Models.Prefix? MarryPrefix { get; set; }
// public Models.Prefix? MarryPrefix { get; set; }
public string? MarryPrefixId { get; set; }
public string? MarryPrefix { get; set; }
public string? MarryFirstName { get; set; }
public string? MarryLastName { get; set; }
public string? MarryOccupation { get; set; }
public string? MarryNationality { get; set; }
public Models.Prefix? FatherPrefix { get; set; }
// public Models.Prefix? FatherPrefix { get; set; }
public string? FatherPrefixId { get; set; }
public string? FatherPrefix { get; set; }
public string? FatherFirstName { get; set; }
public string? FatherLastName { get; set; }
public string? FatherOccupation { get; set; }
public string? FatherNationality { get; set; }
public Models.Prefix? MotherPrefix { get; set; }
// public Models.Prefix? MotherPrefix { get; set; }
public string? MotherPrefixId { get; set; }
public string? MotherPrefix { get; set; }
public string? MotherFirstName { get; set; }
public string? MotherLastName { get; set; }
public string? MotherOccupation { get; set; }

View file

@ -3,20 +3,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
{
public class CandidateInformationResponseItem
{
public Models.Prefix? Prefix { get; set; }
// public Models.Prefix? Prefix { get; set; }
public string? PrefixId { get; set; }
public string? Prefix { get; set; }
public string? FirstName { get; set; } = string.Empty;
public string? LastName { get; set; } = string.Empty;
public string? Nationality { get; set; } = string.Empty;
public DateTime? DateOfBirth { get; set; }
public Models.Relationship? Relationship { get; set; }
// public Models.Relationship? Relationship { get; set; }
public string? RelationshipId { get; set; }
public string? Relationship { get; set; }
public string? Email { get; set; } = string.Empty;
public string? CitizenId { get; set; } = string.Empty;
public Models.Province? CitizenProvince { get; set; }
// public Models.Province? CitizenProvince { get; set; }
public string? CitizenProvinceId { get; set; }
public Models.District? CitizenDistrict { get; set; }
public string? CitizenProvince { get; set; }
// public Models.District? CitizenDistrict { get; set; }
public string? CitizenDistrictId { get; set; }
public string? CitizenDistrict { get; set; }
public DateTime? CitizenDate { get; set; }
public string? Telephone { get; set; }
public string? MobilePhone { get; set; }

View file

@ -3,56 +3,69 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
{
public class CandidateResponseItem
{
public Models.Prefix? Prefix { get; set; }
// public Models.Prefix? Prefix { get; set; }
public string? PrefixId { get; set; }
public string? Prefix { get; set; }
public string? FirstName { get; set; } = string.Empty;
public string? LastName { get; set; } = string.Empty;
public string? Nationality { get; set; } = string.Empty;
public DateTime? DateOfBirth { get; set; }
public Models.Relationship? Relationship { get; set; }
// public Models.Relationship? Relationship { get; set; }
public string? RelationshipId { get; set; }
public string? Relationship { get; set; }
public string? Email { get; set; } = string.Empty;
public string? CitizenId { get; set; } = string.Empty;
public Models.Province? CitizenProvince { get; set; }
// public Models.Province? CitizenProvince { get; set; }
public string? CitizenProvinceId { get; set; }
public Models.District? CitizenDistrict { get; set; }
public string? CitizenProvince { get; set; }
// public Models.District? CitizenDistrict { get; set; }
public string? CitizenDistrictId { get; set; }
public string? CitizenDistrict { get; set; }
public DateTime? CitizenDate { get; set; }
public string? Telephone { get; set; }
public string? MobilePhone { get; set; }
public string? Knowledge { get; set; }
public string? RegistAddress { get; set; }
public Models.Province? RegistProvince { get; set; }
// public Models.Province? RegistProvince { get; set; }
public string? RegistProvinceId { get; set; }
public Models.District? RegistDistrict { get; set; }
public string? RegistProvince { get; set; }
// public Models.District? RegistDistrict { get; set; }
public string? RegistDistrictId { get; set; }
public Models.SubDistrict? RegistSubDistrict { get; set; }
public string? RegistDistrict { get; set; }
// public Models.SubDistrict? RegistSubDistrict { get; set; }
public string? RegistSubDistrictId { get; set; }
public string? RegistSubDistrict { get; set; }
public string? RegistZipCode { get; set; }
public bool? RegistSame { get; set; }
public string? CurrentAddress { get; set; }
public Models.Province? CurrentProvince { get; set; }
// public Models.Province? CurrentProvince { get; set; }
public string? CurrentProvinceId { get; set; }
public Models.District? CurrentDistrict { get; set; }
public string? CurrentProvince { get; set; }
// public Models.District? CurrentDistrict { get; set; }
public string? CurrentDistrictId { get; set; }
public Models.SubDistrict? CurrentSubDistrict { get; set; }
public string? CurrentDistrict { get; set; }
// public Models.SubDistrict? CurrentSubDistrict { get; set; }
public string? CurrentSubDistrictId { get; set; }
public string? CurrentSubDistrict { get; set; }
public string? CurrentZipCode { get; set; }
public bool? Marry { get; set; }
public Models.Prefix? MarryPrefix { get; set; }
// public Models.Prefix? MarryPrefix { get; set; }
public string? MarryPrefixId { get; set; }
public string? MarryPrefix { get; set; }
public string? MarryFirstName { get; set; }
public string? MarryLastName { get; set; }
public string? MarryOccupation { get; set; }
public string? MarryNationality { get; set; }
public Models.Prefix? FatherPrefix { get; set; }
// public Models.Prefix? FatherPrefix { get; set; }
public string? FatherPrefixId { get; set; }
public string? FatherPrefix { get; set; }
public string? FatherFirstName { get; set; }
public string? FatherLastName { get; set; }
public string? FatherOccupation { get; set; }
public string? FatherNationality { get; set; }
public Models.Prefix? MotherPrefix { get; set; }
// public Models.Prefix? MotherPrefix { get; set; }
public string? MotherPrefixId { get; set; }
public string? MotherPrefix { get; set; }
public string? MotherFirstName { get; set; }
public string? MotherLastName { get; set; }
public string? MotherOccupation { get; set; }

View file

@ -18,6 +18,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
#region " Fields "
private readonly ApplicationDbContext _context;
private readonly MetadataDbContext _contextMetadata;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly MinIOService _minioService;
@ -26,10 +27,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
#region " Constructor and Destructor "
public CMSCandidateService(ApplicationDbContext context,
MetadataDbContext contextMetadata,
IHttpContextAccessor httpContextAccessor,
MinIOService minioService)
{
_context = context;
_contextMetadata = contextMetadata;
_httpContextAccessor = httpContextAccessor;
_minioService = minioService;
}
@ -77,9 +80,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Include(x => x.LogoImg)
.Include(x => x.CMSAgencys)
.Include(x => x.CMSGovernments)
.Include(x => x.Province)
.Include(x => x.District)
.Include(x => x.SubDistrict)
.FirstOrDefaultAsync();
if (cmsCandidates == null)
{
@ -119,35 +119,38 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (updated.ProvinceId != null)
{
var province = await _context.Provinces.AsQueryable()
var province = await _contextMetadata.Provinces.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ProvinceId));
if (province == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
cms.Province = province;
cms.ProvinceId = province.Id;
cms.ProvinceName = province.Name;
}
if (updated.DistrictId != null)
{
var pistrict = await _context.Districts.AsQueryable()
var pistrict = await _contextMetadata.Districts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.DistrictId));
if (pistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
cms.District = pistrict;
cms.DistrictId = pistrict.Id;
cms.DistrictName = pistrict.Name;
}
if (updated.SubDistrictId != null)
{
var subDistrict = await _context.SubDistricts.AsQueryable()
var subDistrict = await _contextMetadata.SubDistricts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.SubDistrictId));
if (subDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound);
cms.SubDistrict = subDistrict;
cms.SubDistrictId = subDistrict.Id;
cms.SubDistrictName = subDistrict.Name;
cms.ZipCode = subDistrict.ZipCode;
}
@ -265,7 +268,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Subtitle = x.NameEn,
Supervised = x.ShortName,
Telephone = x.Telephone,
Address = x.Address + " " + (x.SubDistrict == null ? "" : "แขวง" + x.SubDistrict.Name + " ") + (x.District == null ? "" : "เขต" + x.District.Name) + " " + (x.Province == null ? "" : x.Province.Name) + " " + (x.SubDistrict == null ? "" : x.SubDistrict.ZipCode),
Address = x.Address + " " + (x.SubDistrictName == null ? "" : "แขวง" + x.SubDistrictName + " ") + (x.DistrictName == null ? "" : "เขต" + x.DistrictName) + " " + (x.ProvinceName == null ? "" : x.ProvinceName) + " " + (x.ZipCode == null ? "" : x.ZipCode),
Divisions = x.CMSAgencys.Select(s => new HomePageLinkResponseItem
{
Title = s.Name,
@ -339,11 +342,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Id = x.Id.ToString(),
Category = "doctor",
Category_id = "doctor",
Start = x.ExamDate.ToShortDateString(),
End = x.ExamDate.ToShortDateString(),
Exam_date = x.ExamDate.ToShortDateString(),
Announcement_date = x.AnnouncementStartDate.ToShortDateString(),
Announcement_endDate = x.AnnouncementEndDate.ToShortDateString(),
Start = x.ExamDate.ToString("MM-dd-yyyy"),
End = x.ExamDate.ToString("MM-dd-yyyy"),
Exam_date = x.ExamDate.ToString("MM-dd-yyyy"),
Announcement_date = x.AnnouncementStartDate.ToString("MM-dd-yyyy"),
Announcement_endDate = x.AnnouncementEndDate.ToString("MM-dd-yyyy"),
Title = x.Name,
Image = x.PeriodExamImages.OrderBy(o => o.CreatedAt).FirstOrDefault() == null ?
"" :
@ -378,8 +381,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Id = x.Id.ToString(),
Category = "doctor",
Category_id = "doctor",
Start = x.AnnouncementStartDate.ToShortDateString(),
End = x.AnnouncementEndDate.ToShortDateString(),
Start = x.AnnouncementStartDate.ToString("MM-dd-yyyy"),
End = x.AnnouncementEndDate.ToString("MM-dd-yyyy"),
Title = x.Name,
Detail = x.Detail,
Images = x.PeriodExamImages.Select(s => new HomePageLinkResponseItem

View file

@ -15,6 +15,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
#region " Fields "
private readonly ApplicationDbContext _context;
private readonly MetadataDbContext _contextMetadata;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly MinIOService _minioService;
@ -23,10 +24,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
#region " Constructor and Destructor "
public CandidateService(ApplicationDbContext context,
MetadataDbContext contextMetadata,
IHttpContextAccessor httpContextAccessor,
MinIOService minioService)
{
_context = context;
_contextMetadata = contextMetadata;
_httpContextAccessor = httpContextAccessor;
_minioService = minioService;
}
@ -46,19 +49,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
public async Task<Candidate> GetsAsync(string candidateId)
{
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.Prefix)
.Include(x => x.Relationship)
.Include(x => x.CitizenProvince)
.Include(x => x.CitizenDistrict)
.Include(x => x.RegistProvince)
.Include(x => x.RegistDistrict)
.Include(x => x.RegistSubDistrict)
.Include(x => x.CurrentProvince)
.Include(x => x.CurrentDistrict)
.Include(x => x.CurrentSubDistrict)
.Include(x => x.MarryPrefix)
.Include(x => x.FatherPrefix)
.Include(x => x.MotherPrefix)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null)
@ -87,18 +77,18 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position)
.Select(x => new CandidateInformationResponseItem
{
Prefix = x.Prefix,
PrefixId = x.Prefix != null ? x.Prefix.Id.ToString() : null,
Prefix = x.PrefixName,
PrefixId = x.PrefixId != null ? x.PrefixId.ToString() : null,
FirstName = x.FirstName,
LastName = x.LastName,
Nationality = x.Nationality,
DateOfBirth = x.DateOfBirth,
Relationship = x.Relationship,
RelationshipId = x.Relationship != null ? x.Relationship.Id.ToString() : null,
CitizenProvince = x.CitizenProvince,
CitizenProvinceId = x.CitizenProvince != null ? x.CitizenProvince.Id.ToString() : null,
CitizenDistrict = x.CitizenDistrict,
CitizenDistrictId = x.CitizenDistrict != null ? x.CitizenDistrict.Id.ToString() : null,
Relationship = x.RelationshipName,
RelationshipId = x.RelationshipId != null ? x.RelationshipId.ToString() : null,
CitizenProvince = x.CitizenProvinceName,
CitizenProvinceId = x.CitizenProvinceId != null ? x.CitizenProvinceId.ToString() : null,
CitizenDistrict = x.CitizenDistrictName,
CitizenDistrictId = x.CitizenDistrictId != null ? x.CitizenDistrictId.ToString() : null,
CitizenDate = x.CitizenDate,
Email = x.Email,
CitizenId = x.CitizenId,
@ -114,18 +104,18 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.Select(x => new CandidateInformationResponseItem
{
Prefix = x.Prefix,
PrefixId = x.Prefix != null ? x.Prefix.Id.ToString() : null,
Prefix = x.PrefixName,
PrefixId = x.PrefixId != null ? x.PrefixId.ToString() : null,
FirstName = x.FirstName,
LastName = x.LastName,
Nationality = x.Nationality,
DateOfBirth = x.DateOfBirth,
Relationship = x.Relationship,
RelationshipId = x.Relationship != null ? x.Relationship.Id.ToString() : null,
CitizenProvince = x.CitizenProvince,
CitizenProvinceId = x.CitizenProvince != null ? x.CitizenProvince.Id.ToString() : null,
CitizenDistrict = x.CitizenDistrict,
CitizenDistrictId = x.CitizenDistrict != null ? x.CitizenDistrict.Id.ToString() : null,
Relationship = x.RelationshipName,
RelationshipId = x.RelationshipId != null ? x.RelationshipId.ToString() : null,
CitizenProvince = x.CitizenProvinceName,
CitizenProvinceId = x.CitizenProvinceId != null ? x.CitizenProvinceId.ToString() : null,
CitizenDistrict = x.CitizenDistrictName,
CitizenDistrictId = x.CitizenDistrictId != null ? x.CitizenDistrictId.ToString() : null,
CitizenDate = x.CitizenDate,
Email = x.Email,
CitizenId = x.CitizenId,
@ -158,21 +148,21 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Select(x => new CandidateAddressResponseItem
{
RegistAddress = x.RegistAddress,
RegistProvince = x.RegistProvince,
RegistProvinceId = x.RegistProvince != null ? x.RegistProvince.Id.ToString() : null,
RegistDistrict = x.RegistDistrict,
RegistDistrictId = x.RegistDistrict != null ? x.RegistDistrict.Id.ToString() : null,
RegistSubDistrict = x.RegistSubDistrict,
RegistSubDistrictId = x.RegistSubDistrict != null ? x.RegistSubDistrict.Id.ToString() : null,
RegistProvince = x.RegistProvinceName,
RegistProvinceId = x.RegistProvinceId != null ? x.RegistProvinceId.ToString() : null,
RegistDistrict = x.RegistDistrictName,
RegistDistrictId = x.RegistDistrictId != null ? x.RegistDistrictId.ToString() : null,
RegistSubDistrict = x.RegistSubDistrictName,
RegistSubDistrictId = x.RegistSubDistrictId != null ? x.RegistSubDistrictId.ToString() : null,
RegistZipCode = x.RegistZipCode,
RegistSame = x.RegistSame,
CurrentAddress = x.CurrentAddress,
CurrentProvince = x.CurrentProvince,
CurrentProvinceId = x.CurrentProvince != null ? x.CurrentProvince.Id.ToString() : null,
CurrentDistrict = x.CurrentDistrict,
CurrentDistrictId = x.CurrentDistrict != null ? x.CurrentDistrict.Id.ToString() : null,
CurrentSubDistrict = x.CurrentSubDistrict,
CurrentSubDistrictId = x.CurrentSubDistrict != null ? x.CurrentSubDistrict.Id.ToString() : null,
CurrentProvince = x.CurrentProvinceName,
CurrentProvinceId = x.CurrentProvinceId != null ? x.CurrentProvinceId.ToString() : null,
CurrentDistrict = x.CurrentDistrictName,
CurrentDistrictId = x.CurrentDistrictId != null ? x.CurrentDistrictId.ToString() : null,
CurrentSubDistrict = x.CurrentSubDistrictName,
CurrentSubDistrictId = x.CurrentSubDistrictId != null ? x.CurrentSubDistrictId.ToString() : null,
CurrentZipCode = x.CurrentZipCode,
})
.FirstOrDefaultAsync();
@ -184,21 +174,21 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Select(x => new CandidateAddressResponseItem
{
RegistAddress = x.RegistAddress,
RegistProvince = x.RegistProvince,
RegistProvinceId = x.RegistProvince != null ? x.RegistProvince.Id.ToString() : null,
RegistDistrict = x.RegistDistrict,
RegistDistrictId = x.RegistDistrict != null ? x.RegistDistrict.Id.ToString() : null,
RegistSubDistrict = x.RegistSubDistrict,
RegistSubDistrictId = x.RegistSubDistrict != null ? x.RegistSubDistrict.Id.ToString() : null,
RegistProvince = x.RegistProvinceName,
RegistProvinceId = x.RegistProvinceId != null ? x.RegistProvinceId.ToString() : null,
RegistDistrict = x.RegistDistrictName,
RegistDistrictId = x.RegistDistrictId != null ? x.RegistDistrictId.ToString() : null,
RegistSubDistrict = x.RegistSubDistrictName,
RegistSubDistrictId = x.RegistSubDistrictId != null ? x.RegistSubDistrictId.ToString() : null,
RegistZipCode = x.RegistZipCode,
RegistSame = x.RegistSame,
CurrentAddress = x.CurrentAddress,
CurrentProvince = x.CurrentProvince,
CurrentProvinceId = x.CurrentProvince != null ? x.CurrentProvince.Id.ToString() : null,
CurrentDistrict = x.CurrentDistrict,
CurrentDistrictId = x.CurrentDistrict != null ? x.CurrentDistrict.Id.ToString() : null,
CurrentSubDistrict = x.CurrentSubDistrict,
CurrentSubDistrictId = x.CurrentSubDistrict != null ? x.CurrentSubDistrict.Id.ToString() : null,
CurrentProvince = x.CurrentProvinceName,
CurrentProvinceId = x.CurrentProvinceId != null ? x.CurrentProvinceId.ToString() : null,
CurrentDistrict = x.CurrentDistrictName,
CurrentDistrictId = x.CurrentDistrictId != null ? x.CurrentDistrictId.ToString() : null,
CurrentSubDistrict = x.CurrentSubDistrictName,
CurrentSubDistrictId = x.CurrentSubDistrictId != null ? x.CurrentSubDistrictId.ToString() : null,
CurrentZipCode = x.CurrentZipCode,
})
.FirstOrDefaultAsync();
@ -226,20 +216,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Select(x => new CandidateFamilyResponseItem
{
Marry = x.Marry,
MarryPrefix = x.MarryPrefix,
MarryPrefixId = x.MarryPrefix != null ? x.MarryPrefix.Id.ToString() : null,
MarryPrefix = x.MarryPrefixName,
MarryPrefixId = x.MarryPrefixId != null ? x.MarryPrefixId.ToString() : null,
MarryFirstName = x.MarryFirstName,
MarryLastName = x.MarryLastName,
MarryOccupation = x.MarryOccupation,
MarryNationality = x.MarryNationality,
FatherPrefix = x.FatherPrefix,
FatherPrefixId = x.FatherPrefix != null ? x.FatherPrefix.Id.ToString() : null,
FatherPrefix = x.FatherPrefixName,
FatherPrefixId = x.FatherPrefixId != null ? x.FatherPrefixId.ToString() : null,
FatherFirstName = x.FatherFirstName,
FatherLastName = x.FatherLastName,
FatherOccupation = x.FatherOccupation,
FatherNationality = x.FatherNationality,
MotherPrefix = x.MotherPrefix,
MotherPrefixId = x.MotherPrefix != null ? x.MotherPrefix.Id.ToString() : null,
MotherPrefix = x.MotherPrefixName,
MotherPrefixId = x.MotherPrefixId != null ? x.MotherPrefixId.ToString() : null,
MotherFirstName = x.MotherFirstName,
MotherLastName = x.MotherLastName,
MotherOccupation = x.MotherOccupation,
@ -254,20 +244,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Select(x => new CandidateFamilyResponseItem
{
Marry = x.Marry,
MarryPrefix = x.MarryPrefix,
MarryPrefixId = x.MarryPrefix != null ? x.MarryPrefix.Id.ToString() : null,
MarryPrefix = x.MarryPrefixName,
MarryPrefixId = x.MarryPrefixId != null ? x.MarryPrefixId.ToString() : null,
MarryFirstName = x.MarryFirstName,
MarryLastName = x.MarryLastName,
MarryOccupation = x.MarryOccupation,
MarryNationality = x.MarryNationality,
FatherPrefix = x.FatherPrefix,
FatherPrefixId = x.FatherPrefix != null ? x.FatherPrefix.Id.ToString() : null,
FatherPrefix = x.FatherPrefixName,
FatherPrefixId = x.FatherPrefixId != null ? x.FatherPrefixId.ToString() : null,
FatherFirstName = x.FatherFirstName,
FatherLastName = x.FatherLastName,
FatherOccupation = x.FatherOccupation,
FatherNationality = x.FatherNationality,
MotherPrefix = x.MotherPrefix,
MotherPrefixId = x.MotherPrefix != null ? x.MotherPrefix.Id.ToString() : null,
MotherPrefix = x.MotherPrefixName,
MotherPrefixId = x.MotherPrefixId != null ? x.MotherPrefixId.ToString() : null,
MotherFirstName = x.MotherFirstName,
MotherLastName = x.MotherLastName,
MotherOccupation = x.MotherOccupation,
@ -382,7 +372,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
throw new Exception(GlobalMessages.CandidateNotFound);
return await _context.Educations.AsQueryable()
.Include(x => x.EducationLevel)
.Where(x => x.Candidate == candidate)
.OrderBy(d => d.DurationStart)
.ToListAsync();
@ -630,147 +619,160 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (updated.PrefixId != null)
{
var prefix = await _context.Prefixes.AsQueryable()
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.Prefix = prefix;
candidate.PrefixId = prefix.Id;
candidate.PrefixName = prefix.Name;
}
if (updated.RelationshipId != null)
{
var relationship = await _context.Relationships.AsQueryable()
var relationship = await _contextMetadata.Relationships.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RelationshipId));
if (relationship == null)
throw new Exception(GlobalMessages.RelationshipNotFound);
candidate.Relationship = relationship;
candidate.RelationshipId = relationship.Id;
candidate.RelationshipName = relationship.Name;
}
if (updated.CitizenProvinceId != null)
{
var citizenProvince = await _context.Provinces.AsQueryable()
var citizenProvince = await _contextMetadata.Provinces.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenProvinceId));
if (citizenProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CitizenProvince = citizenProvince;
candidate.CitizenProvinceId = citizenProvince.Id;
candidate.CitizenProvinceName = citizenProvince.Name;
}
if (updated.CitizenDistrictId != null)
{
var citizenDistrict = await _context.Districts.AsQueryable()
var citizenDistrict = await _contextMetadata.Districts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenDistrictId));
if (citizenDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CitizenDistrict = citizenDistrict;
candidate.CitizenDistrictId = citizenDistrict.Id;
candidate.CitizenDistrictName = citizenDistrict.Name;
}
if (updated.RegistProvinceId != null)
{
var registProvince = await _context.Provinces.AsQueryable()
var registProvince = await _contextMetadata.Provinces.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistProvinceId));
if (registProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.RegistProvince = registProvince;
candidate.RegistProvinceId = registProvince.Id;
candidate.RegistProvinceName = registProvince.Name;
}
if (updated.RegistDistrictId != null)
{
var registDistrict = await _context.Districts.AsQueryable()
var registDistrict = await _contextMetadata.Districts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistDistrictId));
if (registDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.RegistDistrict = registDistrict;
candidate.RegistDistrictId = registDistrict.Id;
candidate.RegistDistrictName = registDistrict.Name;
}
if (updated.RegistSubDistrictId != null)
{
var registSubDistrict = await _context.SubDistricts.AsQueryable()
var registSubDistrict = await _contextMetadata.SubDistricts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistSubDistrictId));
if (registSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.RegistSubDistrict = registSubDistrict;
candidate.RegistSubDistrictId = registSubDistrict.Id;
candidate.RegistSubDistrictName = registSubDistrict.Name;
candidate.RegistZipCode = registSubDistrict.ZipCode;
}
if (updated.CurrentProvinceId != null)
{
var currentProvince = await _context.Provinces.AsQueryable()
var currentProvince = await _contextMetadata.Provinces.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentProvinceId));
if (currentProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CurrentProvince = currentProvince;
candidate.CurrentProvinceId = currentProvince.Id;
candidate.CurrentProvinceName = currentProvince.Name;
}
if (updated.CurrentDistrictId != null)
{
var currentDistrict = await _context.Districts.AsQueryable()
var currentDistrict = await _contextMetadata.Districts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentDistrictId));
if (currentDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CurrentDistrict = currentDistrict;
candidate.CurrentDistrictId = currentDistrict.Id;
candidate.CurrentDistrictName = currentDistrict.Name;
}
if (updated.CurrentSubDistrictId != null)
{
var currentSubDistrict = await _context.SubDistricts.AsQueryable()
var currentSubDistrict = await _contextMetadata.SubDistricts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentSubDistrictId));
if (currentSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.CurrentSubDistrict = currentSubDistrict;
candidate.CurrentSubDistrictId = currentSubDistrict.Id;
candidate.CurrentSubDistrictName = currentSubDistrict.Name;
candidate.CurrentZipCode = currentSubDistrict.ZipCode;
}
if (updated.MarryPrefixId != null)
{
var prefix = await _context.Prefixes.AsQueryable()
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MarryPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MarryPrefix = prefix;
candidate.MarryPrefixId = prefix.Id;
candidate.MarryPrefixName = prefix.Name;
}
if (updated.FatherPrefixId != null)
{
var prefix = await _context.Prefixes.AsQueryable()
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.FatherPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.FatherPrefix = prefix;
candidate.FatherPrefixId = prefix.Id;
candidate.FatherPrefixName = prefix.Name;
}
if (updated.MotherPrefixId != null)
{
var prefix = await _context.Prefixes.AsQueryable()
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MotherPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MotherPrefix = prefix;
candidate.MotherPrefixId = prefix.Id;
candidate.MotherPrefixName = prefix.Name;
}
candidate.FirstName = updated.FirstName;
@ -824,46 +826,50 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (updated.PrefixId != null)
{
var prefix = await _context.Prefixes.AsQueryable()
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.Prefix = prefix;
candidate.PrefixId = prefix.Id;
candidate.PrefixName = prefix.Name;
}
if (updated.RelationshipId != null)
{
var relationship = await _context.Relationships.AsQueryable()
var relationship = await _contextMetadata.Relationships.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RelationshipId));
if (relationship == null)
throw new Exception(GlobalMessages.RelationshipNotFound);
candidate.Relationship = relationship;
candidate.RelationshipId = relationship.Id;
candidate.RelationshipName = relationship.Name;
}
if (updated.CitizenProvinceId != null)
{
var citizenProvince = await _context.Provinces.AsQueryable()
var citizenProvince = await _contextMetadata.Provinces.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenProvinceId));
if (citizenProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CitizenProvince = citizenProvince;
candidate.CitizenProvinceId = citizenProvince.Id;
candidate.CitizenProvinceName = citizenProvince.Name;
}
if (updated.CitizenDistrictId != null)
{
var citizenDistrict = await _context.Districts.AsQueryable()
var citizenDistrict = await _contextMetadata.Districts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenDistrictId));
if (citizenDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CitizenDistrict = citizenDistrict;
candidate.CitizenDistrictId = citizenDistrict.Id;
candidate.CitizenDistrictName = citizenDistrict.Name;
}
candidate.FirstName = updated.FirstName;
@ -917,69 +923,75 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (updated.RegistProvinceId != null)
{
var registProvince = await _context.Provinces.AsQueryable()
var registProvince = await _contextMetadata.Provinces.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistProvinceId));
if (registProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.RegistProvince = registProvince;
candidate.RegistProvinceId = registProvince.Id;
candidate.RegistProvinceName = registProvince.Name;
}
if (updated.RegistDistrictId != null)
{
var registDistrict = await _context.Districts.AsQueryable()
var registDistrict = await _contextMetadata.Districts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistDistrictId));
if (registDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.RegistDistrict = registDistrict;
candidate.RegistDistrictId = registDistrict.Id;
candidate.RegistDistrictName = registDistrict.Name;
}
if (updated.RegistSubDistrictId != null)
{
var registSubDistrict = await _context.SubDistricts.AsQueryable()
var registSubDistrict = await _contextMetadata.SubDistricts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistSubDistrictId));
if (registSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.RegistSubDistrict = registSubDistrict;
candidate.RegistSubDistrictId = registSubDistrict.Id;
candidate.RegistSubDistrictName = registSubDistrict.Name;
candidate.RegistZipCode = registSubDistrict.ZipCode;
}
if (updated.CurrentProvinceId != null)
{
var currentProvince = await _context.Provinces.AsQueryable()
var currentProvince = await _contextMetadata.Provinces.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentProvinceId));
if (currentProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CurrentProvince = currentProvince;
candidate.CurrentProvinceId = currentProvince.Id;
candidate.CurrentProvinceName = currentProvince.Name;
}
if (updated.CurrentDistrictId != null)
{
var currentDistrict = await _context.Districts.AsQueryable()
var currentDistrict = await _contextMetadata.Districts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentDistrictId));
if (currentDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CurrentDistrict = currentDistrict;
candidate.CurrentDistrictId = currentDistrict.Id;
candidate.CurrentDistrictName = currentDistrict.Name;
}
if (updated.CurrentSubDistrictId != null)
{
var currentSubDistrict = await _context.SubDistricts.AsQueryable()
var currentSubDistrict = await _contextMetadata.SubDistricts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentSubDistrictId));
if (currentSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.CurrentSubDistrict = currentSubDistrict;
candidate.CurrentSubDistrictId = currentSubDistrict.Id;
candidate.CurrentSubDistrictName = currentSubDistrict.Name;
candidate.CurrentZipCode = currentSubDistrict.ZipCode;
}
@ -1002,35 +1014,38 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (updated.MarryPrefixId != null)
{
var prefix = await _context.Prefixes.AsQueryable()
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MarryPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MarryPrefix = prefix;
candidate.MarryPrefixId = prefix.Id;
candidate.MarryPrefixName = prefix.Name;
}
if (updated.FatherPrefixId != null)
{
var prefix = await _context.Prefixes.AsQueryable()
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.FatherPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.FatherPrefix = prefix;
candidate.FatherPrefixId = prefix.Id;
candidate.FatherPrefixName = prefix.Name;
}
if (updated.MotherPrefixId != null)
{
var prefix = await _context.Prefixes.AsQueryable()
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MotherPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MotherPrefix = prefix;
candidate.MotherPrefixId = prefix.Id;
candidate.MotherPrefixName = prefix.Name;
}
candidate.Marry = updated.Marry == null ? null : updated.Marry;
@ -1155,7 +1170,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
var educationLevel = await _context.EducationLevels.AsQueryable()
var educationLevel = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.EducationLevelId));
if (educationLevel == null)
@ -1164,7 +1179,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var education = new Education
{
Candidate = candidate,
EducationLevel = educationLevel,
EducationLevelId = educationLevel.Id,
EducationLevelName = educationLevel.Name,
Major = updated.Major,
Scores = updated.Scores,
Name = updated.Name,
@ -1224,13 +1240,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (education == null)
throw new Exception(GlobalMessages.EducationNotFound);
var educationLevel = await _context.EducationLevels.AsQueryable()
var educationLevel = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.EducationLevelId));
if (educationLevel == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
education.EducationLevel = educationLevel;
education.EducationLevelId = educationLevel.Id;
education.EducationLevelName = educationLevel.Name;
education.Major = updated.Major;
education.Scores = updated.Scores;
education.Name = updated.Name;
@ -1416,7 +1433,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
throw new Exception(GlobalMessages.ExamNotFound);
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.Prefix)
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.FirstOrDefaultAsync();
@ -1429,7 +1445,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
throw new Exception(GlobalMessages.PositionExamNotFound);
candidate = await _context.Candidates.AsQueryable()
.Include(x => x.Prefix)
.Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position)
.FirstOrDefaultAsync();
}
@ -1441,7 +1456,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
FirstName = candidate.FirstName,
LastName = candidate.LastName,
Prefix = candidate.Prefix?.Name,
Prefix = candidate.PrefixName,
CitizenId = candidate.CitizenId,
ExamIdenNumber = candidate.ExamIdenNumber,
SeatNumber = candidate.SeatNumber,

View file

@ -1,101 +0,0 @@
using System.Security.Claims;
using BMA.EHR.Recurit.Exam.Service.Data;
using BMA.EHR.Recurit.Exam.Service.Models;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Recurit.Exam.Service.Services
{
public class DistrictService
{
#region " Fields "
private readonly ApplicationDbContext _context;
private readonly IHttpContextAccessor _httpContextAccessor;
#endregion
#region " Constructor and Destructor "
public DistrictService(ApplicationDbContext context,
IHttpContextAccessor httpContextAccessor)
{
_context = context;
_httpContextAccessor = httpContextAccessor;
}
#endregion
#region " Properties "
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
#endregion
#region " Methods "
public async Task<IEnumerable<District>> GetsAsync(string provinceId, bool showAll = true)
{
if (showAll)
return await _context.Districts.AsQueryable()
.Where(x => x.Province.Id == Guid.Parse(provinceId))
.OrderBy(d => d.Name)
.ToListAsync();
else
return await _context.Districts.AsQueryable()
.Where(x => x.Province.Id == Guid.Parse(provinceId))
.Where(p => p.IsActive)
.OrderBy(d => d.Name)
.ToListAsync();
}
public async Task<District?> GetByIdAsync(Guid id)
{
return await _context.Districts.FirstOrDefaultAsync(x => x.Id == id);
}
public async Task UpdateAsync(Guid id, District updated)
{
var existData = await _context.Districts.FirstOrDefaultAsync(x => x.Id == id);
if (existData != null)
{
if (existData.Name != updated.Name)
{
existData.Name = updated.Name;
existData.LastUpdatedAt = DateTime.Now;
existData.LastUpdateUserId = UserId ?? "";
existData.LastUpdateFullName = FullName ?? "";
}
if (existData.IsActive != updated.IsActive)
{
existData.IsActive = updated.IsActive;
existData.LastUpdatedAt = DateTime.Now;
existData.LastUpdateUserId = UserId ?? "";
existData.LastUpdateFullName = FullName ?? "";
}
await _context.SaveChangesAsync();
}
}
public async Task CreateAsync(District inserted, string provinceId)
{
var province = await _context.Provinces.FirstOrDefaultAsync(x => x.Id == Guid.Parse(provinceId));
inserted.CreatedUserId = UserId ?? "";
inserted.CreatedFullName = FullName ?? "System Administrator";
inserted.CreatedAt = DateTime.Now;
inserted.LastUpdatedAt = DateTime.Now;
inserted.LastUpdateFullName = FullName ?? "System Administrator";
inserted.LastUpdateUserId = UserId ?? "";
inserted.Province = province;
await _context.Districts.AddAsync(inserted);
await _context.SaveChangesAsync();
}
#endregion
}
}

View file

@ -1,98 +0,0 @@
using System.Security.Claims;
using BMA.EHR.Recurit.Exam.Service.Data;
using BMA.EHR.Recurit.Exam.Service.Models;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Recurit.Exam.Service.Services
{
public class EducationLevelService
{
#region " Fields "
private readonly ApplicationDbContext _context;
private readonly IHttpContextAccessor _httpContextAccessor;
#endregion
#region " Constructor and Destructor "
public EducationLevelService(ApplicationDbContext context,
IHttpContextAccessor httpContextAccessor)
{
_context = context;
_httpContextAccessor = httpContextAccessor;
}
#endregion
#region " Properties "
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
#endregion
#region " Methods "
public async Task<IEnumerable<EducationLevel>> GetsAsync(bool showAll = true)
{
if (showAll)
return await _context.EducationLevels.AsQueryable()
.OrderBy(d => d.Name)
.ToListAsync();
else
return await _context.EducationLevels.AsQueryable()
.Where(p => p.IsActive)
.OrderBy(d => d.Name)
.ToListAsync();
}
public async Task<EducationLevel?> GetByIdAsync(Guid id)
{
return await _context.EducationLevels.FirstOrDefaultAsync(x => x.Id == id);
}
public async Task UpdateAsync(Guid id, EducationLevel updated)
{
var existData = await _context.EducationLevels.FirstOrDefaultAsync(x => x.Id == id);
if (existData != null)
{
if (existData.Name != updated.Name)
{
existData.Name = updated.Name;
existData.LastUpdatedAt = DateTime.Now;
existData.LastUpdateUserId = UserId ?? "";
existData.LastUpdateFullName = FullName ?? "";
}
if (existData.IsActive != updated.IsActive)
{
existData.IsActive = updated.IsActive;
existData.LastUpdatedAt = DateTime.Now;
existData.LastUpdateUserId = UserId ?? "";
existData.LastUpdateFullName = FullName ?? "";
}
await _context.SaveChangesAsync();
}
}
public async Task CreateAsync(EducationLevel inserted)
{
inserted.CreatedUserId = UserId ?? "";
inserted.CreatedFullName = FullName ?? "System Administrator";
inserted.CreatedAt = DateTime.Now;
inserted.LastUpdatedAt = DateTime.Now;
inserted.LastUpdateFullName = FullName ?? "System Administrator";
inserted.LastUpdateUserId = UserId ?? "";
await _context.EducationLevels.AddAsync(inserted);
await _context.SaveChangesAsync();
}
#endregion
}
}

View file

@ -18,6 +18,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
#region " Fields "
private readonly ApplicationDbContext _context;
private readonly MetadataDbContext _contextMetadata;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly MinIOService _minioService;
@ -26,10 +27,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
#region " Constructor and Destructor "
public PeriodExamService(ApplicationDbContext context,
MetadataDbContext contextMetadata,
IHttpContextAccessor httpContextAccessor,
MinIOService minioService)
{
_context = context;
_contextMetadata = contextMetadata;
_httpContextAccessor = httpContextAccessor;
_minioService = minioService;
}
@ -530,15 +533,33 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (status == "all")
{
return await _context.Candidates.AsQueryable()
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.ProfileImg)
.Where(x => x.PeriodExam == periodExam && x.Status != "register" && x.Status != "rejectRegister")
.ToListAsync();
var i = 0;
foreach (var item in candidate)
{
if (candidate[i].ProfileImg != null)
candidate[i].ProfileImg.Detail = _minioService.ImagesPath(candidate[i].ProfileImg.Id).Result;
i++;
}
return candidate;
}
else
{
return await _context.Candidates.AsQueryable()
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.ProfileImg)
.Where(x => x.PeriodExam == periodExam && x.Status == status)
.ToListAsync();
var i = 0;
foreach (var item in candidate)
{
if (candidate[i].ProfileImg != null)
candidate[i].ProfileImg.Detail = _minioService.ImagesPath(candidate[i].ProfileImg.Id).Result;
i++;
}
return candidate;
}
}
@ -548,18 +569,18 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.Id == Guid.Parse(candidateId))
.Select(x => new CandidateInformationResponseItem
{
Prefix = x.Prefix,
PrefixId = x.Prefix != null ? x.Prefix.Id.ToString() : null,
Prefix = x.PrefixName,
PrefixId = x.PrefixId != null ? x.PrefixId.ToString() : null,
FirstName = x.FirstName,
LastName = x.LastName,
Nationality = x.Nationality,
DateOfBirth = x.DateOfBirth,
Relationship = x.Relationship,
RelationshipId = x.Relationship != null ? x.Relationship.Id.ToString() : null,
CitizenProvince = x.CitizenProvince,
CitizenProvinceId = x.CitizenProvince != null ? x.CitizenProvince.Id.ToString() : null,
CitizenDistrict = x.CitizenDistrict,
CitizenDistrictId = x.CitizenDistrict != null ? x.CitizenDistrict.Id.ToString() : null,
Relationship = x.RelationshipName,
RelationshipId = x.RelationshipId != null ? x.RelationshipId.ToString() : null,
CitizenProvince = x.CitizenProvinceName,
CitizenProvinceId = x.CitizenProvinceId != null ? x.CitizenProvinceId.ToString() : null,
CitizenDistrict = x.CitizenDistrictName,
CitizenDistrictId = x.CitizenDistrictId != null ? x.CitizenDistrictId.ToString() : null,
CitizenDate = x.CitizenDate,
Email = x.Email,
CitizenId = x.CitizenId,
@ -602,21 +623,21 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Select(x => new CandidateAddressResponseItem
{
RegistAddress = x.RegistAddress,
RegistProvince = x.RegistProvince,
RegistProvinceId = x.RegistProvince != null ? x.RegistProvince.Id.ToString() : null,
RegistDistrict = x.RegistDistrict,
RegistDistrictId = x.RegistDistrict != null ? x.RegistDistrict.Id.ToString() : null,
RegistSubDistrict = x.RegistSubDistrict,
RegistSubDistrictId = x.RegistSubDistrict != null ? x.RegistSubDistrict.Id.ToString() : null,
RegistProvince = x.RegistProvinceName,
RegistProvinceId = x.RegistProvinceId != null ? x.RegistProvinceId.ToString() : null,
RegistDistrict = x.RegistDistrictName,
RegistDistrictId = x.RegistDistrictId != null ? x.RegistDistrictId.ToString() : null,
RegistSubDistrict = x.RegistSubDistrictName,
RegistSubDistrictId = x.RegistSubDistrictId != null ? x.RegistSubDistrictId.ToString() : null,
RegistZipCode = x.RegistZipCode,
RegistSame = x.RegistSame,
CurrentAddress = x.CurrentAddress,
CurrentProvince = x.CurrentProvince,
CurrentProvinceId = x.CurrentProvince != null ? x.CurrentProvince.Id.ToString() : null,
CurrentDistrict = x.CurrentDistrict,
CurrentDistrictId = x.CurrentDistrict != null ? x.CurrentDistrict.Id.ToString() : null,
CurrentSubDistrict = x.CurrentSubDistrict,
CurrentSubDistrictId = x.CurrentSubDistrict != null ? x.CurrentSubDistrict.Id.ToString() : null,
CurrentProvince = x.CurrentProvinceName,
CurrentProvinceId = x.CurrentProvinceId != null ? x.CurrentProvinceId.ToString() : null,
CurrentDistrict = x.CurrentDistrictName,
CurrentDistrictId = x.CurrentDistrictId != null ? x.CurrentDistrictId.ToString() : null,
CurrentSubDistrict = x.CurrentSubDistrictName,
CurrentSubDistrictId = x.CurrentSubDistrictId != null ? x.CurrentSubDistrictId.ToString() : null,
CurrentZipCode = x.CurrentZipCode,
})
.FirstOrDefaultAsync();
@ -629,20 +650,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Select(x => new CandidateFamilyResponseItem
{
Marry = x.Marry,
MarryPrefix = x.MarryPrefix,
MarryPrefixId = x.MarryPrefix != null ? x.MarryPrefix.Id.ToString() : null,
MarryPrefix = x.MarryPrefixName,
MarryPrefixId = x.MarryPrefixId != null ? x.MarryPrefixId.ToString() : null,
MarryFirstName = x.MarryFirstName,
MarryLastName = x.MarryLastName,
MarryOccupation = x.MarryOccupation,
MarryNationality = x.MarryNationality,
FatherPrefix = x.FatherPrefix,
FatherPrefixId = x.FatherPrefix != null ? x.FatherPrefix.Id.ToString() : null,
FatherPrefix = x.FatherPrefixName,
FatherPrefixId = x.FatherPrefixId != null ? x.FatherPrefixId.ToString() : null,
FatherFirstName = x.FatherFirstName,
FatherLastName = x.FatherLastName,
FatherOccupation = x.FatherOccupation,
FatherNationality = x.FatherNationality,
MotherPrefix = x.MotherPrefix,
MotherPrefixId = x.MotherPrefix != null ? x.MotherPrefix.Id.ToString() : null,
MotherPrefix = x.MotherPrefixName,
MotherPrefixId = x.MotherPrefixId != null ? x.MotherPrefixId.ToString() : null,
MotherFirstName = x.MotherFirstName,
MotherLastName = x.MotherLastName,
MotherOccupation = x.MotherOccupation,
@ -654,7 +675,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
public async Task<IEnumerable<Education?>> GetsAsyncEducation(string candidateId)
{
return await _context.Educations.AsQueryable()
.Include(x => x.EducationLevel)
.Where(x => x.Id == Guid.Parse(candidateId))
.OrderBy(d => d.DurationStart)
.ToListAsync();

View file

@ -1,98 +0,0 @@
using BMA.EHR.Recurit.Exam.Service.Data;
using BMA.EHR.Recurit.Exam.Service.Models;
using Microsoft.EntityFrameworkCore;
using System.Security.Claims;
namespace BMA.EHR.Recurit.Exam.Service.Services
{
public class PrefixService
{
#region " Fields "
private readonly ApplicationDbContext _context;
private readonly IHttpContextAccessor _httpContextAccessor;
#endregion
#region " Constructor and Destructor "
public PrefixService(ApplicationDbContext context,
IHttpContextAccessor httpContextAccessor)
{
_context = context;
_httpContextAccessor = httpContextAccessor;
}
#endregion
#region " Properties "
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
#endregion
#region " Methods "
public async Task<IEnumerable<Prefix>> GetsAsync(bool showAll = true)
{
if (showAll)
return await _context.Prefixes.AsQueryable()
.OrderBy(d => d.Name)
.ToListAsync();
else
return await _context.Prefixes.AsQueryable()
.Where(p => p.IsActive)
.OrderBy(d => d.Name)
.ToListAsync();
}
public async Task<Prefix?> GetByIdAsync(Guid id)
{
return await _context.Prefixes.FirstOrDefaultAsync(x => x.Id == id);
}
public async Task UpdateAsync(Guid id, Prefix updated)
{
var existData = await _context.Prefixes.FirstOrDefaultAsync(x => x.Id == id);
if (existData != null)
{
if (existData.Name != updated.Name)
{
existData.Name = updated.Name;
existData.LastUpdateUserId = UserId ?? "";
existData.LastUpdateFullName = FullName ?? "";
existData.LastUpdatedAt = DateTime.Now;
}
if (existData.IsActive != updated.IsActive)
{
existData.IsActive = updated.IsActive;
existData.LastUpdateUserId = UserId ?? "";
existData.LastUpdateFullName = FullName ?? "";
existData.LastUpdatedAt = DateTime.Now;
}
await _context.SaveChangesAsync();
}
}
public async Task CreateAsync(Prefix inserted)
{
inserted.CreatedUserId = UserId ?? "";
inserted.CreatedFullName = FullName ?? "System Administrator";
inserted.CreatedAt = DateTime.Now;
inserted.LastUpdatedAt = DateTime.Now;
inserted.LastUpdateFullName = FullName ?? "System Administrator";
inserted.LastUpdateUserId = UserId ?? "";
await _context.Prefixes.AddAsync(inserted);
await _context.SaveChangesAsync();
}
#endregion
}
}

View file

@ -1,98 +0,0 @@
using BMA.EHR.Recurit.Exam.Service.Data;
using BMA.EHR.Recurit.Exam.Service.Models;
using Microsoft.EntityFrameworkCore;
using System.Security.Claims;
namespace BMA.EHR.Recurit.Exam.Service.Services
{
public class ProvinceService
{
#region " Fields "
private readonly ApplicationDbContext _context;
private readonly IHttpContextAccessor _httpContextAccessor;
#endregion
#region " Constructor and Destructor "
public ProvinceService(ApplicationDbContext context,
IHttpContextAccessor httpContextAccessor)
{
_context = context;
_httpContextAccessor = httpContextAccessor;
}
#endregion
#region " Properties "
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
#endregion
#region " Methods "
public async Task<IEnumerable<Province>> GetsAsync(bool showAll = true)
{
if (showAll)
return await _context.Provinces.AsQueryable()
.OrderBy(d => d.Name)
.ToListAsync();
else
return await _context.Provinces.AsQueryable()
.Where(p => p.IsActive)
.OrderBy(d => d.Name)
.ToListAsync();
}
public async Task<Province?> GetByIdAsync(Guid id)
{
return await _context.Provinces.FirstOrDefaultAsync(x => x.Id == id);
}
public async Task UpdateAsync(Guid id, Province updated)
{
var existData = await _context.Provinces.FirstOrDefaultAsync(x => x.Id == id);
if (existData != null)
{
if (existData.Name != updated.Name)
{
existData.Name = updated.Name;
existData.LastUpdatedAt = DateTime.Now;
existData.LastUpdateUserId = UserId ?? "";
existData.LastUpdateFullName = FullName ?? "";
}
if (existData.IsActive != updated.IsActive)
{
existData.IsActive = updated.IsActive;
existData.LastUpdatedAt = DateTime.Now;
existData.LastUpdateUserId = UserId ?? "";
existData.LastUpdateFullName = FullName ?? "";
}
await _context.SaveChangesAsync();
}
}
public async Task CreateAsync(Province inserted)
{
inserted.CreatedUserId = UserId ?? "";
inserted.CreatedFullName = FullName ?? "System Administrator";
inserted.CreatedAt = DateTime.Now;
inserted.LastUpdatedAt = DateTime.Now;
inserted.LastUpdateFullName = FullName ?? "System Administrator";
inserted.LastUpdateUserId = UserId ?? "";
await _context.Provinces.AddAsync(inserted);
await _context.SaveChangesAsync();
}
#endregion
}
}

View file

@ -1,97 +0,0 @@
using System.Security.Claims;
using BMA.EHR.Recurit.Exam.Service.Data;
using BMA.EHR.Recurit.Exam.Service.Models;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Recurit.Exam.Service.Services;
public class RelationshipService
{
#region " Fields "
private readonly ApplicationDbContext _context;
private readonly IHttpContextAccessor _httpContextAccessor;
#endregion
#region " Constructor and Destructor "
public RelationshipService(ApplicationDbContext context,
IHttpContextAccessor httpContextAccessor)
{
_context = context;
_httpContextAccessor = httpContextAccessor;
}
#endregion
#region " Properties "
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
#endregion
#region " Methods "
public async Task<IEnumerable<Relationship>> GetsAsync(bool showAll = true)
{
if (showAll)
return await _context.Relationships.AsQueryable()
.OrderBy(d => d.Name)
.ToListAsync();
else
return await _context.Relationships.AsQueryable()
.Where(p => p.IsActive)
.OrderBy(d => d.Name)
.ToListAsync();
}
public async Task<Relationship?> GetByIdAsync(Guid id)
{
return await _context.Relationships.FirstOrDefaultAsync(x => x.Id == id);
}
public async Task UpdateAsync(Guid id, Relationship updated)
{
var existData = await _context.Relationships.FirstOrDefaultAsync(x => x.Id == id);
if (existData != null)
{
if (existData.Name != updated.Name)
{
existData.Name = updated.Name;
existData.LastUpdateUserId = UserId ?? "";
existData.LastUpdateFullName = FullName ?? "";
existData.LastUpdatedAt = DateTime.Now;
}
if (existData.IsActive != updated.IsActive)
{
existData.IsActive = updated.IsActive;
existData.LastUpdateUserId = UserId ?? "";
existData.LastUpdateFullName = FullName ?? "";
existData.LastUpdatedAt = DateTime.Now;
}
await _context.SaveChangesAsync();
}
}
public async Task CreateAsync(Relationship inserted)
{
inserted.CreatedUserId = UserId ?? "";
inserted.CreatedFullName = FullName ?? "System Administrator";
inserted.CreatedAt = DateTime.Now;
inserted.LastUpdatedAt = DateTime.Now;
inserted.LastUpdateFullName = FullName ?? "System Administrator";
inserted.LastUpdateUserId = UserId ?? "";
await _context.Relationships.AddAsync(inserted);
await _context.SaveChangesAsync();
}
#endregion
}

View file

@ -1,98 +0,0 @@
using System.Security.Claims;
using BMA.EHR.Recurit.Exam.Service.Data;
using BMA.EHR.Recurit.Exam.Service.Models;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Recurit.Exam.Service.Services
{
public class ReligionService
{
#region " Fields "
private readonly ApplicationDbContext _context;
private readonly IHttpContextAccessor _httpContextAccessor;
#endregion
#region " Constructor and Destructor "
public ReligionService(ApplicationDbContext context,
IHttpContextAccessor httpContextAccessor)
{
_context = context;
_httpContextAccessor = httpContextAccessor;
}
#endregion
#region " Properties "
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
#endregion
#region " Methods "
public async Task<IEnumerable<Religion>> GetsAsync(bool showAll = true)
{
if (showAll)
return await _context.Religions.AsQueryable()
.OrderBy(d => d.Name)
.ToListAsync();
else
return await _context.Religions.AsQueryable()
.Where(p => p.IsActive)
.OrderBy(d => d.Name)
.ToListAsync();
}
public async Task<Religion?> GetByIdAsync(Guid id)
{
return await _context.Religions.FirstOrDefaultAsync(x => x.Id == id);
}
public async Task UpdateAsync(Guid id, Religion updated)
{
var existData = await _context.Religions.FirstOrDefaultAsync(x => x.Id == id);
if (existData != null)
{
if (existData.Name != updated.Name)
{
existData.Name = updated.Name;
existData.LastUpdateUserId = UserId ?? "";
existData.LastUpdateFullName = FullName ?? "";
existData.LastUpdatedAt = DateTime.Now;
}
if (existData.IsActive != updated.IsActive)
{
existData.IsActive = updated.IsActive;
existData.LastUpdateUserId = UserId ?? "";
existData.LastUpdateFullName = FullName ?? "";
existData.LastUpdatedAt = DateTime.Now;
}
await _context.SaveChangesAsync();
}
}
public async Task CreateAsync(Religion inserted)
{
inserted.CreatedUserId = UserId ?? "";
inserted.CreatedFullName = FullName ?? "System Administrator";
inserted.CreatedAt = DateTime.Now;
inserted.LastUpdatedAt = DateTime.Now;
inserted.LastUpdateFullName = FullName ?? "System Administrator";
inserted.LastUpdateUserId = UserId ?? "";
await _context.Religions.AddAsync(inserted);
await _context.SaveChangesAsync();
}
#endregion
}
}

View file

@ -1,119 +0,0 @@
using System.Collections.Immutable;
using System.Security.Claims;
using BMA.EHR.Extensions;
using BMA.EHR.Recurit.Exam.Service.Data;
using BMA.EHR.Recurit.Exam.Service.Models;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
namespace BMA.EHR.Recurit.Exam.Service.Services
{
public class SubDistrictService
{
#region " Fields "
private readonly ApplicationDbContext _context;
private readonly IHttpContextAccessor _httpContextAccessor;
#endregion
#region " Constructor and Destructor "
public SubDistrictService(ApplicationDbContext context,
IHttpContextAccessor httpContextAccessor)
{
_context = context;
_httpContextAccessor = httpContextAccessor;
}
#endregion
#region " Properties "
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
#endregion
#region " Methods "
public async Task<IEnumerable<SubDistrict>> GetsAsync(string districtId, bool showAll = true)
{
if (showAll)
return await _context.SubDistricts.AsQueryable()
.Include(d => d.District)
.Where(x => x.District.Id == Guid.Parse(districtId))
.OrderBy(d => d.Name)
.ToListAsync();
else
return await _context.SubDistricts.AsQueryable()
.Include(d => d.District)
.Where(x => x.District.Id == Guid.Parse(districtId))
.Where(p => p.IsActive)
.OrderBy(d => d.Name)
.ToListAsync();
}
public async Task<SubDistrict?> GetByIdAsync(Guid id)
{
return await _context.SubDistricts.AsQueryable()
.Include(d => d.District)
.FirstOrDefaultAsync(x => x.Id == id);
}
public async Task UpdateAsync(Guid id, SubDistrict updated)
{
var existData = await _context.SubDistricts.FirstOrDefaultAsync(x => x.Id == id);
if (existData != null)
{
// if (!existData.Compare(updated))
// {
// existData.Name = updated.Name;
// existData.ZipCode = updated.ZipCode;
// existData.IsActive = updated.IsActive;
// existData.LastUpdatedAt = DateTime.Now;
// existData.LastUpdateUserId = UserId ?? "";
// existData.LastUpdateFullName = FullName ?? "";
// await _context.SaveChangesAsync();
// }
if (existData.Name != updated.Name || existData.ZipCode != updated.ZipCode)
{
existData.Name = updated.Name;
existData.ZipCode = updated.ZipCode;
existData.LastUpdatedAt = DateTime.Now;
existData.LastUpdateUserId = UserId ?? "";
existData.LastUpdateFullName = FullName ?? "";
}
if (existData.IsActive != updated.IsActive)
{
existData.IsActive = updated.IsActive;
existData.LastUpdatedAt = DateTime.Now;
existData.LastUpdateUserId = UserId ?? "";
existData.LastUpdateFullName = FullName ?? "";
}
await _context.SaveChangesAsync();
}
}
public async Task CreateAsync(SubDistrict inserted, string districtId)
{
var district = await _context.Districts.FirstOrDefaultAsync(x => x.Id == Guid.Parse(districtId));
inserted.CreatedUserId = UserId ?? "";
inserted.CreatedFullName = FullName ?? "System Administrator";
inserted.CreatedAt = DateTime.Now;
inserted.LastUpdatedAt = DateTime.Now;
inserted.LastUpdateFullName = FullName ?? "System Administrator";
inserted.LastUpdateUserId = UserId ?? "";
inserted.District = district;
await _context.SubDistricts.AddAsync(inserted);
await _context.SaveChangesAsync();
}
#endregion
}
}

View file

@ -14,7 +14,9 @@
"AllowedHosts": "*",
"ConnectionStrings": {
"MongoConnection": "mongodb://127.0.0.1:27017",
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
// "MetadataConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
"MetadataConnection": "server=192.168.1.9;user=root;password=adminVM123;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",

View file

@ -14,7 +14,9 @@
"AllowedHosts": "*",
"ConnectionStrings": {
"MongoConnection": "mongodb://admin:adminVM123@127.0.0.1:27017",
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
// "MetadataConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
"MetadataConnection": "server=192.168.1.9;user=root;password=adminVM123;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",

View file

@ -14,7 +14,9 @@
"AllowedHosts": "*",
"ConnectionStrings": {
"MongoConnection": "mongodb://127.0.0.1:27017",
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
// "MetadataConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
"MetadataConnection": "server=192.168.1.9;user=root;password=adminVM123;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",

View file

@ -14,7 +14,9 @@
"AllowedHosts": "*",
"ConnectionStrings": {
"MongoConnection": "mongodb://admin:adminVM123@127.0.0.1:27017",
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
// "MetadataConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
"MetadataConnection": "server=192.168.1.9;user=root;password=adminVM123;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "lByyu16jl2jM556O1T8dlyIx/VDvFB2JFOMrmhKkLT/k8+b+gPmdOXJ2gFJPebo7exLXNtdXcjhUf29jzv3G5g==",
"dgSpecHash": "mgE8pAxImCYHiVLKMjnx+5DEGjPO3U/4vvPl9o5d7ruTNErl7pEqOFIZz2PoSywzj6Qimx+tPqEeIJl1N5oJow==",
"success": true,
"projectFilePath": "D:\\BMA-EHR-Recurit-Exam-Service\\BMA.EHR.Recurit.Exam.Service.csproj",
"expectedPackageFiles": [
@ -75,7 +75,7 @@
"C:\\Users\\M\\.nuget\\packages\\microsoft.extensions.caching.memory\\7.0.0\\microsoft.extensions.caching.memory.7.0.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\microsoft.extensions.configuration\\7.0.0\\microsoft.extensions.configuration.7.0.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\microsoft.extensions.configuration.abstractions\\7.0.0\\microsoft.extensions.configuration.abstractions.7.0.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\microsoft.extensions.configuration.binder\\2.0.0\\microsoft.extensions.configuration.binder.2.0.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\microsoft.extensions.configuration.binder\\2.1.1\\microsoft.extensions.configuration.binder.2.1.1.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\microsoft.extensions.configuration.fileextensions\\7.0.0\\microsoft.extensions.configuration.fileextensions.7.0.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\microsoft.extensions.configuration.json\\7.0.0\\microsoft.extensions.configuration.json.7.0.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\microsoft.extensions.dependencyinjection\\7.0.0\\microsoft.extensions.dependencyinjection.7.0.0.nupkg.sha512",
@ -112,6 +112,10 @@
"C:\\Users\\M\\.nuget\\packages\\newtonsoft.json\\13.0.1\\newtonsoft.json.13.0.1.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\newtonsoft.json.bson\\1.0.2\\newtonsoft.json.bson.1.0.2.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\pomelo.entityframeworkcore.mysql\\7.0.0\\pomelo.entityframeworkcore.mysql.7.0.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\runtime.native.system.data.sqlclient.sni\\4.5.0\\runtime.native.system.data.sqlclient.sni.4.5.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\runtime.win-arm64.runtime.native.system.data.sqlclient.sni\\4.4.0\\runtime.win-arm64.runtime.native.system.data.sqlclient.sni.4.4.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\runtime.win-x64.runtime.native.system.data.sqlclient.sni\\4.4.0\\runtime.win-x64.runtime.native.system.data.sqlclient.sni.4.4.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\runtime.win-x86.runtime.native.system.data.sqlclient.sni\\4.4.0\\runtime.win-x86.runtime.native.system.data.sqlclient.sni.4.4.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\serilog\\2.12.0\\serilog.2.12.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\serilog.aspnetcore\\6.1.0\\serilog.aspnetcore.6.1.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\serilog.enrichers.environment\\2.2.0\\serilog.enrichers.environment.2.2.0.nupkg.sha512",
@ -126,6 +130,10 @@
"C:\\Users\\M\\.nuget\\packages\\serilog.sinks.elasticsearch\\9.0.0\\serilog.sinks.elasticsearch.9.0.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\serilog.sinks.file\\5.0.0\\serilog.sinks.file.5.0.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\serilog.sinks.periodicbatching\\3.1.0\\serilog.sinks.periodicbatching.3.1.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\sqlitepclraw.bundle_green\\2.0.1\\sqlitepclraw.bundle_green.2.0.1.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\sqlitepclraw.core\\2.0.1\\sqlitepclraw.core.2.0.1.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\sqlitepclraw.lib.e_sqlite3\\2.0.1\\sqlitepclraw.lib.e_sqlite3.2.0.1.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\sqlitepclraw.provider.dynamic_cdecl\\2.0.1\\sqlitepclraw.provider.dynamic_cdecl.2.0.1.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\swashbuckle.aspnetcore\\6.4.0\\swashbuckle.aspnetcore.6.4.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\swashbuckle.aspnetcore.annotations\\6.5.0\\swashbuckle.aspnetcore.annotations.6.5.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\swashbuckle.aspnetcore.swagger\\6.5.0\\swashbuckle.aspnetcore.swagger.6.5.0.nupkg.sha512",
@ -136,6 +144,9 @@
"C:\\Users\\M\\.nuget\\packages\\system.collections\\4.3.0\\system.collections.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.collections.immutable\\5.0.0\\system.collections.immutable.5.0.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.componentmodel.annotations\\5.0.0\\system.componentmodel.annotations.5.0.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.configuration.configurationmanager\\4.5.0\\system.configuration.configurationmanager.4.5.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.data.common\\4.3.0\\system.data.common.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.data.sqlclient\\4.6.0\\system.data.sqlclient.4.6.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.diagnostics.debug\\4.3.0\\system.diagnostics.debug.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.diagnostics.diagnosticsource\\6.0.0\\system.diagnostics.diagnosticsource.6.0.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.diagnostics.tools\\4.3.0\\system.diagnostics.tools.4.3.0.nupkg.sha512",
@ -146,8 +157,12 @@
"C:\\Users\\M\\.nuget\\packages\\system.io\\4.3.0\\system.io.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.io.filesystem\\4.3.0\\system.io.filesystem.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.io.filesystem.primitives\\4.3.0\\system.io.filesystem.primitives.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.io.packaging\\4.5.0\\system.io.packaging.4.5.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.memory\\4.5.4\\system.memory.4.5.4.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.reflection\\4.3.0\\system.reflection.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.reflection.emit\\4.3.0\\system.reflection.emit.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.reflection.emit.ilgeneration\\4.3.0\\system.reflection.emit.ilgeneration.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.reflection.emit.lightweight\\4.3.0\\system.reflection.emit.lightweight.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.reflection.metadata\\5.0.0\\system.reflection.metadata.5.0.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.reflection.primitives\\4.3.0\\system.reflection.primitives.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.reflection.typeextensions\\4.7.0\\system.reflection.typeextensions.4.7.0.nupkg.sha512",
@ -157,10 +172,13 @@
"C:\\Users\\M\\.nuget\\packages\\system.runtime.extensions\\4.3.0\\system.runtime.extensions.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.runtime.handles\\4.3.0\\system.runtime.handles.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.runtime.interopservices\\4.3.0\\system.runtime.interopservices.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.runtime.loader\\4.3.0\\system.runtime.loader.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.security.accesscontrol\\4.5.0\\system.security.accesscontrol.4.5.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.security.cryptography.cng\\4.5.0\\system.security.cryptography.cng.4.5.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.security.cryptography.pkcs\\7.0.0\\system.security.cryptography.pkcs.7.0.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.security.cryptography.protecteddata\\4.5.0\\system.security.cryptography.protecteddata.4.5.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.security.cryptography.xml\\7.0.1\\system.security.cryptography.xml.7.0.1.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.security.permissions\\4.5.0\\system.security.permissions.4.5.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.security.principal.windows\\4.5.0\\system.security.principal.windows.4.5.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.text.encoding\\4.3.0\\system.text.encoding.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.text.encoding.codepages\\7.0.0\\system.text.encoding.codepages.7.0.0.nupkg.sha512",
@ -169,13 +187,15 @@
"C:\\Users\\M\\.nuget\\packages\\system.text.json\\7.0.0\\system.text.json.7.0.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.text.regularexpressions\\4.3.0\\system.text.regularexpressions.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.threading\\4.3.0\\system.threading.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.threading.accesscontrol\\4.5.0\\system.threading.accesscontrol.4.5.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.threading.tasks\\4.3.0\\system.threading.tasks.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.threading.tasks.extensions\\4.5.4\\system.threading.tasks.extensions.4.5.4.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.xml.readerwriter\\4.3.1\\system.xml.readerwriter.4.3.1.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.xml.xdocument\\4.3.0\\system.xml.xdocument.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.xml.xmldocument\\4.3.0\\system.xml.xmldocument.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.xml.xpath\\4.3.0\\system.xml.xpath.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\system.xml.xpath.xmldocument\\4.3.0\\system.xml.xpath.xmldocument.4.3.0.nupkg.sha512"
"C:\\Users\\M\\.nuget\\packages\\system.xml.xpath.xmldocument\\4.3.0\\system.xml.xpath.xmldocument.4.3.0.nupkg.sha512",
"C:\\Users\\M\\.nuget\\packages\\telerik.reporting\\15.1.21.616\\telerik.reporting.15.1.21.616.nupkg.sha512"
],
"logs": []
}