Merge branch 'develop' into working
This commit is contained in:
commit
0ca54170f4
26 changed files with 16644 additions and 146 deletions
|
|
@ -4129,6 +4129,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
.Include(p => p.Insignias)
|
||||
.ThenInclude(i => i.Insignia)
|
||||
.Include(p => p.Salaries)
|
||||
.Include(p => p.PositionLevel)
|
||||
.Where(p =>
|
||||
allOc.Contains(p.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OcId.Value) &&
|
||||
p.IsActive == true &&
|
||||
|
|
@ -4180,6 +4181,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
.Include(p => p.Insignias)
|
||||
.ThenInclude(i => i.Insignia)
|
||||
.Include(p => p.Salaries)
|
||||
.Include(p => p.PositionLevel)
|
||||
where allOc.Contains(p.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OcId.Value)
|
||||
&& p.IsActive == true
|
||||
&& p.IsLeave == false
|
||||
|
|
@ -4229,6 +4231,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
.Include(p => p.Insignias)
|
||||
.ThenInclude(i => i.Insignia)
|
||||
.Include(p => p.Salaries)
|
||||
.Include(p => p.PositionLevel)
|
||||
where p.IsActive == true
|
||||
&& allOc.Contains(p.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OcId.Value)
|
||||
&& p.IsLeave == false
|
||||
|
|
@ -4277,6 +4280,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
.Include(p => p.Insignias)
|
||||
.ThenInclude(i => i.Insignia)
|
||||
.Include(p => p.Salaries)
|
||||
.Include(p => p.PositionLevel)
|
||||
where p.IsActive == true
|
||||
&& allOc.Contains(p.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OcId.Value)
|
||||
&& p.IsLeave == false
|
||||
|
|
@ -4326,6 +4330,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
.Include(p => p.Insignias)
|
||||
.ThenInclude(i => i.Insignia)
|
||||
.Include(p => p.Salaries)
|
||||
.Include(p => p.PositionLevel)
|
||||
where p.IsActive == true
|
||||
&& allOc.Contains(p.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OcId.Value)
|
||||
&& p.IsLeave == false
|
||||
|
|
@ -4358,6 +4363,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
.Include(p => p.Insignias)
|
||||
.ThenInclude(i => i.Insignia)
|
||||
.Include(p => p.Salaries)
|
||||
.Include(p => p.PositionLevel)
|
||||
where p.IsActive == true
|
||||
&& allOc.Contains(p.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OcId.Value)
|
||||
&& p.IsLeave == false
|
||||
|
|
@ -4408,6 +4414,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
.Include(p => p.Insignias)
|
||||
.ThenInclude(i => i.Insignia)
|
||||
.Include(p => p.Salaries)
|
||||
.Include(p => p.PositionLevel)
|
||||
where p.IsActive == true
|
||||
&& allOc.Contains(p.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OcId.Value)
|
||||
&& p.IsLeave == false
|
||||
|
|
@ -4457,6 +4464,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
.Include(p => p.Insignias)
|
||||
.ThenInclude(i => i.Insignia)
|
||||
.Include(p => p.Salaries)
|
||||
.Include(p => p.PositionLevel)
|
||||
where p.IsActive == true
|
||||
&& allOc.Contains(p.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OcId.Value)
|
||||
&& p.IsLeave == false
|
||||
|
|
@ -4506,6 +4514,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
.Include(p => p.Insignias)
|
||||
.ThenInclude(i => i.Insignia)
|
||||
.Include(p => p.Salaries)
|
||||
.Include(p => p.PositionLevel)
|
||||
where p.IsActive == true
|
||||
&& allOc.Contains(p.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OcId.Value)
|
||||
&& p.IsLeave == false
|
||||
|
|
@ -4612,7 +4621,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
var type3_level11 = await GetInsigniaCandidate_Type3_Level11(periodId, ocId);
|
||||
var type4_level10 = await GetInsigniaCandidate_Type4_Level10(periodId, ocId);
|
||||
var type4_level11 = await GetInsigniaCandidate_Type4_Level11(periodId, ocId);
|
||||
// var type_coin = await GetInsigniaCandidate(periodId, ocId);
|
||||
var type_coin = await GetInsigniaCandidate(periodId, ocId);
|
||||
|
||||
// union result
|
||||
foreach (var r in type4_level11)
|
||||
|
|
@ -4699,10 +4708,10 @@ namespace BMA.EHR.Application.Repositories
|
|||
if (old == null)
|
||||
result_candidate.Add(r);
|
||||
}
|
||||
// foreach (var r in type_coin)
|
||||
// {
|
||||
// result_candidate.Add(r);
|
||||
// }
|
||||
foreach (var r in type_coin)
|
||||
{
|
||||
result_candidate.Add(r);
|
||||
}
|
||||
|
||||
return result_candidate.OrderBy(x => x.Seq).ThenBy(x => x.Gender).ThenBy(x => x.ProfileId).ToList();
|
||||
}
|
||||
|
|
@ -4980,7 +4989,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
CitizenId = h.Profile.CitizenId,
|
||||
ProfileId = h.Profile.Id,
|
||||
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,
|
||||
PosNo = h.Profile.PosNo.Id,
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,15 +37,61 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
// public async Task<dynamic> GetOcInsigniaPeriod(Guid id)
|
||||
// private string GetPositionByYear(string profileID, int year)
|
||||
// {
|
||||
// var period = await _dbContext.Set<InsigniaPeriod>()
|
||||
// .FirstOrDefaultAsync(x => x.Id == id);
|
||||
// if (period == null)
|
||||
// throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
|
||||
// period.
|
||||
// var OCName = r.OcId == null ? "-" : _organizationCommonRepository.GetOrganizationNameFullPath(r.OcId.Value, false, false);
|
||||
// return OCName;
|
||||
// using (var ctx = new ApplicationDbContext())
|
||||
// {
|
||||
// var ret = (from x in ctx.ProfileSalaryPositions.AsQueryable()
|
||||
// where x.IdNavigation.ProfileId == profileID &&
|
||||
// x.IdNavigation.SalaryDateAnnounce.Value.Year == year
|
||||
// orderby x.IdNavigation.Order descending
|
||||
// select x)
|
||||
// .Include(x => x.Position)
|
||||
// .FirstOrDefault();
|
||||
|
||||
// if (ret != null)
|
||||
// return ret.Position.Name;
|
||||
// else
|
||||
// return "ไม่ระบุ";
|
||||
// }
|
||||
// }
|
||||
|
||||
// private string GetPositionLevelByYear(string profileID, int year)
|
||||
// {
|
||||
// using (var ctx = new ApplicationDbContext())
|
||||
// {
|
||||
// var ret = (from x in ctx.ProfileSalaryPositionLevels.AsQueryable()
|
||||
// where x.IdNavigation.ProfileId == profileID &&
|
||||
// x.IdNavigation.SalaryDateAnnounce.Value.Year == year
|
||||
// orderby x.IdNavigation.Order descending
|
||||
// select x)
|
||||
// .Include(x => x.PositionLevel)
|
||||
// .FirstOrDefault();
|
||||
|
||||
// if (ret != null)
|
||||
// return ret.PositionLevel.Name;
|
||||
// else
|
||||
// return "ไม่ระบุ";
|
||||
// }
|
||||
// }
|
||||
|
||||
// private string GetPositionTypeByYear(string profileID, int year)
|
||||
// {
|
||||
// using (var ctx = new ApplicationDbContext())
|
||||
// {
|
||||
// var ret = (from x in ctx.ProfileSalaryPositionTypes.AsQueryable()
|
||||
// where x.IdNavigation.ProfileId == profileID &&
|
||||
// x.IdNavigation.SalaryDateAnnounce.Value.Year == year
|
||||
// orderby x.IdNavigation.Order descending
|
||||
// select x)
|
||||
// .Include(x => x.PositionType)
|
||||
// .FirstOrDefault();
|
||||
|
||||
// if (ret != null)
|
||||
// return ret.PositionType.Name;
|
||||
// else
|
||||
// return "ไม่ระบุ";
|
||||
// }
|
||||
// }
|
||||
|
||||
public async Task<dynamic> GetYearInsigniaPeriod(Guid id)
|
||||
|
|
@ -149,6 +195,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
G4Female = g.Sum(x => x.Gendor == "หญิง" && x.RequestInsigniaName == "ประถมาภรณ์มงกุฎไทย" ? 1 : 0),
|
||||
G5Male = g.Sum(x => x.Gendor == "ชาย" ? 1 : 0),
|
||||
G5Female = g.Sum(x => x.Gendor == "หญิง" ? 1 : 0),
|
||||
Remark = "",
|
||||
}).ToList();
|
||||
|
||||
return insignia;
|
||||
|
|
@ -191,6 +238,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
G4Female = g.Sum(x => x.Gendor == "หญิง" && x.RequestInsigniaName == "ประถมาภรณ์มงกุฎไทย" ? 1 : 0),
|
||||
G5Male = g.Sum(x => x.Gendor == "ชาย" ? 1 : 0),
|
||||
G5Female = g.Sum(x => x.Gendor == "หญิง" ? 1 : 0),
|
||||
Remark = "",
|
||||
}).ToList();
|
||||
|
||||
return new
|
||||
|
|
@ -205,6 +253,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
G4Female = insignia.Sum(x => x.G4Female),
|
||||
G5Male = insignia.Sum(x => x.G5Male),
|
||||
G5Female = insignia.Sum(x => x.G5Female),
|
||||
Remark = "",
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -254,6 +303,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
G8Female = g.Sum(x => x.Gendor == "หญิง" && x.RequestInsigniaName == "เบญจมาภรณ์มงกุฎไทย" ? 1 : 0),
|
||||
G9Male = g.Sum(x => x.Gendor == "ชาย" ? 1 : 0),
|
||||
G9Female = g.Sum(x => x.Gendor == "หญิง" ? 1 : 0),
|
||||
Remark = "",
|
||||
}).ToList();
|
||||
|
||||
return insignia;
|
||||
|
|
@ -303,6 +353,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
G8Female = g.Sum(x => x.Gendor == "หญิง" && x.RequestInsigniaName == "เบญจมาภรณ์มงกุฎไทย" ? 1 : 0),
|
||||
G9Male = g.Sum(x => x.Gendor == "ชาย" ? 1 : 0),
|
||||
G9Female = g.Sum(x => x.Gendor == "หญิง" ? 1 : 0),
|
||||
Remark = "",
|
||||
}).ToList();
|
||||
|
||||
return new
|
||||
|
|
@ -325,6 +376,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
G8Female = insignia.Sum(x => x.G8Female),
|
||||
G9Male = insignia.Sum(x => x.G9Male),
|
||||
G9Female = insignia.Sum(x => x.G9Female),
|
||||
Remark = "",
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -430,6 +482,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
InsigniaInitial = r.RequestInsignia.ShortName,
|
||||
InsigniaName = r.RequestInsignia.Name,
|
||||
ProfileId = r.Profile.Id,
|
||||
CitizenId = r.Profile.CitizenId,
|
||||
FullName = $"{r.Profile.Prefix?.Name}{r.Profile.FirstName} {r.Profile.LastName}",
|
||||
ShowProfileId = r.Profile.Id,
|
||||
Type = r.Profile.PositionType == null ? "-" : r.Profile.PositionType.Name,
|
||||
|
|
@ -444,8 +497,9 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
Remark = "",
|
||||
Position = r.Profile.Position?.Name +
|
||||
(r.Profile.PositionType == null ? null : " ประเภท" + r.Profile.PositionType?.Name) +
|
||||
(r.Profile.PositionLevel == null ? null : " ระดับ" + r.Profile.PositionLevel?.Name) +
|
||||
CRLF,
|
||||
(r.Profile.PositionLevel == null ? null : " สังกัด" + r.Profile.PositionLevel?.Name) +
|
||||
(r.Request.Organization == null ? null : " ระดับ" + CRLF + _organizationCommonRepository.GetOrganizationNameFullPath(r.Request.Organization.Id, false, false))
|
||||
,
|
||||
OCName = _organizationCommonRepository.GetOrganizationNameFullPath(r.Request.Organization.Id, false, false)
|
||||
})
|
||||
.Distinct()
|
||||
|
|
@ -473,6 +527,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
InsigniaInitial = r.RequestInsignia.ShortName,
|
||||
InsigniaName = r.RequestInsignia.Name,
|
||||
ProfileId = r.Profile.Id,
|
||||
CitizenId = r.Profile.CitizenId,
|
||||
FullName = $"",
|
||||
ShowProfileId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||
Type = "",
|
||||
|
|
@ -487,6 +542,9 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
InsigniaRequest = "",
|
||||
Remark = "",
|
||||
Position = "",
|
||||
// Position = GetPositionByYear(r.Profile.Id, r.Request.Period.Year) + " ประเภท" +
|
||||
// GetPositionTypeByYear(r.Profile.Id, r.Request.Period.Year) + " ระดับ" +
|
||||
// GetPositionLevelByYear(r.Profile.Id, r.Request.Period.Year),
|
||||
OCName = _organizationCommonRepository.GetOrganizationNameFullPath(r.Request.Organization.Id, false, false)
|
||||
})
|
||||
.Distinct()
|
||||
|
|
@ -528,6 +586,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
G1Female = g.Sum(x => x.Gendor == "หญิง" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0),
|
||||
G2Male = g.Sum(x => x.Gendor == "ชาย" ? 1 : 0),
|
||||
G2Female = g.Sum(x => x.Gendor == "หญิง" ? 1 : 0),
|
||||
Remark = "",
|
||||
}).ToList();
|
||||
|
||||
return insignia;
|
||||
|
|
@ -563,6 +622,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
G1Female = g.Sum(x => x.Gendor == "หญิง" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0),
|
||||
G2Male = g.Sum(x => x.Gendor == "ชาย" ? 1 : 0),
|
||||
G2Female = g.Sum(x => x.Gendor == "หญิง" ? 1 : 0),
|
||||
Remark = "",
|
||||
}).ToList();
|
||||
|
||||
return new
|
||||
|
|
@ -570,7 +630,8 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
G1Male = insignia.Sum(x => x.G1Male),
|
||||
G1Female = insignia.Sum(x => x.G1Female),
|
||||
G2Male = insignia.Sum(x => x.G2Male),
|
||||
G2Female = insignia.Sum(x => x.G2Female)
|
||||
G2Female = insignia.Sum(x => x.G2Female),
|
||||
Remark = "",
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -242,6 +242,9 @@ namespace BMA.EHR.Domain.Models.Placement
|
|||
|
||||
[Comment("ข้อมูลตำแหน่ง Draft")]
|
||||
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<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")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("ProfileImgId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Race")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
|
|
@ -11727,6 +11730,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.HasIndex("PrefixId");
|
||||
|
||||
b.HasIndex("ProfileImgId");
|
||||
|
||||
b.HasIndex("RegistDistrictId");
|
||||
|
||||
b.HasIndex("RegistProvinceId");
|
||||
|
|
@ -15295,6 +15300,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.WithMany()
|
||||
.HasForeignKey("PrefixId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "ProfileImg")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProfileImgId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "RegistDistrict")
|
||||
.WithMany()
|
||||
.HasForeignKey("RegistDistrictId");
|
||||
|
|
@ -15359,6 +15368,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.Navigation("Prefix");
|
||||
|
||||
b.Navigation("ProfileImg");
|
||||
|
||||
b.Navigation("RegistDistrict");
|
||||
|
||||
b.Navigation("RegistProvince");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.Security.Claims;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Requests;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Insignias;
|
||||
|
|
@ -26,15 +27,18 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly InsigniaPeriodsRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
|
||||
public InsigniaManageController(ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
InsigniaPeriodsRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
|
|
@ -412,12 +416,13 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
var insigniaNoteProfile = await _context.InsigniaNoteProfiles.AsQueryable()
|
||||
.Include(x => x.RequestInsignia)
|
||||
.Include(x => x.InsigniaNote)
|
||||
.FirstOrDefaultAsync(x => x.Id == req.InsigniaNoteProfileId);
|
||||
if (insigniaNoteProfile == null)
|
||||
return Error(GlobalMessages.InsigniaRequestProfileNotFound);
|
||||
|
||||
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)
|
||||
return Error(GlobalMessages.InsigniaManageNotFound);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.Security.Claims;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Requests;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Insignias;
|
||||
|
|
@ -24,15 +25,18 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly InsigniaPeriodsRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
|
||||
public InsigniaPeriodController(ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
InsigniaPeriodsRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.Security.Claims;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Requests;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Insignias;
|
||||
|
|
@ -23,15 +24,18 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly InsigniaPeriodsRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
|
||||
public InsigniaReceiveController(ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
InsigniaPeriodsRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Security.Claims;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Requests;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
|
|
@ -30,18 +31,21 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly InsigniaPeriodsRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
private readonly string Royal_Type = "Royal";
|
||||
|
||||
public InsigniaRequestController(ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
InsigniaPeriodsRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
IWebHostEnvironment hostingEnvironment,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
}
|
||||
|
|
@ -865,7 +869,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
.Select(x => x.RequestProfiles.Count(x => x.Status != "DELETE" && x.Status != "REJECT"))
|
||||
.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>
|
||||
|
|
@ -1093,6 +1097,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
foreach (var profileOld in profileOlds)
|
||||
{
|
||||
if (profileOld.Status == "DELETE" || profileOld.Status == "REJECT")
|
||||
continue;
|
||||
var noreProfileOld = insigniaNote.InsigniaNoteProfiles
|
||||
.Where(x => x.Profile == profileOld.Profile)
|
||||
.FirstOrDefault();
|
||||
|
|
@ -1397,11 +1403,11 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
var profileInsignia = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.Profile.CitizenId == req.CitizanId);
|
||||
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,
|
||||
IsApprove = true,
|
||||
Status = "DONE",
|
||||
Status = "PENDING",
|
||||
Profile = profile,
|
||||
Issue = req.Issue,
|
||||
Number = req.Number,
|
||||
|
|
@ -1424,48 +1430,83 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||
};
|
||||
if (req.DateReceive != null && req.Date != null)
|
||||
{
|
||||
Year = insigniaNote.Year,
|
||||
No = req.No,
|
||||
Issue = req.VolumeNo,
|
||||
VolumeNo = req.VolumeNo,
|
||||
// Volume = req.Volume,
|
||||
Section = req.Section,
|
||||
Page = req.Page,
|
||||
DateAnnounce = req.DateReceive,
|
||||
ReceiveDate = req.Date,
|
||||
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,
|
||||
});
|
||||
insigniaNoteProfile.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.InsigniaNoteProfiles.AddAsync(insigniaNoteProfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
profileInsignia.Issue = req.Issue;
|
||||
profileInsignia.Number = req.Number;
|
||||
profileInsignia.DateReceive = req.DateReceive;
|
||||
profileInsignia.Date = req.Date;
|
||||
profileInsignia.VolumeNo = req.VolumeNo;
|
||||
profileInsignia.Section = req.Section;
|
||||
profileInsignia.Page = req.Page;
|
||||
profileInsignia.No = req.No;
|
||||
profileInsignia.DatePayment = req.DatePayment;
|
||||
profileInsignia.TypePayment = req.TypePayment;
|
||||
profileInsignia.Address = req.Address;
|
||||
profileInsignia.RequestInsignia = insignia;
|
||||
profileInsignia.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profileInsignia.LastUpdateUserId = UserId ?? "";
|
||||
profileInsignia.LastUpdatedAt = DateTime.Now;
|
||||
if (profileInsignia.Status != "DONE")
|
||||
{
|
||||
profileInsignia.Issue = req.Issue;
|
||||
profileInsignia.Number = req.Number;
|
||||
profileInsignia.DateReceive = req.DateReceive;
|
||||
profileInsignia.Date = req.Date;
|
||||
profileInsignia.VolumeNo = req.VolumeNo;
|
||||
profileInsignia.Section = req.Section;
|
||||
profileInsignia.Page = req.Page;
|
||||
profileInsignia.No = req.No;
|
||||
profileInsignia.DatePayment = req.DatePayment;
|
||||
profileInsignia.TypePayment = req.TypePayment;
|
||||
profileInsignia.Address = req.Address;
|
||||
profileInsignia.RequestInsignia = insignia;
|
||||
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();
|
||||
return Success();
|
||||
|
|
@ -1587,6 +1628,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
var items = await ReadExcelImportReceive(file);
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item.DateReceive == null || item.Date == null)
|
||||
continue;
|
||||
var profile = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.Profile.CitizenId == item.CitizanId);
|
||||
if (profile == null)
|
||||
{
|
||||
|
|
@ -1603,7 +1646,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
RequestDate = DateTime.Now,
|
||||
Salary = _profile.Salaries.Count() == 0 ? null : _profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
IsApprove = true,
|
||||
Status = "DONE",
|
||||
Status = "PENDIND",
|
||||
Number = item.Number,
|
||||
RequestInsignia = _insignia,
|
||||
DateReceive = item.DateReceive,
|
||||
|
|
@ -1622,42 +1665,50 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
}
|
||||
else
|
||||
{
|
||||
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.DateReceive = item.DateReceive;
|
||||
profile.Date = item.Date;
|
||||
profile.VolumeNo = item.VolumeNo;
|
||||
profile.Section = item.Section;
|
||||
profile.Page = item.Page;
|
||||
profile.No = item.No;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = DateTime.Now;
|
||||
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.DateReceive = item.DateReceive;
|
||||
profile.Date = item.Date;
|
||||
profile.VolumeNo = item.VolumeNo;
|
||||
profile.Section = item.Section;
|
||||
profile.Page = item.Page;
|
||||
profile.No = item.No;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
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,
|
||||
No = profile.No,
|
||||
Issue = profile.VolumeNo,
|
||||
VolumeNo = profile.VolumeNo,
|
||||
// Volume = profile.Volume,
|
||||
Section = profile.Section,
|
||||
Page = profile.Page,
|
||||
DateAnnounce = profile.DateReceive,
|
||||
ReceiveDate = profile.Date,
|
||||
InsigniaType = profile.RequestInsignia.InsigniaType == null ? null : profile.RequestInsignia.InsigniaType.Name,
|
||||
Insignia = profile.RequestInsignia,
|
||||
// RefCommandNo = req.RefCommandNo,
|
||||
// RefCommandDate = req.RefCommandDate,
|
||||
Profile = profile.Profile,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
profile.Status = "DONE";
|
||||
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||
{
|
||||
Year = insigniaNote.Year,
|
||||
No = profile.No,
|
||||
Issue = profile.VolumeNo,
|
||||
VolumeNo = profile.VolumeNo,
|
||||
// Volume = profile.Volume,
|
||||
Section = profile.Section,
|
||||
Page = profile.Page,
|
||||
DateAnnounce = profile.Date,
|
||||
ReceiveDate = profile.DateReceive,
|
||||
InsigniaType = profile.RequestInsignia.InsigniaType == null ? null : profile.RequestInsignia.InsigniaType.Name,
|
||||
Insignia = profile.RequestInsignia,
|
||||
// RefCommandNo = req.RefCommandNo,
|
||||
// RefCommandDate = req.RefCommandDate,
|
||||
Profile = profile.Profile,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
|
|
|
|||
|
|
@ -55,13 +55,13 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
if (profile == null)
|
||||
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,
|
||||
ReceiverUserId = req.ReceiverUserId,
|
||||
Type = "",
|
||||
Payload = "",
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
|
|
@ -73,11 +73,11 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
}
|
||||
if (req.IsSendInbox == true)
|
||||
{
|
||||
_context.Notifications.Add(new Notification
|
||||
_context.Inboxes.Add(new Inbox
|
||||
{
|
||||
Subject = req.Subject,
|
||||
Body = req.Body,
|
||||
ReceiverUserId = req.ReceiverUserId,
|
||||
Type = "",
|
||||
Payload = "",
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
public class PlacementAppointmentController : BaseController
|
||||
{
|
||||
private readonly PlacementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public PlacementAppointmentController(PlacementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
|
@ -24,16 +25,19 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
public class PlacementController : BaseController
|
||||
{
|
||||
private readonly PlacementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public PlacementController(PlacementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
|
@ -132,6 +136,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
SalaryAmount = x.Amount,
|
||||
MouthSalaryAmount = x.MouthSalaryAmount,
|
||||
PositionSalaryAmount = x.PositionSalaryAmount,
|
||||
Avatar = x.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.ProfileImg.Id,
|
||||
}).OrderBy(x => x.ExamNumber).ToListAsync();
|
||||
|
||||
var result = new List<dynamic>();
|
||||
|
|
@ -167,6 +172,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.SalaryAmount,
|
||||
p.MouthSalaryAmount,
|
||||
p.PositionSalaryAmount,
|
||||
Avatar = p.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(p.Avatar),
|
||||
};
|
||||
result.Add(_data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
public class PlacementOfficerController : BaseController
|
||||
{
|
||||
private readonly PlacementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public PlacementOfficerController(PlacementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
public class PlacementReceiveController : BaseController
|
||||
{
|
||||
private readonly PlacementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public PlacementReceiveController(PlacementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
public class PlacementRelocationController : BaseController
|
||||
{
|
||||
private readonly PlacementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public PlacementRelocationController(PlacementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
public class PlacementRepatriationController : BaseController
|
||||
{
|
||||
private readonly PlacementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public PlacementRepatriationController(PlacementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
public class PlacementTransferController : BaseController
|
||||
{
|
||||
private readonly PlacementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public PlacementTransferController(PlacementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
|
@ -315,6 +319,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
.Include(x => x.PosNo)
|
||||
.Include(x => x.Salaries)
|
||||
.Include(x => x.Position)
|
||||
.Include(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(UserId));
|
||||
if (profile == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
|
@ -322,8 +327,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
var placementTransfer = new PlacementTransfer
|
||||
{
|
||||
Profile = profile,
|
||||
Organization = Request.Form.ContainsKey("Organization") ? Request.Form["Organization"] : "",
|
||||
Reason = Request.Form.ContainsKey("Reason") ? Request.Form["Reason"] : "",
|
||||
Organization = req.Organization,
|
||||
Reason = req.Reason,
|
||||
Date = req.Date,
|
||||
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
|
||||
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();
|
||||
|
||||
return Success();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
|
|
@ -22,18 +23,21 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
public class RetirementController : BaseController
|
||||
{
|
||||
private readonly RetirementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public RetirementController(RetirementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IConfiguration configuration,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
|
@ -335,7 +339,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
{
|
||||
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 results = responseTask.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.MessageQueue;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
|
|
@ -27,16 +28,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
public class RetirementDeceasedController : BaseController
|
||||
{
|
||||
private readonly RetirementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public RetirementDeceasedController(RetirementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
|
@ -530,56 +534,28 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
var profile = req.Persons.FirstOrDefault(x => x.ProfileId == item.ReceiveUser.Id);
|
||||
if (profile != null)
|
||||
{
|
||||
if (profile.IsSendInbox == true)
|
||||
{
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
Body = $"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
ReceiverUserId = item.ReceiveUser.Id,
|
||||
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);
|
||||
}
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
item.ReceiveUser.Id,
|
||||
$"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
$"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
profile.IsSendNotification,
|
||||
profile.IsSendInbox,
|
||||
profile.IsSendMail
|
||||
);
|
||||
item.IsSendMail = profile.IsSendMail;
|
||||
item.IsSendInbox = profile.IsSendInbox;
|
||||
item.IsSendNotification = profile.IsSendNotification;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.IsSendInbox == true)
|
||||
{
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
Body = $"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
ReceiverUserId = item.ReceiveUser.Id,
|
||||
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 _repositoryNoti.PushNotificationAsync(
|
||||
item.ReceiveUser.Id,
|
||||
$"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
$"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
item.IsSendNotification,
|
||||
item.IsSendInbox,
|
||||
item.IsSendMail
|
||||
);
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
public class RetirementDischargeController : BaseController
|
||||
{
|
||||
private readonly RetirementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public RetirementDischargeController(RetirementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
public class RetirementExpulsionController : BaseController
|
||||
{
|
||||
private readonly RetirementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public RetirementExpulsionController(RetirementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
public class RetirementOtherController : BaseController
|
||||
{
|
||||
private readonly RetirementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public RetirementOtherController(RetirementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
|
|
@ -21,16 +22,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
public class RetirementOutController : BaseController
|
||||
{
|
||||
private readonly RetirementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public RetirementOutController(RetirementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
|
@ -24,16 +25,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
public class RetirementResignController : BaseController
|
||||
{
|
||||
private readonly RetirementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public RetirementResignController(RetirementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
|
@ -293,6 +297,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
.Include(x => x.PosNo)
|
||||
.Include(x => x.Salaries)
|
||||
.Include(x => x.Position)
|
||||
.Include(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(UserId));
|
||||
if (profile == null)
|
||||
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();
|
||||
|
||||
return Success(retirementResign);
|
||||
|
|
@ -431,6 +441,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
public async Task<ActionResult<ResponseObject>> AdminConfirm([FromBody] RetirementReasonRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResigns
|
||||
.Include(x => x.Profile)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
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)
|
||||
{
|
||||
var updated = await _context.RetirementResigns
|
||||
.Include(x => x.Profile)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
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)
|
||||
{
|
||||
var updated = await _context.RetirementResigns
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
|
@ -552,6 +566,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
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();
|
||||
|
||||
return Success();
|
||||
|
|
@ -871,6 +890,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
public async Task<ActionResult<ResponseObject>> UpdateAppointQuestion([FromBody] RetirementQuestionAppointRequest req, Guid id)
|
||||
{
|
||||
var uppdated = await _context.RetirementQuestions.AsQueryable()
|
||||
.Include(x => x.RetirementResign)
|
||||
.ThenInclude(x => x.Profile)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (uppdated == null)
|
||||
return Error(GlobalMessages.RetirementQuestionNotFound);
|
||||
|
|
@ -879,6 +900,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
uppdated.LastUpdateUserId = UserId ?? "";
|
||||
uppdated.LastUpdatedAt = DateTime.Now;
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
uppdated.RetirementResign.Profile.Id,
|
||||
$"การนัดสัมภาษณ์เหตุผลการลาออก {req.AppointDate.ToThaiFullDate()}",
|
||||
$"การนัดสัมภาษณ์เหตุผลการลาออก {req.AppointDate.ToThaiFullDate()}"
|
||||
);
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue