diff --git a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs
index 26f85397..f0a39509 100644
--- a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs
+++ b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs
@@ -9,6 +9,7 @@ using BMA.EHR.Domain.Models.MetaData;
using BMA.EHR.Domain.Models.Notifications;
using BMA.EHR.Domain.Models.Organizations;
using BMA.EHR.Domain.Models.Placement;
+using BMA.EHR.Domain.Models.Retirement;
using BMA.EHR.Domain.Shared;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
@@ -71,10 +72,56 @@ namespace BMA.EHR.Application.Repositories.Commands
switch (command.CommandType.CommandCode.Trim().ToUpper())
{
case "C-PM-01":
- case "C-PM-02":
- case "C-PM-03":
result = await GetReceiver01Async(command);
break;
+ case "C-PM-02":
+ result = await GetReceiver02Async(command);
+ break;
+ case "C-PM-03":
+ result = await GetReceiver03Async(command);
+ break;
+ case "C-PM-04":
+ result = await GetReceiver04Async(command);
+ break;
+ case "C-PM-05":
+ result = await GetReceiver05Async(command);
+ break;
+ case "C-PM-06":
+ result = await GetReceiver06Async(command);
+ break;
+ case "C-PM-07":
+ result = await GetReceiver07Async(command);
+ break;
+ case "C-PM-08":
+ result = await GetReceiver08Async(command);
+ break;
+ case "C-PM-09":
+ result = await GetReceiver09Async(command);
+ break;
+ case "C-PM-13":
+ result = await GetReceiver13Async(command);
+ break;
+ case "C-PM-14":
+ result = await GetReceiver14Async(command);
+ break;
+ case "C-PM-15":
+ result = await GetReceiver15Async(command);
+ break;
+ case "C-PM-16":
+ result = await GetReceiver16Async(command);
+ break;
+ case "C-PM-17":
+ result = await GetReceiver17Async(command);
+ break;
+ case "C-PM-18":
+ result = await GetReceiver18Async(command);
+ break;
+ case "C-PM-19":
+ result = await GetReceiver19Async(command);
+ break;
+ case "C-PM-20":
+ result = await GetReceiver20Async(command);
+ break;
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
}
@@ -82,9 +129,9 @@ namespace BMA.EHR.Application.Repositories.Commands
}
///
- /// C-PM-01
+ /// C-PM-01 - คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้
///
- ///
+ /// object ของรายการคำสั่ง
///
private async Task> GetReceiver01Async(Command command)
{
@@ -97,13 +144,144 @@ namespace BMA.EHR.Application.Repositories.Commands
var otherCommandReceivers = await _dbContext.Set()
.Include(x => x.Command)
.ThenInclude(x => x.CommandType)
- .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper().StartsWith("C-PM"))
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper().StartsWith("C-PM-01"))
.Where(x => x.Command.Id != command.Id)
.Select(x => x.CitizenId)
.ToListAsync();
// 2. Query
var appointPeople = await _dbContext.Set()
+ .Include(x => x.Placement)
+ .ThenInclude(x => x.PlacementType)
+ .Include(x => x.Prefix)
+ .Include(x => x.OrganizationPosition)
+ .ThenInclude(x => x!.Organization)
+ //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
+ .Where(x => !otherCommandReceivers.Contains(x.CitizenId!))
+ .Where(x => x.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN")
+ .Where(x => x.Draft! == true)
+ .Where(x => x.Placement!.PlacementType!.Name == "สอบแข่งขัน")
+ .OrderBy(x => x.ExamNumber)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
+ if (!(await CheckIsActiveOfficerAsync(item.CitizenId!)))
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.CitizenId!,
+ Prefix = item.Prefix!.Name,
+ FirstName = item.Firstname!,
+ LastName = item.Lastname!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+ result.Add(receiver);
+ }
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// C-PM-02 - คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้ได้รับคัดเลือก
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver02Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-02")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.Placement)
+ .ThenInclude(x => x.PlacementType)
+ .Include(x => x.Prefix)
+ .Include(x => x.OrganizationPosition)
+ .ThenInclude(x => x!.Organization)
+ //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
+ .Where(x => !otherCommandReceivers.Contains(x.CitizenId!))
+ .Where(x => x.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN")
+ .Where(x => x.Draft! == true)
+ .Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน")
+ .OrderBy(x => x.ExamNumber)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
+ if (!(await CheckIsActiveOfficerAsync(item.CitizenId!)))
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.CitizenId!,
+ Prefix = item.Prefix!.Name,
+ FirstName = item.Firstname!,
+ LastName = item.Lastname!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+
+ result.Add(receiver);
+ }
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// C-PM-03 - คำสั่งแต่งตั้ง : สำหรับข้าราชการ กทม. เดิม
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver03Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-03")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.Placement)
+ .ThenInclude(x => x.PlacementType)
.Include(x => x.Prefix)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x!.Organization)
@@ -118,7 +296,134 @@ namespace BMA.EHR.Application.Repositories.Commands
var seq = 1;
foreach (var item in appointPeople)
{
+ var profile_oc = await GetProfileOrganizationAsync(item.CitizenId!);
+ if (await CheckIsActiveOfficerAsync(item.CitizenId!))
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.CitizenId!,
+ Prefix = item.Prefix!.Name,
+ FirstName = item.Firstname!,
+ LastName = item.Lastname!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+ result.Add(receiver);
+ }
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// C-PM-04 - คำสั่งย้าย : สำหรับข้าราชการ กทม. เดิม
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver04Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-04")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.Placement)
+ .ThenInclude(x => x.PlacementType)
+ .Include(x => x.Prefix)
+ .Include(x => x.OrganizationPosition)
+ .ThenInclude(x => x!.Organization)
+ .Where(x => !otherCommandReceivers.Contains(x.CitizenId!))
+ .Where(x => x.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN")
+ .Where(x => x.Draft! == true)
+ .OrderBy(x => x.ExamNumber)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
+ var profile_oc = await GetProfileOrganizationAsync(item.CitizenId!);
+ if (await CheckIsActiveOfficerAsync(item.CitizenId!))
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.CitizenId!,
+ Prefix = item.Prefix!.Name,
+ FirstName = item.Firstname!,
+ LastName = item.Lastname!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+
+ result.Add(receiver);
+ }
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// C-PM-05 - คำสั่งแต่งตั้ง
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver05Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-05")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.CommandType)
+ .Include(x => x.Prefix)
+ .Include(x => x.OrganizationPosition)
+ .ThenInclude(x => x!.Organization)
+ //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
+ .Where(x => !otherCommandReceivers.Contains(x.CitizenId!))
+ .Where(x => x.Status.Trim().ToUpper() == "REPORT")
+ .Where(x => x.CommandType!.Id == command.CommandType!.Id)
+ .OrderBy(x => x.CitizenId)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
var receiver = new CommandReceiver
{
Sequence = seq,
@@ -141,6 +446,703 @@ namespace BMA.EHR.Application.Repositories.Commands
}
}
+ ///
+ /// C-PM-06 - คำสั่งเลื่อน
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver06Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-06")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.CommandType)
+ .Include(x => x.Prefix)
+ .Include(x => x.OrganizationPosition)
+ .ThenInclude(x => x!.Organization)
+ //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
+ .Where(x => !otherCommandReceivers.Contains(x.CitizenId!))
+ .Where(x => x.Status.Trim().ToUpper() == "REPORT")
+ .Where(x => x.CommandType!.Id == command.CommandType!.Id)
+ .OrderBy(x => x.CitizenId)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.CitizenId!,
+ Prefix = item.Prefix!.Name,
+ FirstName = item.Firstname!,
+ LastName = item.Lastname!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+
+ result.Add(receiver);
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// C-PM-07 - คำสั่งย้าย
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver07Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-07")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.CommandType)
+ .Include(x => x.Prefix)
+ .Include(x => x.OrganizationPosition)
+ .ThenInclude(x => x!.Organization)
+ //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
+ .Where(x => !otherCommandReceivers.Contains(x.CitizenId!))
+ .Where(x => x.Status.Trim().ToUpper() == "REPORT")
+ .Where(x => x.CommandType!.Id == command.CommandType!.Id)
+ .OrderBy(x => x.CitizenId)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.CitizenId!,
+ Prefix = item.Prefix!.Name,
+ FirstName = item.Firstname!,
+ LastName = item.Lastname!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+
+ result.Add(receiver);
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// C-PM-08 - คำสั่งบรรจุและแต่งตั้งข้าราชการฯ กลับเข้ารับราชการ
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver08Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-08")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.CommandType)
+ .Include(x => x.Prefix)
+ .Include(x => x.OrganizationPosition)
+ .ThenInclude(x => x!.Organization)
+ //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
+ .Where(x => !otherCommandReceivers.Contains(x.CitizenId!))
+ .Where(x => x.Status.Trim().ToUpper() == "REPORT")
+ .Where(x => x.CommandType!.Id == command.CommandType!.Id)
+ .OrderBy(x => x.CitizenId)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.CitizenId!,
+ Prefix = item.Prefix!.Name,
+ FirstName = item.Firstname!,
+ LastName = item.Lastname!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+
+ result.Add(receiver);
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// C-PM-09 - คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver09Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-09")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.CommandType)
+ .Include(x => x.Prefix)
+ .Include(x => x.OrganizationPosition)
+ .ThenInclude(x => x!.Organization)
+ //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
+ .Where(x => !otherCommandReceivers.Contains(x.CitizenId!))
+ .Where(x => x.Status.Trim().ToUpper() == "REPORT")
+ .Where(x => x.CommandType!.Id == command.CommandType!.Id)
+ .OrderBy(x => x.CitizenId)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.CitizenId!,
+ Prefix = item.Prefix!.Name,
+ FirstName = item.Firstname!,
+ LastName = item.Lastname!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+
+ result.Add(receiver);
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// C-PM-13 - คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver13Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-13")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.Profile)
+ .ThenInclude(x => x.Prefix)
+ //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
+ .Where(x => !otherCommandReceivers.Contains(x.Profile!.CitizenId!))
+ .Where(x => x.Status.Trim().ToUpper() == "REPORT")
+ .OrderBy(x => x.Profile!.CitizenId)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.Profile!.CitizenId!,
+ Prefix = item.Profile!.Prefix!.Name,
+ FirstName = item.Profile!.FirstName!,
+ LastName = item.Profile!.LastName!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+
+ result.Add(receiver);
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// C-PM-14 - คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver14Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-14")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.Prefix)
+ .Include(x => x.OrganizationPosition)
+ .ThenInclude(x => x!.Organization)
+ //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
+ .Where(x => !otherCommandReceivers.Contains(x.CitizenId!))
+ .Where(x => x.Status.Trim().ToUpper() == "REPORT")
+ .OrderBy(x => x.CitizenId)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.CitizenId!,
+ Prefix = item.Prefix!.Name,
+ FirstName = item.Firstname!,
+ LastName = item.Lastname!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+
+ result.Add(receiver);
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// C-PM-15 - คำสั่งให้ช่วยราชการ
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver15Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-15")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.Profile)
+ .ThenInclude(x => x.Prefix)
+ //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
+ .Where(x => !otherCommandReceivers.Contains(x.Profile!.CitizenId!))
+ .Where(x => x.Status.Trim().ToUpper() == "REPORT")
+ .OrderBy(x => x.Profile!.CitizenId)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.Profile!.CitizenId!,
+ Prefix = item.Profile!.Prefix!.Name,
+ FirstName = item.Profile!.FirstName!,
+ LastName = item.Profile!.LastName!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+
+ result.Add(receiver);
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// C-PM-16 - คำสั่งส่งตัวกลับ
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver16Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-16")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.Profile)
+ .ThenInclude(x => x.Prefix)
+ //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
+ .Where(x => !otherCommandReceivers.Contains(x.Profile!.CitizenId!))
+ .Where(x => x.Status.Trim().ToUpper() == "REPORT")
+ .OrderBy(x => x.Profile!.CitizenId)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.Profile!.CitizenId!,
+ Prefix = item.Profile!.Prefix!.Name,
+ FirstName = item.Profile!.FirstName!,
+ LastName = item.Profile!.LastName!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+
+ result.Add(receiver);
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// C-PM-17 - คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver17Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-17")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.Profile)
+ .ThenInclude(x => x.Prefix)
+ //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
+ .Where(x => !otherCommandReceivers.Contains(x.Profile!.CitizenId!))
+ .Where(x => x.Status.Trim().ToUpper() == "REPORT")
+ .OrderBy(x => x.Profile!.CitizenId)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.Profile!.CitizenId!,
+ Prefix = item.Profile!.Prefix!.Name,
+ FirstName = item.Profile!.FirstName!,
+ LastName = item.Profile!.LastName!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+
+ result.Add(receiver);
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// C-PM-18 - คำสั่งให้ออกจากราชการ
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver18Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-18")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.Profile)
+ .ThenInclude(x => x.Prefix)
+ //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
+ .Where(x => !otherCommandReceivers.Contains(x.Profile!.CitizenId!))
+ .Where(x => x.Status.Trim().ToUpper() == "REPORT")
+ .OrderBy(x => x.Profile!.CitizenId)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.Profile!.CitizenId!,
+ Prefix = item.Profile!.Prefix!.Name,
+ FirstName = item.Profile!.FirstName!,
+ LastName = item.Profile!.LastName!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+
+ result.Add(receiver);
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// C-PM-19 - คำสั่งปลดออกจากราชการ
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver19Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-19")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.Profile)
+ .ThenInclude(x => x.Prefix)
+ //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
+ .Where(x => !otherCommandReceivers.Contains(x.Profile!.CitizenId!))
+ .Where(x => x.Status.Trim().ToUpper() == "REPORT")
+ .OrderBy(x => x.Profile!.CitizenId)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.Profile!.CitizenId!,
+ Prefix = item.Profile!.Prefix!.Name,
+ FirstName = item.Profile!.FirstName!,
+ LastName = item.Profile!.LastName!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+
+ result.Add(receiver);
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// C-PM-20 - คำสั่งไล่ออกจากราชการ
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver20Async(Command command)
+ {
+ try
+ {
+ var result = new List();
+ // TODO : ต้องมา list คนตามประเภทอีกครั้งนึง
+
+ // 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
+ var otherCommandReceivers = await _dbContext.Set()
+ .Include(x => x.Command)
+ .ThenInclude(x => x.CommandType)
+ .Where(x => x.Command.CommandType.CommandCode.Trim().ToUpper() == "C-PM-20")
+ .Where(x => x.Command.Id != command.Id)
+ .Select(x => x.CitizenId)
+ .ToListAsync();
+
+ // 2. Query
+ var appointPeople = await _dbContext.Set()
+ .Include(x => x.Profile)
+ .ThenInclude(x => x.Prefix)
+ //.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
+ .Where(x => !otherCommandReceivers.Contains(x.Profile!.CitizenId!))
+ .Where(x => x.Status.Trim().ToUpper() == "REPORT")
+ .OrderBy(x => x.Profile!.CitizenId)
+ .ToListAsync();
+
+ // 3. Create new Record
+ var seq = 1;
+ foreach (var item in appointPeople)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = item.Profile!.CitizenId!,
+ Prefix = item.Profile!.Prefix!.Name,
+ FirstName = item.Profile!.FirstName!,
+ LastName = item.Profile!.LastName!,
+ RefPlacementProfileId = item.Id
+ };
+ seq++;
+
+ result.Add(receiver);
+ }
+
+ return result;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
#endregion
#region " Execute and Deploy "
@@ -151,15 +1153,20 @@ namespace BMA.EHR.Application.Repositories.Commands
{
case "C-PM-01":
case "C-PM-02":
- case "C-PM-03":
- await ExecuteCommand01Async(command);
+ await ExecuteCommand01_02Async(command);
break;
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
}
}
- private async Task ExecuteCommand01Async(Command command)
+ ///
+ /// C-PM-01 - คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้,
+ /// C-PM-02 - คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้ได้รับคัดเลือก
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task ExecuteCommand01_02Async(Command command)
{
try
{
diff --git a/BMA.EHR.Application/Repositories/GenericRepository.cs b/BMA.EHR.Application/Repositories/GenericRepository.cs
index 29354dc1..44503ad2 100644
--- a/BMA.EHR.Application/Repositories/GenericRepository.cs
+++ b/BMA.EHR.Application/Repositories/GenericRepository.cs
@@ -1,5 +1,7 @@
-using BMA.EHR.Application.Common.Interfaces;
+using Amazon.S3.Model.Internal.MarshallTransformations;
+using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Domain.Models.Base;
+using BMA.EHR.Domain.Models.HR;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using System.Security.Claims;
@@ -13,7 +15,7 @@ namespace BMA.EHR.Application.Repositories
private readonly IApplicationDBContext _dbContext;
private readonly DbSet _dbSet;
private readonly IHttpContextAccessor _httpContextAccessor;
-
+
#endregion
#region " Constructor and Destructor "
@@ -24,7 +26,7 @@ namespace BMA.EHR.Application.Repositories
_dbContext = dbContext;
_dbSet = _dbContext.Set();
_httpContextAccessor = httpContextAccessor;
-
+
}
#endregion
@@ -35,12 +37,46 @@ namespace BMA.EHR.Application.Repositories
protected string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
- protected bool? IsPlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
+ protected bool? IsPlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
#endregion
#region " Methods "
+ public async Task GetProfileOrganizationAsync(string citizenId)
+ {
+ try
+ {
+ var pf = await _dbContext.Set()
+ .Where(x => x.CitizenId == citizenId)
+ .Where(x => x.ProfileType.ToLower().Trim() == "officer" && x.IsActive && !x.IsLeave)
+ .FirstOrDefaultAsync();
+
+ return pf == null || pf.Oc == null ? Guid.Empty : pf.OcId!.Value;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ public async Task CheckIsActiveOfficerAsync(string citizenId)
+ {
+ try
+ {
+ var pf = await _dbContext.Set()
+ .Where(x => x.CitizenId == citizenId)
+ .Where(x => x.ProfileType.ToLower().Trim() == "officer" && x.IsActive && !x.IsLeave)
+ .FirstOrDefaultAsync();
+
+ return pf != null;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
public virtual async Task> GetAllAsync()
{
return await _dbSet.ToListAsync();
diff --git a/BMA.EHR.Command.Service/Controllers/OrderController.cs b/BMA.EHR.Command.Service/Controllers/OrderController.cs
index 7388b71a..88b79589 100644
--- a/BMA.EHR.Command.Service/Controllers/OrderController.cs
+++ b/BMA.EHR.Command.Service/Controllers/OrderController.cs
@@ -2484,6 +2484,10 @@ namespace BMA.EHR.Command.Service.Controllers
{
try
{
+ var command = await _repository.GetByIdAsync(orderId);
+ if (command == null)
+ throw new Exception(GlobalMessages.CommandNotFound);
+
// TODO : หาค่า Education มาแสดง
var existed = await _repository.GetReceiverByCommmandIdAsync(orderId);
@@ -2500,13 +2504,25 @@ namespace BMA.EHR.Command.Service.Controllers
Education = "" // ยังหาไม่เจอว่าอยุ่ field ไหน
}).ToList();
- foreach (var r in receivers)
+ // ให้ Update Salary เฉพาะของ Command 01-04
+ switch (command.CommandType.CommandCode.ToUpper())
{
- var salary = await _repository.GetPlacementSalaryAsync(r.RefRecordId);
-
- r.SalaryAmount = salary.SalaryAmount;
- r.PositionSalaryAmount = salary.PositionSalaryAmount;
- r.MonthSalaryAmount = salary.MonthSalaryAmount;
+ case "C-PM-01":
+ case "C-PM-02":
+ case "C-PM-03":
+ case "c-PM-04":
+ {
+ foreach (var r in receivers)
+ {
+ var salary = await _repository.GetPlacementSalaryAsync(r.RefRecordId);
+ r.SalaryAmount = salary.SalaryAmount;
+ r.PositionSalaryAmount = salary.PositionSalaryAmount;
+ r.MonthSalaryAmount = salary.MonthSalaryAmount;
+ }
+ }
+ break;
+ default:
+ break;
}
return Success(receivers);
@@ -2534,8 +2550,12 @@ namespace BMA.EHR.Command.Service.Controllers
{
try
{
+ var command = await _repository.GetByIdAsync(orderId);
+ if (command == null)
+ throw new Exception(GlobalMessages.CommandNotFound);
+
var receivers = (await _repository.GetReceiverByCommmandIdAsync(orderId))
- .OrderBy(x => x.Sequence)
+ .OrderBy(x => x.Sequence)
.Select(r => new CommandReceiverResponse
{
RefRecordId = r.RefPlacementProfileId!.Value,
@@ -2547,13 +2567,24 @@ namespace BMA.EHR.Command.Service.Controllers
Education = "" // ยังหาไม่เจอว่าอยุ่ field ไหน
}).ToList();
- foreach (var r in receivers)
+ // ให้ Update Salary เฉพาะของ Command 01-04
+ switch (command.CommandType.CommandCode.ToUpper())
{
- var salary = await _repository.GetPlacementSalaryAsync(r.RefRecordId);
-
- r.SalaryAmount = salary.SalaryAmount;
- r.PositionSalaryAmount = salary.PositionSalaryAmount;
- r.MonthSalaryAmount = salary.MonthSalaryAmount;
+ case "C-PM-01":
+ case "C-PM-02":
+ case "C-PM-03":
+ case "c-PM-04":
+ {
+ foreach (var r in receivers)
+ {
+ var salary = await _repository.GetPlacementSalaryAsync(r.RefRecordId);
+ r.SalaryAmount = salary.SalaryAmount;
+ r.PositionSalaryAmount = salary.PositionSalaryAmount;
+ r.MonthSalaryAmount = salary.MonthSalaryAmount;
+ }
+ break;
+ }
+ default: break;
}
return Success(receivers);
diff --git a/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj b/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj
index 81eba980..0d1ad60c 100644
--- a/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj
+++ b/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj
@@ -11,6 +11,10 @@
BMA.EHR.Report.Service
+
+
+
+
@@ -29,7 +33,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
@@ -42,6 +46,7 @@
+
diff --git a/BMA.EHR.Report.Service/ConfigureSwaggerOptions.cs b/BMA.EHR.Report.Service/ConfigureSwaggerOptions.cs
index 18f4a719..17919338 100644
--- a/BMA.EHR.Report.Service/ConfigureSwaggerOptions.cs
+++ b/BMA.EHR.Report.Service/ConfigureSwaggerOptions.cs
@@ -1,4 +1,5 @@
-using Microsoft.AspNetCore.Mvc.ApiExplorer;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.Extensions.Options;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
@@ -19,6 +20,9 @@ namespace BMA.EHR.Report.Service
public void Configure(SwaggerGenOptions options)
{
// add swagger document for every API version discovered
+
+
+
foreach (var description in _provider.ApiVersionDescriptions)
{
options.EnableAnnotations();
@@ -26,8 +30,9 @@ namespace BMA.EHR.Report.Service
options.SwaggerDoc(
description.GroupName,
CreateVersionInfo(description));
- }
+
+ }
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
In = ParameterLocation.Header,
diff --git a/BMA.EHR.Report.Service/Controllers/InsigniaReportController.cs b/BMA.EHR.Report.Service/Controllers/InsigniaReportController.cs
index c6136721..dd9b8c83 100644
--- a/BMA.EHR.Report.Service/Controllers/InsigniaReportController.cs
+++ b/BMA.EHR.Report.Service/Controllers/InsigniaReportController.cs
@@ -1,15 +1,7 @@
using BMA.EHR.Domain.Common;
-using BMA.EHR.Domain.Extensions;
-using BMA.EHR.Domain.Shared;
-using BMA.EHR.Application.Repositories.Reports;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using Swashbuckle.AspNetCore.Annotations;
-using DocumentFormat.OpenXml.Drawing;
-using Telerik.Reporting;
-using Telerik.Reporting.Processing;
-using System.IO;
namespace BMA.EHR.Report.Service.Controllers
{
diff --git a/BMA.EHR.Report.Service/OpenApiIgnoreFilter.cs b/BMA.EHR.Report.Service/OpenApiIgnoreFilter.cs
new file mode 100644
index 00000000..6a7aa28d
--- /dev/null
+++ b/BMA.EHR.Report.Service/OpenApiIgnoreFilter.cs
@@ -0,0 +1,31 @@
+using Microsoft.AspNetCore.Mvc.Controllers;
+using Microsoft.OpenApi.Models;
+using NSwag.Annotations;
+using Swashbuckle.AspNetCore.SwaggerGen;
+using System.Reflection;
+
+namespace BMA.EHR.Report.Service
+{
+ public class OpenApiIgnoreFilter: IDocumentFilter
+ {
+ public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
+ {
+ foreach (var apiDescription in context.ApiDescriptions)
+ {
+ var actionDescriptor = apiDescription.ActionDescriptor as ControllerActionDescriptor;
+ if (actionDescriptor != null)
+ {
+ var ignoreAttribute = actionDescriptor.MethodInfo.GetCustomAttribute();
+ if (ignoreAttribute != null)
+ {
+ var routeKey = "/" + apiDescription.RelativePath.TrimEnd('/');
+ if (swaggerDoc.Paths.ContainsKey(routeKey))
+ {
+ swaggerDoc.Paths.Remove(routeKey);
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/BMA.EHR.Report.Service/Program.cs b/BMA.EHR.Report.Service/Program.cs
index 92f93f72..b29da486 100644
--- a/BMA.EHR.Report.Service/Program.cs
+++ b/BMA.EHR.Report.Service/Program.cs
@@ -88,10 +88,17 @@ var builder = WebApplication.CreateBuilder(args);
})
.AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
- builder.Services.AddSwaggerGen();
+ builder.Services.AddSwaggerGen(c =>
+ {
+ c.IgnoreObsoleteActions();
+ c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
+ });
builder.Services.ConfigureOptions();
builder.Services.AddHealthChecks();
+
+
+
}
var app = builder.Build();
@@ -113,7 +120,7 @@ var app = builder.Build();
app.MapHealthChecks("/health");
-
+
app.UseHttpsRedirection();
app.UseCors();
app.UseAuthentication();
@@ -131,6 +138,14 @@ var app = builder.Build();
app.Run();
}
+static IConfiguration ResolveSpecificReportingConfiguration(IWebHostEnvironment environment)
+{
+ var reportingConfigFileName = Path.Combine(environment.ContentRootPath, "appsettings.json");
+ return new ConfigurationBuilder()
+ .AddJsonFile(reportingConfigFileName, true)
+ .Build();
+}
+
void ConfigureLogs()
{
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
diff --git a/BMA.EHR.Report.Service/Properties/launchSettings.json b/BMA.EHR.Report.Service/Properties/launchSettings.json
index 985a5c8f..f41c4b5e 100644
--- a/BMA.EHR.Report.Service/Properties/launchSettings.json
+++ b/BMA.EHR.Report.Service/Properties/launchSettings.json
@@ -1,41 +1,51 @@
{
- "profiles": {
- "http": {
- "commandName": "Project",
- "launchBrowser": true,
- "launchUrl": "swagger",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- },
- "dotnetRunMessages": true,
- "applicationUrl": "http://localhost:5156"
+ "profiles": {
+ "http": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "dotnetRunMessages": true,
+ "applicationUrl": "http://localhost:5156"
+ },
+ "https": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "dotnetRunMessages": true,
+ "applicationUrl": "https://localhost:7164;http://localhost:5156"
+ },
+ "report-designer": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "launchUrl": "designer.html",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "dotnetRunMessages": true,
+ "applicationUrl": "https://localhost:7164;http://localhost:5156"
+ },
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "Docker": {
+ "commandName": "Docker",
+ "launchBrowser": true,
+ "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
+ "publishAllPorts": true,
+ "useSSL": true
+ }
},
- "https": {
- "commandName": "Project",
- "launchBrowser": true,
- "launchUrl": "swagger",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- },
- "dotnetRunMessages": true,
- "applicationUrl": "https://localhost:7164;http://localhost:5156"
- },
- "IIS Express": {
- "commandName": "IISExpress",
- "launchBrowser": true,
- "launchUrl": "swagger",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- }
- },
- "Docker": {
- "commandName": "Docker",
- "launchBrowser": true,
- "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
- "publishAllPorts": true,
- "useSSL": true
- }
- },
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
diff --git a/BMA.EHR.Report.Service/appsettings.json b/BMA.EHR.Report.Service/appsettings.json
index 254ef302..2d0fadb9 100644
--- a/BMA.EHR.Report.Service/appsettings.json
+++ b/BMA.EHR.Report.Service/appsettings.json
@@ -31,5 +31,28 @@
"SecretKey": "P@ssw0rd",
"BucketName": "bma-recruit"
},
- "Protocol": "HTTPS"
+ "Protocol": "HTTPS",
+ "telerikReporting": {
+ "privateFonts": [
+ {
+ "fontFamily": "TH SarabunIT๙",
+ "path": "Fonts/THSarabunIT.ttf"
+ },
+ {
+ "fontFamily": "TH SarabunIT๙",
+ "path": "Fonts/THSarabunITBold.ttf",
+ "fontStyle": "Bold"
+ },
+ {
+ "fontFamily": "TH SarabunPSK",
+ "path": "Fonts/THSarabunNew.ttf",
+
+ },
+ {
+ "fontFamily": "TH SarabunPSK",
+ "path": "Fonts/THSarabunNewBold.ttf",
+ "fontStyle": "Bold"
+ }
+ ]
+ }
}
\ No newline at end of file
diff --git a/BMA.EHR.Report.Service/wwwroot/designer.html b/BMA.EHR.Report.Service/wwwroot/designer.html
new file mode 100644
index 00000000..d32e628f
--- /dev/null
+++ b/BMA.EHR.Report.Service/wwwroot/designer.html
@@ -0,0 +1,36 @@
+
+
+
+ Telerik Web Report Designer
+
+
+
+
+
+
+
+
+
+ loading...
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BMA.EHR.Solution.sln b/BMA.EHR.Solution.sln
index 72be7ede..003c2a21 100644
--- a/BMA.EHR.Solution.sln
+++ b/BMA.EHR.Solution.sln
@@ -19,14 +19,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Placement.Service",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.OrganizationEmployee.Service", "BMA.EHR.OrganizationEmployee.Service\BMA.EHR.OrganizationEmployee.Service.csproj", "{A54AA069-8B0E-4784-953B-5DA9F9C8285E}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Report.Service", "BMA.EHR.Report.Service\BMA.EHR.Report.Service.csproj", "{AC4B2602-C543-4165-85D7-F6F92F553D80}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Command.Service", "BMA.EHR.Command.Service\BMA.EHR.Command.Service.csproj", "{E4E905EE-61DF-4451-B063-5C86BC7574CE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Insignia.Service", "BMA.EHR.Insignia.Service\BMA.EHR.Insignia.Service.csproj", "{04B37ACD-65CF-44ED-BC40-B5E7A71C374B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Retirement.Service", "BMA.EHR.Retirement.Service\BMA.EHR.Retirement.Service.csproj", "{3FFE378C-387F-42EA-96E2-68E63BB295F9}"
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
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -57,10 +57,6 @@ Global
{A54AA069-8B0E-4784-953B-5DA9F9C8285E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A54AA069-8B0E-4784-953B-5DA9F9C8285E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A54AA069-8B0E-4784-953B-5DA9F9C8285E}.Release|Any CPU.Build.0 = Release|Any CPU
- {AC4B2602-C543-4165-85D7-F6F92F553D80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AC4B2602-C543-4165-85D7-F6F92F553D80}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AC4B2602-C543-4165-85D7-F6F92F553D80}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AC4B2602-C543-4165-85D7-F6F92F553D80}.Release|Any CPU.Build.0 = Release|Any CPU
{E4E905EE-61DF-4451-B063-5C86BC7574CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E4E905EE-61DF-4451-B063-5C86BC7574CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4E905EE-61DF-4451-B063-5C86BC7574CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -73,6 +69,10 @@ Global
{3FFE378C-387F-42EA-96E2-68E63BB295F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3FFE378C-387F-42EA-96E2-68E63BB295F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3FFE378C-387F-42EA-96E2-68E63BB295F9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {26FE7B1C-771B-4940-9F40-326A7AD53F1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {26FE7B1C-771B-4940-9F40-326A7AD53F1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {26FE7B1C-771B-4940-9F40-326A7AD53F1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {26FE7B1C-771B-4940-9F40-326A7AD53F1C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -85,10 +85,10 @@ Global
{FA618F0C-1AF5-49AB-AE13-C020B403B64F} = {F3C2F68F-8DC8-45A3-825B-24F17867D380}
{81610EF7-AF80-44D8-9263-925C821CF45F} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
{A54AA069-8B0E-4784-953B-5DA9F9C8285E} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
- {AC4B2602-C543-4165-85D7-F6F92F553D80} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
{E4E905EE-61DF-4451-B063-5C86BC7574CE} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
{04B37ACD-65CF-44ED-BC40-B5E7A71C374B} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
{3FFE378C-387F-42EA-96E2-68E63BB295F9} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
+ {26FE7B1C-771B-4940-9F40-326A7AD53F1C} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3111A492-1818-4438-B718-75199D8E779A}