Merge branch 'develop'

* develop:
  fix: skip notification if no commander is assigned; update connection strings in appsettings
  edit permission normal
  fix สิทธิ์เมนูจำนวนสิทธิ์การลาที่ใช้ไป #2094
  Fix รายงานใบสมัครสอบส่วนเนื้อหาคำรับรองเพี้ยน #2099
  migration files
  migrate to CM Server
  no message
  fix role
  แก้ไขข้อความให้ตรงกับฝั่ง ui (ทาง กทม. แจ้งให้แก้ไขข้อความค่ะ)
  แก้ไขข้อความให้ตรงกับฝั่ง ui (ทาง กทม. แจ้งให้แก้ไขข้อความค่ะ)
  no message
  fix bug เพิ่ม-แก้ไขข้อมูลประวัติการศึกษาไม่อัปเดต #2022, #2025
  fix #2016, #2017
  fix ใบสมัครสอบ
  fix ยืมคืนเครื่องราชย?มาใช้่ RootDnaId แทน rootId
  fix ใบสมัครสอบคัดเลือก #2016, #2017, #2018
  fix issue #2007
  fix issues 1972
  migrate
This commit is contained in:
Warunee Tamkoo 2025-12-08 10:11:10 +07:00
commit a047787fb4
43 changed files with 44885 additions and 316 deletions

View file

@ -155,7 +155,12 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
FirstName = pf.FirstName, FirstName = pf.FirstName,
LastName = pf.LastName, LastName = pf.LastName,
LeaveDaysUsed = 0, LeaveDaysUsed = 0,
LeaveDays = leaveType?.Code == "LV-005" ? limit : 0 LeaveDays = leaveType?.Code == "LV-005" ? limit : 0,
RootDnaId = pf.RootDnaId,
Child1DnaId = pf.Child1DnaId,
Child2DnaId = pf.Child2DnaId,
Child3DnaId = pf.Child3DnaId,
Child4DnaId = pf.Child4DnaId
}; };
_dbContext.Set<LeaveBeginning>().Add(data); _dbContext.Set<LeaveBeginning>().Add(data);
@ -216,7 +221,12 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
FirstName = pf.FirstName, FirstName = pf.FirstName,
LastName = pf.LastName, LastName = pf.LastName,
LeaveDaysUsed = 0, LeaveDaysUsed = 0,
LeaveDays = leaveType?.Code == "LV-005" ? limit : 0 LeaveDays = leaveType?.Code == "LV-005" ? limit : 0,
RootDnaId = pf.RootDnaId,
Child1DnaId = pf.Child1DnaId,
Child2DnaId = pf.Child2DnaId,
Child3DnaId = pf.Child3DnaId,
Child4DnaId = pf.Child4DnaId
}; };
_dbContext.Set<LeaveBeginning>().Add(data); _dbContext.Set<LeaveBeginning>().Add(data);

View file

@ -371,7 +371,12 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
rawData = rawData rawData = rawData
.Where(x => node == 0 ? x.Child1DnaId == null : (node == 1 ? x.Child2DnaId == null : (node == 2 ? x.Child3DnaId == null : (node == 3 ? x.Child4DnaId == null : true)))); .Where(x =>
node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : true);
} }
@ -543,7 +548,12 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
rawData = rawData rawData = rawData
.Where(x => node == 0 ? x.Child1DnaId == null : (node == 1 ? x.Child2DnaId == null : (node == 2 ? x.Child3DnaId == null : (node == 3 ? x.Child4DnaId == null : true)))); .Where(x =>
node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : true);
} }
return await rawData.ToListAsync(); return await rawData.ToListAsync();
@ -822,15 +832,20 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
.Where(x => x.ApproveType!.ToUpper() == "COMMANDER") .Where(x => x.ApproveType!.ToUpper() == "COMMANDER")
.OrderBy(x => x.Seq) .OrderBy(x => x.Seq)
.FirstOrDefault(); .FirstOrDefault();
// Send Notification
var noti1 = new Notification // fix: If no commander, skip notification
{ if (firstCommander != null)
Body = $"การขอลาของคุณ {rawData.FirstName} {rawData.LastName} รอรับการอนุมัติจากคุณ", {
ReceiverUserId = firstCommander!.ProfileId, // Send Notification
Type = "", var noti1 = new Notification
Payload = $"{URL}/leave/detail/{id}", {
}; Body = $"การขอลาของคุณ {rawData.FirstName} {rawData.LastName} รอรับการอนุมัติจากคุณ",
_appDbContext.Set<Notification>().Add(noti1); ReceiverUserId = firstCommander!.ProfileId,
Type = "",
Payload = $"{URL}/leave/detail/{id}",
};
_appDbContext.Set<Notification>().Add(noti1);
}
await _appDbContext.SaveChangesAsync(); await _appDbContext.SaveChangesAsync();
} }
@ -1534,10 +1549,11 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
data = data.Where(x => data = data.Where(x =>
node == 0 ? x.Child1DnaId == null : node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
node == 1 ? x.Child2DnaId == null : node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
node == 2 ? x.Child3DnaId == null : node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
node == 3 ? x.Child4DnaId == null : node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
true true
).ToList(); ).ToList();
} }

View file

@ -172,9 +172,14 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
data = data data = data.Where(x =>
.Where(x => node == 0 ? x.Child1DnaId == null : (node == 1 ? x.Child2DnaId == null : (node == 2 ? x.Child3DnaId == null : (node == 3 ? x.Child4DnaId == null : true)))) node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
.ToList(); node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
true
).ToList();
} }
return data; return data;
} }

View file

@ -169,10 +169,11 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
data = data.Where(x => data = data.Where(x =>
node == 0 ? x.Child1DnaId == null : node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
node == 1 ? x.Child2DnaId == null : node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
node == 2 ? x.Child3DnaId == null : node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
node == 3 ? x.Child4DnaId == null : node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
true true
).ToList(); ).ToList();
} }
@ -279,9 +280,14 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
data = data data = data.Where(x =>
.Where(x => node == 0 ? x.Child1DnaId == null : (node == 1 ? x.Child2DnaId == null : (node == 2 ? x.Child3DnaId == null : (node == 3 ? x.Child4DnaId == null : true)))) node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
.ToList(); node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
true
).ToList();
} }
return data; return data;
} }

View file

@ -138,9 +138,14 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
data = data data = data.Where(x =>
.Where(x => node == 0 ? x.Child1DnaId == null : (node == 1 ? x.Child2DnaId == null : (node == 2 ? x.Child3DnaId == null : (node == 3 ? x.Child4DnaId == null : true)))) node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
.ToList(); node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
true
).ToList();
} }
return data; return data;
} }

View file

@ -5,6 +5,7 @@ using BMA.EHR.Domain.Shared;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using static BMA.EHR.Domain.Extensions.DateTimeExtension; using static BMA.EHR.Domain.Extensions.DateTimeExtension;
namespace BMA.EHR.Application.Repositories.Reports namespace BMA.EHR.Application.Repositories.Reports
@ -82,76 +83,128 @@ namespace BMA.EHR.Application.Repositories.Reports
sb.Append(monthDiff == 0 ? "" : $"{monthDiff} เดือน "); sb.Append(monthDiff == 0 ? "" : $"{monthDiff} เดือน ");
sb.Append(dayDiff == 0 ? "" : $"{dayDiff} วัน "); sb.Append(dayDiff == 0 ? "" : $"{dayDiff} วัน ");
} }
var data = await _dbExamContext.Set<Candidate>().AsQueryable() var candidate = await _dbExamContext.Set<Candidate>()
.Where(x => x.Id == id) .Where(x => x.Id == id)
.Select(p => new .Include(p => p.PeriodExam)
{ .Include(p => p.Educations)
p.Id, .Include(p => p.PositionExam)
AvatarId = p.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.ProfileImg.Id, .Include(p => p.ProfileImg)
ExamIdenNumber = p.ExamIdenNumber == null ? "-" : p.ExamIdenNumber.ToThaiNumber(), .FirstOrDefaultAsync();
PositionName = p.PositionExam == null ? "-" : p.PositionExam.PositionName.ToThaiNumber(),
PositionLevelName = p.PositionExam == null ? "-" : p.PositionExam.PositionLevelName.ToThaiNumber(),
PeriodExamName = p.PeriodExam == null ? "-" : p.PeriodExam.Name.ToThaiNumber(),
PeriodExamRound = p.PeriodExam == null ? "-" : p.PeriodExam.Round.ToString().ToThaiNumber(),
PeriodExamYear = p.PeriodExam == null ? "-" : (p.PeriodExam.Year + 543).ToString().ToThaiNumber(),
FullName = $"{p.PrefixName}{p.FirstName} {p.LastName}", if (candidate == null)
Religion = p.ReligionName == null ? "-" : p.ReligionName,
Nationality = p.Nationality == null ? "-" : p.Nationality,
DateOfBirth = p.DateOfBirth == null ? "-" : p.DateOfBirth.Value.ToThaiFullDate2().ToThaiNumber(),
Age = p.DateOfBirth == null ? "-" : p.DateOfBirth.Value.CalculateAgeStrV2(0, 0).ToThaiNumber(),
CitizenId = p.CitizenId == null ? "-" : p.CitizenId.ToThaiNumber(),
EducationLevelExamName = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationLevelExamName.ToThaiNumber(),
EducationName = p.Educations.FirstOrDefault() == null ? null : (p.Educations.FirstOrDefault().EducationLevelExamName == "ปริญญาตรี" || p.Educations.FirstOrDefault().EducationLevelExamName == "ปริญญาโท" || p.Educations.FirstOrDefault().EducationLevelExamName == "ปริญญาเอก" ? p.Educations.FirstOrDefault().EducationName : null),
EducationMajor = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationMajor.ToThaiNumber(),
EducationLocation = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationLocation,
EducationEndDate = p.Educations.FirstOrDefault() == null || p.Educations.FirstOrDefault().EducationEndDate == null ? "-" : p.Educations.FirstOrDefault().EducationEndDate.Value.ToThaiFullDate2().ToThaiNumber(),
EducationScores = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationScores.ToThaiNumber(),
EducationType = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationType,
EducationLevelHighName = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationLevelHighName,
OccupationPositionType = p.OccupationPositionType == "other" ? "ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร" : (p.OccupationPositionType == "temp" ? "ลูกจ้างชั่วคราว" : (p.OccupationPositionType == "prem" ? "ลูกจ้างประจำ" : "-")),
OccupationPosition = p.OccupationPosition == null ? "-" : p.OccupationPosition,
OccupationSalary = p.OccupationSalary == null ? "-" : p.OccupationSalary.Value.ToString("N0").ToThaiNumber(),
OccupationGroup = p.OccupationGroup == null ? "-" : p.OccupationGroup,
OccupationPile = p.OccupationPile == null ? "-" : p.OccupationPile,
OccupationOrg = p.OccupationOrg == null ? "-" : p.OccupationOrg,
OccupationTelephone = p.OccupationTelephone == null ? "-" : p.OccupationTelephone.ToThaiNumber(),
CareersTotal = sb.ToString().ToThaiNumber(),
// Careers = p.Careers.Select(y => new
// {
// Position = y.Position,
// Type = y.Type,
// DurationStart = y.DurationStart.ToThaiShortDate2(),
// DurationEnd = y.DurationEnd.ToThaiShortDate2(),
// RangeDate = y.RangeDate,
// }).ToList(),
RegistAddress = p.RegistAddress == null ? "-" : p.RegistAddress.ToThaiNumber(),
RegistProvinceName = p.RegistProvinceName == null ? "-" : p.RegistProvinceName,
RegistDistrictName = p.RegistDistrictName == null ? "-" : p.RegistDistrictName,
RegistSubDistrictName = p.RegistSubDistrictName == null ? "-" : p.RegistSubDistrictName,
RegistZipCode = p.RegistZipCode == null ? "-" : p.RegistZipCode.ToThaiNumber(),
CurrentAddress = p.CurrentAddress == null ? (p.RegistAddress == null ? "-" : p.RegistAddress.ToThaiNumber()) : p.CurrentAddress.ToThaiNumber(),
CurrentProvinceName = p.CurrentProvinceName == null ? (p.RegistProvinceName == null ? "-" : p.RegistProvinceName) : p.CurrentProvinceName,
CurrentDistrictName = p.CurrentDistrictName == null ? (p.RegistDistrictName == null ? "-" : p.RegistDistrictName) : p.CurrentDistrictName,
CurrentSubDistrictName = p.CurrentSubDistrictName == null ? (p.RegistSubDistrictName == null ? "-" : p.RegistSubDistrictName) : p.CurrentSubDistrictName,
CurrentZipCode = p.CurrentZipCode == null ? (p.RegistZipCode == null ? "-" : p.RegistZipCode.ToThaiNumber()) : p.CurrentZipCode.ToThaiNumber(),
Telephone = p.Telephone == null ? "-" : p.Telephone.ToThaiNumber(),
Email = p.Email == null ? "-" : p.Email,
ContactFullName = $"{p.ContactPrefixName}{p.ContactFirstname} {p.ContactLastname}",
ContactRelations = p.ContactRelations == null ? "-" : p.ContactRelations,
ContactTel = p.ContactTel == null ? "-" : p.ContactTel.ToThaiNumber(),
RegisterDate = p.RegisterDate == null ? "-" : p.RegisterDate.Value.ToThaiFullDate().ToThaiNumber(),
})
.FirstOrDefaultAsync();
if (data == null)
throw new Exception(GlobalMessages.CandidateNotFound); throw new Exception(GlobalMessages.CandidateNotFound);
return data;
List<string> editorConfirmLists;
var textOnly = string.IsNullOrEmpty(candidate.PeriodExam?.EditorConfirm)
? null
: Regex.Replace(
candidate.PeriodExam.EditorConfirm,
"<[^>]+>",
string.Empty
)
.Replace("&nbsp;", " ")
.Trim();
if (!string.IsNullOrEmpty(textOnly))
{
// ลบข้อความทั้งหมดก่อน "1." เพื่อให้เริ่มต้นที่ข้อแรกเสมอ
var cleanedText = Regex.Replace(textOnly, @"^.*?1\.", "1.").Trim();
// ถ้าข้อ 3 จบด้วย "มาตรา 1374." แล้วเลข 4. ติดกับประโยค ให้แทรกขึ้นบรรทัดใหม่เป็นข้อ 4.
if (!cleanedText.Contains("\n4.") && Regex.IsMatch(cleanedText, @"1374\.\s*"))
{
cleanedText = Regex.Replace(cleanedText, @"1374\.\s*", "137\n4. ");
}
// แยกข้อความเป็นแต่ละข้อ โดย split เมื่อเจอ pattern "ตัวเลข. "
// ใช้ lookahead (?=...) เพื่อไม่กินตัวเลขทิ้ง และให้ตัวเลขยังอยู่ในผลลัพธ์
editorConfirmLists = Regex.Split(cleanedText, @"(?=\d+\. )")
.Where(s => !string.IsNullOrWhiteSpace(s))
.Select(s => s.Replace("\n", "").Replace("\r", "").Trim())
.ToList();
}
else
{
editorConfirmLists = new List<string> { "-" };
}
return new
{
candidate.Id,
AvatarId = candidate.ProfileImg?.Id ?? Guid.Empty,
ExamIdenNumber = candidate.ExamIdenNumber ?? "-",
PositionName = candidate.PositionExam?.PositionName ?? "-",
PositionLevelName = candidate.PositionExam?.PositionLevelName ?? "-",
PeriodExamName = candidate.PeriodExam?.Name ?? "-",
PeriodExamRound = candidate.PeriodExam?.Round.ToString() ?? "-",
PeriodExamYear = candidate.PeriodExam != null ? (candidate.PeriodExam.Year + 543).ToString() : "-",
FullName = $"{candidate.PrefixName}{candidate.FirstName} {candidate.LastName}",
Religion = candidate.ReligionName ?? "-",
Nationality = candidate.Nationality ?? "-",
DateOfBirth = candidate.DateOfBirth?.ToThaiFullDate2() ?? "-",
Age = candidate.DateOfBirth?.CalculateAgeStrV2(0, 0) ?? "-",
CitizenId = candidate.CitizenId ?? "-",
EducationLevelExamName = candidate.Educations.FirstOrDefault()?.EducationLevelExamName ?? "-",
EducationName = (candidate.Educations.FirstOrDefault()?.EducationLevelExamName is "ปริญญาตรี" or "ปริญญาโท" or "ปริญญาเอก")
? candidate.Educations.FirstOrDefault()?.EducationName
: null,
EducationMajor = candidate.Educations.FirstOrDefault()?.EducationMajor ?? "-",
EducationLocation = candidate.Educations.FirstOrDefault()?.EducationLocation ?? "-",
EducationEndDate = candidate.Educations.FirstOrDefault()?.EducationEndDate?.ToThaiFullDate2() ?? "-",
EducationScores = candidate.Educations.FirstOrDefault()?.EducationScores ?? "-",
EducationType = candidate.Educations.FirstOrDefault()?.EducationType ?? "-",
EducationLevelHighName = candidate.Educations.FirstOrDefault()?.EducationLevelHighName ?? "-",
OccupationPositionType = candidate.OccupationPositionType == "other" ? "ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร" :
candidate.OccupationPositionType == "temp" ? "ลูกจ้างชั่วคราว" :
candidate.OccupationPositionType == "prem" ? "ลูกจ้างประจำ" : "-",
OccupationPosition = candidate.OccupationPosition ?? "-",
OccupationSalary = candidate.OccupationSalary.HasValue
? (candidate.OccupationSalary.Value % 1 == 0
? candidate.OccupationSalary.Value.ToString("N0")
: candidate.OccupationSalary.Value.ToString("N2"))
: "-",
OccupationGroup = candidate.OccupationGroup ?? "-",
OccupationPile = candidate.OccupationPile ?? "-",
OccupationOrg = candidate.OccupationOrg ?? "-",
OccupationTelephone = candidate.OccupationTelephone ?? "-",
CareersTotal = sb.ToString(),
RegistAddress = candidate.RegistAddress ?? "-",
RegistProvinceName = candidate.RegistProvinceName ?? "-",
RegistDistrictName = candidate.RegistDistrictName ?? "-",
RegistSubDistrictName = candidate.RegistSubDistrictName ?? "-",
RegistZipCode = candidate.RegistZipCode ?? "-",
CurrentAddress = candidate.CurrentAddress ?? candidate.RegistAddress ?? "-",
CurrentProvinceName = candidate.CurrentProvinceName ?? candidate.RegistProvinceName ?? "-",
CurrentDistrictName = candidate.CurrentDistrictName ?? candidate.RegistDistrictName ?? "-",
CurrentSubDistrictName = candidate.CurrentSubDistrictName ?? candidate.RegistSubDistrictName ?? "-",
CurrentZipCode = candidate.CurrentZipCode ?? candidate.RegistZipCode ?? "-",
Telephone = candidate.Telephone ?? "-",
Email = candidate.Email ?? "-",
ContactFullName = $"{candidate.ContactPrefixName}{candidate.ContactFirstname} {candidate.ContactLastname}",
ContactRelations = candidate.ContactRelations ?? "-",
ContactTel = candidate.ContactTel ?? "-",
RegisterDate = candidate.RegisterDate?.ToThaiFullDate() ?? "-",
IsBachelors = candidate.PositionExam != null && !string.IsNullOrEmpty(candidate.PositionExam.PositionLevelName) && candidate.PositionExam.PositionLevelName.Trim() == "ปฏิบัติการ"
? new List<object>
{
new { label = "ชื่อปริญญา", value = candidate.Educations.FirstOrDefault()?.EducationName ?? "-" },
new { label = "สาขาวิชา/วิชาเอก", value = candidate.Educations.FirstOrDefault()?.EducationMajor ?? "-" }
}
: new List<object>
{
new { label = "สาขาวิชา/วิชาเอก", value = candidate.Educations.FirstOrDefault()?.EducationMajor ?? "-" }
},
EditorConfirms = editorConfirmLists
};
} }
public async Task<dynamic> GetExamCareerCandidateAsync(Guid id) public async Task<dynamic> GetExamCareerCandidateAsync(Guid id)
{ {
@ -176,10 +229,10 @@ namespace BMA.EHR.Application.Repositories.Reports
{ {
Position = item.Position, Position = item.Position,
Type = item.Type, Type = item.Type,
DurationStart = item.DurationStart.ToThaiNumber(), DurationStart = item.DurationStart,
DurationEnd = item.DurationEnd.ToThaiNumber(), DurationEnd = item.DurationEnd,
RangeDate = item.RangeDate.ToThaiNumber(), RangeDate = item.RangeDate,
Index = retVal.ToString().ToThaiNumber(), Index = retVal.ToString(),
}; };
data.Add(_data); data.Add(_data);
retVal++; retVal++;

View file

@ -1126,6 +1126,29 @@ namespace BMA.EHR.Application.Repositories
} }
public async Task PostInsigniaMessageToSocket(string message, string userId, string? accessToken)
{
try
{
var apiPath = $"{_configuration["API"]}/org/through-socket/notify";
var apiKey = _configuration["API_KEY"];
var body = new
{
message = message,
userId = userId
};
var apiResult = await PostExternalAPIBooleanAsync(apiPath, accessToken ?? "", body, apiKey);
}
catch
{
throw;
}
}
public async Task PostProfileEmpInsigniaAsync(PostProfileEmpInsigniaDto body, string? accessToken) public async Task PostProfileEmpInsigniaAsync(PostProfileEmpInsigniaDto body, string? accessToken)
{ {
try try

View file

@ -37,5 +37,11 @@ namespace BMA.EHR.Application.Responses.Organizations
public string? Child4 { get; set; } public string? Child4 { get; set; }
public string? Child4ShortName { get; set; } public string? Child4ShortName { get; set; }
public Guid? RootDnaId { get; set; }
public Guid? Child1DnaId { get; set; }
public Guid? Child2DnaId { get; set; }
public Guid? Child3DnaId { get; set; }
public Guid? Child4DnaId { get; set; }
} }
} }

View file

@ -814,8 +814,14 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
data_search = data_search data_search = data_search.Where(x =>
.Where(x => node == 0 ? x.child1DnaId == null : (node == 1 ? x.child2DnaId == null : (node == 2 ? x.child3DnaId == null : (node == 3 ? x.child4DnaId == null : true)))).ToList(); node == 0 ? x.rootDnaId == nodeId && x.child1DnaId == null :
node == 1 ? x.child1DnaId == nodeId && x.child2DnaId == null :
node == 2 ? x.child2DnaId == nodeId && x.child3DnaId == null :
node == 3 ? x.child3DnaId == nodeId && x.child4DnaId == null :
node == 4 ? x.child4DnaId == nodeId :
true
).ToList();
} }
var query = data_search var query = data_search
.Select(x => new .Select(x => new

View file

@ -15,5 +15,7 @@ namespace BMA.EHR.Domain.Models.Insignias
[Comment("Fk Table InsigniaManage")] [Comment("Fk Table InsigniaManage")]
public InsigniaManage InsigniaManage { get; set; } public InsigniaManage InsigniaManage { get; set; }
public virtual List<InsigniaManageProfile> InsigniaManageProfiles { get; set; } = new List<InsigniaManageProfile>(); public virtual List<InsigniaManageProfile> InsigniaManageProfiles { get; set; } = new List<InsigniaManageProfile>();
public Guid? RootDnaId { get; set; }
} }
} }

View file

@ -29,5 +29,15 @@ namespace BMA.EHR.Domain.Models.Leave.Requests
[Required, Comment("จำนวนวันลาที่ใช้ไป")] [Required, Comment("จำนวนวันลาที่ใช้ไป")]
public double LeaveDaysUsed { get; set; } = 0.0; public double LeaveDaysUsed { get; set; } = 0.0;
public Guid? RootDnaId { get; set; }
public Guid? Child1DnaId { get; set; }
public Guid? Child2DnaId { get; set; }
public Guid? Child3DnaId { get; set; }
public Guid? Child4DnaId { get; set; }
} }
} }

View file

@ -189,7 +189,7 @@ namespace BMA.EHR.Domain.Models.Placement
[Comment("ตำแหน่งปัจจุบัน กลุ่ม/ฝ่าย")] [Comment("ตำแหน่งปัจจุบัน กลุ่ม/ฝ่าย")]
public string? OccupationGroup { get; set; } public string? OccupationGroup { get; set; }
[Comment("ตำแหน่งปัจจุบัน เงินเดือน")] [Comment("ตำแหน่งปัจจุบัน เงินเดือน")]
public int? OccupationSalary { get; set; } public double? OccupationSalary { get; set; }
[Comment("ตำแหน่งปัจจุบัน สังกัด")] [Comment("ตำแหน่งปัจจุบัน สังกัด")]
public string? OccupationPosition { get; set; } public string? OccupationPosition { get; set; }
[Comment("ตำแหน่งปัจจุบัน ประเภทราชการ")] [Comment("ตำแหน่งปัจจุบัน ประเภทราชการ")]

View file

@ -267,7 +267,7 @@ namespace BMA.EHR.Domain.ModelsExam.Candidate
[Comment("ตำแหน่งปัจจุบัน กลุ่ม/ฝ่าย")] [Comment("ตำแหน่งปัจจุบัน กลุ่ม/ฝ่าย")]
public string? OccupationGroup { get; set; } public string? OccupationGroup { get; set; }
[Comment("ตำแหน่งปัจจุบัน เงินเดือน")] [Comment("ตำแหน่งปัจจุบัน เงินเดือน")]
public int? OccupationSalary { get; set; } public double? OccupationSalary { get; set; }
[Comment("ตำแหน่งปัจจุบัน สังกัด")] [Comment("ตำแหน่งปัจจุบัน สังกัด")]
public string? OccupationPosition { get; set; } public string? OccupationPosition { get; set; }
[Comment("ตำแหน่งปัจจุบัน ประเภทราชการ")] [Comment("ตำแหน่งปัจจุบัน ประเภทราชการ")]

View file

@ -33,5 +33,8 @@ namespace BMA.EHR.Domain.ModelsExam.Candidate
[Comment("รหัสประจำตำแหน่งที่สอบ")] [Comment("รหัสประจำตำแหน่งที่สอบ")]
public string? Code { get; set; } public string? Code { get; set; }
[Comment("ขีดจำกัดวุฒิการศึกษา")]
public string? EducationLevel { get; set; }
} }
} }

View file

@ -16,11 +16,9 @@ namespace BMA.EHR.Infrastructure.MessageQueue
{ {
#region " Fields " #region " Fields "
private readonly UserProfileRepository _userProfileRepository;
private readonly InsigniaPeriodsRepository _insigniaPeriodsRepository;
private readonly IHttpContextAccessor _httpContextAccessor; private readonly IHttpContextAccessor _httpContextAccessor;
private const string INSIGNIA_QUEUE = "bma_insignia_request"; private const string INSIGNIA_QUEUE = "bma_insignia_request";
private readonly IServiceScopeFactory _serviceScopeFactory; private readonly IServiceScopeFactory _serviceScopeFactory;
private readonly IConfiguration _configuration; private readonly IConfiguration _configuration;
private IConnection _connection; private IConnection _connection;
@ -30,33 +28,29 @@ namespace BMA.EHR.Infrastructure.MessageQueue
#region " Constructor and Destructor " #region " Constructor and Destructor "
public RabbitMQConsumer(UserProfileRepository userProfileRepository, public RabbitMQConsumer(IHttpContextAccessor httpContextAccessor,
InsigniaPeriodsRepository insigniaPeriodsRepository,
IHttpContextAccessor httpContextAccessor,
IServiceScopeFactory serviceScopeFactory, IServiceScopeFactory serviceScopeFactory,
IConfiguration configuration) IConfiguration configuration)
{ {
_serviceScopeFactory = serviceScopeFactory; _serviceScopeFactory = serviceScopeFactory;
_configuration = configuration; _configuration = configuration;
_userProfileRepository = userProfileRepository;
_insigniaPeriodsRepository = insigniaPeriodsRepository;
_httpContextAccessor = httpContextAccessor; _httpContextAccessor = httpContextAccessor;
var host = _configuration["RabbitMQ:URL"]; var host = _configuration["RabbitMQ:URL"];
var userName = _configuration["RabbitMQ:UserName"]; var userName = _configuration["RabbitMQ:UserName"];
var password = _configuration["RabbitMQ:Password"]; var password = _configuration["RabbitMQ:Password"];
var factory = new ConnectionFactory() var factory = new ConnectionFactory()
{ {
HostName = host, HostName = host,
UserName = userName, UserName = userName,
Password = password Password = password
}; };
_connection = factory.CreateConnection(); _connection = factory.CreateConnection();
_channel = _connection.CreateModel(); _channel = _connection.CreateModel();
_channel.QueueDeclare(queue: INSIGNIA_QUEUE, durable: false, exclusive: false, autoDelete: false, arguments: null); _channel.QueueDeclare(queue: INSIGNIA_QUEUE, durable: false, exclusive: false, autoDelete: false, arguments: null);
} }
public override void Dispose() public override void Dispose()
@ -85,19 +79,19 @@ namespace BMA.EHR.Infrastructure.MessageQueue
var userRepo = scope.ServiceProvider.GetRequiredService<UserProfileRepository>(); var userRepo = scope.ServiceProvider.GetRequiredService<UserProfileRepository>();
var insigniaRepo = scope.ServiceProvider.GetRequiredService<InsigniaPeriodsRepository>(); var insigniaRepo = scope.ServiceProvider.GetRequiredService<InsigniaPeriodsRepository>();
var selectPeriod = await _insigniaPeriodsRepository.GetByIdAsync(periodId); var selectPeriod = await insigniaRepo.GetByIdAsync(periodId);
if (selectPeriod == null) if (selectPeriod == null)
{ {
throw new Exception(GlobalMessages.InsigniaPeriodNotFound); throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
} }
var organizations = await userRepo.GetActiveRootAsync(AccessToken, selectPeriod.RevisionId); var organizations = await userRepo.GetActiveRootAsync(AccessToken, selectPeriod.RevisionId);
foreach (var organization in organizations) foreach (var organization in organizations)
{ {
if (organization == null) if (organization == null)
continue; continue;
var result = await insigniaRepo.GetInsigniaRequest(periodId, organization.Id); var result = await insigniaRepo.GetInsigniaRequest(periodId, organization.Id);
if (result != null) if (result != null)
{ {

View file

@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class update_table_PlacementProfile_and_Candidate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<double>(
name: "OccupationSalary",
table: "PlacementProfiles",
type: "double",
nullable: true,
comment: "ตำแหน่งปัจจุบัน เงินเดือน",
oldClrType: typeof(int),
oldType: "int",
oldNullable: true,
oldComment: "ตำแหน่งปัจจุบัน เงินเดือน");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "OccupationSalary",
table: "PlacementProfiles",
type: "int",
nullable: true,
comment: "ตำแหน่งปัจจุบัน เงินเดือน",
oldClrType: typeof(double),
oldType: "double",
oldNullable: true,
oldComment: "ตำแหน่งปัจจุบัน เงินเดือน");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddrootdnatoInsigniaMagOrgTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "RootDnaId",
table: "InsigniaManageOrganiations",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "RootDnaId",
table: "InsigniaManageOrganiations");
}
}
}

View file

@ -5832,6 +5832,9 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("char(36)") .HasColumnType("char(36)")
.HasComment("รหัสหน่วยงาน"); .HasComment("รหัสหน่วยงาน");
b.Property<Guid?>("RootDnaId")
.HasColumnType("char(36)");
b.Property<int>("Total") b.Property<int>("Total")
.HasColumnType("int") .HasColumnType("int")
.HasComment("จำนวนทั้งหมด"); .HasComment("จำนวนทั้งหมด");
@ -12794,8 +12797,8 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("ตำแหน่งปัจจุบัน ประเภทราชการ"); .HasComment("ตำแหน่งปัจจุบัน ประเภทราชการ");
b.Property<int?>("OccupationSalary") b.Property<double?>("OccupationSalary")
.HasColumnType("int") .HasColumnType("double")
.HasComment("ตำแหน่งปัจจุบัน เงินเดือน"); .HasComment("ตำแหน่งปัจจุบัน เงินเดือน");
b.Property<string>("OccupationTelephone") b.Property<string>("OccupationTelephone")

View file

@ -0,0 +1,74 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
/// <inheritdoc />
public partial class AddDnaFieldtoLeaveBegging : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "Child1DnaId",
table: "LeaveBeginnings",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "Child2DnaId",
table: "LeaveBeginnings",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "Child3DnaId",
table: "LeaveBeginnings",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "Child4DnaId",
table: "LeaveBeginnings",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "RootDnaId",
table: "LeaveBeginnings",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Child1DnaId",
table: "LeaveBeginnings");
migrationBuilder.DropColumn(
name: "Child2DnaId",
table: "LeaveBeginnings");
migrationBuilder.DropColumn(
name: "Child3DnaId",
table: "LeaveBeginnings");
migrationBuilder.DropColumn(
name: "Child4DnaId",
table: "LeaveBeginnings");
migrationBuilder.DropColumn(
name: "RootDnaId",
table: "LeaveBeginnings");
}
}
}

View file

@ -128,6 +128,18 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
.HasComment("PrimaryKey") .HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id"); .HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<Guid?>("Child1DnaId")
.HasColumnType("char(36)");
b.Property<Guid?>("Child2DnaId")
.HasColumnType("char(36)");
b.Property<Guid?>("Child3DnaId")
.HasColumnType("char(36)");
b.Property<Guid?>("Child4DnaId")
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)") .HasColumnType("datetime(6)")
.HasColumnOrder(100) .HasColumnOrder(100)
@ -195,6 +207,9 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
.HasColumnType("char(36)") .HasColumnType("char(36)")
.HasComment("รหัส Profile ในระบบทะเบียนประวัติ"); .HasComment("รหัส Profile ในระบบทะเบียนประวัติ");
b.Property<Guid?>("RootDnaId")
.HasColumnType("char(36)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("LeaveTypeId"); b.HasIndex("LeaveTypeId");

View file

@ -330,7 +330,10 @@ namespace BMA.EHR.Insignia.Service.Controllers
var total = insigniaManage.InsigniaManageOrganiations.Where(x => x.OrganizationId != req.OrganizationOrganizationId).Sum(x => x.Total); var total = insigniaManage.InsigniaManageOrganiations.Where(x => x.OrganizationId != req.OrganizationOrganizationId).Sum(x => x.Total);
if (req.Total + total > insigniaManage.Total) if (req.Total + total > insigniaManage.Total)
return Error(GlobalMessages.InsigniaManageOrgLimit); return Error(GlobalMessages.InsigniaManageOrgLimit);
var root = _userProfileRepository.GetOc(req.OrganizationOrganizationId, 0, AccessToken)?.Root ?? null;
var ocData = _userProfileRepository.GetOc(req.OrganizationOrganizationId, 0, AccessToken);
var root = ocData?.Root ?? null;
var rootDnaId = ocData?.RootDnaId ?? null;
await _context.InsigniaManageOrganiations.AddAsync( await _context.InsigniaManageOrganiations.AddAsync(
new InsigniaManageOrganiation new InsigniaManageOrganiation
{ {
@ -344,6 +347,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
LastUpdateFullName = FullName ?? "System Administrator", LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "", LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now, LastUpdatedAt = DateTime.Now,
RootDnaId = rootDnaId
}); });
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
@ -710,8 +714,14 @@ namespace BMA.EHR.Insignia.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
rawData = rawData rawData = rawData.Where(x =>
.Where(x => node == 0 ? x.Child1DnaId == null : (node == 1 ? x.Child2DnaId == null : (node == 2 ? x.Child3DnaId == null : (node == 3 ? x.Child4DnaId == null : true)))).ToList(); node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
true
).ToList();
} }
var data = rawData var data = rawData
@ -791,7 +801,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
var insigniaManageOrganiation = await _context.InsigniaManageOrganiations.AsQueryable() var insigniaManageOrganiation = await _context.InsigniaManageOrganiations.AsQueryable()
.Include(x => x.InsigniaManageProfiles) .Include(x => x.InsigniaManageProfiles)
.FirstOrDefaultAsync(x => x.OrganizationId == insigniaNoteProfile.RootId && x.InsigniaManage.Id == insigniaManage.Id); // แก้เป็นหาจากหน่วยงานยืมเพิม manage id .FirstOrDefaultAsync(x => x.RootDnaId == insigniaNoteProfile.RootDnaId && x.InsigniaManage.Id == insigniaManage.Id); // แก้เป็นหาจากหน่วยงานยืมเพิม manage id
if (insigniaManageOrganiation == null) if (insigniaManageOrganiation == null)
return Error(GlobalMessages.InsigniaManageOrgNotFound); return Error(GlobalMessages.InsigniaManageOrgNotFound);
@ -989,8 +999,14 @@ namespace BMA.EHR.Insignia.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
rawData = rawData rawData = rawData.Where(x =>
.Where(x => node == 0 ? x.Child1DnaId == null : (node == 1 ? x.Child2DnaId == null : (node == 2 ? x.Child3DnaId == null : (node == 3 ? x.Child4DnaId == null : true)))).ToList(); node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
true
).ToList();
} }
var data = rawData var data = rawData

View file

@ -1,4 +1,5 @@
using BMA.EHR.Insignia.Service.Configuration; using BMA.EHR.Application.Repositories;
using BMA.EHR.Insignia.Service.Configuration;
using SocketIOClient; using SocketIOClient;
using System.Security.Claims; using System.Security.Claims;
@ -9,16 +10,17 @@ public class InsigniaRequestProcessService : BackgroundService
{ {
private readonly IBackgroundTaskQueue _queue; private readonly IBackgroundTaskQueue _queue;
private readonly IHttpContextAccessor _httpContextAccessor; private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IServiceScopeFactory _serviceScopeFactory;
public InsigniaRequestProcessService( public InsigniaRequestProcessService(
IBackgroundTaskQueue queue, IBackgroundTaskQueue queue,
IHttpContextAccessor httpContextAccessor) IHttpContextAccessor httpContextAccessor,
IServiceScopeFactory serviceScopeFactory)
{ {
_queue = queue; _queue = queue;
_httpContextAccessor = httpContextAccessor; _httpContextAccessor = httpContextAccessor;
_serviceScopeFactory = serviceScopeFactory;
} }
#region " Properties " #region " Properties "
@ -93,6 +95,14 @@ public class InsigniaRequestProcessService : BackgroundService
var endTime = DateTime.Now; var endTime = DateTime.Now;
var duration = endTime - startTime; var duration = endTime - startTime;
// Resolve repository from a scope because DbContext is scoped/transient.
using var scope = _serviceScopeFactory.CreateScope();
var userProfileRepository = (UserProfileRepository)scope.ServiceProvider.GetService(typeof(UserProfileRepository));
if (userProfileRepository != null)
{
await userProfileRepository.PostInsigniaMessageToSocket("Task completed", UserId ?? "", AccessToken);
}
} }
} }
catch (OperationCanceledException) catch (OperationCanceledException)

View file

@ -1,61 +1,65 @@
{ {
"Serilog": { "Serilog": {
"MinimumLevel": { "MinimumLevel": {
"Default": "Information", "Default": "Information",
"Override": { "Override": {
"Microsoft": "Information", "Microsoft": "Information",
"System": "Warning" "System": "Warning"
} }
} }
}, },
"ElasticConfiguration": { "ElasticConfiguration": {
"Uri": "http://192.168.1.40:9200", "Uri": "http://192.168.1.40:9200",
"IndexFormat": "bma-ehr-log-index", "IndexFormat": "bma-ehr-log-index",
"SystemName": "insignia" "SystemName": "insignia"
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB", //"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", // "DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", // "ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" // "LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
//"DefaultConnection": "server=hrms.chin.in.th;user=root;password=adminVM123;port=53636;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "DefaultConnection": "server=192.168.1.63;user=root;password=12345678;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
//"DefaultConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "ExamConnection": "server=192.168.1.63;user=root;password=12345678;port=3306;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
//"ExamConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "LeaveConnection": "server=192.168.1.63;user=root;password=12345678;port=3306;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
//"LeaveConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
//"DisciplineConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_discipline;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" //"DefaultConnection": "server=hrms.chin.in.th;user=root;password=adminVM123;port=53636;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
}, //"DefaultConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"Jwt": { //"ExamConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
//"Key": "j7C9RO_p4nRtuwCH4z9Db_A_6We42tkD_p4lZtDrezc", //"LeaveConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
//"Issuer": "https://hrms-id.chin.in.th/realms/hrms" //"DisciplineConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_discipline;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI", },
"Issuer": "https://id.frappet.synology.me/realms/hrms" "Jwt": {
}, //"Key": "j7C9RO_p4nRtuwCH4z9Db_A_6We42tkD_p4lZtDrezc",
"EPPlus": { //"Issuer": "https://hrms-id.chin.in.th/realms/hrms"
"ExcelPackage": { "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"LicenseContext": "NonCommercial" "Issuer": "https://id.frappet.synology.me/realms/hrms"
} },
}, "EPPlus": {
"MinIO": { "ExcelPackage": {
"Endpoint": "https://edm-s3.frappet.synology.me/", "LicenseContext": "NonCommercial"
"AccessKey": "XxtdnJajPjp3hHuKdOMn", }
"SecretKey": "rVPzB05giC7bA400cUuIThzT4T9SGCcpcmL3tBBg", },
"BucketName": "bma-ehr-fpt" "MinIO": {
}, "Endpoint": "https://edm-s3.frappet.synology.me/",
"KeycloakCron": { "AccessKey": "XxtdnJajPjp3hHuKdOMn",
"Hour": "08", "SecretKey": "rVPzB05giC7bA400cUuIThzT4T9SGCcpcmL3tBBg",
"Minute": "00" "BucketName": "bma-ehr-fpt"
}, },
"Protocol": "HTTPS", "KeycloakCron": {
"Node": { "Hour": "08",
"API": "https://bma-ehr.frappet.synology.me/api/v1/probation" "Minute": "00"
}, },
"API": "https://bma-ehr.frappet.synology.me/api/v1", "Protocol": "HTTPS",
"RabbitMQ": { "Node": {
"URL": "localhost", "API": "https://bma-ehr.frappet.synology.me/api/v1/probation"
"UserName": "frappet", },
"Password": "FPTadmin2357" "API": "https://bma-ehr.frappet.synology.me/api/v1",
}, "RabbitMQ": {
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz" "URL": "localhost",
"UserName": "frappet",
"Password": "FPTadmin2357"
},
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
} }

View file

@ -12,6 +12,7 @@ using OfficeOpenXml.ConditionalFormatting;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System.Security.Claims; using System.Security.Claims;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using BMA.EHR.Application.Responses.Profiles;
namespace BMA.EHR.Leave.Service.Controllers namespace BMA.EHR.Leave.Service.Controllers
{ {
@ -97,7 +98,7 @@ namespace BMA.EHR.Leave.Service.Controllers
{ {
try try
{ {
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_LEAVE_LIST"); var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_LEAVE_HISTORY");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission); var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200") if (jsonData["status"]?.ToString() != "200")
{ {
@ -109,6 +110,62 @@ namespace BMA.EHR.Leave.Service.Controllers
if (req.Type != Guid.Empty) if (req.Type != Guid.Empty)
resData = resData.Where(x => x.LeaveTypeId == req.Type).ToList(); resData = resData.Where(x => x.LeaveTypeId == req.Type).ToList();
//กรองสิทธิ์
string role = jsonData["result"]?.ToString();
var nodeId = string.Empty;
var profileAdmin = new GetUserOCAllDto();
profileAdmin = await _userProfileRepository.GetUserOCAll(Guid.Parse(UserId!), AccessToken);
if (role == "NORMAL" || role == "CHILD")
{
nodeId = profileAdmin?.Node == 4
? profileAdmin?.Child4DnaId
: profileAdmin?.Node == 3
? profileAdmin?.Child3DnaId
: profileAdmin?.Node == 2
? profileAdmin?.Child2DnaId
: profileAdmin?.Node == 1
? profileAdmin?.Child1DnaId
: profileAdmin?.Node == 0
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}
int? node = profileAdmin?.Node;
if (role == "OWNER")
{
node = null;
}
if (role == "OWNER" || role == "CHILD")
{
resData = resData
.Where(x => node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true)))))).ToList();
}
else if (role == "ROOT")
{
resData = resData
.Where(x => x.RootDnaId == Guid.Parse(nodeId!)).ToList();
}
else if (role == "PARENT")
{
resData = resData
.Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null).ToList();
}
else if (role == "NORMAL")
{
resData = resData
.Where(x =>
node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : true).ToList();
}
//END
var result = new List<dynamic>(); var result = new List<dynamic>();
foreach (var item in resData) foreach (var item in resData)
@ -205,7 +262,7 @@ namespace BMA.EHR.Leave.Service.Controllers
{ {
try try
{ {
var getPermission = await _permission.GetPermissionAPIAsync("DELETE", "SYS_LEAVE_LIST"); var getPermission = await _permission.GetPermissionAPIAsync("DELETE", "SYS_LEAVE_HISTORY");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission); var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200") if (jsonData["status"]?.ToString() != "200")
{ {
@ -237,7 +294,7 @@ namespace BMA.EHR.Leave.Service.Controllers
{ {
try try
{ {
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_LEAVE_LIST"); var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_LEAVE_HISTORY");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission); var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200") if (jsonData["status"]?.ToString() != "200")
{ {
@ -270,7 +327,7 @@ namespace BMA.EHR.Leave.Service.Controllers
{ {
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId); var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
var getPermission = await _permission.GetPermissionAPIAsync("UPDATE", "SYS_LEAVE_LIST"); var getPermission = await _permission.GetPermissionAPIAsync("UPDATE", "SYS_LEAVE_HISTORY");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission); var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200") if (jsonData["status"]?.ToString() != "200")
{ {
@ -325,7 +382,7 @@ namespace BMA.EHR.Leave.Service.Controllers
try try
{ {
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId); var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
var getPermission = await _permission.GetPermissionAPIAsync("CREATE", "SYS_LEAVE_LIST"); var getPermission = await _permission.GetPermissionAPIAsync("CREATE", "SYS_LEAVE_HISTORY");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission); var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200") if (jsonData["status"]?.ToString() != "200")
{ {
@ -359,6 +416,12 @@ namespace BMA.EHR.Leave.Service.Controllers
leaveBeginning.FirstName = profile.FirstName; leaveBeginning.FirstName = profile.FirstName;
leaveBeginning.LastName = profile.LastName; leaveBeginning.LastName = profile.LastName;
leaveBeginning.RootDnaId = profile.RootDnaId;
leaveBeginning.Child1DnaId = profile.Child1DnaId;
leaveBeginning.Child2DnaId = profile.Child2DnaId;
leaveBeginning.Child3DnaId = profile.Child3DnaId;
leaveBeginning.Child4DnaId = profile.Child4DnaId;
leaveBeginning.CreatedUserId = userId.ToString("D"); leaveBeginning.CreatedUserId = userId.ToString("D");
leaveBeginning.CreatedFullName = FullName ?? ""; leaveBeginning.CreatedFullName = FullName ?? "";
leaveBeginning.CreatedAt = DateTime.Now; leaveBeginning.CreatedAt = DateTime.Now;

View file

@ -870,7 +870,7 @@ namespace BMA.EHR.Leave.Service.Controllers
}; };
var startTime = ""; var startTime = "";
if (!data.IsLocation && data.LocationName == "ไปประชุม/อบรม/สัมมนา/ปฏิบัติงานที่บ้านนอกสถานที่") if (!data.IsLocation && data.LocationName == "ไปประชุม / อบรม / สัมมนา")
{ {
startTime = "09:30"; startTime = "09:30";
} }
@ -1834,7 +1834,7 @@ namespace BMA.EHR.Leave.Service.Controllers
? profileAdmin?.RootDnaId ? profileAdmin?.RootDnaId
: ""; : "";
} }
else if (role == "ROOT") else if (role == "ROOT" || role == "PARENT")
{ {
nodeId = profileAdmin?.RootDnaId; nodeId = profileAdmin?.RootDnaId;
} }
@ -2077,7 +2077,7 @@ namespace BMA.EHR.Leave.Service.Controllers
? profileAdmin?.RootDnaId ? profileAdmin?.RootDnaId
: ""; : "";
} }
else if (role == "ROOT") else if (role == "ROOT" || role == "PARENT")
{ {
nodeId = profileAdmin?.RootDnaId; nodeId = profileAdmin?.RootDnaId;
} }

View file

@ -1753,7 +1753,7 @@ namespace BMA.EHR.Leave.Service.Controllers
{ {
if (timeStamps.CheckInLocationName == "ปฏิบัติงานที่บ้าน") if (timeStamps.CheckInLocationName == "ปฏิบัติงานที่บ้าน")
wfhTotal += 1; wfhTotal += 1;
else if (timeStamps.CheckInLocationName == "ไปประชุม/อบรม/สัมมนา/ปฏิบัติงานที่บ้านนอกสถานที่") else if (timeStamps.CheckInLocationName == "ไปประชุม / อบรม / สัมมนา")
seminarTotal += 1; seminarTotal += 1;
} }
} }
@ -1836,7 +1836,7 @@ namespace BMA.EHR.Leave.Service.Controllers
{ {
try try
{ {
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_LEAVE_REPORT"); var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_WORK_REPORT");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission); var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200") if (jsonData["status"]?.ToString() != "200")
{ {
@ -2066,7 +2066,7 @@ namespace BMA.EHR.Leave.Service.Controllers
{ {
if (timeStamps.CheckInLocationName == "ปฏิบัติงานที่บ้าน") if (timeStamps.CheckInLocationName == "ปฏิบัติงานที่บ้าน")
wfhTotal += 1; wfhTotal += 1;
else if (timeStamps.CheckInLocationName == "ไปประชุม/อบรม/สัมมนา/ปฏิบัติงานที่บ้านนอกสถานที่") else if (timeStamps.CheckInLocationName == "ไปประชุม / อบรม / สัมมนา")
seminarTotal += 1; seminarTotal += 1;
} }
} }
@ -2252,7 +2252,7 @@ namespace BMA.EHR.Leave.Service.Controllers
{ {
try try
{ {
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_LEAVE_REPORT"); var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_WORK_REPORT");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission); var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200") if (jsonData["status"]?.ToString() != "200")
{ {

View file

@ -1,66 +1,70 @@
{ {
"Serilog": { "Serilog": {
"MinimumLevel": { "MinimumLevel": {
"Default": "Information", "Default": "Information",
"Override": { "Override": {
"Microsoft": "Information", "Microsoft": "Information",
"System": "Warning" "System": "Warning"
} }
} }
}, },
"ElasticConfiguration": { "ElasticConfiguration": {
"Uri": "http://192.168.1.40:9200", "Uri": "http://192.168.1.40:9200",
"IndexFormat": "bma-ehr-log-index", "IndexFormat": "bma-ehr-log-index",
"SystemName": "leave" "SystemName": "leave"
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" "LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
//"DefaultConnection": "server=172.27.17.68;user=user;password=cDldaqkwESWvuZ37Gr0n;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", // "DefaultConnection": "server=192.168.1.63;user=root;password=12345678;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
//"ExamConnection": "server=172.27.17.68;user=user;password=cDldaqkwESWvuZ37Gr0n;port=3306;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", // "ExamConnection": "server=192.168.1.63;user=root;password=12345678;port=3306;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
//"LeaveConnection": "server=172.27.17.68;user=user;password=cDldaqkwESWvuZ37Gr0n;port=3306;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" // "LeaveConnection": "server=192.168.1.63;user=root;password=12345678;port=3306;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
},
"Jwt": { //"DefaultConnection": "server=172.27.17.68;user=user;password=cDldaqkwESWvuZ37Gr0n;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI", //"ExamConnection": "server=172.27.17.68;user=user;password=cDldaqkwESWvuZ37Gr0n;port=3306;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"Issuer": "https://id.frappet.synology.me/realms/hrms" //"LeaveConnection": "server=172.27.17.68;user=user;password=cDldaqkwESWvuZ37Gr0n;port=3306;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
//"Key": "xY2VR-EFvvNPsMs39u8ooVBWQL6mPwrNJOh3koJFTgU", },
//"Issuer": "https://hrms-id.bangkok.go.th/realms/hrms" "Jwt": {
}, "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"EPPlus": { "Issuer": "https://id.frappet.synology.me/realms/hrms"
"ExcelPackage": { //"Key": "xY2VR-EFvvNPsMs39u8ooVBWQL6mPwrNJOh3koJFTgU",
"LicenseContext": "NonCommercial" //"Issuer": "https://hrms-id.bangkok.go.th/realms/hrms"
} },
}, "EPPlus": {
"MinIO": { "ExcelPackage": {
"Endpoint": "https://edm-s3.frappet.synology.me/", "LicenseContext": "NonCommercial"
"AccessKey": "XxtdnJajPjp3hHuKdOMn", }
"SecretKey": "rVPzB05giC7bA400cUuIThzT4T9SGCcpcmL3tBBg", },
"BucketName": "bma-ehr-fpt" "MinIO": {
}, "Endpoint": "https://edm-s3.frappet.synology.me/",
"Protocol": "HTTPS", "AccessKey": "XxtdnJajPjp3hHuKdOMn",
"Node": { "SecretKey": "rVPzB05giC7bA400cUuIThzT4T9SGCcpcmL3tBBg",
"API": "https://bma-ehr.frappet.synology.me/api/v1/probation" "BucketName": "bma-ehr-fpt"
}, },
"Rabbit": { "Protocol": "HTTPS",
"Host": "192.168.1.40", "Node": {
"API": "https://bma-ehr.frappet.synology.me/api/v1", "API": "https://bma-ehr.frappet.synology.me/api/v1/probation"
"User": "admin", },
"Password": "Test123456", "Rabbit": {
"Queue": "bma-checkin-queue", "Host": "192.168.1.40",
"URL": "https://edm-mq.frappet.synology.me/api/queues/%2F/"
},
"Mail": {
"Server": "mail.bangkok.go.th",
"User": "saraban.csc.rd@bangkok.go.th",
"Password": "Saraban5222",
"MailFrom": "saraban.csc.rd@bangkok.go.th",
"Port": "25"
},
"VITE_URL_MGT": "https://bma-ehr.frappet.synology.me",
"API": "https://bma-ehr.frappet.synology.me/api/v1", "API": "https://bma-ehr.frappet.synology.me/api/v1",
//"API": "https://bma-hrms.bangkok.go.th/api/v1", "User": "admin",
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz" "Password": "Test123456",
} "Queue": "bma-checkin-queue",
"URL": "https://edm-mq.frappet.synology.me/api/queues/%2F/"
},
"Mail": {
"Server": "mail.bangkok.go.th",
"User": "saraban.csc.rd@bangkok.go.th",
"Password": "Saraban5222",
"MailFrom": "saraban.csc.rd@bangkok.go.th",
"Port": "25"
},
"VITE_URL_MGT": "https://bma-ehr.frappet.synology.me",
"API": "https://bma-ehr.frappet.synology.me/api/v1",
//"API": "https://bma-hrms.bangkok.go.th/api/v1",
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
}

View file

@ -229,15 +229,14 @@ namespace BMA.EHR.Placement.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
placementAppointments = placementAppointments placementAppointments = placementAppointments.Where(x =>
.Where(x => node == 0 ? x.rootDnaId == nodeId && x.child1DnaId == null :
(node == 0 && x.child1DnaId == null && x.rootDnaId == nodeId) || node == 1 ? x.child1DnaId == nodeId && x.child2DnaId == null :
(node == 1 && x.child1DnaId != null && x.child2DnaId == null && x.child1DnaId == nodeId) || node == 2 ? x.child2DnaId == nodeId && x.child3DnaId == null :
(node == 2 && x.child2DnaId != null && x.child3DnaId == null && x.child2DnaId == nodeId) || node == 3 ? x.child3DnaId == nodeId && x.child4DnaId == null :
(node == 3 && x.child3DnaId != null && x.child4DnaId == null && x.child3DnaId == nodeId) || node == 4 ? x.child4DnaId == nodeId :
(node == 4 && x.child4DnaId == nodeId) true
) ).ToList();
.ToList();
} }
return Success(placementAppointments); return Success(placementAppointments);
} }

View file

@ -222,8 +222,14 @@ namespace BMA.EHR.Placement.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
placementAppointments = placementAppointments placementAppointments = placementAppointments.Where(x =>
.Where(x => node == 0 ? x.child1DnaId == null : (node == 1 ? x.child2DnaId == null : (node == 2 ? x.child3DnaId == null : (node == 3 ? x.child4DnaId == null : true)))).ToList(); node == 0 ? x.rootDnaId == nodeId && x.child1DnaId == null :
node == 1 ? x.child1DnaId == nodeId && x.child2DnaId == null :
node == 2 ? x.child2DnaId == nodeId && x.child3DnaId == null :
node == 3 ? x.child3DnaId == nodeId && x.child4DnaId == null :
node == 4 ? x.child4DnaId == nodeId :
true
).ToList();
} }
return Success(placementAppointments); return Success(placementAppointments);
} }

View file

@ -1206,6 +1206,7 @@ namespace BMA.EHR.Placement.Service.Controllers
{ {
PlacementProfile = profile, PlacementProfile = profile,
EducationLevelId = req.EducationLevelId, EducationLevelId = req.EducationLevelId,
EducationLevelName = req.EducationLevelName,
PositionPath = positionPath, PositionPath = positionPath,
Institute = req.Institute, Institute = req.Institute,
Degree = req.Degree, Degree = req.Degree,
@ -1248,6 +1249,7 @@ namespace BMA.EHR.Placement.Service.Controllers
return Error(GlobalMessages.EducationNotFound, 404); return Error(GlobalMessages.EducationNotFound, 404);
education.EducationLevelId = req.EducationLevelId; education.EducationLevelId = req.EducationLevelId;
education.EducationLevelName = req.EducationLevelName;
education.PositionPath = positionPath; education.PositionPath = positionPath;
education.Institute = req.Institute; education.Institute = req.Institute;
education.Degree = req.Degree; education.Degree = req.Degree;
@ -3540,6 +3542,8 @@ namespace BMA.EHR.Placement.Service.Controllers
RegisterDate = candidate.GetType().GetProperty("RegisterDate").GetValue(candidate), RegisterDate = candidate.GetType().GetProperty("RegisterDate").GetValue(candidate),
Url = picContent ?? "https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg", Url = picContent ?? "https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg",
Careers = careers, Careers = careers,
IsBachelors = candidate.GetType().GetProperty("IsBachelors").GetValue(candidate),
EditorConfirms = candidate.GetType().GetProperty("EditorConfirms").GetValue(candidate)
}; };
var data = new var data = new

View file

@ -183,8 +183,14 @@ namespace BMA.EHR.Placement.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
placementOfficers = placementOfficers placementOfficers = placementOfficers.Where(x =>
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList(); node == 0 ? x.rootDnaOldId == nodeId && x.child1DnaOldId == null :
node == 1 ? x.child1DnaOldId == nodeId && x.child2DnaOldId == null :
node == 2 ? x.child2DnaOldId == nodeId && x.child3DnaOldId == null :
node == 3 ? x.child3DnaOldId == nodeId && x.child4DnaOldId == null :
node == 4 ? x.child4DnaOldId == nodeId :
true
).ToList();
} }
return Success(placementOfficers); return Success(placementOfficers);
} }

View file

@ -221,8 +221,14 @@ namespace BMA.EHR.Placement.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
placementReceives = placementReceives placementReceives = placementReceives.Where(x =>
.Where(x => (node == 0 ? x.child1DnaId == null : (node == 1 ? x.child2DnaId == null : (node == 2 ? x.child3DnaId == null : (node == 3 ? x.child4DnaId == null : true)))) || (x.CreatedUserId == UserId)).ToList(); node == 0 ? x.rootDnaId == nodeId && x.child1DnaId == null :
node == 1 ? x.child1DnaId == nodeId && x.child2DnaId == null :
node == 2 ? x.child2DnaId == nodeId && x.child3DnaId == null :
node == 3 ? x.child3DnaId == nodeId && x.child4DnaId == null :
node == 4 ? x.child4DnaId == nodeId :
true
).ToList();
} }
return Success(placementReceives); return Success(placementReceives);
} }
@ -501,13 +507,18 @@ namespace BMA.EHR.Placement.Service.Controllers
int calStp2 = cal % 11; int calStp2 = cal % 11;
int chkDigit = 11 - calStp2; int chkDigit = 11 - calStp2;
if (chkDigit == 10) //////if (chkDigit == 10)
//////{
////// chkDigit = 1;
//////}
//////else if (chkDigit == 11)
//////{
////// chkDigit = chkDigit % 10;
//////}
if (chkDigit >= 10)
{ {
chkDigit = 1; chkDigit = 0;
}
else if (chkDigit == 11)
{
chkDigit = chkDigit % 10;
} }
if (citizenIdDigits[12] != chkDigit) if (citizenIdDigits[12] != chkDigit)
@ -817,13 +828,9 @@ namespace BMA.EHR.Placement.Service.Controllers
int calStp2 = cal % 11; int calStp2 = cal % 11;
int chkDigit = 11 - calStp2; int chkDigit = 11 - calStp2;
if (chkDigit == 10) if (chkDigit >= 10)
{ {
chkDigit = 1; chkDigit = 0;
}
else if (chkDigit == 11)
{
chkDigit = chkDigit % 10;
} }
if (citizenIdDigits[12] != chkDigit) if (citizenIdDigits[12] != chkDigit)

View file

@ -188,8 +188,14 @@ namespace BMA.EHR.Placement.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
placementRepatriations = placementRepatriations placementRepatriations = placementRepatriations.Where(x =>
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList(); node == 0 ? x.rootDnaOldId == nodeId && x.child1DnaOldId == null :
node == 1 ? x.child1DnaOldId == nodeId && x.child2DnaOldId == null :
node == 2 ? x.child2DnaOldId == nodeId && x.child3DnaOldId == null :
node == 3 ? x.child3DnaOldId == nodeId && x.child4DnaOldId == null :
node == 4 ? x.child4DnaOldId == nodeId :
true
).ToList();
} }
return Success(placementRepatriations); return Success(placementRepatriations);
} }

View file

@ -274,8 +274,14 @@ namespace BMA.EHR.Placement.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
placementTransfers = placementTransfers placementTransfers = placementTransfers.Where(x =>
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList(); node == 0 ? x.rootDnaOldId == nodeId && x.child1DnaOldId == null :
node == 1 ? x.child1DnaOldId == nodeId && x.child2DnaOldId == null :
node == 2 ? x.child2DnaOldId == nodeId && x.child3DnaOldId == null :
node == 3 ? x.child3DnaOldId == nodeId && x.child4DnaOldId == null :
node == 4 ? x.child4DnaOldId == nodeId :
true
).ToList();
} }
return Success(placementTransfers); return Success(placementTransfers);

View file

@ -23,6 +23,7 @@ namespace BMA.EHR.Placement.Service.Requests
public DateTime? FinishDate { get; set; } public DateTime? FinishDate { get; set; }
public DateTime? StartDate { get; set; } public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; } public DateTime? EndDate { get; set; }
public string? EducationLevelName { get; set; }
} }
} }

View file

@ -167,8 +167,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
retirementDeceaseds = retirementDeceaseds retirementDeceaseds = retirementDeceaseds.Where(x =>
.Where(x => node == 0 ? x.child1DnaId == null : (node == 1 ? x.child2DnaId == null : (node == 2 ? x.child3DnaId == null : (node == 3 ? x.child4DnaId == null : true)))).ToList(); node == 0 ? x.rootDnaId == nodeId && x.child1DnaId == null :
node == 1 ? x.child1DnaId == nodeId && x.child2DnaId == null :
node == 2 ? x.child2DnaId == nodeId && x.child3DnaId == null :
node == 3 ? x.child3DnaId == nodeId && x.child4DnaId == null :
node == 4 ? x.child4DnaId == nodeId :
true
).ToList();
} }
return Success(retirementDeceaseds); return Success(retirementDeceaseds);
} }

View file

@ -217,8 +217,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
retirementOthers = retirementOthers retirementOthers = retirementOthers.Where(x =>
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList(); node == 0 ? x.rootDnaOldId == nodeId && x.child1DnaOldId == null :
node == 1 ? x.child1DnaOldId == nodeId && x.child2DnaOldId == null :
node == 2 ? x.child2DnaOldId == nodeId && x.child3DnaOldId == null :
node == 3 ? x.child3DnaOldId == nodeId && x.child4DnaOldId == null :
node == 4 ? x.child4DnaOldId == nodeId :
true
).ToList();
} }
return Success(retirementOthers); return Success(retirementOthers);
} }

View file

@ -198,8 +198,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
retirementOuts = retirementOuts retirementOuts = retirementOuts.Where(x =>
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList(); node == 0 ? x.rootDnaOldId == nodeId && x.child1DnaOldId == null :
node == 1 ? x.child1DnaOldId == nodeId && x.child2DnaOldId == null :
node == 2 ? x.child2DnaOldId == nodeId && x.child3DnaOldId == null :
node == 3 ? x.child3DnaOldId == nodeId && x.child4DnaOldId == null :
node == 4 ? x.child4DnaOldId == nodeId :
true
).ToList();
} }
return Success(retirementOuts); return Success(retirementOuts);
} }

View file

@ -324,8 +324,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
retirementResigns = retirementResigns retirementResigns = retirementResigns.Where(x =>
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList(); node == 0 ? x.rootDnaOldId == nodeId && x.child1DnaOldId == null :
node == 1 ? x.child1DnaOldId == nodeId && x.child2DnaOldId == null :
node == 2 ? x.child2DnaOldId == nodeId && x.child3DnaOldId == null :
node == 3 ? x.child3DnaOldId == nodeId && x.child4DnaOldId == null :
node == 4 ? x.child4DnaOldId == nodeId :
true
).ToList();
} }
return Success(retirementResigns); return Success(retirementResigns);
@ -432,8 +438,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
retirementResigns = retirementResigns retirementResigns = retirementResigns.Where(x =>
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList(); node == 0 ? x.rootDnaOldId == nodeId && x.child1DnaOldId == null :
node == 1 ? x.child1DnaOldId == nodeId && x.child2DnaOldId == null :
node == 2 ? x.child2DnaOldId == nodeId && x.child3DnaOldId == null :
node == 3 ? x.child3DnaOldId == nodeId && x.child4DnaOldId == null :
node == 4 ? x.child4DnaOldId == nodeId :
true
).ToList();
} }
return Success(retirementResigns); return Success(retirementResigns);
@ -2197,8 +2209,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
data = data data = data.Where(x =>
.Where(x => node == 0 ? x.child1DnaId == null : (node == 1 ? x.child2DnaId == null : (node == 2 ? x.child3DnaId == null : (node == 3 ? x.child4DnaId == null : true)))).ToList(); node == 0 ? x.rootDnaId == nodeId && x.child1DnaId == null :
node == 1 ? x.child1DnaId == nodeId && x.child2DnaId == null :
node == 2 ? x.child2DnaId == nodeId && x.child3DnaId == null :
node == 3 ? x.child3DnaId == nodeId && x.child4DnaId == null :
node == 4 ? x.child4DnaId == nodeId :
true
).ToList();
} }
return Success(data); return Success(data);
} }

View file

@ -263,8 +263,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
retirementResignEmployees = retirementResignEmployees retirementResignEmployees = retirementResignEmployees.Where(x =>
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList(); node == 0 ? x.rootDnaOldId == nodeId && x.child1DnaOldId == null :
node == 1 ? x.child1DnaOldId == nodeId && x.child2DnaOldId == null :
node == 2 ? x.child2DnaOldId == nodeId && x.child3DnaOldId == null :
node == 3 ? x.child3DnaOldId == nodeId && x.child4DnaOldId == null :
node == 4 ? x.child4DnaOldId == nodeId :
true
).ToList();
} }
return Success(retirementResignEmployees); return Success(retirementResignEmployees);
@ -370,8 +376,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
retirementResignEmployees = retirementResignEmployees retirementResignEmployees = retirementResignEmployees.Where(x =>
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList(); node == 0 ? x.rootDnaOldId == nodeId && x.child1DnaOldId == null :
node == 1 ? x.child1DnaOldId == nodeId && x.child2DnaOldId == null :
node == 2 ? x.child2DnaOldId == nodeId && x.child3DnaOldId == null :
node == 3 ? x.child3DnaOldId == nodeId && x.child4DnaOldId == null :
node == 4 ? x.child4DnaOldId == nodeId :
true
).ToList();
} }
return Success(retirementResignEmployees); return Success(retirementResignEmployees);
@ -2113,8 +2125,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
} }
else if (role == "NORMAL") else if (role == "NORMAL")
{ {
data = data data = data.Where(x =>
.Where(x => node == 0 ? x.child1DnaId == null : (node == 1 ? x.child2DnaId == null : (node == 2 ? x.child3DnaId == null : (node == 3 ? x.child4DnaId == null : true)))).ToList(); node == 0 ? x.rootDnaId == nodeId && x.child1DnaId == null :
node == 1 ? x.child1DnaId == nodeId && x.child2DnaId == null :
node == 2 ? x.child2DnaId == nodeId && x.child3DnaId == null :
node == 3 ? x.child3DnaId == nodeId && x.child4DnaId == null :
node == 4 ? x.child4DnaId == nodeId :
true
).ToList();
} }
return Success(data); return Success(data);
} }