แก้ api ลา
This commit is contained in:
parent
d08b4ca723
commit
4822110533
20 changed files with 20695 additions and 2783 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -136,6 +136,28 @@ namespace BMA.EHR.Application.Repositories
|
||||||
var apiPath = $"{_configuration["API"]}/org/dotnet/keycloak/{keycloakId}";
|
var apiPath = $"{_configuration["API"]}/org/dotnet/keycloak/{keycloakId}";
|
||||||
var apiKey = _configuration["API_KEY"];
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
|
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetProfileByKeycloakIdResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<GetProfileByKeycloakIdDto?> GetProfileByProfileIdAsync(Guid keycloakId, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/profile/{keycloakId}";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||||
if (apiResult != null)
|
if (apiResult != null)
|
||||||
|
|
@ -146,15 +168,6 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
//var data = await _dbContext.Set<Profile>().AsQueryable()
|
|
||||||
// .Include(p => p.Prefix)
|
|
||||||
// .Include(p => p.Position)
|
|
||||||
// .Include(p => p.PositionLevel)
|
|
||||||
// .Include(p => p.Salaries)
|
|
||||||
// .FirstOrDefaultAsync(p => p.KeycloakId == keycloakId);
|
|
||||||
|
|
||||||
//return data;
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
@ -532,7 +545,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public GetProfileByIdDto GetOfficerProfileByCitizenId(string citizenId, string? accessToken)
|
public async Task<GetProfileByKeycloakIdDto?> GetOfficerProfileByCitizenId(string citizenId, string? accessToken)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -542,7 +555,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
var apiResult = GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
var apiResult = GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||||
if (apiResult.Result != null)
|
if (apiResult.Result != null)
|
||||||
{
|
{
|
||||||
var raw = JsonConvert.DeserializeObject<GetProfileByIdResultDto>(apiResult.Result);
|
var raw = JsonConvert.DeserializeObject<GetProfileByKeycloakIdResultDto>(apiResult.Result);
|
||||||
if (raw != null)
|
if (raw != null)
|
||||||
return raw.Result;
|
return raw.Result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,11 @@ namespace BMA.EHR.Application.Requests
|
||||||
|
|
||||||
public int Seq { get; set; }
|
public int Seq { get; set; }
|
||||||
|
|
||||||
|
public double? Amount { get; set; }
|
||||||
|
public double? PositionSalaryAmount { get; set; }
|
||||||
|
public Guid? RootId { get; set; }
|
||||||
|
public string? Root { get; set; }
|
||||||
|
|
||||||
public List<MatchingCondition> MatchingConditions { get; set; } = new List<MatchingCondition>();
|
public List<MatchingCondition> MatchingConditions { get; set; } = new List<MatchingCondition>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
|
||||||
public Guid? OcId { get; set; }
|
public Guid? OcId { get; set; }
|
||||||
|
|
||||||
public PosType? PosType { get; set; }
|
public string? PosType { get; set; }
|
||||||
|
|
||||||
public PosLevel? PosLevel { get; set; }
|
public string? PosLevel { get; set; }
|
||||||
|
|
||||||
public string? Oc { get; set; }
|
public string? Oc { get; set; }
|
||||||
|
|
||||||
|
|
@ -45,16 +45,17 @@ namespace BMA.EHR.Application.Responses.Profiles
|
||||||
public bool? IsLeave { get; set; }
|
public bool? IsLeave { get; set; }
|
||||||
|
|
||||||
public string? Root { get; set; }
|
public string? Root { get; set; }
|
||||||
|
|
||||||
public string? Child1 { get; set; }
|
public string? Child1 { get; set; }
|
||||||
|
|
||||||
public string? Child2 { get; set; }
|
public string? Child2 { get; set; }
|
||||||
|
|
||||||
public string? Child3 { get; set; }
|
public string? Child3 { get; set; }
|
||||||
|
|
||||||
public string? Child4 { get; set; }
|
public string? Child4 { get; set; }
|
||||||
|
public Guid? RootId { get; set; }
|
||||||
|
public Guid? Child1Id { get; set; }
|
||||||
|
public Guid? Child2Id { get; set; }
|
||||||
|
public Guid? Child3Id { get; set; }
|
||||||
|
public Guid? Child4Id { get; set; }
|
||||||
public double? Amount { get; set; }
|
public double? Amount { get; set; }
|
||||||
|
public double? PositionSalaryAmount { get; set; }
|
||||||
public string? Commander { get; set; }
|
public string? Commander { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -127,5 +128,6 @@ namespace BMA.EHR.Application.Responses.Profiles
|
||||||
public int? Year { get; set; }
|
public int? Year { get; set; }
|
||||||
|
|
||||||
public Guid? InsigniaId { get; set; }
|
public Guid? InsigniaId { get; set; }
|
||||||
|
public string? Insignia { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,13 @@ namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
|
||||||
public Guid? OcId { get; set; }
|
public Guid? OcId { get; set; }
|
||||||
|
|
||||||
public PosType? PosType { get; set; }
|
public string? PosType { get; set; }
|
||||||
|
|
||||||
public PosLevel? PosLevel { get; set; }
|
public string? PosLevel { get; set; }
|
||||||
|
|
||||||
|
public Guid? PosTypeId { get; set; }
|
||||||
|
|
||||||
|
public Guid? PosLevelId { get; set; }
|
||||||
|
|
||||||
public string? Oc { get; set; }
|
public string? Oc { get; set; }
|
||||||
|
|
||||||
|
|
@ -42,5 +46,9 @@ namespace BMA.EHR.Application.Responses.Profiles
|
||||||
public string? PosNoEmployee { get; set; }
|
public string? PosNoEmployee { get; set; }
|
||||||
|
|
||||||
public string? Gender { get; set; }
|
public string? Gender { get; set; }
|
||||||
|
public double? Amount { get; set; }
|
||||||
|
public double? PositionSalaryAmount { get; set; }
|
||||||
|
public Guid? RootId { get; set; }
|
||||||
|
public string? Root { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ namespace BMA.EHR.Domain.Models.Insignias
|
||||||
public int Total { get; set; }
|
public int Total { get; set; }
|
||||||
[Comment("รหัสหน่วยงาน")]
|
[Comment("รหัสหน่วยงาน")]
|
||||||
public Guid OrganizationId { get; set; }
|
public Guid OrganizationId { get; set; }
|
||||||
|
[Comment("รหัสหน่วยงาน")]
|
||||||
|
public string? Organization { get; set; }
|
||||||
//public OrganizationOrganization OrganizationOrganization { get; set; }
|
//public OrganizationOrganization OrganizationOrganization { get; set; }
|
||||||
[Comment("Fk Table InsigniaManage")]
|
[Comment("Fk Table InsigniaManage")]
|
||||||
public InsigniaManage InsigniaManage { get; set; }
|
public InsigniaManage InsigniaManage { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ namespace BMA.EHR.Domain.Models.Insignias
|
||||||
[Comment("Fk Table OrganizationOrganization Borrow")]
|
[Comment("Fk Table OrganizationOrganization Borrow")]
|
||||||
//public OrganizationOrganization? BorrowOrganization { get; set; }
|
//public OrganizationOrganization? BorrowOrganization { get; set; }
|
||||||
public Guid? BorrowOrganizationId { get; set; }
|
public Guid? BorrowOrganizationId { get; set; }
|
||||||
|
public string? BorrowOrganization { get; set; }
|
||||||
|
|
||||||
[Comment("คืนวันที่")]
|
[Comment("คืนวันที่")]
|
||||||
public DateTime? ReturnDate { get; set; }
|
public DateTime? ReturnDate { get; set; }
|
||||||
|
|
@ -25,6 +26,7 @@ namespace BMA.EHR.Domain.Models.Insignias
|
||||||
[Comment("Fk Table OrganizationOrganization Return")]
|
[Comment("Fk Table OrganizationOrganization Return")]
|
||||||
//public OrganizationOrganization? ReturnOrganization { get; set; }
|
//public OrganizationOrganization? ReturnOrganization { get; set; }
|
||||||
public Guid? ReturnOrganizationId { get; set; }
|
public Guid? ReturnOrganizationId { get; set; }
|
||||||
|
public string? ReturnOrganization { get; set; }
|
||||||
|
|
||||||
[Comment("เหตุผลคืน")]
|
[Comment("เหตุผลคืน")]
|
||||||
public string? ReturnReason { get; set; }
|
public string? ReturnReason { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,6 @@ namespace BMA.EHR.Domain.Models.Insignias
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public int Year { get; set; }
|
public int Year { get; set; }
|
||||||
// public DateTime StartDate { get; set; }
|
|
||||||
// public DateTime EndDate { get; set; }
|
|
||||||
// [MaxLength(50)]
|
|
||||||
// public int Amount { get; set; }
|
|
||||||
// public Document? ReliefDoc { get; set; }
|
|
||||||
// [Comment("ราบการยื่นขอ")]
|
|
||||||
// public int Round { get; set; } = 1;
|
|
||||||
public virtual List<InsigniaNoteProfile> InsigniaNoteProfiles { get; set; }
|
public virtual List<InsigniaNoteProfile> InsigniaNoteProfiles { get; set; }
|
||||||
public virtual List<InsigniaNoteDoc> InsigniaNoteDocs { get; set; }
|
public virtual List<InsigniaNoteDoc> InsigniaNoteDocs { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,5 +76,7 @@ namespace BMA.EHR.Domain.Models.Insignias
|
||||||
public string? PosNo { get; set; }
|
public string? PosNo { get; set; }
|
||||||
public double? Amount { get; set; }
|
public double? Amount { get; set; }
|
||||||
public double? PositionSalaryAmount { get; set; }
|
public double? PositionSalaryAmount { get; set; }
|
||||||
|
public Guid? RootId { get; set; }
|
||||||
|
public string? Root { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,8 @@ namespace BMA.EHR.Domain.Models.Insignias
|
||||||
public string? PosNo { get; set; }
|
public string? PosNo { get; set; }
|
||||||
public double? Amount { get; set; }
|
public double? Amount { get; set; }
|
||||||
public double? PositionSalaryAmount { get; set; }
|
public double? PositionSalaryAmount { get; set; }
|
||||||
|
|
||||||
public string? LastInsigniaName { get; set; }
|
public string? LastInsigniaName { get; set; }
|
||||||
|
public Guid? RootId { get; set; }
|
||||||
|
public string? Root { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
19178
BMA.EHR.Infrastructure/Migrations/20241118093933_update table insignia add rootid.Designer.cs
generated
Normal file
19178
BMA.EHR.Infrastructure/Migrations/20241118093933_update table insignia add rootid.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,97 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class updatetableinsigniaaddrootid : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Root",
|
||||||
|
table: "InsigniaRequestProfiles",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "RootId",
|
||||||
|
table: "InsigniaRequestProfiles",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Root",
|
||||||
|
table: "InsigniaNoteProfiles",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "RootId",
|
||||||
|
table: "InsigniaNoteProfiles",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "BorrowOrganization",
|
||||||
|
table: "InsigniaManageProfiles",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "ReturnOrganization",
|
||||||
|
table: "InsigniaManageProfiles",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Organization",
|
||||||
|
table: "InsigniaManageOrganiations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "รหัสหน่วยงาน")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Root",
|
||||||
|
table: "InsigniaRequestProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "RootId",
|
||||||
|
table: "InsigniaRequestProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Root",
|
||||||
|
table: "InsigniaNoteProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "RootId",
|
||||||
|
table: "InsigniaNoteProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "BorrowOrganization",
|
||||||
|
table: "InsigniaManageProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ReturnOrganization",
|
||||||
|
table: "InsigniaManageProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Organization",
|
||||||
|
table: "InsigniaManageOrganiations");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5763,6 +5763,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasColumnOrder(102)
|
.HasColumnOrder(102)
|
||||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("Organization")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("รหัสหน่วยงาน");
|
||||||
|
|
||||||
b.Property<Guid>("OrganizationId")
|
b.Property<Guid>("OrganizationId")
|
||||||
.HasColumnType("char(36)")
|
.HasColumnType("char(36)")
|
||||||
.HasComment("รหัสหน่วยงาน");
|
.HasComment("รหัสหน่วยงาน");
|
||||||
|
|
@ -5791,6 +5795,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasColumnType("datetime(6)")
|
.HasColumnType("datetime(6)")
|
||||||
.HasComment("ยืมวันที่");
|
.HasComment("ยืมวันที่");
|
||||||
|
|
||||||
|
b.Property<string>("BorrowOrganization")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<Guid?>("BorrowOrganizationId")
|
b.Property<Guid?>("BorrowOrganizationId")
|
||||||
.HasColumnType("char(36)")
|
.HasColumnType("char(36)")
|
||||||
.HasComment("Fk Table OrganizationOrganization Borrow");
|
.HasComment("Fk Table OrganizationOrganization Borrow");
|
||||||
|
|
@ -5843,6 +5850,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasColumnType("datetime(6)")
|
.HasColumnType("datetime(6)")
|
||||||
.HasComment("คืนวันที่");
|
.HasComment("คืนวันที่");
|
||||||
|
|
||||||
|
b.Property<string>("ReturnOrganization")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<Guid?>("ReturnOrganizationId")
|
b.Property<Guid?>("ReturnOrganizationId")
|
||||||
.HasColumnType("char(36)")
|
.HasColumnType("char(36)")
|
||||||
.HasComment("Fk Table OrganizationOrganization Return");
|
.HasComment("Fk Table OrganizationOrganization Return");
|
||||||
|
|
@ -6153,6 +6163,12 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Property<Guid>("RequestInsigniaId")
|
b.Property<Guid>("RequestInsigniaId")
|
||||||
.HasColumnType("char(36)");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("Root")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<Guid?>("RootId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<double?>("Salary")
|
b.Property<double?>("Salary")
|
||||||
.HasColumnType("double");
|
.HasColumnType("double");
|
||||||
|
|
||||||
|
|
@ -6497,6 +6513,12 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Property<Guid>("RequestInsigniaId")
|
b.Property<Guid>("RequestInsigniaId")
|
||||||
.HasColumnType("char(36)");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("Root")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<Guid?>("RootId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<double?>("Salary")
|
b.Property<double?>("Salary")
|
||||||
.HasColumnType("double");
|
.HasColumnType("double");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -283,7 +283,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
Id = p.Id,
|
Id = p.Id,
|
||||||
OrganizationOrganization = _userProfileRepository.GetOc(p.OrganizationId, 0, AccessToken) == null ? "" : _userProfileRepository.GetOc(p.OrganizationId, 0, AccessToken)!.Root,
|
OrganizationOrganization = p.Organization,
|
||||||
Total = p.Total,
|
Total = p.Total,
|
||||||
Allocate = p.InsigniaManageProfiles.Where(x => x.Status == false).Count(),
|
Allocate = p.InsigniaManageProfiles.Where(x => x.Status == false).Count(),
|
||||||
Remain = p.Total - p.InsigniaManageProfiles.Where(x => x.Status == false).Count(),
|
Remain = p.Total - p.InsigniaManageProfiles.Where(x => x.Status == false).Count(),
|
||||||
|
|
@ -312,36 +312,26 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
var organization = _userProfileRepository.GetOc(req.OrganizationOrganizationId, 0, AccessToken);
|
|
||||||
|
|
||||||
//var organization = await _context.Organizations.AsQueryable()
|
|
||||||
// .Include(x => x.OrganizationOrganization)
|
|
||||||
// .FirstOrDefaultAsync(x => x.Id == req.OrganizationOrganizationId);
|
|
||||||
if (organization == null)
|
|
||||||
return Error(GlobalMessages.OrganizationNotFound);
|
|
||||||
//if (organization.OrganizationOrganization == null)
|
|
||||||
// return Error(GlobalMessages.OrganizationNotFound);
|
|
||||||
|
|
||||||
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
||||||
.Include(x => x.InsigniaManageOrganiations)
|
.Include(x => x.InsigniaManageOrganiations)
|
||||||
//.ThenInclude(x => x.OrganizationOrganization)
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == req.insigniaManageId);
|
.FirstOrDefaultAsync(x => x.Id == req.insigniaManageId);
|
||||||
if (insigniaManage == null)
|
if (insigniaManage == null)
|
||||||
return Error(GlobalMessages.InsigniaManageNotFound);
|
return Error(GlobalMessages.InsigniaManageNotFound);
|
||||||
|
|
||||||
var insigniaManageOrganiation = await _context.InsigniaManageOrganiations.AsQueryable()
|
var insigniaManageOrganiation = await _context.InsigniaManageOrganiations.AsQueryable()
|
||||||
.FirstOrDefaultAsync(x => x.OrganizationId == organization.RootId && x.InsigniaManage == insigniaManage);
|
.FirstOrDefaultAsync(x => x.OrganizationId == req.OrganizationOrganizationId && x.InsigniaManage == insigniaManage);
|
||||||
if (insigniaManageOrganiation != null)
|
if (insigniaManageOrganiation != null)
|
||||||
return Error(GlobalMessages.InsigniaManageOrgDupicate);
|
return Error(GlobalMessages.InsigniaManageOrgDupicate);
|
||||||
|
|
||||||
var total = insigniaManage.InsigniaManageOrganiations.Where(x => x.OrganizationId != organization.RootId).Sum(x => x.Total);
|
var total = insigniaManage.InsigniaManageOrganiations.Where(x => x.OrganizationId != req.OrganizationOrganizationId).Sum(x => x.Total);
|
||||||
if (req.Total + total > insigniaManage.Total)
|
if (req.Total + total > insigniaManage.Total)
|
||||||
return Error(GlobalMessages.InsigniaManageOrgLimit);
|
return Error(GlobalMessages.InsigniaManageOrgLimit);
|
||||||
|
var root = _userProfileRepository.GetOc(req.OrganizationOrganizationId, 0, AccessToken)?.Root ?? null;
|
||||||
await _context.InsigniaManageOrganiations.AddAsync(
|
await _context.InsigniaManageOrganiations.AddAsync(
|
||||||
new InsigniaManageOrganiation
|
new InsigniaManageOrganiation
|
||||||
{
|
{
|
||||||
//OrganizationOrganization = organization.OrganizationOrganization,
|
OrganizationId = req.OrganizationOrganizationId,
|
||||||
OrganizationId = organization.RootId ?? Guid.Empty,
|
Organization = root,
|
||||||
Total = req.Total,
|
Total = req.Total,
|
||||||
InsigniaManage = insigniaManage,
|
InsigniaManage = insigniaManage,
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
|
@ -404,7 +394,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
var uppdated = await _context.InsigniaManageOrganiations.AsQueryable()
|
var uppdated = await _context.InsigniaManageOrganiations.AsQueryable()
|
||||||
//.Include(x => x.OrganizationOrganization)
|
|
||||||
.Include(x => x.InsigniaManage)
|
.Include(x => x.InsigniaManage)
|
||||||
.FirstOrDefaultAsync(x => x.Id == insigniaManageOrgId);
|
.FirstOrDefaultAsync(x => x.Id == insigniaManageOrgId);
|
||||||
if (uppdated == null)
|
if (uppdated == null)
|
||||||
|
|
@ -412,7 +401,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
|
|
||||||
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
||||||
.Include(x => x.InsigniaManageOrganiations)
|
.Include(x => x.InsigniaManageOrganiations)
|
||||||
//.ThenInclude(x => x.OrganizationOrganization)
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == uppdated.InsigniaManage.Id);
|
.FirstOrDefaultAsync(x => x.Id == uppdated.InsigniaManage.Id);
|
||||||
if (insigniaManage == null)
|
if (insigniaManage == null)
|
||||||
return Error(GlobalMessages.InsigniaManageNotFound);
|
return Error(GlobalMessages.InsigniaManageNotFound);
|
||||||
|
|
@ -496,26 +484,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
if (insigniaNoteProfile.Status != "DONE")
|
if (insigniaNoteProfile.Status != "DONE")
|
||||||
return Error(GlobalMessages.InsigniaNoBorrow);
|
return Error(GlobalMessages.InsigniaNoBorrow);
|
||||||
|
|
||||||
var userProfile = _userProfileRepository.GetOfficerProfileById(insigniaNoteProfile.ProfileId.Value, AccessToken);
|
|
||||||
|
|
||||||
//var _organization = await _context.Organizations.AsQueryable()
|
|
||||||
// .FirstOrDefaultAsync(x => x.Id == insigniaNoteProfile.Profile.OcId);
|
|
||||||
|
|
||||||
//TODO : Hardcode OCId ต้องแก้ให้ดึงมาจากคน Login
|
|
||||||
var user_oc = _userProfileRepository.GetUserOCId(userProfile.Keycloak.Value, AccessToken);
|
|
||||||
if (req.BorrowOrganizationId == null) req.BorrowOrganizationId = user_oc;
|
|
||||||
//if (req.BorrowOrganizationId == null) req.BorrowOrganizationId = Guid.Parse("e8493cd1-d371-402e-add6-566e68d5d1b3");
|
|
||||||
|
|
||||||
var organization = _userProfileRepository.GetOc(req.BorrowOrganizationId.Value, 0, AccessToken);
|
|
||||||
//if (organization == null)
|
|
||||||
// return Error(GlobalMessages.OrganizationNotFound);
|
|
||||||
|
|
||||||
//var organization = await _context.Organizations.AsQueryable()
|
|
||||||
// .Include(x => x.OrganizationOrganization)
|
|
||||||
// .FirstOrDefaultAsync(x => x.Id == _organization.OrganizationAgencyId);
|
|
||||||
//if (organization == null)
|
|
||||||
// return Error(GlobalMessages.OrganizationNotFound);
|
|
||||||
|
|
||||||
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
||||||
.FirstOrDefaultAsync(x => x.Year == insigniaNoteProfile.InsigniaNote.Year && x.Insignia == insigniaNoteProfile.RequestInsignia);
|
.FirstOrDefaultAsync(x => x.Year == insigniaNoteProfile.InsigniaNote.Year && x.Insignia == insigniaNoteProfile.RequestInsignia);
|
||||||
if (insigniaManage == null)
|
if (insigniaManage == null)
|
||||||
|
|
@ -523,7 +491,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
|
|
||||||
var insigniaManageOrganiation = await _context.InsigniaManageOrganiations.AsQueryable()
|
var insigniaManageOrganiation = await _context.InsigniaManageOrganiations.AsQueryable()
|
||||||
.Include(x => x.InsigniaManageProfiles)
|
.Include(x => x.InsigniaManageProfiles)
|
||||||
.FirstOrDefaultAsync(x => x.OrganizationId == organization.RootId && x.InsigniaManage == insigniaManage);
|
.FirstOrDefaultAsync(x => x.OrganizationId == insigniaNoteProfile.RootId && x.InsigniaManage == insigniaManage);
|
||||||
if (insigniaManageOrganiation == null)
|
if (insigniaManageOrganiation == null)
|
||||||
return Error(GlobalMessages.InsigniaManageOrgNotFound);
|
return Error(GlobalMessages.InsigniaManageOrgNotFound);
|
||||||
|
|
||||||
|
|
@ -540,7 +508,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
{
|
{
|
||||||
Status = false,
|
Status = false,
|
||||||
InsigniaManageOrganiation = insigniaManageOrganiation,
|
InsigniaManageOrganiation = insigniaManageOrganiation,
|
||||||
BorrowOrganizationId = organization.RootId,
|
BorrowOrganizationId = insigniaNoteProfile.RootId,
|
||||||
|
BorrowOrganization = insigniaNoteProfile.Root,
|
||||||
BorrowDate = req.BorrowDate,
|
BorrowDate = req.BorrowDate,
|
||||||
InsigniaNoteProfile = insigniaNoteProfile,
|
InsigniaNoteProfile = insigniaNoteProfile,
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
|
@ -575,26 +544,14 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
var uppdated = await _context.InsigniaManageProfiles.AsQueryable()
|
var uppdated = await _context.InsigniaManageProfiles.AsQueryable()
|
||||||
//.Include(x => x.BorrowOrganization)
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == insigniaManageProfileId);
|
.FirstOrDefaultAsync(x => x.Id == insigniaManageProfileId);
|
||||||
if (uppdated == null)
|
if (uppdated == null)
|
||||||
return Error(GlobalMessages.InsigniaManageNotFound);
|
return Error(GlobalMessages.InsigniaManageNotFound);
|
||||||
|
|
||||||
uppdated.Status = true;
|
uppdated.Status = true;
|
||||||
uppdated.ReturnDate = req.ReturnDate;
|
uppdated.ReturnDate = req.ReturnDate;
|
||||||
// if (req.ReturnOrganizationId == Guid.Parse("00000000-0000-0000-0000-000000000000"))
|
|
||||||
// {
|
|
||||||
uppdated.ReturnOrganizationId = uppdated.BorrowOrganizationId;
|
uppdated.ReturnOrganizationId = uppdated.BorrowOrganizationId;
|
||||||
// }
|
uppdated.ReturnOrganization = uppdated.BorrowOrganization;
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// var organization = await _context.Organizations.AsQueryable()
|
|
||||||
// .Include(x => x.OrganizationOrganization)
|
|
||||||
// .FirstOrDefaultAsync(x => x.Id == req.ReturnOrganizationId);
|
|
||||||
// if (organization == null)
|
|
||||||
// return Error(GlobalMessages.OrganizationNotFound);
|
|
||||||
// uppdated.ReturnOrganization = organization.OrganizationOrganization;
|
|
||||||
// }
|
|
||||||
uppdated.ReturnReason = req.ReturnReason;
|
uppdated.ReturnReason = req.ReturnReason;
|
||||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
uppdated.LastUpdateUserId = UserId ?? "";
|
uppdated.LastUpdateUserId = UserId ?? "";
|
||||||
|
|
@ -637,9 +594,17 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
Id = p.Id,
|
Id = p.Id,
|
||||||
BorrowOrganization = p.BorrowOrganizationId == null ? null : _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken),
|
BorrowOrganization = p.BorrowOrganization,
|
||||||
ReturnOrganization = p.ReturnOrganizationId == null ? null : _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken),
|
BorrowOrganizationId = p.BorrowOrganizationId,
|
||||||
Profile = p.InsigniaNoteProfile.ProfileId == null ? null : _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken),
|
ReturnOrganization = p.ReturnOrganization,
|
||||||
|
ReturnOrganizationId = p.ReturnOrganizationId,
|
||||||
|
Profile = p.InsigniaNoteProfile!.ProfileId ?? Guid.Empty,
|
||||||
|
CitizenId = p.InsigniaNoteProfile!.CitizenId ?? string.Empty,
|
||||||
|
Prefix = p.InsigniaNoteProfile!.Prefix ?? string.Empty,
|
||||||
|
FirstName = p.InsigniaNoteProfile!.FirstName ?? string.Empty,
|
||||||
|
LastName = p.InsigniaNoteProfile!.LastName ?? string.Empty,
|
||||||
|
ProfileType = p.InsigniaNoteProfile!.ProfileType ?? string.Empty,
|
||||||
|
Position = p.InsigniaNoteProfile!.Position ?? string.Empty,
|
||||||
|
|
||||||
Status = p.Status,
|
Status = p.Status,
|
||||||
BorrowDate = p.BorrowDate,
|
BorrowDate = p.BorrowDate,
|
||||||
|
|
@ -675,21 +640,21 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
{
|
{
|
||||||
p.Id,
|
p.Id,
|
||||||
p.Status,
|
p.Status,
|
||||||
BorrowOrganization = p.BorrowOrganization == null ? "" : p.BorrowOrganization.Root,
|
BorrowOrganization = p.BorrowOrganization,
|
||||||
BorrowOrganizationId = p.BorrowOrganization == null ? Guid.Empty : p.BorrowOrganization.RootId,
|
BorrowOrganizationId = p.BorrowOrganizationId,
|
||||||
p.BorrowDate,
|
p.BorrowDate,
|
||||||
p.ReturnDate,
|
p.ReturnDate,
|
||||||
ReturnOrganization = p.ReturnOrganization == null ? "" : p.ReturnOrganization.Root,
|
ReturnOrganization = p.ReturnOrganization,
|
||||||
ReturnOrganizationId = p.ReturnOrganization == null ? Guid.Empty : p.ReturnOrganization.RootId,
|
ReturnOrganizationId = p.ReturnOrganizationId,
|
||||||
p.ReturnReason,
|
p.ReturnReason,
|
||||||
p.LastUpdatedAt,
|
p.LastUpdatedAt,
|
||||||
p.CreatedAt,
|
p.CreatedAt,
|
||||||
p.InsigniaNoteProfileId,
|
p.InsigniaNoteProfileId,
|
||||||
CitizenId = p.Profile == null ? "" : p.Profile.CitizenId,
|
CitizenId = p.CitizenId,
|
||||||
Prefix = p.Profile == null ? "" : p.Profile.Prefix,
|
Prefix = p.Prefix,
|
||||||
Position = p.Profile == null ? "" : p.Profile.Position,
|
Position = p.Position,
|
||||||
FullName = p.Profile == null ? "" : $"{p.Profile.Prefix}{p.Profile.FirstName} {p.Profile.LastName}",
|
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
||||||
ProfileType = p.Profile == null ? "" : p.Profile.ProfileType,
|
ProfileType = p.ProfileType,
|
||||||
p.RequestInsignia,
|
p.RequestInsignia,
|
||||||
p.RequestInsigniaId,
|
p.RequestInsigniaId,
|
||||||
p.RequestInsigniaShortName,
|
p.RequestInsigniaShortName,
|
||||||
|
|
@ -712,51 +677,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
//var data = await _context.InsigniaManageProfiles.AsQueryable()
|
|
||||||
// .Where(x => x.InsigniaNoteProfile.RequestInsignia.InsigniaType == insigniaType)
|
|
||||||
// .Where(x => year == 0 ? x.Id != null : x.InsigniaManageOrganiation.InsigniaManage.Year == year)
|
|
||||||
// .OrderByDescending(x => x.CreatedAt)
|
|
||||||
// .Select(p => new
|
|
||||||
// {
|
|
||||||
// Id = p.Id,
|
|
||||||
// Status = p.Status,
|
|
||||||
// BorrowOrganization = _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken) == null ? null : _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken).Root,
|
|
||||||
// BorrowOrganizationId = _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken) == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken).RootId,
|
|
||||||
// BorrowDate = p.BorrowDate,
|
|
||||||
// ReturnDate = p.ReturnDate,
|
|
||||||
// ReturnOrganization = _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken) == null ? null : _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken).Root,
|
|
||||||
// ReturnOrganizationId = _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken) == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken).RootId,
|
|
||||||
// ReturnReason = p.ReturnReason,
|
|
||||||
// LastUpdatedAt = p.LastUpdatedAt,
|
|
||||||
// CreatedAt = p.CreatedAt,
|
|
||||||
|
|
||||||
// InsigniaNoteProfileId = p.InsigniaNoteProfile.Id,
|
|
||||||
// Prefix = _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).Prefix,
|
|
||||||
// Position = _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).Position,
|
|
||||||
// _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).CitizenId,
|
|
||||||
// _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).ProfileType,
|
|
||||||
// FullName = $"{_userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).Prefix}{_userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).FirstName} {_userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).LastName}",
|
|
||||||
// RequestInsignia = p.InsigniaNoteProfile.RequestInsignia == null ? null : p.InsigniaNoteProfile.RequestInsignia.Name,
|
|
||||||
// RequestInsigniaId = p.InsigniaNoteProfile.RequestInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.InsigniaNoteProfile.RequestInsignia.Id,
|
|
||||||
// RequestInsigniaShortName = p.InsigniaNoteProfile.RequestInsignia == null ? null : p.InsigniaNoteProfile.RequestInsignia.ShortName,
|
|
||||||
// p.InsigniaNoteProfile.DateReceive,
|
|
||||||
// p.InsigniaNoteProfile.OrganizationOrganizationSend,
|
|
||||||
// p.InsigniaNoteProfile.OrganizationOrganizationReceive,
|
|
||||||
// InsigniaNoteProfileStatus = p.InsigniaNoteProfile.Status,
|
|
||||||
// p.InsigniaNoteProfile.Issue,
|
|
||||||
// p.InsigniaNoteProfile.Date,
|
|
||||||
// p.InsigniaNoteProfile.VolumeNo,
|
|
||||||
// p.InsigniaNoteProfile.Section,
|
|
||||||
// p.InsigniaNoteProfile.Page,
|
|
||||||
// p.InsigniaNoteProfile.No,
|
|
||||||
// p.InsigniaNoteProfile.DatePayment,
|
|
||||||
// p.InsigniaNoteProfile.TypePayment,
|
|
||||||
// p.InsigniaNoteProfile.Address,
|
|
||||||
// p.InsigniaNoteProfile.Number,
|
|
||||||
// p.InsigniaNoteProfile.Salary,
|
|
||||||
// })
|
|
||||||
// .ToListAsync();
|
|
||||||
|
|
||||||
return Success(data);
|
return Success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -778,12 +698,12 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
{
|
{
|
||||||
Id = p.Id,
|
Id = p.Id,
|
||||||
Status = p.Status,
|
Status = p.Status,
|
||||||
BorrowOrganization = _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken) == null ? null : _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken).Root,
|
BorrowOrganization = p.BorrowOrganization,
|
||||||
BorrowOrganizationId = _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken) == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken).RootId,
|
BorrowOrganizationId = p.BorrowOrganizationId,
|
||||||
BorrowDate = p.BorrowDate,
|
BorrowDate = p.BorrowDate,
|
||||||
ReturnDate = p.ReturnDate,
|
ReturnDate = p.ReturnDate,
|
||||||
ReturnOrganization = _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken) == null ? null : _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken).Root,
|
ReturnOrganization = p.ReturnOrganization,
|
||||||
ReturnOrganizationId = _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken) == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken).RootId,
|
ReturnOrganizationId = p.ReturnOrganizationId,
|
||||||
ReturnReason = p.ReturnReason,
|
ReturnReason = p.ReturnReason,
|
||||||
LastUpdatedAt = p.LastUpdatedAt,
|
LastUpdatedAt = p.LastUpdatedAt,
|
||||||
CreatedAt = p.CreatedAt,
|
CreatedAt = p.CreatedAt,
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
var insigniaPeriods = await _context.InsigniaPeriods.AsQueryable()
|
var insigniaPeriods = await _context.InsigniaPeriods.AsQueryable()
|
||||||
// .Where(x => x.Type == type)
|
|
||||||
.OrderByDescending(x => x.Year)
|
.OrderByDescending(x => x.Year)
|
||||||
.ThenByDescending(x => x.StartDate)
|
.ThenByDescending(x => x.StartDate)
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
|
|
@ -234,7 +233,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
|
||||||
RevisionId = revisionId ?? Guid.Empty
|
RevisionId = revisionId ?? Guid.Empty
|
||||||
};
|
};
|
||||||
await _context.InsigniaPeriods.AddAsync(period);
|
await _context.InsigniaPeriods.AddAsync(period);
|
||||||
|
|
@ -248,7 +246,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
period.ReliefDoc = doc;
|
period.ReliefDoc = doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// await _context.InsigniaPeriods.AddAsync(period);
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
|
|
|
||||||
|
|
@ -57,87 +57,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// var request = _context.InsigniaRequestProfiles
|
|
||||||
// .Include(x => x.Request)
|
|
||||||
// .ThenInclude(x => x.Period)
|
|
||||||
// .Include(x => x.RequestInsignia)
|
|
||||||
// .ThenInclude(x => x.InsigniaType)
|
|
||||||
// .Include(x => x.Profile)
|
|
||||||
// .ThenInclude(x => x.AcademicStanding)
|
|
||||||
// .Include(x => x.Profile)
|
|
||||||
// .ThenInclude(x => x.Position)
|
|
||||||
// .Include(x => x.Profile)
|
|
||||||
// .ThenInclude(x => x.Insignias)
|
|
||||||
// .ThenInclude(x => x.Insignia)
|
|
||||||
// .ThenInclude(x => x.InsigniaType)
|
|
||||||
// .Include(x => x.Profile)
|
|
||||||
// .ThenInclude(x => x.PositionNumber)
|
|
||||||
// .Where(x => x.Request.Period.Id == result.PeriodId)
|
|
||||||
// .Where(x => x.Request.RequestStatus == "st5p")
|
|
||||||
// .Where(x => x.IsApprove)
|
|
||||||
// .Select(p => new
|
|
||||||
// {
|
|
||||||
// Profile = p.Profile.Id,
|
|
||||||
// Name = $"{p.Profile.Prefix} {p.Profile.FirstName} {p.Profile.LastName}",
|
|
||||||
// Insignia = p.RequestInsignia,
|
|
||||||
// Type = p.RequestInsignia.InsigniaType,
|
|
||||||
// IsApprove = p.IsApprove,
|
|
||||||
// InsigniaId = p.RequestInsignia.Id,
|
|
||||||
// Year = p.Request.Period.Year,
|
|
||||||
// Special = p.Special,
|
|
||||||
// LastInsignia = p.Profile.Insignias.AsQueryable()
|
|
||||||
// .Include(x => x.Insignia)
|
|
||||||
// .Where(x => x.Insignia.Id == p.RequestInsignia.Id)
|
|
||||||
// .Where(x => x.Year == p.Request.Period.Year)
|
|
||||||
// .FirstOrDefault()
|
|
||||||
// })
|
|
||||||
// .ToList()
|
|
||||||
// .Select(r => new InsigniaReceiveResponse
|
|
||||||
// {
|
|
||||||
// Profile = r.Profile,
|
|
||||||
// Name = r.Name,
|
|
||||||
// Insignia = r.Insignia.Name,
|
|
||||||
// TypeId = r.Type == null ? null : r.Type.Id,
|
|
||||||
// TypeName = r.Type == null ? "" : r.Type.Description,
|
|
||||||
// IsApprove = r.IsApprove,
|
|
||||||
// InsigniaId = r.InsigniaId,
|
|
||||||
// InsigniaPage = r.LastInsignia == null ? "" : r.LastInsignia.Page,
|
|
||||||
// InsigniaNo = r.LastInsignia == null ? "" : r.LastInsignia.No,
|
|
||||||
// InsigniaIssue = r.LastInsignia == null ? "" : r.LastInsignia.Issue,
|
|
||||||
// InsigniaVolumeno = r.LastInsignia == null ? "" : r.LastInsignia.VolumeNo,
|
|
||||||
// InsigniaVolume = r.LastInsignia == null ? "" : r.LastInsignia.Volume,
|
|
||||||
// InsigniaSection = r.LastInsignia == null ? "" : r.LastInsignia.Section,
|
|
||||||
// InsigniaDatereceive = r.LastInsignia == null ? null : r.LastInsignia.DateReceive,
|
|
||||||
// InsigniaDateannounce = r.LastInsignia == null ? null : r.LastInsignia.DateAnnounce,
|
|
||||||
// Special = r.Special
|
|
||||||
// })
|
|
||||||
// .ToList()
|
|
||||||
// .GroupBy(r => new { r.TypeId, r.TypeName })
|
|
||||||
// .Select(r => new
|
|
||||||
// {
|
|
||||||
// TypeId = r.Key.TypeId,
|
|
||||||
// InsigniaIssue = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaIssue : "",
|
|
||||||
// InsigniaVolumeno = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaVolumeno : null,
|
|
||||||
// InsigniaVolume = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaVolume : "",
|
|
||||||
// InsigniaSection = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaSection : "",
|
|
||||||
// InsigniaDatereceive = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaDatereceive : null,
|
|
||||||
// InsigniaDateannounce = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaDateannounce : null,
|
|
||||||
// TypeName = r.Key.TypeName,
|
|
||||||
// Profile = r.Select(r => new
|
|
||||||
// {
|
|
||||||
// Profile = r.Profile,
|
|
||||||
// Name = r.Name,
|
|
||||||
// Insignia = r.Insignia,
|
|
||||||
// InsigniaId = r.InsigniaId,
|
|
||||||
// InsigniaPage = r.InsigniaPage,
|
|
||||||
// InsigniaNo = r.InsigniaNo,
|
|
||||||
// //Special = bool.Parse(r.Special)
|
|
||||||
// }).ToList(),
|
|
||||||
// Docs = new List<dynamic>()
|
|
||||||
// });
|
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
// return Success(request);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -179,68 +99,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
|
|
||||||
}, AccessToken);
|
}, AccessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// foreach (var i in items.Profile)
|
|
||||||
// {
|
|
||||||
// var profile = _context.Profiles.AsQueryable()
|
|
||||||
// .Include(x => x.Insignias)
|
|
||||||
// .ThenInclude(x => x.Insignia)
|
|
||||||
// .Where(x => x.Id == i.FkProfileId)
|
|
||||||
// .FirstOrDefault();
|
|
||||||
// if (profile != null)
|
|
||||||
// {
|
|
||||||
// var kp7 = profile.Insignias.AsQueryable()
|
|
||||||
// .Where(x => x.Insignia.Id == i.Kp7InsigniaId)
|
|
||||||
// .FirstOrDefault();
|
|
||||||
|
|
||||||
// if (kp7 != null)
|
|
||||||
// {
|
|
||||||
// // exit item update to database
|
|
||||||
// kp7.DateReceive = items.InsigniaDatereceive.Value;
|
|
||||||
// kp7.Level = items.InsigniaLevel;
|
|
||||||
// kp7.Issue = items.InsigniaIssue;
|
|
||||||
// kp7.VolumeNo = items.InsigniaVolumeno.Value.ToString();
|
|
||||||
// kp7.Volume = items.InsigniaVolume;
|
|
||||||
// kp7.Section = items.InsigniaSection;
|
|
||||||
// kp7.DateAnnounce = items.InsigniaDateannounce.Value;
|
|
||||||
// kp7.Page = i.InsigniaPage;
|
|
||||||
// kp7.No = i.InsigniaNo;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// // insert new item to kp7
|
|
||||||
// var insignia_item = _context.Insignias.FirstOrDefault(x => x.Id == i.Kp7InsigniaId);
|
|
||||||
// var result = _repository.GetInsigniaRequest(type, items.OCId);
|
|
||||||
|
|
||||||
// var period = _context.InsigniaPeriods.FirstOrDefault(x => x.Id == result.PeriodId);
|
|
||||||
|
|
||||||
// kp7 = new Models.HR.ProfileInsignia
|
|
||||||
// {
|
|
||||||
// Order = profile.Insignias.ToList().Count + 1,
|
|
||||||
// Year = period.Year,
|
|
||||||
// Insignia = insignia_item,
|
|
||||||
// DateReceive = items.InsigniaDatereceive.Value,
|
|
||||||
// DateStamp = DateTime.Now,
|
|
||||||
// Level = items.InsigniaLevel,
|
|
||||||
// Issue = items.InsigniaIssue,
|
|
||||||
// VolumeNo = items.InsigniaVolumeno.Value.ToString(),
|
|
||||||
// Volume = items.InsigniaVolume,
|
|
||||||
// Section = items.InsigniaSection,
|
|
||||||
// DateAnnounce = items.InsigniaDateannounce.Value,
|
|
||||||
// Page = i.InsigniaPage,
|
|
||||||
// No = i.InsigniaNo,
|
|
||||||
// };
|
|
||||||
// profile.Insignias.Add(kp7);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// return NotFound("Profile not found!!!");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
//_context.SaveChanges();
|
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -9,7 +9,6 @@ namespace BMA.EHR.Insignia.Service.Requests
|
||||||
public Guid insigniaId { get; set; }
|
public Guid insigniaId { get; set; }
|
||||||
public Guid insigniaPeriodId { get; set; }
|
public Guid insigniaPeriodId { get; set; }
|
||||||
public string? Reason { get; set; }
|
public string? Reason { get; set; }
|
||||||
|
|
||||||
public Guid OcId { get; set; }
|
public Guid OcId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -850,7 +850,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
no = count,
|
no = count,
|
||||||
fullName = $"{p.Prefix}{p.FirstName} {p.LastName}",// _userProfileRepository.GetUserFullName(p.Keycloak ?? Guid.Empty, AccessToken),
|
fullName = $"{p.Prefix}{p.FirstName} {p.LastName}",// _userProfileRepository.GetUserFullName(p.Keycloak ?? Guid.Empty, AccessToken),
|
||||||
position = p.Position == null ? "" : p.Position,
|
position = p.Position == null ? "" : p.Position,
|
||||||
//positionLevel = p.PosLevel == null ? "" : p.PosLevel.PosLevelName,
|
//positionLevel = p.PosLevel == null ? "" : p.PosLevel,
|
||||||
//posNo = p.ProfileSalary == null ? "" : p.ProfileSalary.PosNo,
|
//posNo = p.ProfileSalary == null ? "" : p.ProfileSalary.PosNo,
|
||||||
positionLevel = p.PositionLevel == null ? "" : p.PositionLevel,
|
positionLevel = p.PositionLevel == null ? "" : p.PositionLevel,
|
||||||
posNo = p.PosNo == null ? "" : p.PosNo,
|
posNo = p.PosNo == null ? "" : p.PosNo,
|
||||||
|
|
@ -1084,7 +1084,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
{
|
{
|
||||||
//var profile = await _userProfileRepository.SearchProfile(null, null, null);
|
//var profile = await _userProfileRepository.SearchProfile(null, null, null);
|
||||||
var profile = await _userProfileRepository.GetProfileWithKeycloak(AccessToken);
|
var profile = await _userProfileRepository.GetProfileWithKeycloak(AccessToken);
|
||||||
if(profile.Count > 0)
|
if (profile.Count > 0)
|
||||||
{
|
{
|
||||||
profile = profile.Where(p => p.IsLeave == false).ToList();
|
profile = profile.Where(p => p.IsLeave == false).ToList();
|
||||||
}
|
}
|
||||||
|
|
@ -1232,7 +1232,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
workTotal += 1;
|
workTotal += 1;
|
||||||
if (!timeStamps.IsLocationCheckIn)
|
if (!timeStamps.IsLocationCheckIn)
|
||||||
{
|
{
|
||||||
if(timeStamps.CheckInLocationName == "ปฏิบัติงานที่บ้าน")
|
if (timeStamps.CheckInLocationName == "ปฏิบัติงานที่บ้าน")
|
||||||
wfhTotal += 1;
|
wfhTotal += 1;
|
||||||
else if (timeStamps.CheckInLocationName == "ไปประชุม/อบรม/สัมมนา/ปฏิบัติงานที่บ้านนอกสถานที่")
|
else if (timeStamps.CheckInLocationName == "ไปประชุม/อบรม/สัมมนา/ปฏิบัติงานที่บ้านนอกสถานที่")
|
||||||
seminarTotal += 1;
|
seminarTotal += 1;
|
||||||
|
|
|
||||||
|
|
@ -348,7 +348,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
leaveRequest.LeaveTypeCode = leaveType.Code;
|
leaveRequest.LeaveTypeCode = leaveType.Code;
|
||||||
leaveRequest.Dear = approver;
|
leaveRequest.Dear = approver;
|
||||||
leaveRequest.PositionName = profile.Position == null ? "" : profile.Position;
|
leaveRequest.PositionName = profile.Position == null ? "" : profile.Position;
|
||||||
leaveRequest.PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel.PosLevelName;
|
leaveRequest.PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel;
|
||||||
leaveRequest.OrganizationName = userOc;
|
leaveRequest.OrganizationName = userOc;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -376,7 +376,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
leave.CitizenId = profile.CitizenId;
|
leave.CitizenId = profile.CitizenId;
|
||||||
|
|
||||||
leave.PositionName = profile.Position == null ? "" : profile.Position;
|
leave.PositionName = profile.Position == null ? "" : profile.Position;
|
||||||
leave.PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel.PosLevelName;
|
leave.PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel;
|
||||||
leave.OrganizationName = profile.Root ?? "";
|
leave.OrganizationName = profile.Root ?? "";
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -628,7 +628,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
oldData.LeaveTypeCode = leaveType.Code;
|
oldData.LeaveTypeCode = leaveType.Code;
|
||||||
oldData.Dear = approver;
|
oldData.Dear = approver;
|
||||||
oldData.PositionName = profile.Position == null ? "" : profile.Position;
|
oldData.PositionName = profile.Position == null ? "" : profile.Position;
|
||||||
oldData.PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel.PosLevelName;
|
oldData.PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel;
|
||||||
oldData.OrganizationName = profile.Oc ?? "";
|
oldData.OrganizationName = profile.Oc ?? "";
|
||||||
|
|
||||||
_context.Entry(oldData.Type).State = Microsoft.EntityFrameworkCore.EntityState.Detached;
|
_context.Entry(oldData.Type).State = Microsoft.EntityFrameworkCore.EntityState.Detached;
|
||||||
|
|
@ -729,7 +729,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
|
|
||||||
Dear = profile.Commander ?? "",
|
Dear = profile.Commander ?? "",
|
||||||
PositionName = profile.Position == null ? "" : profile.Position,
|
PositionName = profile.Position == null ? "" : profile.Position,
|
||||||
PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel.PosLevelName,
|
PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel,
|
||||||
OrganizationName = profile.Root ?? "", //profile.Oc ?? "",
|
OrganizationName = profile.Root ?? "", //profile.Oc ?? "",
|
||||||
|
|
||||||
LeaveLimit = leaveType.Limit,
|
LeaveLimit = leaveType.Limit,
|
||||||
|
|
@ -1574,8 +1574,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
{
|
{
|
||||||
refId = id,
|
refId = id,
|
||||||
sysName = "SYS_LEAVE_LIST",
|
sysName = "SYS_LEAVE_LIST",
|
||||||
posLevelName = profile.PosLevel?.PosLevelName ?? "",
|
posLevelName = profile.PosLevel ?? "",
|
||||||
posTypeName = profile.PosType?.PosTypeName ?? "",
|
posTypeName = profile.PosType ?? "",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue