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,
LastName = pf.LastName,
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);
@ -216,7 +221,12 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
FirstName = pf.FirstName,
LastName = pf.LastName,
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);

View file

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

View file

@ -172,9 +172,14 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
}
else if (role == "NORMAL")
{
data = data
.Where(x => node == 0 ? x.Child1DnaId == null : (node == 1 ? x.Child2DnaId == null : (node == 2 ? x.Child3DnaId == null : (node == 3 ? x.Child4DnaId == null : true))))
.ToList();
data = data.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();
}
return data;
}

View file

@ -169,10 +169,11 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
else if (role == "NORMAL")
{
data = data.Where(x =>
node == 0 ? x.Child1DnaId == null :
node == 1 ? x.Child2DnaId == null :
node == 2 ? x.Child3DnaId == null :
node == 3 ? x.Child4DnaId == null :
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();
}
@ -279,9 +280,14 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
}
else if (role == "NORMAL")
{
data = data
.Where(x => node == 0 ? x.Child1DnaId == null : (node == 1 ? x.Child2DnaId == null : (node == 2 ? x.Child3DnaId == null : (node == 3 ? x.Child4DnaId == null : true))))
.ToList();
data = data.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();
}
return data;
}

View file

@ -138,9 +138,14 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
}
else if (role == "NORMAL")
{
data = data
.Where(x => node == 0 ? x.Child1DnaId == null : (node == 1 ? x.Child2DnaId == null : (node == 2 ? x.Child3DnaId == null : (node == 3 ? x.Child4DnaId == null : true))))
.ToList();
data = data.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();
}
return data;
}

View file

@ -5,6 +5,7 @@ using BMA.EHR.Domain.Shared;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using System.Text;
using System.Text.RegularExpressions;
using static BMA.EHR.Domain.Extensions.DateTimeExtension;
namespace BMA.EHR.Application.Repositories.Reports
@ -82,76 +83,128 @@ namespace BMA.EHR.Application.Repositories.Reports
sb.Append(monthDiff == 0 ? "" : $"{monthDiff} เดือน ");
sb.Append(dayDiff == 0 ? "" : $"{dayDiff} วัน ");
}
var data = await _dbExamContext.Set<Candidate>().AsQueryable()
.Where(x => x.Id == id)
.Select(p => new
{
p.Id,
AvatarId = p.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.ProfileImg.Id,
ExamIdenNumber = p.ExamIdenNumber == null ? "-" : p.ExamIdenNumber.ToThaiNumber(),
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(),
var candidate = await _dbExamContext.Set<Candidate>()
.Where(x => x.Id == id)
.Include(p => p.PeriodExam)
.Include(p => p.Educations)
.Include(p => p.PositionExam)
.Include(p => p.ProfileImg)
.FirstOrDefaultAsync();
FullName = $"{p.PrefixName}{p.FirstName} {p.LastName}",
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)
if (candidate == null)
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)
{
@ -176,10 +229,10 @@ namespace BMA.EHR.Application.Repositories.Reports
{
Position = item.Position,
Type = item.Type,
DurationStart = item.DurationStart.ToThaiNumber(),
DurationEnd = item.DurationEnd.ToThaiNumber(),
RangeDate = item.RangeDate.ToThaiNumber(),
Index = retVal.ToString().ToThaiNumber(),
DurationStart = item.DurationStart,
DurationEnd = item.DurationEnd,
RangeDate = item.RangeDate,
Index = retVal.ToString(),
};
data.Add(_data);
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)
{
try

View file

@ -37,5 +37,11 @@ namespace BMA.EHR.Application.Responses.Organizations
public string? Child4 { 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")
{
data_search = data_search
.Where(x => node == 0 ? x.child1DnaId == null : (node == 1 ? x.child2DnaId == null : (node == 2 ? x.child3DnaId == null : (node == 3 ? x.child4DnaId == null : true)))).ToList();
data_search = data_search.Where(x =>
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
.Select(x => new

View file

@ -15,5 +15,7 @@ namespace BMA.EHR.Domain.Models.Insignias
[Comment("Fk Table InsigniaManage")]
public InsigniaManage InsigniaManage { get; set; }
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("จำนวนวันลาที่ใช้ไป")]
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("ตำแหน่งปัจจุบัน กลุ่ม/ฝ่าย")]
public string? OccupationGroup { get; set; }
[Comment("ตำแหน่งปัจจุบัน เงินเดือน")]
public int? OccupationSalary { get; set; }
public double? OccupationSalary { get; set; }
[Comment("ตำแหน่งปัจจุบัน สังกัด")]
public string? OccupationPosition { get; set; }
[Comment("ตำแหน่งปัจจุบัน ประเภทราชการ")]

View file

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

View file

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

View file

@ -16,11 +16,9 @@ namespace BMA.EHR.Infrastructure.MessageQueue
{
#region " Fields "
private readonly UserProfileRepository _userProfileRepository;
private readonly InsigniaPeriodsRepository _insigniaPeriodsRepository;
private readonly IHttpContextAccessor _httpContextAccessor;
private const string INSIGNIA_QUEUE = "bma_insignia_request";
private readonly IServiceScopeFactory _serviceScopeFactory;
private readonly IConfiguration _configuration;
private IConnection _connection;
@ -30,33 +28,29 @@ namespace BMA.EHR.Infrastructure.MessageQueue
#region " Constructor and Destructor "
public RabbitMQConsumer(UserProfileRepository userProfileRepository,
InsigniaPeriodsRepository insigniaPeriodsRepository,
IHttpContextAccessor httpContextAccessor,
public RabbitMQConsumer(IHttpContextAccessor httpContextAccessor,
IServiceScopeFactory serviceScopeFactory,
IConfiguration configuration)
{
_serviceScopeFactory = serviceScopeFactory;
_configuration = configuration;
_userProfileRepository = userProfileRepository;
_insigniaPeriodsRepository = insigniaPeriodsRepository;
_httpContextAccessor = httpContextAccessor;
var host = _configuration["RabbitMQ:URL"];
var userName = _configuration["RabbitMQ:UserName"];
var password = _configuration["RabbitMQ:Password"];
var factory = new ConnectionFactory()
{
HostName = host,
UserName = userName,
Password = password
};
_connection = factory.CreateConnection();
_channel = _connection.CreateModel();
_channel.QueueDeclare(queue: INSIGNIA_QUEUE, durable: false, exclusive: false, autoDelete: false, arguments: null);
}
public override void Dispose()
@ -85,19 +79,19 @@ namespace BMA.EHR.Infrastructure.MessageQueue
var userRepo = scope.ServiceProvider.GetRequiredService<UserProfileRepository>();
var insigniaRepo = scope.ServiceProvider.GetRequiredService<InsigniaPeriodsRepository>();
var selectPeriod = await _insigniaPeriodsRepository.GetByIdAsync(periodId);
var selectPeriod = await insigniaRepo.GetByIdAsync(periodId);
if (selectPeriod == null)
{
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
}
var organizations = await userRepo.GetActiveRootAsync(AccessToken, selectPeriod.RevisionId);
foreach (var organization in organizations)
{
if (organization == null)
continue;
var result = await insigniaRepo.GetInsigniaRequest(periodId, organization.Id);
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)")
.HasComment("รหัสหน่วยงาน");
b.Property<Guid?>("RootDnaId")
.HasColumnType("char(36)");
b.Property<int>("Total")
.HasColumnType("int")
.HasComment("จำนวนทั้งหมด");
@ -12794,8 +12797,8 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("ตำแหน่งปัจจุบัน ประเภทราชการ");
b.Property<int?>("OccupationSalary")
.HasColumnType("int")
b.Property<double?>("OccupationSalary")
.HasColumnType("double")
.HasComment("ตำแหน่งปัจจุบัน เงินเดือน");
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")
.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")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
@ -195,6 +207,9 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
.HasColumnType("char(36)")
.HasComment("รหัส Profile ในระบบทะเบียนประวัติ");
b.Property<Guid?>("RootDnaId")
.HasColumnType("char(36)");
b.HasKey("Id");
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);
if (req.Total + total > insigniaManage.Total)
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(
new InsigniaManageOrganiation
{
@ -344,6 +347,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
RootDnaId = rootDnaId
});
await _context.SaveChangesAsync();
@ -710,8 +714,14 @@ namespace BMA.EHR.Insignia.Service.Controllers
}
else if (role == "NORMAL")
{
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)))).ToList();
rawData = rawData.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();
}
var data = rawData
@ -791,7 +801,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
var insigniaManageOrganiation = await _context.InsigniaManageOrganiations.AsQueryable()
.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)
return Error(GlobalMessages.InsigniaManageOrgNotFound);
@ -989,8 +999,14 @@ namespace BMA.EHR.Insignia.Service.Controllers
}
else if (role == "NORMAL")
{
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)))).ToList();
rawData = rawData.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();
}
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 System.Security.Claims;
@ -9,16 +10,17 @@ public class InsigniaRequestProcessService : BackgroundService
{
private readonly IBackgroundTaskQueue _queue;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IServiceScopeFactory _serviceScopeFactory;
public InsigniaRequestProcessService(
IBackgroundTaskQueue queue,
IHttpContextAccessor httpContextAccessor)
IHttpContextAccessor httpContextAccessor,
IServiceScopeFactory serviceScopeFactory)
{
_queue = queue;
_httpContextAccessor = httpContextAccessor;
_serviceScopeFactory = serviceScopeFactory;
}
#region " Properties "
@ -93,6 +95,14 @@ public class InsigniaRequestProcessService : BackgroundService
var endTime = DateTime.Now;
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)

View file

@ -1,61 +1,65 @@
{
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Information",
"System": "Warning"
}
}
},
"ElasticConfiguration": {
"Uri": "http://192.168.1.40:9200",
"IndexFormat": "bma-ehr-log-index",
"SystemName": "insignia"
},
"AllowedHosts": "*",
"ConnectionStrings": {
//"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;",
"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;"
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Information",
"System": "Warning"
}
}
},
"ElasticConfiguration": {
"Uri": "http://192.168.1.40:9200",
"IndexFormat": "bma-ehr-log-index",
"SystemName": "insignia"
},
"AllowedHosts": "*",
"ConnectionStrings": {
//"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;",
// "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;"
//"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;",
//"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=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;"
},
"Jwt": {
//"Key": "j7C9RO_p4nRtuwCH4z9Db_A_6We42tkD_p4lZtDrezc",
//"Issuer": "https://hrms-id.chin.in.th/realms/hrms"
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"Issuer": "https://id.frappet.synology.me/realms/hrms"
},
"EPPlus": {
"ExcelPackage": {
"LicenseContext": "NonCommercial"
}
},
"MinIO": {
"Endpoint": "https://edm-s3.frappet.synology.me/",
"AccessKey": "XxtdnJajPjp3hHuKdOMn",
"SecretKey": "rVPzB05giC7bA400cUuIThzT4T9SGCcpcmL3tBBg",
"BucketName": "bma-ehr-fpt"
},
"KeycloakCron": {
"Hour": "08",
"Minute": "00"
},
"Protocol": "HTTPS",
"Node": {
"API": "https://bma-ehr.frappet.synology.me/api/v1/probation"
},
"API": "https://bma-ehr.frappet.synology.me/api/v1",
"RabbitMQ": {
"URL": "localhost",
"UserName": "frappet",
"Password": "FPTadmin2357"
},
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
"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=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=192.168.1.63;user=root;password=12345678;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=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms;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=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;"
},
"Jwt": {
//"Key": "j7C9RO_p4nRtuwCH4z9Db_A_6We42tkD_p4lZtDrezc",
//"Issuer": "https://hrms-id.chin.in.th/realms/hrms"
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"Issuer": "https://id.frappet.synology.me/realms/hrms"
},
"EPPlus": {
"ExcelPackage": {
"LicenseContext": "NonCommercial"
}
},
"MinIO": {
"Endpoint": "https://edm-s3.frappet.synology.me/",
"AccessKey": "XxtdnJajPjp3hHuKdOMn",
"SecretKey": "rVPzB05giC7bA400cUuIThzT4T9SGCcpcmL3tBBg",
"BucketName": "bma-ehr-fpt"
},
"KeycloakCron": {
"Hour": "08",
"Minute": "00"
},
"Protocol": "HTTPS",
"Node": {
"API": "https://bma-ehr.frappet.synology.me/api/v1/probation"
},
"API": "https://bma-ehr.frappet.synology.me/api/v1",
"RabbitMQ": {
"URL": "localhost",
"UserName": "frappet",
"Password": "FPTadmin2357"
},
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
}

View file

@ -12,6 +12,7 @@ using OfficeOpenXml.ConditionalFormatting;
using Swashbuckle.AspNetCore.Annotations;
using System.Security.Claims;
using Microsoft.EntityFrameworkCore;
using BMA.EHR.Application.Responses.Profiles;
namespace BMA.EHR.Leave.Service.Controllers
{
@ -97,7 +98,7 @@ namespace BMA.EHR.Leave.Service.Controllers
{
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);
if (jsonData["status"]?.ToString() != "200")
{
@ -109,6 +110,62 @@ namespace BMA.EHR.Leave.Service.Controllers
if (req.Type != Guid.Empty)
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>();
foreach (var item in resData)
@ -205,7 +262,7 @@ namespace BMA.EHR.Leave.Service.Controllers
{
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);
if (jsonData["status"]?.ToString() != "200")
{
@ -237,7 +294,7 @@ namespace BMA.EHR.Leave.Service.Controllers
{
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);
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 getPermission = await _permission.GetPermissionAPIAsync("UPDATE", "SYS_LEAVE_LIST");
var getPermission = await _permission.GetPermissionAPIAsync("UPDATE", "SYS_LEAVE_HISTORY");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
@ -325,7 +382,7 @@ namespace BMA.EHR.Leave.Service.Controllers
try
{
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);
if (jsonData["status"]?.ToString() != "200")
{
@ -359,6 +416,12 @@ namespace BMA.EHR.Leave.Service.Controllers
leaveBeginning.FirstName = profile.FirstName;
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.CreatedFullName = FullName ?? "";
leaveBeginning.CreatedAt = DateTime.Now;

View file

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

View file

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

View file

@ -1,66 +1,70 @@
{
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Information",
"System": "Warning"
}
}
},
"ElasticConfiguration": {
"Uri": "http://192.168.1.40:9200",
"IndexFormat": "bma-ehr-log-index",
"SystemName": "leave"
},
"AllowedHosts": "*",
"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;",
"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;"
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Information",
"System": "Warning"
}
}
},
"ElasticConfiguration": {
"Uri": "http://192.168.1.40:9200",
"IndexFormat": "bma-ehr-log-index",
"SystemName": "leave"
},
"AllowedHosts": "*",
"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;",
"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;"
//"DefaultConnection": "server=172.27.17.68;user=user;password=cDldaqkwESWvuZ37Gr0n;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;",
//"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;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"Issuer": "https://id.frappet.synology.me/realms/hrms"
//"Key": "xY2VR-EFvvNPsMs39u8ooVBWQL6mPwrNJOh3koJFTgU",
//"Issuer": "https://hrms-id.bangkok.go.th/realms/hrms"
},
"EPPlus": {
"ExcelPackage": {
"LicenseContext": "NonCommercial"
}
},
"MinIO": {
"Endpoint": "https://edm-s3.frappet.synology.me/",
"AccessKey": "XxtdnJajPjp3hHuKdOMn",
"SecretKey": "rVPzB05giC7bA400cUuIThzT4T9SGCcpcmL3tBBg",
"BucketName": "bma-ehr-fpt"
},
"Protocol": "HTTPS",
"Node": {
"API": "https://bma-ehr.frappet.synology.me/api/v1/probation"
},
"Rabbit": {
"Host": "192.168.1.40",
"API": "https://bma-ehr.frappet.synology.me/api/v1",
"User": "admin",
"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",
// "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=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=192.168.1.63;user=root;password=12345678;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;",
//"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;",
//"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;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"Issuer": "https://id.frappet.synology.me/realms/hrms"
//"Key": "xY2VR-EFvvNPsMs39u8ooVBWQL6mPwrNJOh3koJFTgU",
//"Issuer": "https://hrms-id.bangkok.go.th/realms/hrms"
},
"EPPlus": {
"ExcelPackage": {
"LicenseContext": "NonCommercial"
}
},
"MinIO": {
"Endpoint": "https://edm-s3.frappet.synology.me/",
"AccessKey": "XxtdnJajPjp3hHuKdOMn",
"SecretKey": "rVPzB05giC7bA400cUuIThzT4T9SGCcpcmL3tBBg",
"BucketName": "bma-ehr-fpt"
},
"Protocol": "HTTPS",
"Node": {
"API": "https://bma-ehr.frappet.synology.me/api/v1/probation"
},
"Rabbit": {
"Host": "192.168.1.40",
"API": "https://bma-ehr.frappet.synology.me/api/v1",
//"API": "https://bma-hrms.bangkok.go.th/api/v1",
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
}
"User": "admin",
"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")
{
placementAppointments = placementAppointments
.Where(x =>
(node == 0 && x.child1DnaId == null && x.rootDnaId == nodeId) ||
(node == 1 && x.child1DnaId != null && x.child2DnaId == null && x.child1DnaId == nodeId) ||
(node == 2 && x.child2DnaId != null && x.child3DnaId == null && x.child2DnaId == nodeId) ||
(node == 3 && x.child3DnaId != null && x.child4DnaId == null && x.child3DnaId == nodeId) ||
(node == 4 && x.child4DnaId == nodeId)
)
.ToList();
placementAppointments = placementAppointments.Where(x =>
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);
}

View file

@ -222,8 +222,14 @@ namespace BMA.EHR.Placement.Service.Controllers
}
else if (role == "NORMAL")
{
placementAppointments = placementAppointments
.Where(x => node == 0 ? x.child1DnaId == null : (node == 1 ? x.child2DnaId == null : (node == 2 ? x.child3DnaId == null : (node == 3 ? x.child4DnaId == null : true)))).ToList();
placementAppointments = placementAppointments.Where(x =>
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);
}

View file

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

View file

@ -183,8 +183,14 @@ namespace BMA.EHR.Placement.Service.Controllers
}
else if (role == "NORMAL")
{
placementOfficers = placementOfficers
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList();
placementOfficers = placementOfficers.Where(x =>
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);
}

View file

@ -221,8 +221,14 @@ namespace BMA.EHR.Placement.Service.Controllers
}
else if (role == "NORMAL")
{
placementReceives = placementReceives
.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();
placementReceives = placementReceives.Where(x =>
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);
}
@ -501,13 +507,18 @@ namespace BMA.EHR.Placement.Service.Controllers
int calStp2 = cal % 11;
int chkDigit = 11 - calStp2;
if (chkDigit == 10)
//////if (chkDigit == 10)
//////{
////// chkDigit = 1;
//////}
//////else if (chkDigit == 11)
//////{
////// chkDigit = chkDigit % 10;
//////}
if (chkDigit >= 10)
{
chkDigit = 1;
}
else if (chkDigit == 11)
{
chkDigit = chkDigit % 10;
chkDigit = 0;
}
if (citizenIdDigits[12] != chkDigit)
@ -817,13 +828,9 @@ namespace BMA.EHR.Placement.Service.Controllers
int calStp2 = cal % 11;
int chkDigit = 11 - calStp2;
if (chkDigit == 10)
if (chkDigit >= 10)
{
chkDigit = 1;
}
else if (chkDigit == 11)
{
chkDigit = chkDigit % 10;
chkDigit = 0;
}
if (citizenIdDigits[12] != chkDigit)

View file

@ -188,8 +188,14 @@ namespace BMA.EHR.Placement.Service.Controllers
}
else if (role == "NORMAL")
{
placementRepatriations = placementRepatriations
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList();
placementRepatriations = placementRepatriations.Where(x =>
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);
}

View file

@ -274,8 +274,14 @@ namespace BMA.EHR.Placement.Service.Controllers
}
else if (role == "NORMAL")
{
placementTransfers = placementTransfers
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList();
placementTransfers = placementTransfers.Where(x =>
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);

View file

@ -23,6 +23,7 @@ namespace BMA.EHR.Placement.Service.Requests
public DateTime? FinishDate { get; set; }
public DateTime? StartDate { 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")
{
retirementDeceaseds = retirementDeceaseds
.Where(x => node == 0 ? x.child1DnaId == null : (node == 1 ? x.child2DnaId == null : (node == 2 ? x.child3DnaId == null : (node == 3 ? x.child4DnaId == null : true)))).ToList();
retirementDeceaseds = retirementDeceaseds.Where(x =>
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);
}

View file

@ -217,8 +217,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
}
else if (role == "NORMAL")
{
retirementOthers = retirementOthers
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList();
retirementOthers = retirementOthers.Where(x =>
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);
}

View file

@ -198,8 +198,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
}
else if (role == "NORMAL")
{
retirementOuts = retirementOuts
.Where(x => node == 0 ? x.child1DnaOldId == null : (node == 1 ? x.child2DnaOldId == null : (node == 2 ? x.child3DnaOldId == null : (node == 3 ? x.child4DnaOldId == null : true)))).ToList();
retirementOuts = retirementOuts.Where(x =>
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);
}

View file

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

View file

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