noti พ้นราชการ บรรจุ
This commit is contained in:
parent
e5af4a3513
commit
d34f04ffee
25 changed files with 16558 additions and 130 deletions
|
|
@ -4980,7 +4980,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
CitizenId = h.Profile.CitizenId,
|
CitizenId = h.Profile.CitizenId,
|
||||||
ProfileId = h.Profile.Id,
|
ProfileId = h.Profile.Id,
|
||||||
ProfileType = h.Profile.ProfileType,
|
ProfileType = h.Profile.ProfileType,
|
||||||
FullName = $"{h.Profile.FirstName} {h.Profile.LastName}",
|
FullName = $"{h.Profile.Prefix?.Name}{h.Profile.FirstName} {h.Profile.LastName}",
|
||||||
Position = h.Profile.Position.Name,
|
Position = h.Profile.Position.Name,
|
||||||
PosNo = h.Profile.PosNo.Id,
|
PosNo = h.Profile.PosNo.Id,
|
||||||
Rank = $"{h.Profile.PositionType.Name}/{h.Profile.PositionLevel.Name}",
|
Rank = $"{h.Profile.PositionType.Name}/{h.Profile.PositionLevel.Name}",
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,70 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task PushNotificationAsync(Guid ReceiverUserId, string Subject, string Body, bool IsSendNotification = true, bool IsSendInbox = false, bool IsSendMail = false)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var profile = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.Id == ReceiverUserId);
|
||||||
|
if (profile == null)
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
|
||||||
|
if (IsSendNotification == true)
|
||||||
|
{
|
||||||
|
_dbContext.Set<Notification>().Add(new Notification
|
||||||
|
{
|
||||||
|
Body = Body,
|
||||||
|
ReceiverUserId = ReceiverUserId,
|
||||||
|
Type = "",
|
||||||
|
Payload = "",
|
||||||
|
CreatedUserId = FullName ?? "",
|
||||||
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (IsSendInbox == true)
|
||||||
|
{
|
||||||
|
_dbContext.Set<Inbox>().Add(new Inbox
|
||||||
|
{
|
||||||
|
Subject = Subject,
|
||||||
|
Body = Body,
|
||||||
|
ReceiverUserId = ReceiverUserId,
|
||||||
|
Payload = "",
|
||||||
|
CreatedUserId = FullName ?? "",
|
||||||
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (IsSendMail == true)
|
||||||
|
{
|
||||||
|
// _context.Notifications.Add(new Notification
|
||||||
|
// {
|
||||||
|
// Body = req.Body,
|
||||||
|
// ReceiverUserId = req.ReceiverUserId,
|
||||||
|
// Type = "",
|
||||||
|
// Payload = "",
|
||||||
|
// CreatedUserId = FullName ?? "",
|
||||||
|
// CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
// CreatedAt = DateTime.Now,
|
||||||
|
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
// LastUpdateUserId = UserId ?? "",
|
||||||
|
// LastUpdatedAt = DateTime.Now,
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,9 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
|
|
||||||
[Comment("ข้อมูลตำแหน่ง Draft")]
|
[Comment("ข้อมูลตำแหน่ง Draft")]
|
||||||
public bool? Draft { get; set; }
|
public bool? Draft { get; set; }
|
||||||
|
|
||||||
|
[Comment("Id รูปโปรไฟล์")]
|
||||||
|
public virtual Document? ProfileImg { get; set; }
|
||||||
public virtual List<PlacementCertificate> PlacementCertificates { get; set; } = new List<PlacementCertificate>();
|
public virtual List<PlacementCertificate> PlacementCertificates { get; set; } = new List<PlacementCertificate>();
|
||||||
public virtual List<PlacementEducation> PlacementEducations { get; set; } = new List<PlacementEducation>();
|
public virtual List<PlacementEducation> PlacementEducations { get; set; } = new List<PlacementEducation>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
16177
BMA.EHR.Infrastructure/Migrations/20230907030700_update table placementprofile add image.Designer.cs
generated
Normal file
16177
BMA.EHR.Infrastructure/Migrations/20230907030700_update table placementprofile add image.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,50 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class updatetableplacementprofileaddimage : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "ProfileImgId",
|
||||||
|
table: "PlacementProfiles",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PlacementProfiles_ProfileImgId",
|
||||||
|
table: "PlacementProfiles",
|
||||||
|
column: "ProfileImgId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PlacementProfiles_Documents_ProfileImgId",
|
||||||
|
table: "PlacementProfiles",
|
||||||
|
column: "ProfileImgId",
|
||||||
|
principalTable: "Documents",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_PlacementProfiles_Documents_ProfileImgId",
|
||||||
|
table: "PlacementProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_PlacementProfiles_ProfileImgId",
|
||||||
|
table: "PlacementProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ProfileImgId",
|
||||||
|
table: "PlacementProfiles");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11620,6 +11620,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Property<Guid?>("PrefixId")
|
b.Property<Guid?>("PrefixId")
|
||||||
.HasColumnType("char(36)");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ProfileImgId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<string>("Race")
|
b.Property<string>("Race")
|
||||||
.HasMaxLength(40)
|
.HasMaxLength(40)
|
||||||
.HasColumnType("varchar(40)")
|
.HasColumnType("varchar(40)")
|
||||||
|
|
@ -11727,6 +11730,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
|
||||||
b.HasIndex("PrefixId");
|
b.HasIndex("PrefixId");
|
||||||
|
|
||||||
|
b.HasIndex("ProfileImgId");
|
||||||
|
|
||||||
b.HasIndex("RegistDistrictId");
|
b.HasIndex("RegistDistrictId");
|
||||||
|
|
||||||
b.HasIndex("RegistProvinceId");
|
b.HasIndex("RegistProvinceId");
|
||||||
|
|
@ -15295,6 +15300,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("PrefixId");
|
.HasForeignKey("PrefixId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "ProfileImg")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ProfileImgId");
|
||||||
|
|
||||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "RegistDistrict")
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "RegistDistrict")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("RegistDistrictId");
|
.HasForeignKey("RegistDistrictId");
|
||||||
|
|
@ -15359,6 +15368,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
|
||||||
b.Navigation("Prefix");
|
b.Navigation("Prefix");
|
||||||
|
|
||||||
|
b.Navigation("ProfileImg");
|
||||||
|
|
||||||
b.Navigation("RegistDistrict");
|
b.Navigation("RegistDistrict");
|
||||||
|
|
||||||
b.Navigation("RegistProvince");
|
b.Navigation("RegistProvince");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Application.Requests;
|
using BMA.EHR.Application.Requests;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Models.Insignias;
|
using BMA.EHR.Domain.Models.Insignias;
|
||||||
|
|
@ -26,15 +27,18 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly InsigniaPeriodsRepository _repository;
|
private readonly InsigniaPeriodsRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
|
|
||||||
public InsigniaManageController(ApplicationDBContext context,
|
public InsigniaManageController(ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
InsigniaPeriodsRepository repository,
|
InsigniaPeriodsRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -412,12 +416,13 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
|
|
||||||
var insigniaNoteProfile = await _context.InsigniaNoteProfiles.AsQueryable()
|
var insigniaNoteProfile = await _context.InsigniaNoteProfiles.AsQueryable()
|
||||||
.Include(x => x.RequestInsignia)
|
.Include(x => x.RequestInsignia)
|
||||||
|
.Include(x => x.InsigniaNote)
|
||||||
.FirstOrDefaultAsync(x => x.Id == req.InsigniaNoteProfileId);
|
.FirstOrDefaultAsync(x => x.Id == req.InsigniaNoteProfileId);
|
||||||
if (insigniaNoteProfile == null)
|
if (insigniaNoteProfile == null)
|
||||||
return Error(GlobalMessages.InsigniaRequestProfileNotFound);
|
return Error(GlobalMessages.InsigniaRequestProfileNotFound);
|
||||||
|
|
||||||
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
||||||
.FirstOrDefaultAsync(x => x.Year == DateTime.Now.Year && x.Insignia == insigniaNoteProfile.RequestInsignia);
|
.FirstOrDefaultAsync(x => x.Year == insigniaNoteProfile.InsigniaNote.Year && x.Insignia == insigniaNoteProfile.RequestInsignia);
|
||||||
if (insigniaManage == null)
|
if (insigniaManage == null)
|
||||||
return Error(GlobalMessages.InsigniaManageNotFound);
|
return Error(GlobalMessages.InsigniaManageNotFound);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Application.Requests;
|
using BMA.EHR.Application.Requests;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Models.Insignias;
|
using BMA.EHR.Domain.Models.Insignias;
|
||||||
|
|
@ -24,15 +25,18 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly InsigniaPeriodsRepository _repository;
|
private readonly InsigniaPeriodsRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
|
|
||||||
public InsigniaPeriodController(ApplicationDBContext context,
|
public InsigniaPeriodController(ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
InsigniaPeriodsRepository repository,
|
InsigniaPeriodsRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Application.Requests;
|
using BMA.EHR.Application.Requests;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Models.Insignias;
|
using BMA.EHR.Domain.Models.Insignias;
|
||||||
|
|
@ -23,15 +24,18 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly InsigniaPeriodsRepository _repository;
|
private readonly InsigniaPeriodsRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
|
|
||||||
public InsigniaReceiveController(ApplicationDBContext context,
|
public InsigniaReceiveController(ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
InsigniaPeriodsRepository repository,
|
InsigniaPeriodsRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Application.Requests;
|
using BMA.EHR.Application.Requests;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Extensions;
|
using BMA.EHR.Domain.Extensions;
|
||||||
|
|
@ -30,18 +31,21 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly InsigniaPeriodsRepository _repository;
|
private readonly InsigniaPeriodsRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||||
private readonly string Royal_Type = "Royal";
|
private readonly string Royal_Type = "Royal";
|
||||||
|
|
||||||
public InsigniaRequestController(ApplicationDBContext context,
|
public InsigniaRequestController(ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
InsigniaPeriodsRepository repository,
|
InsigniaPeriodsRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
IWebHostEnvironment hostingEnvironment,
|
IWebHostEnvironment hostingEnvironment,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
_hostingEnvironment = hostingEnvironment;
|
_hostingEnvironment = hostingEnvironment;
|
||||||
}
|
}
|
||||||
|
|
@ -865,7 +869,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
.Select(x => x.RequestProfiles.Count(x => x.Status != "DELETE" && x.Status != "REJECT"))
|
.Select(x => x.RequestProfiles.Count(x => x.Status != "DELETE" && x.Status != "REJECT"))
|
||||||
.SumAsync();
|
.SumAsync();
|
||||||
|
|
||||||
return Success(new { OrgAllCount = orgAllCount.Count(), OrgSendCount = orgAllCount.Where(x => x.RequestStatus != "st1" && x.RequestStatus != "st2").Count(), OrgNoSendCount = orgAllCount.Where(x => x.RequestStatus == "st1" && x.RequestStatus == "st2").Count(), AllUserUser = allUserUser });
|
return Success(new { OrgAllCount = orgAllCount.Count(), OrgSendCount = orgAllCount.Where(x => x.RequestStatus != "st1" && x.RequestStatus != "st2").Count(), OrgNoSendCount = orgAllCount.Where(x => x.RequestStatus == "st1" || x.RequestStatus == "st2").Count(), AllUserUser = allUserUser });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1093,6 +1097,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
|
|
||||||
foreach (var profileOld in profileOlds)
|
foreach (var profileOld in profileOlds)
|
||||||
{
|
{
|
||||||
|
if (profileOld.Status == "DELETE" || profileOld.Status == "REJECT")
|
||||||
|
continue;
|
||||||
var noreProfileOld = insigniaNote.InsigniaNoteProfiles
|
var noreProfileOld = insigniaNote.InsigniaNoteProfiles
|
||||||
.Where(x => x.Profile == profileOld.Profile)
|
.Where(x => x.Profile == profileOld.Profile)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
@ -1397,11 +1403,11 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
var profileInsignia = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.Profile.CitizenId == req.CitizanId);
|
var profileInsignia = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.Profile.CitizenId == req.CitizanId);
|
||||||
if (profileInsignia == null)
|
if (profileInsignia == null)
|
||||||
{
|
{
|
||||||
await _context.InsigniaNoteProfiles.AddAsync(new InsigniaNoteProfile
|
var insigniaNoteProfile = new InsigniaNoteProfile
|
||||||
{
|
{
|
||||||
Salary = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
Salary = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||||
IsApprove = true,
|
IsApprove = true,
|
||||||
Status = "DONE",
|
Status = "PENDING",
|
||||||
Profile = profile,
|
Profile = profile,
|
||||||
Issue = req.Issue,
|
Issue = req.Issue,
|
||||||
Number = req.Number,
|
Number = req.Number,
|
||||||
|
|
@ -1424,48 +1430,83 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
});
|
};
|
||||||
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
if (req.DateReceive != null && req.Date != null)
|
||||||
{
|
{
|
||||||
Year = insigniaNote.Year,
|
insigniaNoteProfile.Status = "DONE";
|
||||||
No = req.No,
|
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||||
Issue = req.VolumeNo,
|
{
|
||||||
VolumeNo = req.VolumeNo,
|
Year = insigniaNote.Year,
|
||||||
// Volume = req.Volume,
|
No = req.No,
|
||||||
Section = req.Section,
|
Issue = req.VolumeNo,
|
||||||
Page = req.Page,
|
VolumeNo = req.VolumeNo,
|
||||||
DateAnnounce = req.DateReceive,
|
// Volume = req.Volume,
|
||||||
ReceiveDate = req.Date,
|
Section = req.Section,
|
||||||
InsigniaType = insignia.InsigniaType == null ? null : insignia.InsigniaType.Name,
|
Page = req.Page,
|
||||||
Insignia = insignia,
|
DateAnnounce = req.Date,
|
||||||
// RefCommandNo = req.RefCommandNo,
|
ReceiveDate = req.DateReceive,
|
||||||
// RefCommandDate = req.RefCommandDate,
|
InsigniaType = insignia.InsigniaType == null ? null : insignia.InsigniaType.Name,
|
||||||
Profile = profile,
|
Insignia = insignia,
|
||||||
CreatedUserId = FullName ?? "",
|
// RefCommandNo = req.RefCommandNo,
|
||||||
CreatedFullName = UserId ?? "System Administrator",
|
// RefCommandDate = req.RefCommandDate,
|
||||||
CreatedAt = DateTime.Now,
|
Profile = profile,
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
CreatedUserId = FullName ?? "",
|
||||||
LastUpdateUserId = UserId ?? "",
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
LastUpdatedAt = DateTime.Now,
|
CreatedAt = DateTime.Now,
|
||||||
});
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await _context.InsigniaNoteProfiles.AddAsync(insigniaNoteProfile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
profileInsignia.Issue = req.Issue;
|
if (profileInsignia.Status != "DONE")
|
||||||
profileInsignia.Number = req.Number;
|
{
|
||||||
profileInsignia.DateReceive = req.DateReceive;
|
profileInsignia.Issue = req.Issue;
|
||||||
profileInsignia.Date = req.Date;
|
profileInsignia.Number = req.Number;
|
||||||
profileInsignia.VolumeNo = req.VolumeNo;
|
profileInsignia.DateReceive = req.DateReceive;
|
||||||
profileInsignia.Section = req.Section;
|
profileInsignia.Date = req.Date;
|
||||||
profileInsignia.Page = req.Page;
|
profileInsignia.VolumeNo = req.VolumeNo;
|
||||||
profileInsignia.No = req.No;
|
profileInsignia.Section = req.Section;
|
||||||
profileInsignia.DatePayment = req.DatePayment;
|
profileInsignia.Page = req.Page;
|
||||||
profileInsignia.TypePayment = req.TypePayment;
|
profileInsignia.No = req.No;
|
||||||
profileInsignia.Address = req.Address;
|
profileInsignia.DatePayment = req.DatePayment;
|
||||||
profileInsignia.RequestInsignia = insignia;
|
profileInsignia.TypePayment = req.TypePayment;
|
||||||
profileInsignia.LastUpdateFullName = FullName ?? "System Administrator";
|
profileInsignia.Address = req.Address;
|
||||||
profileInsignia.LastUpdateUserId = UserId ?? "";
|
profileInsignia.RequestInsignia = insignia;
|
||||||
profileInsignia.LastUpdatedAt = DateTime.Now;
|
profileInsignia.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
profileInsignia.LastUpdateUserId = UserId ?? "";
|
||||||
|
profileInsignia.LastUpdatedAt = DateTime.Now;
|
||||||
|
if (req.DateReceive != null && req.Date != null)
|
||||||
|
{
|
||||||
|
profileInsignia.Status = "DONE";
|
||||||
|
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||||
|
{
|
||||||
|
Year = insigniaNote.Year,
|
||||||
|
No = req.No,
|
||||||
|
Issue = req.VolumeNo,
|
||||||
|
VolumeNo = req.VolumeNo,
|
||||||
|
// Volume = req.Volume,
|
||||||
|
Section = req.Section,
|
||||||
|
Page = req.Page,
|
||||||
|
DateAnnounce = req.Date,
|
||||||
|
ReceiveDate = req.DateReceive,
|
||||||
|
InsigniaType = insignia.InsigniaType == null ? null : insignia.InsigniaType.Name,
|
||||||
|
Insignia = insignia,
|
||||||
|
// RefCommandNo = req.RefCommandNo,
|
||||||
|
// RefCommandDate = req.RefCommandDate,
|
||||||
|
Profile = profile,
|
||||||
|
CreatedUserId = FullName ?? "",
|
||||||
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return Success();
|
return Success();
|
||||||
|
|
@ -1587,6 +1628,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
var items = await ReadExcelImportReceive(file);
|
var items = await ReadExcelImportReceive(file);
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
|
if (item.DateReceive == null || item.Date == null)
|
||||||
|
continue;
|
||||||
var profile = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.Profile.CitizenId == item.CitizanId);
|
var profile = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.Profile.CitizenId == item.CitizanId);
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
{
|
{
|
||||||
|
|
@ -1603,7 +1646,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
RequestDate = DateTime.Now,
|
RequestDate = DateTime.Now,
|
||||||
Salary = _profile.Salaries.Count() == 0 ? null : _profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
Salary = _profile.Salaries.Count() == 0 ? null : _profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||||
IsApprove = true,
|
IsApprove = true,
|
||||||
Status = "DONE",
|
Status = "PENDIND",
|
||||||
Number = item.Number,
|
Number = item.Number,
|
||||||
RequestInsignia = _insignia,
|
RequestInsignia = _insignia,
|
||||||
DateReceive = item.DateReceive,
|
DateReceive = item.DateReceive,
|
||||||
|
|
@ -1622,42 +1665,50 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
profile.Status = "DONE";
|
if (profile.Status != "DONE")
|
||||||
profile.Number = item.Number;
|
{
|
||||||
profile.RequestInsignia = await _context.Insignias.FirstOrDefaultAsync(x => x.Name == item.RequestInsignia) == null ? profile.RequestInsignia : await _context.Insignias.FirstOrDefaultAsync(x => x.Name == item.RequestInsignia);
|
profile.Number = item.Number;
|
||||||
profile.DateReceive = item.DateReceive;
|
profile.RequestInsignia = await _context.Insignias.FirstOrDefaultAsync(x => x.Name == item.RequestInsignia) == null ? profile.RequestInsignia : await _context.Insignias.FirstOrDefaultAsync(x => x.Name == item.RequestInsignia);
|
||||||
profile.Date = item.Date;
|
profile.DateReceive = item.DateReceive;
|
||||||
profile.VolumeNo = item.VolumeNo;
|
profile.Date = item.Date;
|
||||||
profile.Section = item.Section;
|
profile.VolumeNo = item.VolumeNo;
|
||||||
profile.Page = item.Page;
|
profile.Section = item.Section;
|
||||||
profile.No = item.No;
|
profile.Page = item.Page;
|
||||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
profile.No = item.No;
|
||||||
profile.LastUpdateUserId = UserId ?? "";
|
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
profile.LastUpdatedAt = DateTime.Now;
|
profile.LastUpdateUserId = UserId ?? "";
|
||||||
|
profile.LastUpdatedAt = DateTime.Now;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
// if (profile.DateReceive == null || profile.Date == null)
|
||||||
|
// continue;
|
||||||
|
if (profile.Status != "DONE")
|
||||||
{
|
{
|
||||||
Year = insigniaNote.Year,
|
profile.Status = "DONE";
|
||||||
No = profile.No,
|
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||||
Issue = profile.VolumeNo,
|
{
|
||||||
VolumeNo = profile.VolumeNo,
|
Year = insigniaNote.Year,
|
||||||
// Volume = profile.Volume,
|
No = profile.No,
|
||||||
Section = profile.Section,
|
Issue = profile.VolumeNo,
|
||||||
Page = profile.Page,
|
VolumeNo = profile.VolumeNo,
|
||||||
DateAnnounce = profile.DateReceive,
|
// Volume = profile.Volume,
|
||||||
ReceiveDate = profile.Date,
|
Section = profile.Section,
|
||||||
InsigniaType = profile.RequestInsignia.InsigniaType == null ? null : profile.RequestInsignia.InsigniaType.Name,
|
Page = profile.Page,
|
||||||
Insignia = profile.RequestInsignia,
|
DateAnnounce = profile.Date,
|
||||||
// RefCommandNo = req.RefCommandNo,
|
ReceiveDate = profile.DateReceive,
|
||||||
// RefCommandDate = req.RefCommandDate,
|
InsigniaType = profile.RequestInsignia.InsigniaType == null ? null : profile.RequestInsignia.InsigniaType.Name,
|
||||||
Profile = profile.Profile,
|
Insignia = profile.RequestInsignia,
|
||||||
CreatedUserId = FullName ?? "",
|
// RefCommandNo = req.RefCommandNo,
|
||||||
CreatedFullName = UserId ?? "System Administrator",
|
// RefCommandDate = req.RefCommandDate,
|
||||||
CreatedAt = DateTime.Now,
|
Profile = profile.Profile,
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
CreatedUserId = FullName ?? "",
|
||||||
LastUpdateUserId = UserId ?? "",
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
LastUpdatedAt = DateTime.Now,
|
CreatedAt = DateTime.Now,
|
||||||
});
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return Success();
|
return Success();
|
||||||
|
|
|
||||||
|
|
@ -55,13 +55,13 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
return Error(GlobalMessages.DataNotFound);
|
return Error(GlobalMessages.DataNotFound);
|
||||||
|
|
||||||
if (req.IsSendInbox == true)
|
if (req.IsSendNotification == true)
|
||||||
{
|
{
|
||||||
_context.Inboxes.Add(new Inbox
|
_context.Notifications.Add(new Notification
|
||||||
{
|
{
|
||||||
Subject = req.Subject,
|
|
||||||
Body = req.Body,
|
Body = req.Body,
|
||||||
ReceiverUserId = req.ReceiverUserId,
|
ReceiverUserId = req.ReceiverUserId,
|
||||||
|
Type = "",
|
||||||
Payload = "",
|
Payload = "",
|
||||||
CreatedUserId = FullName ?? "",
|
CreatedUserId = FullName ?? "",
|
||||||
CreatedFullName = UserId ?? "System Administrator",
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
|
@ -73,11 +73,11 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
}
|
}
|
||||||
if (req.IsSendInbox == true)
|
if (req.IsSendInbox == true)
|
||||||
{
|
{
|
||||||
_context.Notifications.Add(new Notification
|
_context.Inboxes.Add(new Inbox
|
||||||
{
|
{
|
||||||
|
Subject = req.Subject,
|
||||||
Body = req.Body,
|
Body = req.Body,
|
||||||
ReceiverUserId = req.ReceiverUserId,
|
ReceiverUserId = req.ReceiverUserId,
|
||||||
Type = "",
|
|
||||||
Payload = "",
|
Payload = "",
|
||||||
CreatedUserId = FullName ?? "",
|
CreatedUserId = FullName ?? "",
|
||||||
CreatedFullName = UserId ?? "System Administrator",
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Models.Placement;
|
using BMA.EHR.Domain.Models.Placement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
public class PlacementAppointmentController : BaseController
|
public class PlacementAppointmentController : BaseController
|
||||||
{
|
{
|
||||||
private readonly PlacementRepository _repository;
|
private readonly PlacementRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public PlacementAppointmentController(PlacementRepository repository,
|
public PlacementAppointmentController(PlacementRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Extensions;
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.MetaData;
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
|
@ -24,16 +25,19 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
public class PlacementController : BaseController
|
public class PlacementController : BaseController
|
||||||
{
|
{
|
||||||
private readonly PlacementRepository _repository;
|
private readonly PlacementRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public PlacementController(PlacementRepository repository,
|
public PlacementController(PlacementRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
|
@ -132,6 +136,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
SalaryAmount = x.Amount,
|
SalaryAmount = x.Amount,
|
||||||
MouthSalaryAmount = x.MouthSalaryAmount,
|
MouthSalaryAmount = x.MouthSalaryAmount,
|
||||||
PositionSalaryAmount = x.PositionSalaryAmount,
|
PositionSalaryAmount = x.PositionSalaryAmount,
|
||||||
|
Avatar = x.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.ProfileImg.Id,
|
||||||
}).OrderBy(x => x.ExamNumber).ToListAsync();
|
}).OrderBy(x => x.ExamNumber).ToListAsync();
|
||||||
|
|
||||||
var result = new List<dynamic>();
|
var result = new List<dynamic>();
|
||||||
|
|
@ -167,6 +172,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
p.SalaryAmount,
|
p.SalaryAmount,
|
||||||
p.MouthSalaryAmount,
|
p.MouthSalaryAmount,
|
||||||
p.PositionSalaryAmount,
|
p.PositionSalaryAmount,
|
||||||
|
Avatar = p.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(p.Avatar),
|
||||||
};
|
};
|
||||||
result.Add(_data);
|
result.Add(_data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Models.Placement;
|
using BMA.EHR.Domain.Models.Placement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
public class PlacementOfficerController : BaseController
|
public class PlacementOfficerController : BaseController
|
||||||
{
|
{
|
||||||
private readonly PlacementRepository _repository;
|
private readonly PlacementRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public PlacementOfficerController(PlacementRepository repository,
|
public PlacementOfficerController(PlacementRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Models.Placement;
|
using BMA.EHR.Domain.Models.Placement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
public class PlacementReceiveController : BaseController
|
public class PlacementReceiveController : BaseController
|
||||||
{
|
{
|
||||||
private readonly PlacementRepository _repository;
|
private readonly PlacementRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public PlacementReceiveController(PlacementRepository repository,
|
public PlacementReceiveController(PlacementRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Models.Placement;
|
using BMA.EHR.Domain.Models.Placement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
public class PlacementRelocationController : BaseController
|
public class PlacementRelocationController : BaseController
|
||||||
{
|
{
|
||||||
private readonly PlacementRepository _repository;
|
private readonly PlacementRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public PlacementRelocationController(PlacementRepository repository,
|
public PlacementRelocationController(PlacementRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Models.Placement;
|
using BMA.EHR.Domain.Models.Placement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
public class PlacementRepatriationController : BaseController
|
public class PlacementRepatriationController : BaseController
|
||||||
{
|
{
|
||||||
private readonly PlacementRepository _repository;
|
private readonly PlacementRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public PlacementRepatriationController(PlacementRepository repository,
|
public PlacementRepatriationController(PlacementRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Models.Placement;
|
using BMA.EHR.Domain.Models.Placement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
public class PlacementTransferController : BaseController
|
public class PlacementTransferController : BaseController
|
||||||
{
|
{
|
||||||
private readonly PlacementRepository _repository;
|
private readonly PlacementRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public PlacementTransferController(PlacementRepository repository,
|
public PlacementTransferController(PlacementRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
|
@ -315,6 +319,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
.Include(x => x.PosNo)
|
.Include(x => x.PosNo)
|
||||||
.Include(x => x.Salaries)
|
.Include(x => x.Salaries)
|
||||||
.Include(x => x.Position)
|
.Include(x => x.Position)
|
||||||
|
.Include(x => x.Prefix)
|
||||||
.FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(UserId));
|
.FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(UserId));
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
@ -322,8 +327,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
var placementTransfer = new PlacementTransfer
|
var placementTransfer = new PlacementTransfer
|
||||||
{
|
{
|
||||||
Profile = profile,
|
Profile = profile,
|
||||||
Organization = Request.Form.ContainsKey("Organization") ? Request.Form["Organization"] : "",
|
Organization = req.Organization,
|
||||||
Reason = Request.Form.ContainsKey("Reason") ? Request.Form["Reason"] : "",
|
Reason = req.Reason,
|
||||||
Date = req.Date,
|
Date = req.Date,
|
||||||
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
|
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
|
||||||
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
||||||
|
|
@ -367,6 +372,11 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await _repositoryNoti.PushNotificationAsync(
|
||||||
|
Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||||
|
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำขอโอน",
|
||||||
|
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำขอโอนไปยัง {req.Organization}"
|
||||||
|
);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Extensions;
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.Retirement;
|
using BMA.EHR.Domain.Models.Retirement;
|
||||||
|
|
@ -22,18 +23,21 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
public class RetirementController : BaseController
|
public class RetirementController : BaseController
|
||||||
{
|
{
|
||||||
private readonly RetirementRepository _repository;
|
private readonly RetirementRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
|
|
||||||
public RetirementController(RetirementRepository repository,
|
public RetirementController(RetirementRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
|
@ -335,7 +339,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
{
|
{
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
var url = $"https://s3cluster.frappet.com/bma-ehr-fpt/{profileHistorys.ProfileFile}.json";
|
// var url = $"https://s3cluster.frappet.com/bma-ehr-fpt/{profileHistorys.ProfileFile}.json";
|
||||||
|
var url = await _documentService.ImagesPathByName($"{profileHistorys.ProfileFile}.json");
|
||||||
var responseTask = client.GetAsync(url);
|
var responseTask = client.GetAsync(url);
|
||||||
var results = responseTask.Result;
|
var results = responseTask.Result;
|
||||||
var profileOlds = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ProfileJsonRequest>>(results.Content.ReadAsStringAsync().Result);
|
var profileOlds = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ProfileJsonRequest>>(results.Content.ReadAsStringAsync().Result);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Extensions;
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.HR;
|
using BMA.EHR.Domain.Models.HR;
|
||||||
|
|
@ -27,16 +28,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
public class RetirementDeceasedController : BaseController
|
public class RetirementDeceasedController : BaseController
|
||||||
{
|
{
|
||||||
private readonly RetirementRepository _repository;
|
private readonly RetirementRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public RetirementDeceasedController(RetirementRepository repository,
|
public RetirementDeceasedController(RetirementRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
|
@ -530,56 +534,28 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
var profile = req.Persons.FirstOrDefault(x => x.ProfileId == item.ReceiveUser.Id);
|
var profile = req.Persons.FirstOrDefault(x => x.ProfileId == item.ReceiveUser.Id);
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
{
|
{
|
||||||
if (profile.IsSendInbox == true)
|
await _repositoryNoti.PushNotificationAsync(
|
||||||
{
|
item.ReceiveUser.Id,
|
||||||
var inbox = new Inbox
|
$"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||||
{
|
$"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||||
Subject = $"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
profile.IsSendNotification,
|
||||||
Body = $"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
profile.IsSendInbox,
|
||||||
ReceiverUserId = item.ReceiveUser.Id,
|
profile.IsSendMail
|
||||||
Payload = "",
|
);
|
||||||
};
|
|
||||||
_context.Inboxes.Add(inbox);
|
|
||||||
}
|
|
||||||
if (profile.IsSendNotification == true)
|
|
||||||
{
|
|
||||||
var noti = new Notification
|
|
||||||
{
|
|
||||||
Body = $"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
|
||||||
ReceiverUserId = item.ReceiveUser.Id,
|
|
||||||
Type = "",
|
|
||||||
Payload = "",
|
|
||||||
};
|
|
||||||
_context.Notifications.Add(noti);
|
|
||||||
}
|
|
||||||
item.IsSendMail = profile.IsSendMail;
|
item.IsSendMail = profile.IsSendMail;
|
||||||
item.IsSendInbox = profile.IsSendInbox;
|
item.IsSendInbox = profile.IsSendInbox;
|
||||||
item.IsSendNotification = profile.IsSendNotification;
|
item.IsSendNotification = profile.IsSendNotification;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (item.IsSendInbox == true)
|
await _repositoryNoti.PushNotificationAsync(
|
||||||
{
|
item.ReceiveUser.Id,
|
||||||
var inbox = new Inbox
|
$"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||||
{
|
$"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||||
Subject = $"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
item.IsSendNotification,
|
||||||
Body = $"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
item.IsSendInbox,
|
||||||
ReceiverUserId = item.ReceiveUser.Id,
|
item.IsSendMail
|
||||||
Payload = "",
|
);
|
||||||
};
|
|
||||||
_context.Inboxes.Add(inbox);
|
|
||||||
}
|
|
||||||
if (item.IsSendNotification == true)
|
|
||||||
{
|
|
||||||
var noti = new Notification
|
|
||||||
{
|
|
||||||
Body = $"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
|
||||||
ReceiverUserId = item.ReceiveUser.Id,
|
|
||||||
Type = "",
|
|
||||||
Payload = "",
|
|
||||||
};
|
|
||||||
_context.Notifications.Add(noti);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Models.Retirement;
|
using BMA.EHR.Domain.Models.Retirement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
public class RetirementDischargeController : BaseController
|
public class RetirementDischargeController : BaseController
|
||||||
{
|
{
|
||||||
private readonly RetirementRepository _repository;
|
private readonly RetirementRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public RetirementDischargeController(RetirementRepository repository,
|
public RetirementDischargeController(RetirementRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Models.Retirement;
|
using BMA.EHR.Domain.Models.Retirement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
public class RetirementExpulsionController : BaseController
|
public class RetirementExpulsionController : BaseController
|
||||||
{
|
{
|
||||||
private readonly RetirementRepository _repository;
|
private readonly RetirementRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public RetirementExpulsionController(RetirementRepository repository,
|
public RetirementExpulsionController(RetirementRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Models.Retirement;
|
using BMA.EHR.Domain.Models.Retirement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
public class RetirementOtherController : BaseController
|
public class RetirementOtherController : BaseController
|
||||||
{
|
{
|
||||||
private readonly RetirementRepository _repository;
|
private readonly RetirementRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public RetirementOtherController(RetirementRepository repository,
|
public RetirementOtherController(RetirementRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Models.Retirement;
|
using BMA.EHR.Domain.Models.Retirement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
public class RetirementOutController : BaseController
|
public class RetirementOutController : BaseController
|
||||||
{
|
{
|
||||||
private readonly RetirementRepository _repository;
|
private readonly RetirementRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public RetirementOutController(RetirementRepository repository,
|
public RetirementOutController(RetirementRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Extensions;
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.MetaData;
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
|
@ -24,16 +25,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
public class RetirementResignController : BaseController
|
public class RetirementResignController : BaseController
|
||||||
{
|
{
|
||||||
private readonly RetirementRepository _repository;
|
private readonly RetirementRepository _repository;
|
||||||
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public RetirementResignController(RetirementRepository repository,
|
public RetirementResignController(RetirementRepository repository,
|
||||||
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
|
@ -293,6 +297,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
.Include(x => x.PosNo)
|
.Include(x => x.PosNo)
|
||||||
.Include(x => x.Salaries)
|
.Include(x => x.Salaries)
|
||||||
.Include(x => x.Position)
|
.Include(x => x.Position)
|
||||||
|
.Include(x => x.Prefix)
|
||||||
.FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(UserId));
|
.FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(UserId));
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
@ -346,6 +351,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await _repositoryNoti.PushNotificationAsync(
|
||||||
|
Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||||
|
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำลาออก",
|
||||||
|
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำลาออก"
|
||||||
|
);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return Success(retirementResign);
|
return Success(retirementResign);
|
||||||
|
|
@ -431,6 +441,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
public async Task<ActionResult<ResponseObject>> AdminConfirm([FromBody] RetirementReasonRequest req, Guid id)
|
public async Task<ActionResult<ResponseObject>> AdminConfirm([FromBody] RetirementReasonRequest req, Guid id)
|
||||||
{
|
{
|
||||||
var updated = await _context.RetirementResigns
|
var updated = await _context.RetirementResigns
|
||||||
|
.Include(x => x.Profile)
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (updated == null)
|
if (updated == null)
|
||||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||||
|
|
@ -458,6 +469,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
public async Task<ActionResult<ResponseObject>> AdminReject([FromBody] RetirementReasonRequest req, Guid id)
|
public async Task<ActionResult<ResponseObject>> AdminReject([FromBody] RetirementReasonRequest req, Guid id)
|
||||||
{
|
{
|
||||||
var updated = await _context.RetirementResigns
|
var updated = await _context.RetirementResigns
|
||||||
|
.Include(x => x.Profile)
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (updated == null)
|
if (updated == null)
|
||||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||||
|
|
@ -542,6 +554,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
public async Task<ActionResult<ResponseObject>> OligarchConfirm([FromBody] RetirementReasonRequest req, Guid id)
|
public async Task<ActionResult<ResponseObject>> OligarchConfirm([FromBody] RetirementReasonRequest req, Guid id)
|
||||||
{
|
{
|
||||||
var updated = await _context.RetirementResigns
|
var updated = await _context.RetirementResigns
|
||||||
|
.Include(x => x.Profile)
|
||||||
|
.ThenInclude(x => x.Prefix)
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (updated == null)
|
if (updated == null)
|
||||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||||
|
|
@ -552,6 +566,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
updated.LastUpdateUserId = UserId ?? "";
|
updated.LastUpdateUserId = UserId ?? "";
|
||||||
updated.LastUpdatedAt = DateTime.Now;
|
updated.LastUpdatedAt = DateTime.Now;
|
||||||
|
await _repositoryNoti.PushNotificationAsync(
|
||||||
|
Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||||
|
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติ",
|
||||||
|
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติ"
|
||||||
|
);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
|
|
@ -871,6 +890,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
public async Task<ActionResult<ResponseObject>> UpdateAppointQuestion([FromBody] RetirementQuestionAppointRequest req, Guid id)
|
public async Task<ActionResult<ResponseObject>> UpdateAppointQuestion([FromBody] RetirementQuestionAppointRequest req, Guid id)
|
||||||
{
|
{
|
||||||
var uppdated = await _context.RetirementQuestions.AsQueryable()
|
var uppdated = await _context.RetirementQuestions.AsQueryable()
|
||||||
|
.Include(x => x.RetirementResign)
|
||||||
|
.ThenInclude(x => x.Profile)
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (uppdated == null)
|
if (uppdated == null)
|
||||||
return Error(GlobalMessages.RetirementQuestionNotFound);
|
return Error(GlobalMessages.RetirementQuestionNotFound);
|
||||||
|
|
@ -879,6 +900,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
uppdated.LastUpdateUserId = UserId ?? "";
|
uppdated.LastUpdateUserId = UserId ?? "";
|
||||||
uppdated.LastUpdatedAt = DateTime.Now;
|
uppdated.LastUpdatedAt = DateTime.Now;
|
||||||
|
await _repositoryNoti.PushNotificationAsync(
|
||||||
|
uppdated.RetirementResign.Profile.Id,
|
||||||
|
$"การนัดสัมภาษณ์เหตุผลการลาออก {req.AppointDate.ToThaiFullDate()}",
|
||||||
|
$"การนัดสัมภาษณ์เหตุผลการลาออก {req.AppointDate.ToThaiFullDate()}"
|
||||||
|
);
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue