api ระบบวินัย กรรมการ/ช่องทางร้องเรียน

This commit is contained in:
Kittapath 2023-11-18 01:43:03 +07:00
parent 9ed48d93b4
commit 2cdf724d58
69 changed files with 21578 additions and 134 deletions

View file

@ -0,0 +1,87 @@
name: release-dev
run-name: release-dev ${{ github.actor }}
on:
# push:
# tags:
# - 'v[0-9]+.[0-9]+.[0-9]+'
# tags-ignore:
# - '2.*'
# Allow run workflow manually from Action tab
workflow_dispatch:
env:
REGISTRY: docker.frappet.com
IMAGE_NAME: ehr/bma-ehr-discipline-service
DEPLOY_HOST: frappet.com
COMPOSE_PATH: /home/frappet/docker/bma-ehr-discipline
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
jobs:
# act workflow_dispatch -W .github/workflows/release_discipline.yaml --input IMAGE_VER=discipline-1.0.0 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
release-dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# skip Set up QEMU because it fail on act and container
- name: Gen Version
id: gen_ver
run: |
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
else
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
fi
if [[ $IMAGE_VER == '' ]]; then
IMAGE_VER='test-vBeta'
fi
echo '::set-output name=image_ver::'$IMAGE_VER
- name: Test Version
run: |
echo $GITHUB_REF
echo ${{ steps.gen_ver.outputs.image_ver }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login in to registry
uses: docker/login-action@v2
with:
registry: ${{env.REGISTRY}}
username: ${{secrets.DOCKER_USER}}
password: ${{secrets.DOCKER_PASS}}
- name: Build and load local docker image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
file: BMA.EHR.Discipline.Service/Dockerfile
push: true
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
- name: Reload docker compose
uses: appleboy/ssh-action@v0.1.8
with:
host: ${{env.DEPLOY_HOST}}
username: frappet
password: ${{ secrets.SSH_PASSWORD }}
port: 22
script: |
cd "${{env.COMPOSE_PATH}}"
docker-compose pull
docker-compose up -d
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
# - uses: snow-actions/line-notify@v1.1.0
# if: success()
# with:
# access_token: ${{ env.TOKEN_LINE }}
# message: |
# -Success✅✅✅
# Image: ${{env.IMAGE_NAME}}
# Version: ${{ github.event.inputs.IMAGE_VER }}
# By: ${{secrets.DOCKER_USER}}
# - uses: snow-actions/line-notify@v1.1.0
# if: failure()
# with:
# access_token: ${{ env.TOKEN_LINE }}
# message: |
# -Failure❌❌❌
# Image: ${{env.IMAGE_NAME}}
# Version: ${{ github.event.inputs.IMAGE_VER }}
# By: ${{secrets.DOCKER_USER}}

View file

@ -48,5 +48,12 @@ namespace BMA.EHR.Application
return services;
}
public static IServiceCollection AddDisciplineApplication(this IServiceCollection services)
{
// services.AddTransient<DutyTimeRepository>();
return services;
}
}
}

View file

@ -0,0 +1,13 @@
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Application.Common.Interfaces
{
public interface IDisciplineDbContext
{
DbSet<T> Set<T>() where T : class;
void Attatch<T>(T entity) where T : class;
Task<int> SaveChangesAsync();
}
}

View file

@ -6003,8 +6003,8 @@ namespace BMA.EHR.Application.Repositories
Organization = oc,
RequestStatus = "st1",
RequestNote = "",
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -6026,8 +6026,8 @@ namespace BMA.EHR.Application.Repositories
Salary = item.Salary == null ? null : item.Salary,
RequestDate = DateTime.Now,
MatchingConditions = System.Text.Json.JsonSerializer.Serialize(item.MatchingConditions), // serialize to string
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -109,8 +109,8 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
ReceiverUserId = ReceiverUserId,
Type = "",
Payload = Payload,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -124,8 +124,8 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
Body = Body,
ReceiverUserId = ReceiverUserId,
Payload = Payload,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -993,8 +993,8 @@ namespace BMA.EHR.Application.Repositories.Reports
// EndDate = insigniaPeriod.EndDate,
// Amount = insigniaPeriod.Amount,
// ReliefDoc = insigniaPeriod.ReliefDoc,
CreatedUserId = "System Administrator",
CreatedFullName = "",
CreatedFullName = "System Administrator",
CreatedUserId = "",
CreatedAt = DateTime.Now,
LastUpdateFullName = "System Administrator",
LastUpdateUserId = "",
@ -1034,8 +1034,8 @@ namespace BMA.EHR.Application.Repositories.Reports
noreProfileOld.Salary = profileOld.Salary;
noreProfileOld.IsApprove = profileOld.IsApprove;
noreProfileOld.RequestInsignia = profileOld.RequestInsignia;
noreProfileOld.CreatedUserId = "System Administrator";
noreProfileOld.CreatedFullName = "";
noreProfileOld.CreatedFullName = "System Administrator";
noreProfileOld.CreatedUserId = "";
noreProfileOld.CreatedAt = DateTime.Now;
noreProfileOld.LastUpdateFullName = "System Administrator";
noreProfileOld.LastUpdateUserId = "";
@ -1055,8 +1055,8 @@ namespace BMA.EHR.Application.Repositories.Reports
RequestInsignia = profileOld.RequestInsignia,
OrganizationOrganizationSend = profileOld.Profile == null || profileOld.Profile.OcId == null ? null : _organizationCommonRepository.GetOrganizationNameFullPath(profileOld.Profile.OcId.Value, false, false),
InsigniaNote = insigniaNote,
CreatedUserId = "System Administrator",
CreatedFullName = "",
CreatedFullName = "System Administrator",
CreatedUserId = "",
CreatedAt = DateTime.Now,
LastUpdateFullName = "System Administrator",
LastUpdateUserId = "",

View file

@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

View file

@ -0,0 +1,45 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>9d934a68-d1dd-449d-bde0-3078a774ad0f</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<DockerfileContext>.</DockerfileContext>
<RootNamespace>BMA.EHR.Discipline.Service</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hangfire" Version="1.8.5" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.5" />
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.IdentityModel.Logging" Version="6.31.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="6.0.5.128" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Sentry.AspNetCore" Version="3.33.1" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
<PackageReference Include="Serilog.Exceptions" Version="8.4.0" />
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="9.0.3" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,84 @@
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.Extensions.Options;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
using System.Reflection;
namespace BMA.EHR.Discipline.Service
{
public class ConfigureSwaggerOptions : IConfigureNamedOptions<SwaggerGenOptions>
{
private readonly IApiVersionDescriptionProvider _provider;
public ConfigureSwaggerOptions(
IApiVersionDescriptionProvider provider)
{
_provider = provider;
}
public void Configure(SwaggerGenOptions options)
{
// add swagger document for every API version discovered
foreach (var description in _provider.ApiVersionDescriptions)
{
options.EnableAnnotations();
options.SwaggerDoc(
description.GroupName,
CreateVersionInfo(description));
}
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
In = ParameterLocation.Header,
Description = "Please enter a valid token",
Name = "Authorization",
Type = SecuritySchemeType.Http,
BearerFormat = "JWT",
Scheme = "Bearer"
});
options.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme,
Id = "Bearer"
}
},
new string[]{}
}
});
// generate the XML docs that'll drive the swagger docs
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
options.IncludeXmlComments(xmlPath);
}
public void Configure(string name, SwaggerGenOptions options)
{
Configure(options);
}
private OpenApiInfo CreateVersionInfo(
ApiVersionDescription desc)
{
var info = new OpenApiInfo()
{
Title = "BMA EHR Discipline Service Document",
Version = desc.ApiVersion.ToString()
};
if (desc.IsDeprecated)
{
info.Description += " This API version has been deprecated. Please use one of the new APIs available from the explorer.";
}
return info;
}
}
}

View file

@ -0,0 +1,225 @@
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.MessageQueue;
using BMA.EHR.Discipline.Service.Requests;
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Models.Discipline;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
// using BMA.EHR.Placement.Service.Requests;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Swashbuckle.AspNetCore.Annotations;
using System.Security.Claims;
namespace BMA.EHR.DisciplineComplaint.Service.Controllers
{
[Route("api/v{version:apiVersion}/discipline/complaint")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("ระบบวินัย")]
public class DisciplineComplaintController : BaseController
{
private readonly DisciplineDbContext _context;
private readonly MinIOService _documentService;
private readonly IHttpContextAccessor _httpContextAccessor;
public DisciplineComplaintController(DisciplineDbContext context,
MinIOService documentService,
IHttpContextAccessor httpContextAccessor)
{
// _repository = repository;
_context = context;
_documentService = documentService;
_httpContextAccessor = httpContextAccessor;
}
#region " Properties "
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
#endregion
/// <summary>
/// list รายการวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetDiscipline(int page = 1, int pageSize = 25, string keyword = "")
{
var data = await _context.DisciplineComplaints
.Select(x => new
{
Id = x.Id,//id ข้อมูลเรื่องร้องเรียน
Title = x.Title,//ชื่อเรื่อง
Description = x.Description,//รายละเอียด
//Respondent = x.xxx,//ผู้ถูกร้องเรียน
DescMistake = x.OffenseDetails,//ลักษณะความผิด
CreatedAt = x.CreatedAt,//วันที่สร้างเรื่องร้องเรียน
DevLevel = x.LevelConsideration,//ระดับการพัฒนา
ConsiderationDate = x.DateConsideration,//วันที่กำหนดพิจารณา
ComplaintStatus = x.Status,//สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)
})
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToListAsync();
return Success(new { data, total = data.Count() });
}
/// <summary>
/// get รายการวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("{id:guid}")]
public async Task<ActionResult<ResponseObject>> GetByDiscipline(Guid id)
{
var data = await _context.DisciplineComplaints
.Select(x => new
{
Id = x.Id,//id ข้อมูลเรื่องร้องเรียน
Title = x.Title,//ชื่อเรื่อง
Description = x.Description,//รายละเอียด
//Respondent = x.xxx,//ผู้ถูกร้องเรียน
DescMistake = x.OffenseDetails,//ลักษณะความผิด
CreatedAt = x.CreatedAt,//วันที่สร้างเรื่องร้องเรียน
DevLevel = x.LevelConsideration,//ระดับการพัฒนา
ConsiderationDate = x.DateConsideration,//วันที่กำหนดพิจารณา
ComplaintStatus = x.Status,//สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)
})
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
if (data == null)
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
return Success(data);
}
/// <summary>
/// สร้างรายการวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost()]
public async Task<ActionResult<ResponseObject>> CreateDiscipline([FromForm] DisciplineComplaintRequest req)
{
var disciplineComplaint = new Domain.Models.Discipline.DisciplineComplaint
{
RespondentType = req.respondentType,
// xxx = req.xxx,
// xxx = req.xxx,
// xxx = req.xxx,
// xxx = req.xxx,
Title = req.title,
Description = req.description,
DateReceived = req.dateReceived,
LevelConsideration = req.levelConsideration,
DateConsideration = req.dateConsideration,
OffenseDetails = req.offenseDetails,
DateNotification = req.dateNotification,
ComplaintFrom = req.complaintFrom,
Appellant = req.appellant,
Status = "NEW",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
};
// var doc = await _documentService.UploadFileAsync(file, file.FileName);
// var _doc = await _context.Documents.AsQueryable()
// .FirstOrDefaultAsync(x => x.Id == doc.Id);
// disciplineComplaint.Document = _doc;
await _context.DisciplineComplaints.AddAsync(disciplineComplaint);
await _context.SaveChangesAsync();
return Success();
}
/// <summary>
/// แก้ไขรายการวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("{id:guid}")]
public async Task<ActionResult<ResponseObject>> UpdateDiscipline(Guid id, [FromForm] DisciplineComplaintRequest req)
{
var data = await _context.DisciplineComplaints.Where(x => x.Id == id).FirstOrDefaultAsync();
if (data == null)
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
if (data.Status.Trim().ToUpper() != "NEW")
return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), (int)StatusCodes.Status500InternalServerError);
data.RespondentType = req.respondentType;
// data.xxx = req.xxx;
// data.xxx = req.xxx;
// data.xxx = req.xxx;
// data.xxx = req.xxx;
data.Title = req.title;
data.Description = req.description;
data.DateReceived = req.dateReceived;
data.LevelConsideration = req.levelConsideration;
data.DateConsideration = req.dateConsideration;
data.OffenseDetails = req.offenseDetails;
data.DateNotification = req.dateNotification;
data.ComplaintFrom = req.complaintFrom;
data.Appellant = req.appellant;
data.LastUpdateFullName = FullName ?? "System Administrator";
data.LastUpdateUserId = UserId ?? "";
data.LastUpdatedAt = DateTime.Now;
await _context.SaveChangesAsync();
// if (Request.Form.Files != null && Request.Form.Files.Count != 0)
// {
// var doc = await _documentService.UploadFileAsync(file, file.FileName);
// var _doc = await _context.Documents.AsQueryable()
// .FirstOrDefaultAsync(x => x.Id == doc.Id);
// disciplineComplaint.Document = _doc;
// var _docId = profileDoc.Document.Id;
// await _documentService.DeleteFileAsync(_docId);
// await _context.SaveChangesAsync();
// }
return Success(data);
}
/// <summary>
/// ลบรายการวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpDelete("{id:guid}")]
public async Task<ActionResult<ResponseObject>> DeleteDiscipline(Guid id)
{
var data = await _context.DisciplineComplaints
// .Include(x=>x.Document)
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
if (data == null)
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
_context.DisciplineComplaints.Remove(data);
// var _docId = data.Document.Id;
// await _context.SaveChangesAsync();
// await _documentService.DeleteFileAsync(_docId);
await _context.SaveChangesAsync();
return Success();
}
}
}

View file

@ -0,0 +1,166 @@
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.MessageQueue;
using BMA.EHR.Discipline.Service.Requests;
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Models.Discipline;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
// using BMA.EHR.Placement.Service.Requests;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Swashbuckle.AspNetCore.Annotations;
using System.Security.Claims;
namespace BMA.EHR.DisciplineComplaint_Channel.Service.Controllers
{
[Route("api/v{version:apiVersion}/discipline/complaint_Channel")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("ช่องทางการร้องเรียนระบบวินัย")]
public class DisciplineComplaint_ChannelController : BaseController
{
private readonly DisciplineDbContext _context;
private readonly MinIOService _documentService;
private readonly IHttpContextAccessor _httpContextAccessor;
public DisciplineComplaint_ChannelController(DisciplineDbContext context,
MinIOService documentService,
IHttpContextAccessor httpContextAccessor)
{
// _repository = repository;
_context = context;
_documentService = documentService;
_httpContextAccessor = httpContextAccessor;
}
#region " Properties "
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
#endregion
/// <summary>
/// list รายการช่องทางการร้องเรียนระบบวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetDiscipline(int page = 1, int pageSize = 25, string keyword = "")
{
var data = await _context.DisciplineComplaint_Channels
.Select(x => new
{
Id = x.Id,
Name = x.Name,
})
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToListAsync();
return Success(new { data, total = data.Count() });
}
/// <summary>
/// get รายการช่องทางการร้องเรียนระบบวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("{id:guid}")]
public async Task<ActionResult<ResponseObject>> GetByDiscipline(Guid id)
{
var data = await _context.DisciplineComplaint_Channels
.Select(x => new
{
Id = x.Id,
Name = x.Name,
})
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
if (data == null)
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
return Success(data);
}
/// <summary>
/// สร้างรายการช่องทางการร้องเรียนระบบวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost()]
public async Task<ActionResult<ResponseObject>> CreateDiscipline([FromBody] DisciplineComplaint_ChannelRequest req)
{
var disciplineComplaint_Channel = new Domain.Models.Discipline.DisciplineComplaint_Channel
{
Name = req.name,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
};
await _context.DisciplineComplaint_Channels.AddAsync(disciplineComplaint_Channel);
await _context.SaveChangesAsync();
return Success();
}
/// <summary>
/// แก้ไขรายการช่องทางการร้องเรียนระบบวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("{id:guid}")]
public async Task<ActionResult<ResponseObject>> UpdateDiscipline(Guid id, [FromBody] DisciplineComplaint_ChannelRequest req)
{
var data = await _context.DisciplineComplaint_Channels.Where(x => x.Id == id).FirstOrDefaultAsync();
if (data == null)
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
var dupicateData = await _context.DisciplineComplaint_Channels.Where(x => x.Id != id && x.Name == req.name).FirstOrDefaultAsync();
if (data != null)
return Error(new Exception("ชื่อประเภทนี้มีอยู่ในระบบแล้ว"), (int)StatusCodes.Status400BadRequest);
data.Name = req.name;
data.LastUpdateFullName = FullName ?? "System Administrator";
data.LastUpdateUserId = UserId ?? "";
data.LastUpdatedAt = DateTime.Now;
await _context.SaveChangesAsync();
return Success(data);
}
/// <summary>
/// ลบรายการช่องทางการร้องเรียนระบบวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpDelete("{id:guid}")]
public async Task<ActionResult<ResponseObject>> DeleteDiscipline(Guid id)
{
var data = await _context.DisciplineComplaint_Channels.Where(x => x.Id == id).FirstOrDefaultAsync();
if (data == null)
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
_context.DisciplineComplaint_Channels.Remove(data);
await _context.SaveChangesAsync();
return Success();
}
}
}

View file

@ -0,0 +1,182 @@
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.MessageQueue;
using BMA.EHR.Discipline.Service.Requests;
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Models.Discipline;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
// using BMA.EHR.Placement.Service.Requests;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Swashbuckle.AspNetCore.Annotations;
using System.Security.Claims;
namespace BMA.EHR.DisciplineDirector.Service.Controllers
{
[Route("api/v{version:apiVersion}/discipline/director")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("กรรมการระบบวินัย")]
public class DisciplineDirectorController : BaseController
{
private readonly DisciplineDbContext _context;
private readonly MinIOService _documentService;
private readonly IHttpContextAccessor _httpContextAccessor;
public DisciplineDirectorController(DisciplineDbContext context,
MinIOService documentService,
IHttpContextAccessor httpContextAccessor)
{
// _repository = repository;
_context = context;
_documentService = documentService;
_httpContextAccessor = httpContextAccessor;
}
#region " Properties "
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
#endregion
/// <summary>
/// list รายการกรรมการระบบวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetDiscipline(int page = 1, int pageSize = 25, string keyword = "")
{
var data = await _context.DisciplineDirectors
.Select(x => new
{
Id = x.Id,
// Prefix = x.Prefix,
FirstName = x.FirstName,
LastName = x.LastName,
Position = x.Position,
Email = x.Email,
Phone = x.Phone,
})
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToListAsync();
return Success(new { data, total = data.Count() });
}
/// <summary>
/// get รายการกรรมการระบบวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("{id:guid}")]
public async Task<ActionResult<ResponseObject>> GetByDiscipline(Guid id)
{
var data = await _context.DisciplineDirectors
.Select(x => new
{
Id = x.Id,
// Prefix = x.Prefix,
FirstName = x.FirstName,
LastName = x.LastName,
Position = x.Position,
Email = x.Email,
Phone = x.Phone,
})
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
if (data == null)
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
return Success(data);
}
/// <summary>
/// สร้างรายการกรรมการระบบวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost()]
public async Task<ActionResult<ResponseObject>> CreateDiscipline([FromBody] DisciplineDirectorRequest req)
{
var disciplineDirector = new Domain.Models.Discipline.DisciplineDirector
{
// Prefix = req.Prefix,
FirstName = req.firstName,
LastName = req.lastName,
Position = req.position,
Email = req.email,
Phone = req.phone,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
};
await _context.DisciplineDirectors.AddAsync(disciplineDirector);
await _context.SaveChangesAsync();
return Success();
}
/// <summary>
/// แก้ไขรายการกรรมการระบบวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("{id:guid}")]
public async Task<ActionResult<ResponseObject>> UpdateDiscipline(Guid id, [FromBody] DisciplineDirectorRequest req)
{
var data = await _context.DisciplineDirectors.Where(x => x.Id == id).FirstOrDefaultAsync();
if (data == null)
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
// data.Prefix = req.Prefix;
data.FirstName = req.firstName;
data.LastName = req.lastName;
data.Position = req.position;
data.Email = req.email;
data.Phone = req.phone;
data.LastUpdateFullName = FullName ?? "System Administrator";
data.LastUpdateUserId = UserId ?? "";
data.LastUpdatedAt = DateTime.Now;
await _context.SaveChangesAsync();
return Success(data);
}
/// <summary>
/// ลบรายการกรรมการระบบวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpDelete("{id:guid}")]
public async Task<ActionResult<ResponseObject>> DeleteDiscipline(Guid id)
{
var data = await _context.DisciplineDirectors.Where(x => x.Id == id).FirstOrDefaultAsync();
if (data == null)
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
_context.DisciplineDirectors.Remove(data);
await _context.SaveChangesAsync();
return Success();
}
}
}

View file

@ -0,0 +1,27 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["BMA.EHR.Domain/BMA.EHR.Domain.csproj", "BMA.EHR.Domain/"]
COPY ["BMA.EHR.Application/BMA.EHR.Application.csproj", "BMA.EHR.Application/"]
COPY ["BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj", "BMA.EHR.Infrastructure/"]
COPY ["BMA.EHR.Discipline.Service/BMA.EHR.Discipline.Service.csproj", "BMA.EHR.Discipline.Service/"]
RUN dotnet restore "BMA.EHR.Discipline.Service/BMA.EHR.Discipline.Service.csproj"
COPY . .
WORKDIR "/src/BMA.EHR.Discipline.Service"
RUN dotnet build "BMA.EHR.Discipline.Service.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "BMA.EHR.Discipline.Service.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "BMA.EHR.Discipline.Service.dll"]

View file

@ -0,0 +1,26 @@
@page
@model ErrorModel
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>

View file

@ -0,0 +1,27 @@
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace BMA.EHR.Discipline.Service.Pages;
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
private readonly ILogger<ErrorModel> _logger;
public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}

View file

@ -0,0 +1,10 @@
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>

View file

@ -0,0 +1,19 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace BMA.EHR.Discipline.Service.Pages;
public class IndexModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
public IndexModel(ILogger<IndexModel> logger)
{
_logger = logger;
}
public void OnGet()
{
}
}

View file

@ -0,0 +1,8 @@
@page
@model PrivacyModel
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>

View file

@ -0,0 +1,19 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace BMA.EHR.Discipline.Service.Pages;
public class PrivacyModel : PageModel
{
private readonly ILogger<PrivacyModel> _logger;
public PrivacyModel(ILogger<PrivacyModel> logger)
{
_logger = logger;
}
public void OnGet()
{
}
}

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - BMA.EHR.Discipline.Service</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/BMA.EHR.Discipline.Service.styles.css" asp-append-version="true" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container">
<a class="navbar-brand" asp-area="" asp-page="/Index">BMA.EHR.Discipline.Service</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2023 - BMA.EHR.Discipline.Service - <a asp-area="" asp-page="/Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>

View file

@ -0,0 +1,48 @@
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
for details on configuring this project to bundle and minify static web assets. */
a.navbar-brand {
white-space: normal;
text-align: center;
word-break: break-all;
}
a {
color: #0077cc;
}
.btn-primary {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.border-top {
border-top: 1px solid #e5e5e5;
}
.border-bottom {
border-bottom: 1px solid #e5e5e5;
}
.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}
button.accept-policy {
font-size: 1rem;
line-height: inherit;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
white-space: nowrap;
line-height: 60px;
}

View file

@ -0,0 +1,2 @@
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>

View file

@ -0,0 +1,3 @@
@using BMA.EHR.Discipline.Service
@namespace BMA.EHR.Discipline.Service.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View file

@ -0,0 +1,3 @@
@{
Layout = "_Layout";
}

View file

@ -0,0 +1,164 @@
using BMA.EHR.Application;
using BMA.EHR.Discipline.Service;
using BMA.EHR.Domain.Middlewares;
using BMA.EHR.Infrastructure;
using BMA.EHR.Infrastructure.Persistence;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Versioning;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Logging;
using Microsoft.IdentityModel.Tokens;
using Serilog;
using Serilog.Exceptions;
using Serilog.Sinks.Elasticsearch;
using System.Reflection;
using System.Text;
var builder = WebApplication.CreateBuilder(args);
{
var issuer = builder.Configuration["Jwt:Issuer"];
var key = builder.Configuration["Jwt:Key"];
IdentityModelEventSource.ShowPII = true;
builder.Services.AddHttpContextAccessor();
builder.Services.AddApiVersioning(opt =>
{
opt.DefaultApiVersion = new ApiVersion(1, 0);
opt.AssumeDefaultVersionWhenUnspecified = true;
opt.ReportApiVersions = true;
opt.ApiVersionReader = ApiVersionReader.Combine(new UrlSegmentApiVersionReader(),
new HeaderApiVersionReader("x-api-version"),
new MediaTypeApiVersionReader("x-api-version"));
});
builder.Services.AddVersionedApiExplorer(setup =>
{
setup.GroupNameFormat = "'v'VVV";
setup.SubstituteApiVersionInUrl = true;
});
builder.Services.AddEndpointsApiExplorer();
// Authorization
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(opt =>
{
opt.SaveToken = true;
opt.RequireHttpsMetadata = false; //false for dev
opt.Authority = issuer;
opt.TokenValidationParameters = new()
{
ValidateIssuer = true,
ValidateAudience = false,
ValidateLifetime = true,
ValidateIssuerSigningKey = true,
ValidIssuer = issuer,
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(key))
};
});
builder.Services.AddAuthorization();
// use serilog
ConfigureLogs();
builder.Host.UseSerilog();
// Add config CORS
builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
{
builder
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.SetIsOriginAllowedToAllowWildcardSubdomains();
}));
// Add services to the container.
builder.Services.AddApplication();
builder.Services.AddDisciplineApplication();
builder.Services.AddPersistence(builder.Configuration);
builder.Services.AddDisciplinePersistence(builder.Configuration);
builder.Services.AddControllers(options =>
{
options.SuppressAsyncSuffixInActionNames = false;
})
.AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
builder.Services.AddSwaggerGen();
builder.Services.ConfigureOptions<ConfigureSwaggerOptions>();
builder.Services.AddHealthChecks();
}
var app = builder.Build();
{
var apiVersionDescriptionProvider = app.Services.GetRequiredService<IApiVersionDescriptionProvider>();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(options =>
{
foreach (var description in apiVersionDescriptionProvider.ApiVersionDescriptions)
{
options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json",
description.GroupName.ToUpperInvariant());
}
});
}
app.MapHealthChecks("/health");
app.UseHttpsRedirection();
app.UseCors();
app.UseAuthentication();
app.UseAuthorization();
app.UseDefaultFiles();
app.UseStaticFiles();
app.MapControllers();
app.UseMiddleware<ErrorHandlerMiddleware>();
// apply migrations
await using var scope = app.Services.CreateAsyncScope();
await using var db = scope.ServiceProvider.GetRequiredService<DisciplineDbContext>();
await db.Database.MigrateAsync();
app.Run();
}
void ConfigureLogs()
{
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
var configuration = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile(
$"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json",
optional: true)
.Build();
Log.Logger = new LoggerConfiguration()
.Enrich.FromLogContext()
.MinimumLevel.Error()
.WriteTo.Console()
.Enrich.WithExceptionDetails()
.WriteTo.Elasticsearch(ConfigureElasticSink(configuration, environment ?? ""))
.Enrich.WithProperty("Environment", environment)
.ReadFrom.Configuration(configuration)
.CreateLogger();
}
ElasticsearchSinkOptions ConfigureElasticSink(IConfigurationRoot configuration, string environment)
{
return new ElasticsearchSinkOptions(new Uri(configuration["ElasticConfiguration:Uri"] ?? ""))
{
AutoRegisterTemplate = true,
IndexFormat = $"{Assembly.GetExecutingAssembly()?.GetName()?.Name?.ToLower().Replace(".", "-")}-{environment?.ToLower().Replace(".", "-")}"
};
}

View file

@ -0,0 +1,37 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:34365",
"sslPort": 44368
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5180",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7097;http://localhost:5180",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View file

@ -0,0 +1,24 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Discipline.Service.Requests
{
public class DisciplineComplaintRequest
{
public string respondentType { get; set; }// *ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)
// public Array personId { get; set; }// กรณีบุคคลใส่ id คน มาใน array แต่ถ้าเป็น type อื่นจะ null
// public Guid organizationId { get; set; }// กรณีหน่วยงานใส่ id ของหน่วยงาน
// public Array[Guid, Guid] respondentId { get; set; }// *ถ้าเป็นบุคคลคือ id ของบุคคล / ถ้าหน่วยงาน คือ id ของหน่วยงาน / กรุงเทพมหานคร คือ null
// public Guid consideredAgency { get; set; }// *หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
public string title { get; set; }// *เรื่องที่ร้องเรียน
public string description { get; set; }// *รายละเอียดของเรื่องร้องเรียน
public DateTime dateReceived { get; set; }// *วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ
public string levelConsideration { get; set; }// *ระดับการพิจารณา "ยังไม่ระบุ" (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)
public DateTime? dateConsideration { get; set; }// วันที่กำหนดพิจารณา
public string offenseDetails { get; set; }// *ลักษณะความผิดครั้งแรกจะเป็น "ยังไม่ระบุ" (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)
public DateTime dateNotification { get; set; }//*วันแจ้งเตือนล่วงหน้า
public string complaintFrom { get; set; }//*รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)
public string appellant { get; set; }//*ผู้ร้องเรียน
public FormFile documentFile { get; set; }//*ไฟล์เอกสารหลักฐาน
}
}

View file

@ -0,0 +1,10 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Discipline.Service.Requests
{
public class DisciplineComplaint_ChannelRequest
{
public string name { get; set; }
}
}

View file

@ -0,0 +1,15 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Discipline.Service.Requests
{
public class DisciplineDirectorRequest
{
// public Guid prefix { get; set; }
public string firstName { get; set; }
public string lastName { get; set; }
public string position { get; set; }
public string email { get; set; }
public string phone { get; set; }
}
}

View file

@ -0,0 +1,9 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View file

@ -0,0 +1,42 @@
{
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Information",
"System": "Warning"
}
}
},
"ElasticConfiguration": {
"Uri": "http://localhost:9200"
},
"AllowedHosts": "*",
"ConnectionStrings": {
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"ExamConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"LeaveConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_leave_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"DisciplineConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_discipline_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"Issuer": "https://id.frappet.synology.me/realms/bma-ehr"
},
"EPPlus": {
"ExcelPackage": {
"LicenseContext": "NonCommercial"
}
},
"MinIO": {
"Endpoint": "https://s3cluster.frappet.com/",
"AccessKey": "frappet",
"SecretKey": "FPTadmin2357",
"BucketName": "bma-ehr-fpt"
},
"KeycloakCron": {
"Hour": "08",
"Minute": "00"
},
"Protocol": "HTTPS"
}

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="private_nuget" value="https://nuget.frappet.synology.me/v3/index.json" />
</packageSources>
</configuration>

View file

@ -0,0 +1,184 @@
<!--
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
~ and other contributors as indicated by the @author tags.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<html>
<head>
<script src="./keycloak.js"></script>
</head>
<body>
<div>
<button onclick="keycloak.login()">Login</button>
<button onclick="keycloak.login({ action: 'UPDATE_PASSWORD' })">Update Password</button>
<button onclick="keycloak.logout()">Logout</button>
<button onclick="keycloak.register()">Register</button>
<button onclick="keycloak.accountManagement()">Account</button>
<button onclick="refreshToken(9999)">Refresh Token</button>
<button onclick="refreshToken(30)">Refresh Token (if <30s validity)</button>
<button onclick="loadProfile()">Get Profile</button>
<button onclick="updateProfile()">Update profile</button>
<button onclick="loadUserInfo()">Get User Info</button>
<button onclick="output(keycloak.tokenParsed)">Show Token</button>
<button onclick="output(keycloak.refreshTokenParsed)">Show Refresh Token</button>
<button onclick="output(keycloak.idTokenParsed)">Show ID Token</button>
<button onclick="showExpires()">Show Expires</button>
<button onclick="output(keycloak)">Show Details</button>
<button onclick="output(keycloak.createLoginUrl())">Show Login URL</button>
<button onclick="output(keycloak.createLogoutUrl())">Show Logout URL</button>
<button onclick="output(keycloak.createRegisterUrl())">Show Register URL</button>
<button onclick="output(keycloak.createAccountUrl())">Show Account URL</button>
</div>
<h2>Result</h2>
<pre style="background-color: #ddd; border: 1px solid #ccc; padding: 10px; word-wrap: break-word; white-space: pre-wrap;" id="output"></pre>
<h2>Events</h2>
<pre style="background-color: #ddd; border: 1px solid #ccc; padding: 10px; word-wrap: break-word; white-space: pre-wrap;" id="events"></pre>
<script>
function loadProfile() {
keycloak.loadUserProfile().success(function(profile) {
output(profile);
}).error(function() {
output('Failed to load profile');
});
}
function updateProfile() {
var url = keycloak.createAccountUrl().split('?')[0];
var req = new XMLHttpRequest();
req.open('POST', url, true);
req.setRequestHeader('Accept', 'application/json');
req.setRequestHeader('Content-Type', 'application/json');
req.setRequestHeader('Authorization', 'bearer ' + keycloak.token);
req.onreadystatechange = function () {
if (req.readyState == 4) {
if (req.status == 200) {
output('Success');
} else {
output('Failed');
}
}
}
req.send('{"email":"myemail@foo.bar","firstName":"test","lastName":"bar"}');
}
function loadUserInfo() {
keycloak.loadUserInfo().success(function(userInfo) {
output(userInfo);
}).error(function() {
output('Failed to load user info');
});
}
function refreshToken(minValidity) {
keycloak.updateToken(minValidity).then(function(refreshed) {
if (refreshed) {
output(keycloak.tokenParsed);
} else {
output('Token not refreshed, valid for ' + Math.round(keycloak.tokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds');
}
}).catch(function() {
output('Failed to refresh token');
});
}
function showExpires() {
if (!keycloak.tokenParsed) {
output("Not authenticated");
return;
}
var o = 'Token Expires:\t\t' + new Date((keycloak.tokenParsed.exp + keycloak.timeSkew) * 1000).toLocaleString() + '\n';
o += 'Token Expires in:\t' + Math.round(keycloak.tokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds\n';
if (keycloak.refreshTokenParsed) {
o += 'Refresh Token Expires:\t' + new Date((keycloak.refreshTokenParsed.exp + keycloak.timeSkew) * 1000).toLocaleString() + '\n';
o += 'Refresh Expires in:\t' + Math.round(keycloak.refreshTokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds';
}
output(o);
}
function output(data) {
if (typeof data === 'object') {
data = JSON.stringify(data, null, ' ');
}
document.getElementById('output').innerHTML = data;
}
function event(event) {
var e = document.getElementById('events').innerHTML;
document.getElementById('events').innerHTML = new Date().toLocaleString() + "\t" + event + "\n" + e;
}
var keycloak = Keycloak();
keycloak.onAuthSuccess = function () {
event('Auth Success');
};
keycloak.onAuthError = function (errorData) {
event("Auth Error: " + JSON.stringify(errorData) );
};
keycloak.onAuthRefreshSuccess = function () {
event('Auth Refresh Success');
};
keycloak.onAuthRefreshError = function () {
event('Auth Refresh Error');
};
keycloak.onAuthLogout = function () {
event('Auth Logout');
};
keycloak.onTokenExpired = function () {
event('Access token expired.');
};
keycloak.onActionUpdate = function (status) {
switch (status) {
case 'success':
event('Action completed successfully'); break;
case 'cancelled':
event('Action cancelled by user'); break;
case 'error':
event('Action failed'); break;
}
};
// Flow can be changed to 'implicit' or 'hybrid', but then client must enable implicit flow in admin console too
var initOptions = {
responseMode: 'fragment',
flow: 'standard'
};
keycloak.init(initOptions).then(function(authenticated) {
output('Init Success (' + (authenticated ? 'Authenticated' : 'Not Authenticated') + ')');
}).catch(function() {
output('Init Error');
});
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,7 @@
{
"realm": "bma-ehr",
"auth-server-url": "https://id.frappet.synology.me",
"ssl-required": "external",
"resource": "bma-ehr",
"public-client": true
}

View file

@ -0,0 +1,45 @@
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Domain.Models.Base;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Domain.Models.Discipline
{
public class DisciplineComplaint : EntityBase
{
[Required, Comment("สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)")]
public string Status { get; set; } = string.Empty;
[Required, Comment("ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)")]
public string RespondentType { get; set; } = string.Empty;
[Required, Comment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง")]
public string ConsideredAgency { get; set; } = string.Empty;
[Required, Comment("เรื่องที่ร้องเรียน")]
public string Title { get; set; } = string.Empty;
[Required, Comment("รายละเอียดของเรื่องร้องเรียน")]
public string Description { get; set; } = string.Empty;
[Required, Comment("วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ")]
public DateTime DateReceived { get; set; }
[Required, Comment("ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)")]
public string LevelConsideration { get; set; } = string.Empty;
[Comment("วันที่กำหนดพิจารณา")]
public DateTime? DateConsideration { get; set; }
[Required, Comment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)")]
public string OffenseDetails { get; set; } = string.Empty;
[Required, Comment("วันแจ้งเตือนล่วงหน้า")]
public DateTime DateNotification { get; set; }
[Required, Comment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)")]
public string ComplaintFrom { get; set; } = string.Empty;
[Required, Comment("ผู้ร้องเรียน")]
public string Appellant { get; set; } = string.Empty;
// [Required, Comment("อ้างอิงรหัสเอกสาร")]
// public Document Document { get; set; }
}
}

View file

@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Domain.Models.Base;
using BMA.EHR.Domain.Models.Documents;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Domain.Models.Discipline
{
public class DisciplineComplaint_Channel : EntityBase
{
[Required, Comment("ชื่อประเภทการร้องเรียน")]
public string Name { get; set; } = string.Empty;
}
}

View file

@ -0,0 +1,28 @@
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Domain.Models.Base;
using BMA.EHR.Domain.Models.Documents;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Domain.Models.Discipline
{
public class DisciplineDirector : EntityBase
{
// [Comment("คำนำหน้าชื่อ")]
// public Guid Prefix { get; set; }
[Required, Comment("ชื่อ")]
public string FirstName { get; set; } = string.Empty;
[Required, Comment("นามสกุล")]
public string LastName { get; set; } = string.Empty;
[Required, Comment("ตำแหน่ง")]
public string Position { get; set; } = string.Empty;
[Required, Comment("อีเมล")]
public string Email { get; set; } = string.Empty;
[Required, Comment("เบอร์โทรศัพท์")]
public string Phone { get; set; } = string.Empty;
}
}

View file

@ -12,7 +12,7 @@ namespace BMA.EHR.Infrastructure
public static IServiceCollection AddLeavePersistence(this IServiceCollection services,
IConfiguration configuration)
{
// leave db context
var connectionStringLeave = configuration.GetConnectionString("LeaveConnection");
@ -32,6 +32,28 @@ namespace BMA.EHR.Infrastructure
return services;
}
public static IServiceCollection AddDisciplinePersistence(this IServiceCollection services,
IConfiguration configuration)
{
// discipline db context
var connectionStringDiscipline = configuration.GetConnectionString("DisciplineConnection");
services.AddDbContext<DisciplineDbContext>(options =>
options.UseMySql(connectionStringDiscipline, ServerVersion.AutoDetect(connectionStringDiscipline),
b =>
{
b.MigrationsAssembly(typeof(DisciplineDbContext).Assembly.FullName);
b.MigrationsHistoryTable("__DisciplineMigrationsHistory");
}),
ServiceLifetime.Transient);
services.AddScoped<IDisciplineDbContext>(provider => provider.GetService<DisciplineDbContext>());
return services;
}
public static IServiceCollection AddPersistence(this IServiceCollection services,
IConfiguration configuration)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,122 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class createtableDisciplineComplaint : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "InsigniaTypes",
type: "varchar(50)",
maxLength: 50,
nullable: false,
comment: "ชื่อประเภทเครื่องราช",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldComment: "ชื่อประเภทเครื่องราชย์")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ShortName",
table: "Insignias",
type: "varchar(30)",
maxLength: 30,
nullable: false,
comment: "ชื่อย่อเครื่องราช",
oldClrType: typeof(string),
oldType: "varchar(30)",
oldMaxLength: 30,
oldComment: "ชื่อย่อเครื่องราชย์")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Insignias",
type: "varchar(100)",
maxLength: 100,
nullable: false,
comment: "ชื่อเครื่องราช",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldComment: "ชื่อเครื่องราชย์")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<int>(
name: "Level",
table: "Insignias",
type: "int",
nullable: false,
comment: "ลำดับชั้นของเครื่องราช เอาไว้ตรวจสอบเวลาขอว่าต้องได้ชั้นที่สูงกว่าที่เคยได้รับแล้วเท่านั้น",
oldClrType: typeof(int),
oldType: "int",
oldComment: "ลำดับชั้นของเครื่องราชย์ เอาไว้ตรวจสอบเวลาขอว่าต้องได้ชั้นที่สูงกว่าที่เคยได้รับแล้วเท่านั้น");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "InsigniaTypes",
type: "varchar(50)",
maxLength: 50,
nullable: false,
comment: "ชื่อประเภทเครื่องราชย์",
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldComment: "ชื่อประเภทเครื่องราช")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ShortName",
table: "Insignias",
type: "varchar(30)",
maxLength: 30,
nullable: false,
comment: "ชื่อย่อเครื่องราชย์",
oldClrType: typeof(string),
oldType: "varchar(30)",
oldMaxLength: 30,
oldComment: "ชื่อย่อเครื่องราช")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Insignias",
type: "varchar(100)",
maxLength: 100,
nullable: false,
comment: "ชื่อเครื่องราชย์",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldComment: "ชื่อเครื่องราช")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<int>(
name: "Level",
table: "Insignias",
type: "int",
nullable: false,
comment: "ลำดับชั้นของเครื่องราชย์ เอาไว้ตรวจสอบเวลาขอว่าต้องได้ชั้นที่สูงกว่าที่เคยได้รับแล้วเท่านั้น",
oldClrType: typeof(int),
oldType: "int",
oldComment: "ลำดับชั้นของเครื่องราช เอาไว้ตรวจสอบเวลาขอว่าต้องได้ชั้นที่สูงกว่าที่เคยได้รับแล้วเท่านั้น");
}
}
}

View file

@ -6610,14 +6610,14 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Property<int>("Level")
.HasColumnType("int")
.HasColumnOrder(4)
.HasComment("ลำดับชั้นของเครื่องราชย์ เอาไว้ตรวจสอบเวลาขอว่าต้องได้ชั้นที่สูงกว่าที่เคยได้รับแล้วเท่านั้น");
.HasComment("ลำดับชั้นของเครื่องราช เอาไว้ตรวจสอบเวลาขอว่าต้องได้ชั้นที่สูงกว่าที่เคยได้รับแล้วเท่านั้น");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnOrder(1)
.HasComment("ชื่อเครื่องราชย์");
.HasComment("ชื่อเครื่องราช");
b.Property<string>("Note")
.IsRequired()
@ -6630,7 +6630,7 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasMaxLength(30)
.HasColumnType("varchar(30)")
.HasColumnOrder(2)
.HasComment("ชื่อย่อเครื่องราชย์");
.HasComment("ชื่อย่อเครื่องราช");
b.HasKey("Id");
@ -6696,7 +6696,7 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnOrder(1)
.HasComment("ชื่อประเภทเครื่องราชย์");
.HasComment("ชื่อประเภทเครื่องราช");
b.HasKey("Id");

View file

@ -0,0 +1,83 @@
// <auto-generated />
using System;
using BMA.EHR.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
[DbContext(typeof(DisciplineDbContext))]
[Migration("20231117102708_create table DisciplineComplaint1")]
partial class createtableDisciplineComplaint1
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.DisciplineComplaint", 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<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>("RespondentType")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("DisciplineComplaints");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,49 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
/// <inheritdoc />
public partial class createtableDisciplineComplaint1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "DisciplineComplaints",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
RespondentType = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineComplaints", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DisciplineComplaints");
}
}
}

View file

@ -0,0 +1,270 @@
// <auto-generated />
using System;
using BMA.EHR.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
[DbContext(typeof(DisciplineDbContext))]
[Migration("20231117162924_create table DisciplineDirector")]
partial class createtableDisciplineDirector
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("Appellant")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ผู้ร้องเรียน");
b.Property<string>("ComplaintFrom")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)");
b.Property<string>("ConsideredAgency")
.IsRequired()
.HasColumnType("longtext")
.HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง");
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<DateTime?>("DateConsideration")
.HasColumnType("datetime(6)")
.HasComment("วันที่กำหนดพิจารณา");
b.Property<DateTime>("DateNotification")
.HasColumnType("datetime(6)")
.HasComment("วันแจ้งเตือนล่วงหน้า");
b.Property<DateTime>("DateReceived")
.HasColumnType("datetime(6)")
.HasComment("วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext")
.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>("LevelConsideration")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)");
b.Property<string>("OffenseDetails")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)");
b.Property<string>("RespondentType")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เรื่องที่ร้องเรียน");
b.HasKey("Id");
b.ToTable("DisciplineComplaints");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Channel", 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<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()
.HasColumnType("longtext")
.HasComment("ชื่อประเภทการร้องเรียน");
b.HasKey("Id");
b.ToTable("DisciplineComplaint_Channels");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", 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<string>("Email")
.IsRequired()
.HasColumnType("longtext")
.HasComment("อีเมล");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อ");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("longtext")
.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>("Phone")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เบอร์โทรศัพท์");
b.Property<string>("Position")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ตำแหน่ง");
b.HasKey("Id");
b.ToTable("DisciplineDirectors");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,234 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
/// <inheritdoc />
public partial class createtableDisciplineDirector : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "RespondentType",
table: "DisciplineComplaints",
type: "longtext",
nullable: false,
comment: "ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)",
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Appellant",
table: "DisciplineComplaints",
type: "longtext",
nullable: false,
comment: "ผู้ร้องเรียน")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "ComplaintFrom",
table: "DisciplineComplaints",
type: "longtext",
nullable: false,
comment: "รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "ConsideredAgency",
table: "DisciplineComplaints",
type: "longtext",
nullable: false,
comment: "หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<DateTime>(
name: "DateConsideration",
table: "DisciplineComplaints",
type: "datetime(6)",
nullable: true,
comment: "วันที่กำหนดพิจารณา");
migrationBuilder.AddColumn<DateTime>(
name: "DateNotification",
table: "DisciplineComplaints",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันแจ้งเตือนล่วงหน้า");
migrationBuilder.AddColumn<DateTime>(
name: "DateReceived",
table: "DisciplineComplaints",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ");
migrationBuilder.AddColumn<string>(
name: "Description",
table: "DisciplineComplaints",
type: "longtext",
nullable: false,
comment: "รายละเอียดของเรื่องร้องเรียน")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "LevelConsideration",
table: "DisciplineComplaints",
type: "longtext",
nullable: false,
comment: "ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "OffenseDetails",
table: "DisciplineComplaints",
type: "longtext",
nullable: false,
comment: "ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Status",
table: "DisciplineComplaints",
type: "longtext",
nullable: false,
comment: "สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Title",
table: "DisciplineComplaints",
type: "longtext",
nullable: false,
comment: "เรื่องที่ร้องเรียน")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "DisciplineComplaint_Channels",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
Name = table.Column<string>(type: "longtext", nullable: false, comment: "ชื่อประเภทการร้องเรียน")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineComplaint_Channels", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "DisciplineDirectors",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
FirstName = table.Column<string>(type: "longtext", nullable: false, comment: "ชื่อ")
.Annotation("MySql:CharSet", "utf8mb4"),
LastName = table.Column<string>(type: "longtext", nullable: false, comment: "นามสกุล")
.Annotation("MySql:CharSet", "utf8mb4"),
Position = table.Column<string>(type: "longtext", nullable: false, comment: "ตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4"),
Email = table.Column<string>(type: "longtext", nullable: false, comment: "อีเมล")
.Annotation("MySql:CharSet", "utf8mb4"),
Phone = table.Column<string>(type: "longtext", nullable: false, comment: "เบอร์โทรศัพท์")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDirectors", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DisciplineComplaint_Channels");
migrationBuilder.DropTable(
name: "DisciplineDirectors");
migrationBuilder.DropColumn(
name: "Appellant",
table: "DisciplineComplaints");
migrationBuilder.DropColumn(
name: "ComplaintFrom",
table: "DisciplineComplaints");
migrationBuilder.DropColumn(
name: "ConsideredAgency",
table: "DisciplineComplaints");
migrationBuilder.DropColumn(
name: "DateConsideration",
table: "DisciplineComplaints");
migrationBuilder.DropColumn(
name: "DateNotification",
table: "DisciplineComplaints");
migrationBuilder.DropColumn(
name: "DateReceived",
table: "DisciplineComplaints");
migrationBuilder.DropColumn(
name: "Description",
table: "DisciplineComplaints");
migrationBuilder.DropColumn(
name: "LevelConsideration",
table: "DisciplineComplaints");
migrationBuilder.DropColumn(
name: "OffenseDetails",
table: "DisciplineComplaints");
migrationBuilder.DropColumn(
name: "Status",
table: "DisciplineComplaints");
migrationBuilder.DropColumn(
name: "Title",
table: "DisciplineComplaints");
migrationBuilder.AlterColumn<string>(
name: "RespondentType",
table: "DisciplineComplaints",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldComment: "ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

View file

@ -0,0 +1,267 @@
// <auto-generated />
using System;
using BMA.EHR.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
[DbContext(typeof(DisciplineDbContext))]
partial class DisciplineDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("Appellant")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ผู้ร้องเรียน");
b.Property<string>("ComplaintFrom")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)");
b.Property<string>("ConsideredAgency")
.IsRequired()
.HasColumnType("longtext")
.HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง");
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<DateTime?>("DateConsideration")
.HasColumnType("datetime(6)")
.HasComment("วันที่กำหนดพิจารณา");
b.Property<DateTime>("DateNotification")
.HasColumnType("datetime(6)")
.HasComment("วันแจ้งเตือนล่วงหน้า");
b.Property<DateTime>("DateReceived")
.HasColumnType("datetime(6)")
.HasComment("วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext")
.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>("LevelConsideration")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)");
b.Property<string>("OffenseDetails")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)");
b.Property<string>("RespondentType")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เรื่องที่ร้องเรียน");
b.HasKey("Id");
b.ToTable("DisciplineComplaints");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Channel", 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<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()
.HasColumnType("longtext")
.HasComment("ชื่อประเภทการร้องเรียน");
b.HasKey("Id");
b.ToTable("DisciplineComplaint_Channels");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", 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<string>("Email")
.IsRequired()
.HasColumnType("longtext")
.HasComment("อีเมล");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อ");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("longtext")
.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>("Phone")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เบอร์โทรศัพท์");
b.Property<string>("Position")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ตำแหน่ง");
b.HasKey("Id");
b.ToTable("DisciplineDirectors");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,34 @@
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Domain.Models.Discipline;
// using BMA.EHR.Domain.Models.Discipline;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Infrastructure.Persistence
{
public class DisciplineDbContext : DbContext, IDisciplineDbContext
{
#region " Discipline "
public DbSet<DisciplineComplaint> DisciplineComplaints { get; set; }
public DbSet<DisciplineComplaint_Channel> DisciplineComplaint_Channels { get; set; }
public DbSet<DisciplineDirector> DisciplineDirectors { get; set; }
#endregion
public DisciplineDbContext(DbContextOptions<DisciplineDbContext> options) : base(options)
{
}
public Task<int> SaveChangesAsync()
{
return base.SaveChangesAsync();
}
public void Attatch<T>(T entity) where T : class
{
Attach(entity);
}
}
}

View file

@ -146,8 +146,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
Insignia = insignia,
Year = req.Year,
Total = req.Total,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -299,8 +299,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
OrganizationOrganization = organization.OrganizationOrganization,
Total = req.Total,
InsigniaManage = insigniaManage,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -465,8 +465,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
BorrowOrganization = organization.OrganizationOrganization,
BorrowDate = req.BorrowDate,
InsigniaNoteProfile = insigniaNoteProfile,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -180,8 +180,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
EndDate = req.EndDate,
Amount = req.Amount,
IsActive = true,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -1071,8 +1071,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
Organization = org,
RequestStatus = "st1",
RequestNote = "",
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -1090,8 +1090,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
RequestDate = DateTime.Now,
MatchingConditions = System.Text.Json.JsonSerializer.Serialize(new List<dynamic>()), // serialize to string
Salary = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -1164,8 +1164,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
// EndDate = insigniaPeriod.EndDate,
// Amount = insigniaPeriod.Amount,
// ReliefDoc = insigniaPeriod.ReliefDoc,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -1205,8 +1205,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
noreProfileOld.Salary = profileOld.Salary;
noreProfileOld.IsApprove = profileOld.IsApprove;
noreProfileOld.RequestInsignia = profileOld.RequestInsignia;
noreProfileOld.CreatedUserId = UserId ?? "System Administrator";
noreProfileOld.CreatedFullName = FullName ?? "";
noreProfileOld.CreatedFullName = FullName ?? "System Administrator";
noreProfileOld.CreatedUserId = UserId ?? "";
noreProfileOld.CreatedAt = DateTime.Now;
noreProfileOld.LastUpdateFullName = FullName ?? "System Administrator";
noreProfileOld.LastUpdateUserId = UserId ?? "";
@ -1226,8 +1226,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
RequestInsignia = profileOld.RequestInsignia,
OrganizationOrganizationSend = profileOld.Profile == null || profileOld.Profile.OcId == null ? null : FindOCFullPath(profileOld.Profile.OcId.Value, true),
InsigniaNote = insigniaNote,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -1533,8 +1533,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
OrganizationOrganizationReceive = req.OrganizationOrganizationReceive,
OrganizationOrganizationSend = req.OrganizationOrganizationSend,
InsigniaNote = insigniaNote,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -1559,8 +1559,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
// RefCommandNo = req.RefCommandNo,
// RefCommandDate = req.RefCommandDate,
Profile = profile,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -1610,8 +1610,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
// RefCommandNo = req.RefCommandNo,
// RefCommandDate = req.RefCommandDate,
Profile = profile,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -1657,8 +1657,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
Reason = req.Reason,
Document = _doc,
InsigniaNote = insigniaNote,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -1813,8 +1813,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
// RefCommandNo = req.RefCommandNo,
// RefCommandDate = req.RefCommandDate,
Profile = profile.Profile,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -181,8 +181,8 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
var _data = new OrganizationPositionEmployeeLevel
{
PositionEmployeeLevel = await _context.PositionEmployeeLevels.FindAsync(p),
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -196,8 +196,8 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
var _data = new OrganizationPositionEmployeePositionSide
{
PositionEmployeePositionSide = await _context.PositionEmployeePositionSides.FindAsync(p),
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -237,8 +237,8 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
OrganizationShortName = await _context.OrganizationShortNames.FindAsync(req.OrganizationShortNameId),
OrganizationPositionEmployeeLevels = positionEmployeeLevel,
OrganizationPositionEmployeePositionSides = positionEmployeePositionSide,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -269,8 +269,8 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
var _data = new OrganizationPositionEmployeeLevel
{
PositionEmployeeLevel = await _context.PositionEmployeeLevels.FindAsync(p),
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -284,8 +284,8 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
var _data = new OrganizationPositionEmployeePositionSide
{
PositionEmployeePositionSide = await _context.PositionEmployeePositionSides.FindAsync(p),
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -450,8 +450,8 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
OrgEmployee = organizationEmployee,
Profile = profile,
Status = "PENDING",
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -463,8 +463,8 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
{
organizationEmployeeProfile.OrgEmployee = organizationEmployee;
organizationEmployeeProfile.Status = "PENDING";
organizationEmployeeProfile.CreatedUserId = UserId ?? "System Administrator";
organizationEmployeeProfile.CreatedFullName = FullName ?? "";
organizationEmployeeProfile.CreatedFullName = FullName ?? "System Administrator";
organizationEmployeeProfile.CreatedUserId = UserId ?? "";
organizationEmployeeProfile.CreatedAt = DateTime.Now;
organizationEmployeeProfile.LastUpdateFullName = FullName ?? "System Administrator";
organizationEmployeeProfile.LastUpdateUserId = UserId ?? "";

View file

@ -89,8 +89,8 @@ namespace BMA.EHR.Placement.Service.Controllers
IsSendMail = req.IsSendMail,
IsSendInbox = req.IsSendInbox,
ReceiveDate = req.ReceiveDate,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -272,8 +272,8 @@ namespace BMA.EHR.Placement.Service.Controllers
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
PositionDate = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Date,
Status = "WAITTING",
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -296,8 +296,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
PlacementAppointment = placementAppointment,
Document = _doc,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -286,8 +286,8 @@ namespace BMA.EHR.Placement.Service.Controllers
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
PositionDate = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Date,
Status = "WAITTING",
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -310,8 +310,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
PlacementAppointment = placementAppointment,
Document = _doc,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -927,8 +927,8 @@ namespace BMA.EHR.Placement.Service.Controllers
IssueDate = req.IssueDate,
ExpireDate = req.ExpireDate,
CertificateType = req.CertificateType,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -1015,8 +1015,8 @@ namespace BMA.EHR.Placement.Service.Controllers
FinishDate = req.FinishDate,
StartDate = req.StartDate,
EndDate = req.EndDate,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -1236,8 +1236,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
PlacementProfile = placementProfile,
Document = _doc,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -198,8 +198,8 @@ namespace BMA.EHR.Placement.Service.Controllers
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
Status = "WAITTING",
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -247,8 +247,8 @@ namespace BMA.EHR.Placement.Service.Controllers
Relationship = await _context.Relationships.FindAsync(req.RelationshipId),
TelephoneNumber = req.TelephoneNumber,
Status = "WAITTING",
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -290,8 +290,8 @@ namespace BMA.EHR.Placement.Service.Controllers
// {
// PlacementReceive = placementReceive,
// Document = _doc,
// CreatedUserId = UserId ?? "System Administrator",
// CreatedFullName = FullName ?? "",
// CreatedFullName = FullName ?? "System Administrator",
// CreatedUserId = UserId ?? "",
// CreatedAt = DateTime.Now,
// LastUpdateFullName = FullName ?? "System Administrator",
// LastUpdateUserId = UserId ?? "",
@ -353,8 +353,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
PlacementReceive = uppdated,
Document = _doc,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -262,8 +262,8 @@ namespace BMA.EHR.Placement.Service.Controllers
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
Status = "WAITTING",
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -286,8 +286,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
PlacementRelocation = placementRelocation,
Document = _doc,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -198,8 +198,8 @@ namespace BMA.EHR.Placement.Service.Controllers
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
Status = "WAITTING",
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -336,8 +336,8 @@ namespace BMA.EHR.Placement.Service.Controllers
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
Status = "WAITTING",
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -360,8 +360,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
PlacementTransfer = placementTransfer,
Document = _doc,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -337,8 +337,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
Detail = "มาตรา ๑๖ และมาตรา ๒๑ แห่งพระราชบัญญัตบำเหน็จบำนาญข้าราชการส่วนท้องถิ่น พ.ศ.๒๕๗๗ มาตรา ๘ แห่งพระราชบัญญัติบัเหน็จบำนาญข้าราชการกรุงเทพมหานคร พ.ศ.๒๕๕๔ ประกอบกับมติ ก.ก. ครั้งที่๑๑/๒๕๕๕ เมื่อวันที่ ๑๕ พฤศจิกายน ๒๕๕๕และมติ อ.ก.ก. สามัญข้ารายการสามัญครั้งที่ ๑/๒๕๖๕ เมื่อวันที่ ๒๑ กุมภาพันธ์ ๒๕๖๕",
Type = req.Type.Trim().ToUpper(),
Year = req.Year,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -359,8 +359,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
Remove = "PENDING",
RetirementPeriod = retire,
Profile = profile,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -462,8 +462,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
retire.Round = retire.Round + 1;
retire.TypeReport = req.Option.Trim().ToUpper();
retire.SignDate = null;
retire.CreatedUserId = UserId ?? "System Administrator";
retire.CreatedFullName = FullName ?? "";
retire.CreatedFullName = FullName ?? "System Administrator";
retire.CreatedUserId = UserId ?? "";
retire.CreatedAt = DateTime.Now;
retire.LastUpdateFullName = FullName ?? "System Administrator";
retire.LastUpdateUserId = UserId ?? "";
@ -498,8 +498,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
Remove = "PENDING",
RetirementPeriod = retire,
Profile = _profile,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -530,8 +530,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
Remove = "PENDING",
RetirementPeriod = retire,
Profile = profileOld.Profile,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -768,8 +768,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
Remove = "ADD",
RetirementPeriod = retire,
Profile = profile,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -246,8 +246,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
Location = req.Location,
Reason = req.Reason,
IsActive = true,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -277,8 +277,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
CommandTypeName = "-",
SalaryStatus = "DEATH",
Profile = profile,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -292,8 +292,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
CategoryName = "DEATH",
Document = _doc,
Profile = profile,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -329,8 +329,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
OrganizationName = orgPos!.OrganizationPosition!.Organization!.OrganizationOrganization!.Name,
PositionName = orgPos!.OrganizationPosition!.PositionMaster!.PositionPath!.Name,
ReceiveUser = profile,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -483,8 +483,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
OrganizationName = profile.OrganizationOrganization == null ? "" : profile.OrganizationOrganization,
PositionName = profile.Position == null ? null : profile.Position.Name,
ReceiveUser = profile,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -195,8 +195,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
Status = "WAITTING",
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -195,8 +195,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
Status = "WAITTING",
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -278,8 +278,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
PositionLevel = profile.PositionLevel,
// OrganizationPositionId = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
Status = "WAITTING",
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -302,8 +302,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
{
RetirementOther = retirementOther,
Document = _doc,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -195,8 +195,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
Status = "WAITTING",
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -321,8 +321,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
Status = "WAITTING",
IsActive = true,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -345,8 +345,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
{
RetirementResign = retirementResign,
Document = _doc,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
@ -859,8 +859,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
FutureWork = req.FutureWork,
FutureWorkReason = req.FutureWorkReason,
Suggestion = req.Suggestion,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",

View file

@ -27,7 +27,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Retirement.Service"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Report.Service", "BMA.EHR.Report.Service\BMA.EHR.Report.Service.csproj", "{26FE7B1C-771B-4940-9F40-326A7AD53F1C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.Leave.Service", "BMA.EHR.Leave.Service\BMA.EHR.Leave.Service.csproj", "{0F15B902-82D7-4878-B12D-B36C14E8EDBC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Leave.Service", "BMA.EHR.Leave.Service\BMA.EHR.Leave.Service.csproj", "{0F15B902-82D7-4878-B12D-B36C14E8EDBC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.Discipline.Service", "BMA.EHR.Discipline.Service\BMA.EHR.Discipline.Service.csproj", "{0145A11E-7780-437B-A86F-CBDDB50BC3D1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -79,6 +81,10 @@ Global
{0F15B902-82D7-4878-B12D-B36C14E8EDBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F15B902-82D7-4878-B12D-B36C14E8EDBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F15B902-82D7-4878-B12D-B36C14E8EDBC}.Release|Any CPU.Build.0 = Release|Any CPU
{0145A11E-7780-437B-A86F-CBDDB50BC3D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0145A11E-7780-437B-A86F-CBDDB50BC3D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0145A11E-7780-437B-A86F-CBDDB50BC3D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0145A11E-7780-437B-A86F-CBDDB50BC3D1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -96,6 +102,7 @@ Global
{3FFE378C-387F-42EA-96E2-68E63BB295F9} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
{26FE7B1C-771B-4940-9F40-326A7AD53F1C} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
{0F15B902-82D7-4878-B12D-B36C14E8EDBC} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
{0145A11E-7780-437B-A86F-CBDDB50BC3D1} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3111A492-1818-4438-B718-75199D8E779A}