Merge branch 'develop' of github.com:Frappet/hrms-api-backend into develop
This commit is contained in:
commit
cf6f0feef5
6 changed files with 20846 additions and 28 deletions
|
|
@ -8745,6 +8745,23 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<Guid?> GetRequestIdByTypeAsync(Guid period, Guid ocId, string type = "officer")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var req = await _dbContext.Set<InsigniaRequest>()
|
||||||
|
.Where(x => x.OrganizationId != null)
|
||||||
|
.FirstOrDefaultAsync(x => x.Period.Id == period && x.OrganizationId == ocId && x.ProfileType.ToLower() == type.ToLower());
|
||||||
|
if (req == null)
|
||||||
|
return null;
|
||||||
|
return req.Id;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Save Aprove
|
// Save Aprove
|
||||||
public async Task SaveAprove(Guid period, Guid ocId)
|
public async Task SaveAprove(Guid period, Guid ocId)
|
||||||
{
|
{
|
||||||
|
|
@ -8771,6 +8788,31 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task SaveApproveByTypeAsync(Guid period, Guid ocId, string type = "officer")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var req = await GetRequestIdByTypeAsync(period, ocId, type);
|
||||||
|
|
||||||
|
if (req != null)
|
||||||
|
{
|
||||||
|
var insigniaRequestProfiles = await _dbContext.Set<InsigniaRequestProfile>()
|
||||||
|
.Where(x => x.Request.Id == req)
|
||||||
|
.ToListAsync();
|
||||||
|
foreach (var insigniaRequestProfile in insigniaRequestProfiles)
|
||||||
|
{
|
||||||
|
insigniaRequestProfile.IsApprove = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// เช็คข้อมูล ใน table insignia_request_new
|
// เช็คข้อมูล ใน table insignia_request_new
|
||||||
public async Task<InsigniaResults?> GetInsigniaRequest(Guid id, Guid ocId)
|
public async Task<InsigniaResults?> GetInsigniaRequest(Guid id, Guid ocId)
|
||||||
{
|
{
|
||||||
|
|
@ -8820,6 +8862,54 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<InsigniaResults?> GetInsigniaRequestByTypeAsync(Guid id, Guid ocId, string type = "officer")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var period = await _dbContext.Set<InsigniaPeriod>()
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
Id = p.Id,
|
||||||
|
Name = p.Name,
|
||||||
|
Round = p.Round,
|
||||||
|
Year = p.Year,
|
||||||
|
IsLock = p.IsLock,
|
||||||
|
})
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
|
||||||
|
if (period == null)
|
||||||
|
return null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var request = await _dbContext.Set<InsigniaRequest>()
|
||||||
|
.Include(x => x.Document)
|
||||||
|
.FirstOrDefaultAsync(x => x.Period.Id == period.Id && x.OrganizationId == ocId && x.ProfileType.ToLower() == type.ToLower());
|
||||||
|
|
||||||
|
return new InsigniaResults
|
||||||
|
{
|
||||||
|
PeriodId = period.Id,
|
||||||
|
Year = period.Year,
|
||||||
|
Round = period.Round,
|
||||||
|
Name = period.Name,
|
||||||
|
IsLock = period.IsLock,
|
||||||
|
RequestId = request == null ? null : request.Id,
|
||||||
|
RequestNote = request == null ? "" : request.RequestNote,
|
||||||
|
RequestStatus = request == null ? null : request.RequestStatus,
|
||||||
|
OrganizationName = request == null ? "" : request.Organization,
|
||||||
|
Document = request == null
|
||||||
|
? null
|
||||||
|
: (request.Document == null
|
||||||
|
? null
|
||||||
|
: await _documentService.ImagesPath(request.Document.Id)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get Data Table insignai_has_profile
|
// Get Data Table insignai_has_profile
|
||||||
public async Task<List<InsigniaRequestItem>> InsigniaHasProfile(Guid period, Guid ocId, string status)
|
public async Task<List<InsigniaRequestItem>> InsigniaHasProfile(Guid period, Guid ocId, string status)
|
||||||
{
|
{
|
||||||
|
|
@ -8975,7 +9065,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
|
|
||||||
// insert candidate list
|
// insert candidate list
|
||||||
|
|
||||||
public async Task UpdateCandidateAsync(Guid periodId, Guid ocId, string oc, List<InsigniaResultSet> items)
|
public async Task UpdateCandidateAsync(Guid periodId, Guid ocId, string oc, List<InsigniaResultSet> items, string type = "officer")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -8989,6 +9079,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
.Include(x => x.Period)
|
.Include(x => x.Period)
|
||||||
.Where(x => x.Period.Id == periodId)
|
.Where(x => x.Period.Id == periodId)
|
||||||
.Where(x => x.OrganizationId == ocId)
|
.Where(x => x.OrganizationId == ocId)
|
||||||
|
.Where(x => x.ProfileType.ToLower() == type.ToLower())
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
if (req != null)
|
if (req != null)
|
||||||
|
|
@ -9068,7 +9159,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task InsertCandidate(Guid periodId, Guid ocId, string oc, List<InsigniaResultSet> items)
|
public async Task InsertCandidate(Guid periodId, Guid ocId, string oc, List<InsigniaResultSet> items, string type = "officer")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -9103,6 +9194,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
ProfileType = type
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
|
|
|
||||||
|
|
@ -25,5 +25,7 @@ namespace BMA.EHR.Domain.Models.Insignias
|
||||||
public Document? Document { get; set; }
|
public Document? Document { get; set; }
|
||||||
|
|
||||||
public virtual List<InsigniaRequestProfile> RequestProfiles { get; set; } = new List<InsigniaRequestProfile>();
|
public virtual List<InsigniaRequestProfile> RequestProfiles { get; set; } = new List<InsigniaRequestProfile>();
|
||||||
|
|
||||||
|
public string? ProfileType { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
20683
BMA.EHR.Infrastructure/Migrations/20250529062132_Add ProfileType To InsigniaRequest.Designer.cs
generated
Normal file
20683
BMA.EHR.Infrastructure/Migrations/20250529062132_Add ProfileType To InsigniaRequest.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,29 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddProfileTypeToInsigniaRequest : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "ProfileType",
|
||||||
|
table: "InsigniaRequests",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ProfileType",
|
||||||
|
table: "InsigniaRequests");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6542,6 +6542,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Property<Guid>("PeriodId")
|
b.Property<Guid>("PeriodId")
|
||||||
.HasColumnType("char(36)");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("ProfileType")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<string>("RequestNote")
|
b.Property<string>("RequestNote")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
[HttpGet("{insigniaPeriodId:length(36)}/{ocId:length(36)}/{role}/{status}/{isDeputy}/{type}")]
|
[HttpGet("{insigniaPeriodId:length(36)}/{ocId:length(36)}/{role}/{status}/{isDeputy}/{type}")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetInsignaiRequestBkkByTypeAsync(Guid insigniaPeriodId, Guid ocId, string role, string status, bool isDeputy, string type = "officer")
|
public async Task<ActionResult<ResponseObject>> GetInsignaiRequestBkkByTypeAsync(Guid insigniaPeriodId, Guid ocId, string role, string status, bool isDeputy, string type = "officer")
|
||||||
{
|
{
|
||||||
var result = await _repository.GetInsigniaRequest(insigniaPeriodId, ocId);
|
var result = await _repository.GetInsigniaRequestByTypeAsync(insigniaPeriodId, ocId, type);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Guid period = result.PeriodId;
|
Guid period = result.PeriodId;
|
||||||
|
|
@ -647,7 +647,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
var result = await _repository.GetInsigniaRequest(insigniaPeriodId, organization.Id);
|
var result = await _repository.GetInsigniaRequestByTypeAsync(insigniaPeriodId, organization.Id, type);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Guid period = result.PeriodId;
|
Guid period = result.PeriodId;
|
||||||
|
|
@ -657,12 +657,12 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
if (requestStatus == null)
|
if (requestStatus == null)
|
||||||
{
|
{
|
||||||
// บันทึกรายชื่อ
|
// บันทึกรายชื่อ
|
||||||
await _repository.InsertCandidate(period, organization.Id, organization.OrgRootName, candidate);
|
await _repository.InsertCandidate(period, organization.Id, organization.OrgRootName, candidate, type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// update รายชื่อ
|
// update รายชื่อ
|
||||||
await _repository.UpdateCandidateAsync(period, organization.Id, organization.OrgRootName, candidate);
|
await _repository.UpdateCandidateAsync(period, organization.Id, organization.OrgRootName, candidate, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -750,11 +750,11 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("officer/approve/{id:length(36)}/{ocId:length(36)}")]
|
[HttpGet("officer/approve/{type}/{id:length(36)}/{ocId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt3(Guid id, Guid ocId)
|
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt3(Guid id, Guid ocId, string type)
|
||||||
{
|
{
|
||||||
await _repository.SaveAprove(id, ocId);
|
await _repository.SaveApproveByTypeAsync(id, ocId, type);
|
||||||
var requestId = await _repository.GetRequestId(id, ocId);
|
var requestId = await _repository.GetRequestIdByTypeAsync(id, ocId, type);
|
||||||
var requestNew = await _context.InsigniaRequests
|
var requestNew = await _context.InsigniaRequests
|
||||||
.Include(x => x.Period)
|
.Include(x => x.Period)
|
||||||
.FirstOrDefaultAsync(i => i.Id == requestId);
|
.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||||
|
|
@ -785,11 +785,11 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpPut("officer/reject/{id:length(36)}/{ocId:length(36)}")]
|
[HttpPut("officer/reject/{type}/{id:length(36)}/{ocId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt2([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId)
|
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt2([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId, string type)
|
||||||
{
|
{
|
||||||
await _repository.SaveAprove(id, ocId);
|
await _repository.SaveApproveByTypeAsync(id, ocId, type);
|
||||||
var requestId = await _repository.GetRequestId(id, ocId);
|
var requestId = await _repository.GetRequestIdByTypeAsync(id, ocId, type);
|
||||||
var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId);
|
var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||||
if (requestNew != null)
|
if (requestNew != null)
|
||||||
{
|
{
|
||||||
|
|
@ -810,10 +810,10 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("director/approve/{id:length(36)}/{ocId:length(36)}")]
|
[HttpGet("director/approve/{type}/{id:length(36)}/{ocId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt6(Guid id, Guid ocId)
|
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt6(Guid id, Guid ocId, string type)
|
||||||
{
|
{
|
||||||
var requestId = await _repository.GetRequestId(id, ocId);
|
var requestId = await _repository.GetRequestIdByTypeAsync(id, ocId, type);
|
||||||
var requestNew = await _context.InsigniaRequests
|
var requestNew = await _context.InsigniaRequests
|
||||||
.Include(x => x.Period)
|
.Include(x => x.Period)
|
||||||
.FirstOrDefaultAsync(i => i.Id == requestId);
|
.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||||
|
|
@ -852,10 +852,10 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpPut("director/reject/{id:length(36)}/{ocId:length(36)}")]
|
[HttpPut("director/reject/{type}/{id:length(36)}/{ocId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt4([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId)
|
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt4([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId, string type)
|
||||||
{
|
{
|
||||||
var requestId = await _repository.GetRequestId(id, ocId);
|
var requestId = await _repository.GetRequestIdByTypeAsync(id, ocId, type);
|
||||||
var requestNew = await _context.InsigniaRequests
|
var requestNew = await _context.InsigniaRequests
|
||||||
.Include(x => x.Period)
|
.Include(x => x.Period)
|
||||||
.FirstOrDefaultAsync(i => i.Id == requestId);
|
.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||||
|
|
@ -886,10 +886,10 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpPut("head/reject/{id:length(36)}/{ocId:length(36)}")]
|
[HttpPut("head/reject/{type}/{id:length(36)}/{ocId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt5([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId)
|
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt5([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId, string type)
|
||||||
{
|
{
|
||||||
var requestId = await _repository.GetRequestId(id, ocId);
|
var requestId = await _repository.GetRequestIdByTypeAsync(id, ocId, type);
|
||||||
var requestNew = await _context.InsigniaRequests
|
var requestNew = await _context.InsigniaRequests
|
||||||
.Include(x => x.Period)
|
.Include(x => x.Period)
|
||||||
.FirstOrDefaultAsync(i => i.Id == requestId);
|
.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||||
|
|
@ -1015,18 +1015,20 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("dashboard/{insigniaPeriodId:length(36)}")]
|
[HttpGet("dashboard/{type}/{insigniaPeriodId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> DashboardInsigniaPeriod(Guid insigniaPeriodId)
|
public async Task<ActionResult<ResponseObject>> DashboardInsigniaPeriod(Guid insigniaPeriodId, string type)
|
||||||
{
|
{
|
||||||
var insigniaPeriod = await _context.InsigniaPeriods.FirstOrDefaultAsync(x => x.Id == insigniaPeriodId);
|
var insigniaPeriod = await _context.InsigniaPeriods.FirstOrDefaultAsync(x => x.Id == insigniaPeriodId);
|
||||||
if (insigniaPeriod == null)
|
if (insigniaPeriod == null)
|
||||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||||
var orgAllCount = await _context.InsigniaRequests
|
var orgAllCount = await _context.InsigniaRequests
|
||||||
.Where(x => x.Period == insigniaPeriod)
|
.Where(x => x.Period == insigniaPeriod)
|
||||||
|
.Where(x => x.ProfileType!.ToLower() == type.ToLower())
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
GetIsOfficerDto RoleInsignia = await _userProfileRepository.GetIsOfficerRootAsync(AccessToken, "SYS_INSIGNIA_MANAGE");
|
GetIsOfficerDto RoleInsignia = await _userProfileRepository.GetIsOfficerRootAsync(AccessToken, "SYS_INSIGNIA_MANAGE");
|
||||||
var allUserUser = await _context.InsigniaRequests
|
var allUserUser = await _context.InsigniaRequests
|
||||||
.Where(x => x.Period == insigniaPeriod)
|
.Where(x => x.Period == insigniaPeriod)
|
||||||
|
.Where(x => x.ProfileType!.ToLower() == type.ToLower())
|
||||||
.Where(x => RoleInsignia.isOfficer == true ? x.RequestStatus == "st6" : (RoleInsignia.isDirector == true ? (x.RequestStatus != "st1" && x.RequestStatus != "st2") : x.Id != null))
|
.Where(x => RoleInsignia.isOfficer == true ? x.RequestStatus == "st6" : (RoleInsignia.isDirector == true ? (x.RequestStatus != "st1" && x.RequestStatus != "st2") : x.Id != null))
|
||||||
.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();
|
||||||
|
|
@ -1043,8 +1045,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("org/no-send/{insigniaPeriodId:length(36)}")]
|
[HttpGet("org/no-send/{type}/{insigniaPeriodId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> ListOrgDontSentUser(Guid insigniaPeriodId)
|
public async Task<ActionResult<ResponseObject>> ListOrgDontSentUser(Guid insigniaPeriodId, string type)
|
||||||
{
|
{
|
||||||
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_INSIGNIA_MANAGE");
|
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_INSIGNIA_MANAGE");
|
||||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||||
|
|
@ -1057,6 +1059,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||||
var orgIdSend = await _context.InsigniaRequests
|
var orgIdSend = await _context.InsigniaRequests
|
||||||
.Where(x => x.Period == insigniaPeriod)
|
.Where(x => x.Period == insigniaPeriod)
|
||||||
|
.Where(x => x.ProfileType!.ToLower() == type.ToLower())
|
||||||
.Where(x => x.RequestStatus == "st6")
|
.Where(x => x.RequestStatus == "st6")
|
||||||
.Select(x => x.OrganizationId)
|
.Select(x => x.OrganizationId)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
@ -1514,6 +1517,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
.Where(x => req.InsigniaId == null ? x.RequestInsignia != null : (x.RequestInsignia.Id == req.InsigniaId))
|
.Where(x => req.InsigniaId == null ? x.RequestInsignia != null : (x.RequestInsignia.Id == req.InsigniaId))
|
||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
|
x.ProfileId,
|
||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
x.Prefix,
|
x.Prefix,
|
||||||
x.FirstName,
|
x.FirstName,
|
||||||
|
|
@ -1555,6 +1559,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
|
ProfileId = x.ProfileId,
|
||||||
Prefix = x.Prefix ?? "",
|
Prefix = x.Prefix ?? "",
|
||||||
Position = x.Position ?? "",
|
Position = x.Position ?? "",
|
||||||
ProfileType = x.ProfileType ?? "",
|
ProfileType = x.ProfileType ?? "",
|
||||||
|
|
@ -1597,6 +1602,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
insigniaNoteProfile.Id,
|
insigniaNoteProfile.Id,
|
||||||
|
insigniaNoteProfile.ProfileId,
|
||||||
insigniaNoteProfile.Prefix,
|
insigniaNoteProfile.Prefix,
|
||||||
insigniaNoteProfile.Position,
|
insigniaNoteProfile.Position,
|
||||||
insigniaNoteProfile.CitizenId,
|
insigniaNoteProfile.CitizenId,
|
||||||
|
|
@ -2938,7 +2944,10 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
requestProfiles = requestProfiles.Where(x => x.ProfileId != null)
|
requestProfiles = requestProfiles.Where(x => x.ProfileId != null)
|
||||||
.ToList();
|
.ToList();
|
||||||
if (req.InsigniaId != null)
|
if (req.InsigniaId != null)
|
||||||
requestProfiles = requestProfiles.Where(x => x.RequestInsignia.Id == req.InsigniaId).ToList();
|
requestProfiles = requestProfiles
|
||||||
|
.Where(x => x.ProfileType.ToLower() == req.ProfileType.ToLower())
|
||||||
|
.Where(x => x.RequestInsignia.Id == req.InsigniaId)
|
||||||
|
.ToList();
|
||||||
var row = 2;
|
var row = 2;
|
||||||
foreach (var item in requestProfiles)
|
foreach (var item in requestProfiles)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue