Merge branch 'develop' into working
This commit is contained in:
commit
fb5ffde9d3
30 changed files with 49951 additions and 51 deletions
|
|
@ -1842,14 +1842,14 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คุณได้รับบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ ตามคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คุณได้รับรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ ตามคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
|
||||
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คุณได้รับบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ ตามคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คุณได้รับรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ ตามคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = profile.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
|
|
@ -1857,7 +1857,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คุณได้รับบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ ตามคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คุณได้รับรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ ตามคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = profile.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
|
|
@ -1879,7 +1879,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งบบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
|
|
@ -1891,14 +1891,14 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งบบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
}
|
||||
|
||||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คำสั่งบบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
|
|
@ -3200,7 +3200,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
if (lastSarary.Order != null)
|
||||
order = lastSarary.Order.Value + 1;
|
||||
|
||||
|
||||
|
||||
|
||||
var salary = new ProfileSalary
|
||||
{
|
||||
|
|
@ -6496,12 +6496,24 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
PositionSalaryAmount = 0,
|
||||
MonthSalaryAmount = 0
|
||||
};
|
||||
var profile = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Salaries)
|
||||
.FirstOrDefaultAsync(p => p.CitizenId == cmdReceiver.CitizenId);
|
||||
Double SalaryAmount = 0;
|
||||
Double PositionSalaryAmount = 0;
|
||||
Double MonthSalaryAmount = 0;
|
||||
if (profile != null && profile.Salaries.Count() > 0)
|
||||
{
|
||||
SalaryAmount = cmdReceiver.Amount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0;
|
||||
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0;
|
||||
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 0;
|
||||
}
|
||||
|
||||
return new PlacementSalaryResponse
|
||||
{
|
||||
SalaryAmount = cmdReceiver.Amount ?? 0,
|
||||
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount ?? 0,
|
||||
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount ?? 0
|
||||
SalaryAmount = cmdReceiver.Amount != null ? cmdReceiver.Amount.Value : SalaryAmount,
|
||||
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount != null ? cmdReceiver.PositionSalaryAmount.Value : PositionSalaryAmount,
|
||||
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount != null ? cmdReceiver.MouthSalaryAmount.Value : MonthSalaryAmount,
|
||||
};
|
||||
}
|
||||
catch
|
||||
|
|
@ -6520,12 +6532,24 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
if (placementProfile == null)
|
||||
throw new Exception($"Invalid placement profile: {placementProfileId}");
|
||||
var profile = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Salaries)
|
||||
.FirstOrDefaultAsync(p => p.CitizenId == placementProfile.CitizenId);
|
||||
Double SalaryAmount = 0;
|
||||
Double PositionSalaryAmount = 0;
|
||||
Double MonthSalaryAmount = 0;
|
||||
if (profile != null && profile.Salaries.Count() > 0)
|
||||
{
|
||||
SalaryAmount = placementProfile.Amount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0;
|
||||
PositionSalaryAmount = placementProfile.PositionSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0;
|
||||
MonthSalaryAmount = placementProfile.MouthSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 0;
|
||||
}
|
||||
|
||||
return new PlacementSalaryResponse
|
||||
{
|
||||
SalaryAmount = placementProfile.Amount ?? 0,
|
||||
PositionSalaryAmount = placementProfile.PositionSalaryAmount ?? 0,
|
||||
MonthSalaryAmount = placementProfile.MouthSalaryAmount ?? 0
|
||||
SalaryAmount = placementProfile.Amount != null ? placementProfile.Amount.Value : SalaryAmount,
|
||||
PositionSalaryAmount = placementProfile.PositionSalaryAmount != null ? placementProfile.PositionSalaryAmount.Value : PositionSalaryAmount,
|
||||
MonthSalaryAmount = placementProfile.MouthSalaryAmount != null ? placementProfile.MouthSalaryAmount.Value : MonthSalaryAmount,
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
p.IsActive == true &&
|
||||
p.IsLeave == false &&
|
||||
p.DateAppoint != null &&
|
||||
|
||||
|
||||
p.ProfileType == "employee" &&
|
||||
p.EmployeeClass == "perm"
|
||||
)
|
||||
|
|
@ -259,7 +259,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name,
|
||||
LastInsigniaId = p.Insignias.Count == 0 ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id,
|
||||
Salary = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
SalaryCondition = p.Salaries.Count() == 0 ? null : p.Salaries.Where(x => x.Date <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
SalaryCondition = p.Salaries.Count() == 0 ? null : p.Salaries.Where(x => x.Date <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
PostionSalaryAmount = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
|
||||
//FirstRecvInsigniaYear1 = p.Insignias.Count == 0 ? 0 :
|
||||
// p.Insignias.Where(x => x.Insignia.Name == "เบญจมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
|
||||
|
|
@ -273,8 +273,8 @@ namespace BMA.EHR.Application.Repositories
|
|||
var s1 = ((from p in inst_profile
|
||||
where p.ProfileDateAppoint <= new DateTime(period.Year - 8, 5, 29)
|
||||
&& p.LastInsigniaId == Guid.Parse("00000000-0000-0000-0000-000000000000")
|
||||
&& (p.SalaryCondition >= 8340
|
||||
&& p.SalaryCondition < 15050 )
|
||||
&& (p.SalaryCondition >= 8340
|
||||
&& p.SalaryCondition < 15050)
|
||||
select p)
|
||||
.ToList()
|
||||
.Select(p => new InsigniaResultSet
|
||||
|
|
@ -891,6 +891,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
p.IsLeave == false &&
|
||||
p.DateAppoint != null &&
|
||||
p.PositionType != null &&
|
||||
p.ProfileType == "officer" &&
|
||||
p.PositionType.Name == "ทั่วไป" //
|
||||
)
|
||||
.Select(p => new
|
||||
|
|
@ -962,6 +963,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& p.PositionLevel.Name == "ปฏิบัติงาน" // ปฏิบัติงาน
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("เบญจมาภรณ์ช้างเผือก")
|
||||
|
|
@ -1036,6 +1038,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป1
|
||||
&& p.PositionLevel.Name == "ปฏิบัติงาน" // ปฏิบัติงาน1
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("จัตุรถาภรณ์มงกุฎไทย")
|
||||
|
|
@ -1104,6 +1107,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป1
|
||||
&& p.PositionLevel.Name == "ปฏิบัติงาน" // ปฏิบัติงาน1
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("จัตุรถาภรณ์ช้างเผือก")
|
||||
|
|
@ -1285,6 +1289,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& p.PositionLevel.Name == "ชำนาญงาน" // ชำนาญงาน
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ตริตาภรณ์มงกุฎไทย")
|
||||
|
|
@ -1357,6 +1362,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& p.PositionLevel.Name == "ชำนาญงาน" // ชำนาญงาน
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ตริตาภรณ์ช้างเผือก")
|
||||
|
|
@ -1501,6 +1507,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& p.PositionLevel.Name == "อาวุโส" // อาวุโส
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์มงกุฎไทย")
|
||||
|
|
@ -1573,6 +1580,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& p.PositionLevel.Name == "อาวุโส" // อาวุโส
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
|
|
@ -1718,6 +1726,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& (p.PositionLevel.Name == "อาวุโส" || p.PositionLevel.Name == "อาวุโส (เฉพาะสายงาน)") // อาวุโส
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
|
|
@ -1790,6 +1799,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& (p.PositionLevel.Name == "อาวุโส" || p.PositionLevel.Name == "อาวุโส (เฉพาะสายงาน)") // อาวุโส
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
|
|
@ -1868,6 +1878,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& (p.PositionLevel.Name == "อาวุโส" || p.PositionLevel.Name == "อาวุโส (เฉพาะสายงาน)") // อาวุโส
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")
|
||||
|
|
@ -2035,7 +2046,8 @@ namespace BMA.EHR.Application.Repositories
|
|||
p.IsLeave == false &&
|
||||
p.DateAppoint != null &&
|
||||
p.PositionType != null &&
|
||||
p.PositionType.Name == "วิชาการ" // ประเภทวิชาการ
|
||||
p.PositionType.Name == "วิชาการ" && // ประเภทวิชาการ
|
||||
p.ProfileType == "officer"
|
||||
)
|
||||
.Select(p => new
|
||||
{
|
||||
|
|
@ -2160,6 +2172,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "ชำนาญการ" // ชำนาญการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ตริตาภรณ์ช้างเผือก")
|
||||
|
|
@ -2230,6 +2243,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "ชำนาญการ" // ชำนาญการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์มงกุฎไทย")
|
||||
|
|
@ -2301,6 +2315,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "ชำนาญการ" // ชำนาญการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
|
|
@ -2461,6 +2476,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "ชำนาญการพิเศษ" // ชำนาญการพิเศษ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
|
|
@ -2531,6 +2547,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "ชำนาญการพิเศษ" // ชำนาญการพิเศษ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
|
|
@ -2683,6 +2700,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "เชี่ยวชาญ" // เชี่ยวชสญ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
|
|
@ -2753,6 +2771,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "เชี่ยวชาญ" // เชี่ยวชาญ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
|
|
@ -2828,6 +2847,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "เชี่ยวชาญ" // เชี่ยวชาญ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")
|
||||
|
|
@ -2991,6 +3011,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionType != null
|
||||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& (p.PositionLevel.Name == "ทรงคุณวุฒิ" || p.PositionLevel.Name == "ทรงคุณวุฒิ (เฉพาะสายงาน)") // ทรงคุณวุฒิ
|
||||
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
|
|
@ -3074,6 +3095,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionType != null
|
||||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& (p.PositionLevel.Name == "ทรงคุณวุฒิ" || p.PositionLevel.Name == "ทรงคุณวุฒิ (เฉพาะสายงาน)") // ทรงคุณวุฒิ
|
||||
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
|
|
@ -3159,6 +3181,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionType != null
|
||||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& (p.PositionLevel.Name == "ทรงคุณวุฒิ" || p.PositionLevel.Name == "ทรงคุณวุฒิ (เฉพาะสายงาน)") // ทรงคุณวุฒิ
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
|
|
@ -3332,6 +3355,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionType != null
|
||||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& (p.PositionLevel.Name == "ทรงคุณวุฒิ" || p.PositionLevel.Name == "ทรงคุณวุฒิ (เฉพาะสายงาน)") // ทรงคุณวุฒิ
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
|
|
@ -3414,6 +3438,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionType != null
|
||||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& (p.PositionLevel.Name == "ทรงคุณวุฒิ" || p.PositionLevel.Name == "ทรงคุณวุฒิ (เฉพาะสายงาน)") // ทรงคุณวุฒิ
|
||||
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
|
|
@ -3498,6 +3523,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionType != null
|
||||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& (p.PositionLevel.Name == "ทรงคุณวุฒิ" || p.PositionLevel.Name == "ทรงคุณวุฒิ (เฉพาะสายงาน)") // ทรงคุณวุฒิ
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
|
|
@ -3668,6 +3694,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "อำนวยการ" // อำนวยการ
|
||||
&& p.PositionLevel.Name == "ต้น" // ต้น
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
|
|
@ -3738,6 +3765,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "ชำนาญการพิเศษ" // ชำนาญการพิเศษ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
|
|
@ -3883,6 +3911,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "อำนวยการ" // อำนวยการ
|
||||
&& p.PositionLevel.Name == "สูง" // สูง
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
|
|
@ -3957,6 +3986,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "อำนวยการ" // อำนวยการ
|
||||
&& p.PositionLevel.Name == "สูง" // สูง
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")
|
||||
|
|
@ -4031,6 +4061,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "อำนวยการ" // อำนวยการ
|
||||
&& p.PositionLevel.Name == "สูง" // สูง
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ")
|
||||
|
|
@ -4193,6 +4224,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "บริหาร" // บริหาร
|
||||
&& p.PositionLevel.Name == "ต้น" // ต้น
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
|
|
@ -4267,6 +4299,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "บริหาร" // บริหาร
|
||||
&& p.PositionLevel.Name == "ต้น" // ต้น
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")
|
||||
|
|
@ -4341,6 +4374,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "บริหาร" // บริหาร
|
||||
&& p.PositionLevel.Name == "ต้น" // ต้น
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ")
|
||||
|
|
@ -4475,6 +4509,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "บริหาร" // บริหาร
|
||||
&& p.PositionLevel.Name == "สูง" // สูง
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")
|
||||
|
|
@ -4557,6 +4592,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "บริหาร" // บริหาร
|
||||
&& p.PositionLevel.Name == "สูง" // สูง
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ")
|
||||
|
|
@ -4639,6 +4675,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "บริหาร" // บริหาร
|
||||
&& p.PositionLevel.Name == "สูง" // สูง
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("มหาปรมาภรณ์ช้างเผือก")
|
||||
|
|
@ -4788,6 +4825,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
allOc.Contains(p.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OcId.Value) &&
|
||||
p.IsActive == true &&
|
||||
p.IsLeave == false &&
|
||||
p.ProfileType == "officer" &&
|
||||
p.DateAppoint != null
|
||||
)
|
||||
.Select(p => new
|
||||
|
|
@ -4841,6 +4879,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.PositionLevel.Name == "ชำนาญการ"
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ตริตาภรณ์ช้างเผือก")
|
||||
select new
|
||||
{
|
||||
|
|
@ -4891,6 +4930,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.PositionLevel.Name == "ชำนาญการ"
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์มงกุฎไทย")
|
||||
select new
|
||||
{
|
||||
|
|
@ -4940,6 +4980,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.PositionLevel.Name == "ชำนาญการ"
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
select new
|
||||
{
|
||||
|
|
@ -4989,6 +5030,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& allOc.Contains(p.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OcId.Value)
|
||||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
select p)
|
||||
.ToList()
|
||||
|
|
@ -5023,6 +5065,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.PositionLevel.Name == "ชำนาญการพิเศษ"
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
select new
|
||||
{
|
||||
|
|
@ -5074,6 +5117,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.PositionLevel.Name == "เชี่ยวชาญ"
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
select new
|
||||
{
|
||||
|
|
@ -5124,6 +5168,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.PositionLevel.Name == "เชี่ยวชาญ"
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")
|
||||
select new
|
||||
{
|
||||
|
|
@ -5174,6 +5219,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.PositionLevel.Name == "เชี่ยวชาญ"
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ")
|
||||
select new
|
||||
{
|
||||
|
|
@ -5261,6 +5307,8 @@ namespace BMA.EHR.Application.Repositories
|
|||
{
|
||||
var result_candidate = new List<InsigniaResultSet>();
|
||||
|
||||
var employee_type1 = await GetEmployeeInsignia_Type1(periodId, ocId);
|
||||
var employee_type2 = await GetEmployeeInsignia_Type2(periodId, ocId);
|
||||
var type1_level1 = await GetInsigniaCandidate_Type1_Level1(periodId, ocId);
|
||||
var type1_level2 = await GetInsigniaCandidate_Type1_Level2(periodId, ocId);
|
||||
var type1_level3 = await GetInsigniaCandidate_Type1_Level3(periodId, ocId);
|
||||
|
|
@ -5362,6 +5410,18 @@ namespace BMA.EHR.Application.Repositories
|
|||
if (old == null)
|
||||
result_candidate.Add(r);
|
||||
}
|
||||
foreach (var r in employee_type2)
|
||||
{
|
||||
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
|
||||
if (old == null)
|
||||
result_candidate.Add(r);
|
||||
}
|
||||
foreach (var r in employee_type1)
|
||||
{
|
||||
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
|
||||
if (old == null)
|
||||
result_candidate.Add(r);
|
||||
}
|
||||
foreach (var r in type_coin)
|
||||
{
|
||||
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using System.Reflection.Metadata;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Reports
|
||||
|
|
@ -17,11 +21,11 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public RetireReportRepository(IApplicationDBContext dbContext, IWebHostEnvironment hostEnvironment)
|
||||
public RetireReportRepository(IApplicationDBContext dbContext,
|
||||
IWebHostEnvironment hostEnvironment)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_hostingEnvironment = hostEnvironment;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -49,7 +53,8 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
// throw;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
#region รายงานประกาศเกษียณ
|
||||
public async Task<dynamic> GetProfileRetirementdAsync(Guid retireId)
|
||||
{
|
||||
var retire = await _dbContext.Set<RetirementPeriod>()
|
||||
|
|
@ -122,6 +127,133 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
return new { retire.Id, retire.CreatedAt, Year = retire.Year.ToThaiYear().ToString().ToThaiNumber(), retire.Round, retire.Type, retire.TypeReport, Total = profile_retire.Count.ToString().ToThaiNumber(), profile = profile_retire };
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region รายงานบันทึกการถึงแก่กรรม
|
||||
public async Task<dynamic> GetRetirementDeceasedAsync(Guid id)
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
|
||||
.Where(x => x.Id == id)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
ProfileId = p.Profile.Id,
|
||||
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
||||
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
|
||||
p.Profile.FirstName,
|
||||
p.Profile.LastName,
|
||||
Position = p.Profile.Position == null ? null : p.Profile.Position.Name,
|
||||
PositionId = p.Profile.Position == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Position.Id,
|
||||
PositionType = p.Profile.PositionType == null ? null : p.Profile.PositionType.Name,
|
||||
PositionTypeId = p.Profile.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionType.Id,
|
||||
p.Profile.PositionLine,
|
||||
p.Profile.PositionLineId,
|
||||
PositionLevel = p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name,
|
||||
PositionLevelId = p.Profile.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionLevel.Id,
|
||||
p.Profile.PositionExecutive,
|
||||
p.Profile.PositionExecutiveId,
|
||||
Organization = p.Profile.Oc,
|
||||
OrganizationId = p.Profile.OcId,
|
||||
p.Number,
|
||||
p.Date,
|
||||
p.Location,
|
||||
p.Reason,
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (data == null)
|
||||
return null;
|
||||
|
||||
string Date = string.IsNullOrEmpty(data.Date.ToString()) ? "วันที่ - เดือน - พ.ศ. -" : DateTime.Parse(data.Date.ToString()).ToThaiFullDate().ToString().ToThaiNumber();
|
||||
return new
|
||||
{
|
||||
data.Prefix,
|
||||
data.FirstName,
|
||||
data.LastName,
|
||||
data.Position,
|
||||
data.PositionExecutive,
|
||||
data.PositionType,
|
||||
data.PositionLine,
|
||||
data.PositionLevel,
|
||||
data.Organization,
|
||||
data.PositionId,
|
||||
data.PositionExecutiveId,
|
||||
data.PositionTypeId,
|
||||
data.PositionLineId,
|
||||
data.PositionLevelId,
|
||||
data.OrganizationId,
|
||||
data.Number,
|
||||
Date,
|
||||
data.Location,
|
||||
data.Reason,
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region หัวกระดาษหนังสือเวียน
|
||||
public async Task<dynamic> GetHeadRetirementDeceasedAsync(Guid id)
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
|
||||
.Include(x => x.Profile)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
var oc = "";
|
||||
if (data == null)
|
||||
return new
|
||||
{
|
||||
Oc = oc,
|
||||
Number = $"กท /",
|
||||
Date = "",
|
||||
Subject = "ข้าราชการถึงแก่กรรม",
|
||||
Send = "หัวหน้าสำนักงาน ก.ก.",
|
||||
};
|
||||
|
||||
if (data.Profile.OcId != null)
|
||||
{
|
||||
var organization = await _dbContext.Set<OrganizationEntity>().AsQueryable()
|
||||
.Where(x => x.Id == data.Profile.OcId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (organization != null)
|
||||
{
|
||||
var organizationAgency = await _dbContext.Set<OrganizationEntity>().AsQueryable()
|
||||
.Where(x => x.Id == organization.OrganizationAgencyId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (organizationAgency != null)
|
||||
{
|
||||
var agency = await _dbContext.Set<OrganizationEntity>().AsQueryable()
|
||||
.Where(x => x.Id == organizationAgency.Id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (agency != null)
|
||||
{
|
||||
oc = agency.OrganizationOrganization?.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new
|
||||
{
|
||||
Oc = oc,
|
||||
Number = $"กท /{data.CreatedAt.Year.ToThaiYear()}",
|
||||
Date = data.CreatedAt.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
Subject = "ข้าราชการถึงแก่กรรม",
|
||||
Send = "หัวหน้าสำนักงาน ก.ก.",
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region บันทึกหนังสือเวียน
|
||||
public async Task UploadFileRetirementDeceasedAsync(Guid id, Domain.Models.Documents.Document file)
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
|
||||
.Include(x => x.Profile)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data != null)
|
||||
data.DocumentForward = file;
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
@ -9,17 +10,83 @@ namespace BMA.EHR.Application.Repositories
|
|||
{
|
||||
private readonly IApplicationDBContext _dbContext;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
public RetirementRepository(IApplicationDBContext dbContext, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
public RetirementRepository(IApplicationDBContext dbContext,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
}
|
||||
|
||||
// public async Task<IEnumerable<Retirement>> FindByNameAsync(string name)
|
||||
// {
|
||||
// var data = await _dbContext.Set<Retirement>().Where(x => x.Name == name).ToListAsync();
|
||||
//ปลดออก
|
||||
public async Task NotifyDischarge()
|
||||
{
|
||||
var cronjobNotis = await _dbContext.Set<RetirementDischarge>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.Where(x => x.Date != null && x.Date.Value.Date == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
cronjobNoti.Profile.IsLeave = true;
|
||||
cronjobNoti.Profile.LeaveReason = "DISCHARGE";
|
||||
cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}",
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}"
|
||||
// );
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
// return data;
|
||||
// }
|
||||
//ไล่ออก
|
||||
public async Task NotifyExpulsion()
|
||||
{
|
||||
var cronjobNotis = await _dbContext.Set<RetirementExpulsion>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.Where(x => x.Date != null && x.Date.Value.Date == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
cronjobNoti.Profile.IsLeave = true;
|
||||
cronjobNoti.Profile.LeaveReason = "DISMISS";
|
||||
cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}",
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}"
|
||||
// );
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
//ให้ออก
|
||||
public async Task NotifyOut()
|
||||
{
|
||||
var cronjobNotis = await _dbContext.Set<RetirementOut>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.Where(x => x.Date != null && x.Date.Value.Date == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
cronjobNoti.Profile.IsLeave = true;
|
||||
cronjobNoti.Profile.LeaveReason = "LAYOFF";
|
||||
cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}",
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}"
|
||||
// );
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue