แก้สมัครสอบ

This commit is contained in:
kittapath 2025-01-05 21:59:15 +07:00
parent afc0cd830c
commit 07903d3b67
30 changed files with 3471 additions and 771 deletions

View file

@ -185,32 +185,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
throw; throw;
} }
} }
private List<Guid?> GetAllIdByRoot(Guid id)
{
try
{
var ret = new List<Guid?>();
var oc = _contextMetadata.Organizations.FirstOrDefault(x => x.Id == id && x.IsActive);
if (oc != null)
ret.Add(oc.Id);
var child = _contextMetadata.Organizations.AsQueryable().Where(x => x.ParentId == id && x.IsActive).ToList();
if (child.Any())
{
foreach (var item in child)
{
ret.AddRange(GetAllIdByRoot(item.Id));
}
}
return ret;
}
catch
{
throw;
}
}
#endregion #endregion
@ -717,45 +691,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
x.CreatedUserId, x.CreatedUserId,
}) })
.ToListAsync(); .ToListAsync();
var profileOrganizations = await _contextMetadata.ProfileOrganizations.AsQueryable()
.ToListAsync();
var _periodExams = (from x in data
join po in profileOrganizations on Guid.Parse(x.CreatedUserId) equals po?.UserId into poGroup
from po in poGroup.DefaultIfEmpty()
select new
{
x.Id,
x.Year,
x.Name,
x.Round,
x.ImportDate,
x.ExamCount,
x.Score,
x.CreatedUserId,
OcId = po == null ? null : po.OrganizationId,
}).AsQueryable()
.ToList();
var roles = _httpContextAccessor?.HttpContext?.User?.FindAll(ClaimTypes.Role)?.Select(c => c.Value).ToList(); var roles = _httpContextAccessor?.HttpContext?.User?.FindAll(ClaimTypes.Role)?.Select(c => c.Value).ToList();
// if (!roles.Contains("head"))
// {
// var criteria = new List<Guid?>();
// var profileOrganization = await _contextMetadata.ProfileOrganizations.AsQueryable()
// .FirstOrDefaultAsync(x => x.UserId == Guid.Parse(UserId));
// if (profileOrganization == null) return Success(data);
// return Success(new List<dynamic>());
// var ocId = _contextMetadata.Organizations.AsQueryable()
// .FirstOrDefault(x => x.Id == profileOrganization.OrganizationId);
// if (ocId == null)
// return Success(new List<dynamic>());
// criteria = GetAllIdByRoot(ocId.Id);
// if (criteria.Any())
// _periodExams = _periodExams.Where(x => x.CreatedUserId == UserId || criteria.Contains(x.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OcId)).ToList();
// }
return Success(_periodExams);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -867,6 +806,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
r.CitizenCardExpireDate = Convert.ToDateTime(workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PersonalCardExpireDate)]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-")); r.CitizenCardExpireDate = Convert.ToDateTime(workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PersonalCardExpireDate)]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"));
r.ApplyDate = (DateTime)workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ApplyDate)]?.GetValue<DateTime>(); r.ApplyDate = (DateTime)workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ApplyDate)]?.GetValue<DateTime>();
r.PositionName = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PositionName)]?.GetValue<string>().IsNull(""); r.PositionName = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PositionName)]?.GetValue<string>().IsNull("");
r.PositionType = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PositionType)]?.GetValue<string>().IsNull("");
r.PositionLevel = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PositionLevel)]?.GetValue<string>().IsNull("");
// address // address
@ -1229,6 +1170,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
r.CitizenCardExpireDate = Convert.ToDateTime(workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PersonalCardExpireDate)]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-")); r.CitizenCardExpireDate = Convert.ToDateTime(workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PersonalCardExpireDate)]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"));
r.ApplyDate = (DateTime)workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ApplyDate)]?.GetValue<DateTime>(); r.ApplyDate = (DateTime)workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ApplyDate)]?.GetValue<DateTime>();
r.PositionName = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PositionName)]?.GetValue<string>().IsNull(""); r.PositionName = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PositionName)]?.GetValue<string>().IsNull("");
r.PositionType = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PositionType)]?.GetValue<string>().IsNull("");
r.PositionLevel = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PositionLevel)]?.GetValue<string>().IsNull("");
// address // address
r.Addresses.Add(new DisableAddress() r.Addresses.Add(new DisableAddress()
@ -1626,6 +1569,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
applyDate = dr["applydate"] == null ? "" : Convert.ToDateTime(dr["applydate"]).ToThaiShortDate(), applyDate = dr["applydate"] == null ? "" : Convert.ToDateTime(dr["applydate"]).ToThaiShortDate(),
university = dr["university"].ToString(), university = dr["university"].ToString(),
position_name = dr["position_name"].ToString(), position_name = dr["position_name"].ToString(),
position_level = dr["position_level"].ToString(),
position_type = dr["position_type"].ToString(),
exam_name = dr["exam_name"].ToString(), exam_name = dr["exam_name"].ToString(),
exam_order = dr["exam_order"].ToString(), exam_order = dr["exam_order"].ToString(),
score_year = Convert.ToInt32(dr["score_year"]).ToThaiYear().ToString(), score_year = Convert.ToInt32(dr["score_year"]).ToThaiYear().ToString(),
@ -1722,6 +1667,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
Remark = p.Remark, Remark = p.Remark,
University = p.Educations.First().University, University = p.Educations.First().University,
PositionName = p.PositionName, PositionName = p.PositionName,
PositionType = p.PositionType,
PositionLevel = p.PositionLevel,
ExamName = p.PeriodExam.Name, ExamName = p.PeriodExam.Name,
ExamOrder = p.PeriodExam.Round, ExamOrder = p.PeriodExam.Round,
ExamYear = p.PeriodExam.Year == null ? 0 : p.PeriodExam.Year.Value.ToThaiYear(), ExamYear = p.PeriodExam.Year == null ? 0 : p.PeriodExam.Year.Value.ToThaiYear(),
@ -1820,7 +1767,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
ExamId = x.ExamId, ExamId = x.ExamId,
CitizenId = x.CitizenId, CitizenId = x.CitizenId,
Fullname = $"{x.Prefix}{x.FirstName} {x.LastName}", Fullname = $"{x.Prefix}{x.FirstName} {x.LastName}",
PositionName = x.PositionName PositionName = x.PositionName,
PositionType = x.PositionType,
PositionLevel = x.PositionLevel
}) })
.ToList(); .ToList();
@ -1835,69 +1784,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
} }
}; };
return Success(_data); return Success(_data);
//var template_dir = Path.Combine(_webHostEnvironment.ContentRootPath, "Templates");
//var template_file = Path.Combine(template_dir, "ExamList.xlsx");
//var tmpDir = Path.Combine(_webHostEnvironment.ContentRootPath, "tmp");
//if (!Directory.Exists(tmpDir))
// Directory.CreateDirectory(tmpDir);
//var exportFile = Path.Combine(tmpDir, $"ExamList_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx");
//try
//{
// // copy template
// System.IO.File.Copy(template_file, exportFile);
// using (var excel = new ExcelPackage(new FileInfo(exportFile)))
// {
// var workSheet = excel.Workbook.Worksheets[0];
// workSheet.Cells[1, 2].Value = header;
// var disables = data.Disables.OrderBy(x => x.ExamId).ToList();
// var row = 4; // start at row 4
// foreach (var item in disables)
// {
// workSheet.Cells[row, 1].Value = item.ExamId;
// workSheet.Cells[row, 2].Value = item.CitizenId;
// workSheet.Cells[row, 3].Value = $"{item.Prefix}{item.FirstName} {item.LastName}";
// workSheet.Cells[row, 4].Value = item.PositionName;
// row++;
// }
// excel.Save();
// using (FileStream fs = new FileStream(exportFile, FileMode.Open, FileAccess.Read))
// {
// byte[] bytes = System.IO.File.ReadAllBytes(exportFile);
// fs.Read(bytes, 0, System.Convert.ToInt32(fs.Length));
// fs.Close();
// var fname = Path.GetFileName(exportFile);
// Response.Headers["Content-Disposition"] = $"inline; filename={fname}";
// var ret = new FileContentResult(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
// {
// FileDownloadName = fname
// };
// return ret;
// }
// }
//}
//catch (Exception ex)
//{
// return Error(ex, "ไม่สามารถส่งออกรายชื่อผู้มีสิทธิ์สอบได้!!");
//}
//finally
//{
// if (System.IO.File.Exists(exportFile))
// System.IO.File.Delete(exportFile);
//}
} }
[HttpGet("export/pass-exam/{id:length(36)}")] [HttpGet("export/pass-exam/{id:length(36)}")]
@ -1928,9 +1814,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
{ {
r.ExamId, r.ExamId,
r.CitizenId, r.CitizenId,
r.Prefix, Fullname = $"{r.Prefix}{r.FirstName} {r.LastName}",
r.FirstName,
r.LastName,
s.FullA, s.FullA,
s.SumA, s.SumA,
s.AStatus, s.AStatus,
@ -1946,87 +1830,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
} }
}; };
return Success(_data); return Success(_data);
//var template_dir = Path.Combine(_webHostEnvironment.ContentRootPath, "Templates");
//var template_file = Path.Combine(template_dir, "PassAExamList.xlsx");
//var tmpDir = Path.Combine(_webHostEnvironment.ContentRootPath, "tmp");
//if (!Directory.Exists(tmpDir))
// Directory.CreateDirectory(tmpDir);
//var exportFile = Path.Combine(tmpDir, $"PassExamList_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx");
//try
//{
// var result = (from r in data.Disables.ToList()
// join s in data_pass.ScoreImport.Scores.Where(x => x.AStatus == "ผ่าน").ToList() on r.ExamId equals s.ExamId
// select new
// {
// r.ExamId,
// r.CitizenId,
// r.Prefix,
// r.FirstName,
// r.LastName,
// s.FullA,
// s.SumA,
// s.AStatus,
// }).ToList();
// // copy template
// System.IO.File.Copy(template_file, exportFile);
// using (var excel = new ExcelPackage(new FileInfo(exportFile)))
// {
// var workSheet = excel.Workbook.Worksheets[0];
// workSheet.Cells[1, 2].Value = header;
// var disables = data.Disables.OrderBy(x => x.ExamId).ToList();
// var row = 4; // start at row 4
// foreach (var item in result)
// {
// workSheet.Cells[row, 1].Value = item.ExamId;
// workSheet.Cells[row, 2].Value = item.CitizenId;
// workSheet.Cells[row, 3].Value = $"{item.Prefix}{item.FirstName} {item.LastName}";
// workSheet.Cells[row, 4].Value = item.FullA;
// workSheet.Cells[row, 5].Value = item.SumA;
// workSheet.Cells[row, 6].Value = item.AStatus;
// row++;
// }
// excel.Save();
// using (FileStream fs = new FileStream(exportFile, FileMode.Open, FileAccess.Read))
// {
// byte[] bytes = System.IO.File.ReadAllBytes(exportFile);
// fs.Read(bytes, 0, System.Convert.ToInt32(fs.Length));
// fs.Close();
// var fname = Path.GetFileName(exportFile);
// Response.Headers["Content-Disposition"] = $"inline; filename={fname}";
// var ret = new FileContentResult(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
// {
// FileDownloadName = fname
// };
// return ret;
// }
// }
//}
//catch (Exception ex)
//{
// return Error(ex, "ไม่สามารถส่งออกรายชื่อผู้สอบผ่านได้!!");
//}
//finally
//{
// if (System.IO.File.Exists(exportFile))
// System.IO.File.Delete(exportFile);
//}
} }
[HttpGet("export/pass/{id:length(36)}")] [HttpGet("export/pass/{id:length(36)}")]
@ -2060,8 +1863,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
Full = s.FullA + s.FullB + s.FullC, Full = s.FullA + s.FullB + s.FullC,
Sum = s.SumA + s.SumB + s.SumC, Sum = s.SumA + s.SumB + s.SumC,
Status = s.ExamStatus, Status = s.ExamStatus,
Number = s.Number, s.Number,
PositionName = r.PositionName, r.PositionName,
r.PositionType,
r.PositionLevel,
}).ToList() }).ToList()
.OrderBy(x => x.ExamId) .OrderBy(x => x.ExamId)
.ThenBy(x => x.PositionName) .ThenBy(x => x.PositionName)
@ -2078,90 +1883,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
} }
}; };
return Success(_data); return Success(_data);
//var template_dir = Path.Combine(_webHostEnvironment.ContentRootPath, "Templates");
//var template_file = Path.Combine(template_dir, "PassExamList.xlsx");
//var tmpDir = Path.Combine(_webHostEnvironment.ContentRootPath, "tmp");
//if (!Directory.Exists(tmpDir))
// Directory.CreateDirectory(tmpDir);
//var exportFile = Path.Combine(tmpDir, $"PassExamList_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx");
//try
//{
// var result = (from r in data.Disables.ToList()
// join s in data_pass.ScoreImport.Scores.Where(x => x.ExamStatus == "ผ่าน").ToList() on r.ExamId equals s.ExamId
// select new
// {
// r.ExamId,
// r.CitizenId,
// r.Prefix,
// r.FirstName,
// r.LastName,
// Full = s.FullA + s.FullB + s.FullC,
// Sum = s.SumA + s.SumB + s.SumC,
// Status = s.ExamStatus,
// r.PositionName,
// s.Number
// }).ToList();
// // copy template
// System.IO.File.Copy(template_file, exportFile);
// using (var excel = new ExcelPackage(new FileInfo(exportFile)))
// {
// var workSheet = excel.Workbook.Worksheets[0];
// workSheet.Cells[1, 2].Value = header;
// var disables = data.Disables.OrderBy(x => x.ExamId).ToList();
// var row = 4; // start at row 4
// foreach (var item in result)
// {
// workSheet.Cells[row, 1].Value = item.ExamId;
// workSheet.Cells[row, 2].Value = item.CitizenId;
// workSheet.Cells[row, 3].Value = $"{item.Prefix}{item.FirstName} {item.LastName}";
// workSheet.Cells[row, 4].Value = item.Full;
// workSheet.Cells[row, 5].Value = item.Sum;
// workSheet.Cells[row, 6].Value = item.Status;
// workSheet.Cells[row, 7].Value = item.Number;
// workSheet.Cells[row, 8].Value = item.PositionName;
// row++;
// }
// excel.Save();
// using (FileStream fs = new FileStream(exportFile, FileMode.Open, FileAccess.Read))
// {
// byte[] bytes = System.IO.File.ReadAllBytes(exportFile);
// fs.Read(bytes, 0, System.Convert.ToInt32(fs.Length));
// fs.Close();
// var fname = Path.GetFileName(exportFile);
// Response.Headers["Content-Disposition"] = $"inline; filename={fname}";
// var ret = new FileContentResult(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
// {
// FileDownloadName = fname
// };
// return ret;
// }
// }
//}
//catch (Exception ex)
//{
// return Error(ex, "ไม่สามารถส่งออกรายชื่อผู้สอบผ่านได้!!");
//}
//finally
//{
// if (System.IO.File.Exists(exportFile))
// System.IO.File.Delete(exportFile);
//}
} }
/// <summary> /// <summary>

View file

@ -179,6 +179,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
ExamResult = sr == null ? "" : sr.ExamStatus, ExamResult = sr == null ? "" : sr.ExamStatus,
University = p.Educations.First().University, University = p.Educations.First().University,
PositionName = p.PositionName, PositionName = p.PositionName,
PositionType = p.PositionType,
PositionLevel = p.PositionLevel,
ExamName = $"{p.PeriodExam.Name} ครั้งที่ {p.PeriodExam.Round}/{p.PeriodExam.Year.Value.ToThaiYear()}", ExamName = $"{p.PeriodExam.Name} ครั้งที่ {p.PeriodExam.Round}/{p.PeriodExam.Year.Value.ToThaiYear()}",
Number = sr == null ? "" : sr.Number, Number = sr == null ? "" : sr.Number,
// ExamCount = 10, // ExamCount = 10,

View file

@ -34,36 +34,36 @@ namespace BMA.EHR.Recurit.Exam.Service.Data
} }
} }
public DbSet<BMA.EHR.Profile.Service.Models.HR.ProfileOrganization> ProfileOrganizations { get; set; } // public DbSet<BMA.EHR.Profile.Service.Models.HR.ProfileOrganization> ProfileOrganizations { get; set; }
public DbSet<BMA.EHR.Profile.Service.Models.HR.Profile> Profiles { get; set; } // public DbSet<BMA.EHR.Profile.Service.Models.HR.Profile> Profiles { get; set; }
public DbSet<BMA.EHR.Profile.Service.Models.HR.ProfileSalary> ProfileSalaries { get; set; } // public DbSet<BMA.EHR.Profile.Service.Models.HR.ProfileSalary> ProfileSalaries { get; set; }
public DbSet<BMA.EHR.Profile.Service.Models.HR.OrganizationEntity> Organizations { get; set; } // public DbSet<BMA.EHR.Profile.Service.Models.HR.OrganizationEntity> Organizations { get; set; }
public DbSet<Prefix> Prefixes { get; set; } // public DbSet<Prefix> Prefixes { get; set; }
public DbSet<Religion> Religions { get; set; } // public DbSet<Religion> Religions { get; set; }
public DbSet<EducationLevel> EducationLevels { get; set; } // public DbSet<EducationLevel> EducationLevels { get; set; }
public DbSet<Relationship> Relationships { get; set; } // public DbSet<Relationship> Relationships { get; set; }
public DbSet<Province> Provinces { get; set; } // public DbSet<Province> Provinces { get; set; }
public DbSet<District> Districts { get; set; } // public DbSet<District> Districts { get; set; }
public DbSet<SubDistrict> SubDistricts { get; set; } // public DbSet<SubDistrict> SubDistricts { get; set; }
public DbSet<OrganizationOrganization> OrganizationOrganizations { get; set; } // public DbSet<OrganizationOrganization> OrganizationOrganizations { get; set; }
public DbSet<OrganizationShortName> OrganizationShortNames { get; set; } // public DbSet<OrganizationShortName> OrganizationShortNames { get; set; }
public DbSet<Placement> Placements { get; set; } public DbSet<Placement> Placements { get; set; }
public DbSet<PlacementCertificate> PlacementCertificates { get; set; } public DbSet<PlacementCertificate> PlacementCertificates { get; set; }
public DbSet<PlacementEducation> PlacementEducations { get; set; } public DbSet<PlacementEducation> PlacementEducations { get; set; }
public DbSet<PlacementIsProperty> PlacementIsProperties { get; set; } public DbSet<PlacementIsProperty> PlacementIsProperties { get; set; }
public DbSet<PlacementProfile> PlacementProfiles { get; set; } public DbSet<PlacementProfile> PlacementProfiles { get; set; }
public DbSet<PlacementType> PlacementTypes { get; set; } public DbSet<PlacementType> PlacementTypes { get; set; }
public DbSet<PositionPath> PositionPaths { get; set; } // public DbSet<PositionPath> PositionPaths { get; set; }
public DbSet<Gender> Genders { get; set; } // public DbSet<Gender> Genders { get; set; }
public DbSet<Document> Documents { get; set; } public DbSet<Document> Documents { get; set; }
} }
} }

View file

@ -1146,9 +1146,15 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Property<Guid?>("PeriodExamId") b.Property<Guid?>("PeriodExamId")
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<string>("PositionLevel")
.HasColumnType("longtext");
b.Property<string>("PositionName") b.Property<string>("PositionName")
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("PositionType")
.HasColumnType("longtext");
b.Property<string>("Prefix") b.Property<string>("Prefix")
.IsRequired() .IsRequired()
.HasMaxLength(50) .HasMaxLength(50)
@ -2727,7 +2733,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Career", b => modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Career", b =>
{ {
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Candidate", "Candidate") b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Candidate", "Candidate")
.WithMany() .WithMany("Careers")
.HasForeignKey("CandidateId") .HasForeignKey("CandidateId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
@ -2938,6 +2944,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Candidate", b => modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Candidate", b =>
{ {
b.Navigation("Careers");
b.Navigation("Educations"); b.Navigation("Educations");
}); });

46
Data/OrgDbContext.cs Normal file
View file

@ -0,0 +1,46 @@
using BMA.EHR.Recurit.Exam.Service.Models;
using BMA.EHR.Recurit.Exam.Service.Models.Documents;
using Microsoft.EntityFrameworkCore;
using BMA.EHR.Domain.Models.Placement;
namespace BMA.EHR.Recurit.Exam.Service.Data
{
public class OrgDbContext : DbContext
{
public OrgDbContext(DbContextOptions<OrgDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
}
// The following configures EF to create a Sqlite database file in the
// special "local" folder for your platform.
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
if (!options.IsConfigured)
{
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production";
var configurationBuilder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: true, true)
.AddJsonFile($"appsettings.{environment}.json", true, true)
.AddEnvironmentVariables()
.Build();
var historyConnection = configurationBuilder.GetConnectionString("HistoryConnection");
options.UseMySql(historyConnection, ServerVersion.AutoDetect(historyConnection));
}
}
public DbSet<Prefix> prefixe { get; set; }
public DbSet<Religion> religion { get; set; }
public DbSet<EducationLevel> educationLevel { get; set; }
public DbSet<Relationship> relationship { get; set; }
public DbSet<Province> province { get; set; }
public DbSet<District> district { get; set; }
public DbSet<SubDistrict> subDistrict { get; set; }
public DbSet<Gender> gender { get; set; }
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class updatetableDisableaddpostype : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "PositionLevel",
table: "Disables",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PositionType",
table: "Disables",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PositionLevel",
table: "Disables");
migrationBuilder.DropColumn(
name: "PositionType",
table: "Disables");
}
}
}

View file

@ -78,5 +78,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Models.Disables
public DateTime ApplyDate { get; set; } public DateTime ApplyDate { get; set; }
public string? PositionName { get; set; }// public string? PositionName { get; set; }//
public string? PositionType { get; set; }
public string? PositionLevel { get; set; }
} }
} }

View file

@ -7,13 +7,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
public class District : EntityBase public class District : EntityBase
{ {
[Required, MaxLength(150), Column(Order = 1), Comment("เขต/อำเภอ")] [Required, MaxLength(150), Column(Order = 1), Comment("เขต/อำเภอ")]
public string Name { get; set; } = string.Empty; public string name { get; set; } = string.Empty;
[Column(Order = 2), Comment("สถานะการใช้งาน")] // [Column(Order = 2), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true; // public bool IsActive { get; set; } = true;
public virtual List<SubDistrict> SubDistricts { get; set; } = new(); // public virtual List<SubDistrict> SubDistricts { get; set; } = new();
public virtual Province? Province { get; set; } // public virtual Province? Province { get; set; }
} }
} }

View file

@ -7,9 +7,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
public class EducationLevel : EntityBase public class EducationLevel : EntityBase
{ {
[Required, MaxLength(100), Column(Order = 1), Comment("ระดับการศึกษา")] [Required, MaxLength(100), Column(Order = 1), Comment("ระดับการศึกษา")]
public string Name { get; set; } = string.Empty; public string name { get; set; } = string.Empty;
[Column(Order = 2), Comment("สถานะการใช้งาน")] // [Column(Order = 2), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true; // public bool IsActive { get; set; } = true;
} }
} }

View file

@ -29,7 +29,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Column(Order = 105), Comment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"), MaxLength(200)] [Column(Order = 105), Comment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"), MaxLength(200)]
public string LastUpdateFullName { get; set; } = string.Empty; public string LastUpdateFullName { get; set; } = string.Empty;
[Column(Order = 106), Comment("สถานะการใช้งาน")] // [Column(Order = 106), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true; // public bool IsActive { get; set; } = true;
} }
} }

View file

@ -7,6 +7,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
public class Gender : EntityBase public class Gender : EntityBase
{ {
[Required, MaxLength(20), Column(Order = 1), Comment("เพศ")] [Required, MaxLength(20), Column(Order = 1), Comment("เพศ")]
public string Name { get; set; } = string.Empty; public string name { get; set; } = string.Empty;
} }
} }

View file

@ -23,6 +23,9 @@ namespace BMA.EHR.Domain.Models.Placement
[Comment("สถานะการใช้งาน")] [Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true; public bool IsActive { get; set; } = true;
[Comment("Id การสอบ")]
public Guid? RefId { get; set; }
public virtual List<PlacementProfile> PlacementProfiles { get; set; } = new List<PlacementProfile>(); public virtual List<PlacementProfile> PlacementProfiles { get; set; } = new List<PlacementProfile>();
} }
} }

View file

@ -9,7 +9,9 @@ namespace BMA.EHR.Domain.Models.Placement
[Required, Comment("Id ผู้สมัคร")] [Required, Comment("Id ผู้สมัคร")]
public virtual PlacementProfile? PlacementProfile { get; set; } public virtual PlacementProfile? PlacementProfile { get; set; }
[Comment("Idวุฒิที่ได้รับ")] [Comment("Idวุฒิที่ได้รับ")]
public virtual EducationLevel? EducationLevel { get; set; } public Guid? EducationLevelId { get; set; }
[Comment("วุฒิที่ได้รับ")]
public string? EducationLevelName { get; set; }
[MaxLength(1000), Comment("สถานศึกษา")] [MaxLength(1000), Comment("สถานศึกษา")]
public string? Institute { get; set; } public string? Institute { get; set; }
[MaxLength(200), Comment("วุฒิการศึกษา")] [MaxLength(200), Comment("วุฒิการศึกษา")]

View file

@ -19,13 +19,9 @@ namespace BMA.EHR.Domain.Models.Placement
[Comment("Id เพศ")] [Comment("Id เพศ")]
public string? Gender { get; set; } public string? Gender { get; set; }
[Comment("Id ตำแหน่งที่สอบได้")]
public PositionPath? PositionCandidate { get; set; }
[Comment("ตำแหน่งที่สอบได้")] [Comment("ตำแหน่งที่สอบได้")]
public string? positionName { get; set; } public string? positionName { get; set; }
// [Comment("Id เลขที่ตำแหน่ง")]
// public OrganizationPositionEntity? OrganizationPosition { get; set; }
[Comment("วันที่บรรจุ")] [Comment("วันที่บรรจุ")]
public DateTime? RecruitDate { get; set; } public DateTime? RecruitDate { get; set; }
[Comment("วันที่รายงานตัว")] [Comment("วันที่รายงานตัว")]
@ -50,8 +46,6 @@ namespace BMA.EHR.Domain.Models.Placement
public bool IsRelief { get; set; } = false; public bool IsRelief { get; set; } = false;
[Comment("เหตุผลผ่อนผัน")] [Comment("เหตุผลผ่อนผัน")]
public string? ReliefReason { get; set; } public string? ReliefReason { get; set; }
// [Comment("Id เอกสารผ่อนผัน")]
// public Document? ReliefDoc { get; set; }
[Comment("การคัดกรองคุณสมบัติ")] [Comment("การคัดกรองคุณสมบัติ")]
public string? IsProperty { get; set; } public string? IsProperty { get; set; }
@ -66,8 +60,6 @@ namespace BMA.EHR.Domain.Models.Placement
[Comment("Id สถานภาพ")] [Comment("Id สถานภาพ")]
public string? Relationship { get; set; } public string? Relationship { get; set; }
// [Comment("Id กลุ่มเลือด")]
// public BloodGroup? BloodGroup { get; set; }
[Comment("Id ศาสนา")] [Comment("Id ศาสนา")]
public string? Religion { get; set; } public string? Religion { get; set; }
@ -78,10 +70,10 @@ namespace BMA.EHR.Domain.Models.Placement
public string? CitizenId { get; set; } public string? CitizenId { get; set; }
[Comment("Id เขตที่ออกบัตรประชาชน")] [Comment("Id เขตที่ออกบัตรประชาชน")]
public string? CitizenDistrictId { get; set; } public Guid? CitizenDistrictId { get; set; }
[Comment("Id จังหวัดที่ออกบัตรประชาชน")] [Comment("Id จังหวัดที่ออกบัตรประชาชน")]
public string? CitizenProvinceId { get; set; } public Guid? CitizenProvinceId { get; set; }
[Comment("วันที่ออกบัตร")] [Comment("วันที่ออกบัตร")]
public DateTime? CitizenDate { get; set; } public DateTime? CitizenDate { get; set; }
@ -99,13 +91,13 @@ namespace BMA.EHR.Domain.Models.Placement
public string? RegistAddress { get; set; } public string? RegistAddress { get; set; }
[Comment("Id จังหวัดที่อยู่ตามทะเบียนบ้าน")] [Comment("Id จังหวัดที่อยู่ตามทะเบียนบ้าน")]
public string? RegistProvinceId { get; set; } public Guid? RegistProvinceId { get; set; }
[Comment("Id อำเภอที่อยู่ตามทะเบียนบ้าน")] [Comment("Id อำเภอที่อยู่ตามทะเบียนบ้าน")]
public string? RegistDistrictId { get; set; } public Guid? RegistDistrictId { get; set; }
[Comment("Id ตำบลที่อยู่ตามทะเบียนบ้าน")] [Comment("Id ตำบลที่อยู่ตามทะเบียนบ้าน")]
public string? RegistSubDistrictId { get; set; } public Guid? RegistSubDistrictId { get; set; }
[MaxLength(10), Comment("รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน")] [MaxLength(10), Comment("รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน")]
public string? RegistZipCode { get; set; } public string? RegistZipCode { get; set; }
@ -117,13 +109,13 @@ namespace BMA.EHR.Domain.Models.Placement
public string? CurrentAddress { get; set; } public string? CurrentAddress { get; set; }
[Comment("Id จังหวัดที่อยู่ปัจจุบัน")] [Comment("Id จังหวัดที่อยู่ปัจจุบัน")]
public string? CurrentProvinceId { get; set; } public Guid? CurrentProvinceId { get; set; }
[Comment("Id อำเภอที่อยู่ปัจจุบัน")] [Comment("Id อำเภอที่อยู่ปัจจุบัน")]
public string? CurrentDistrictId { get; set; } public Guid? CurrentDistrictId { get; set; }
[Comment("Id ตำบลที่อยู่ปัจจุบัน")] [Comment("Id ตำบลที่อยู่ปัจจุบัน")]
public string? CurrentSubDistrictId { get; set; } public Guid? CurrentSubDistrictId { get; set; }
[MaxLength(10), Comment("รหัสไปรษณีย์ที่อยู่ปัจจุบัน")] [MaxLength(10), Comment("รหัสไปรษณีย์ที่อยู่ปัจจุบัน")]
public string? CurrentZipCode { get; set; } public string? CurrentZipCode { get; set; }
@ -192,25 +184,15 @@ namespace BMA.EHR.Domain.Models.Placement
[MaxLength(20), Comment("ตำแหน่งปัจจุบัน เบอร์โทรที่ทำงาน")] [MaxLength(20), Comment("ตำแหน่งปัจจุบัน เบอร์โทรที่ทำงาน")]
public string? OccupationTelephone { get; set; } public string? OccupationTelephone { get; set; }
// [Comment("Id ตำแหน่งเลขที่")] [Comment("ตำแหน่งสอบ")]
// public PositionNumberEntity? PositionNumber { get; set; } public string? PositionCandidate { get; set; }
// [Comment("Id ตำแหน่ง")]
// public PositionPath? PositionPath { get; set; }
// [Comment("Id ด้าน/สาขา")]
// public PositionPathSide? PositionPathSide { get; set; }
[Comment("ประเภทตำแหน่ง")] [Comment("ประเภทตำแหน่ง")]
public string? PositionType { get; set; } public string? PositionType { get; set; }
// [Comment("Id สายงาน")]
// public PositionLine? PositionLine { get; set; }
[Comment("ระดับ")] [Comment("ระดับ")]
public string? PositionLevel { get; set; } public string? PositionLevel { get; set; }
[Comment("คะแนนเต็มภาค ก")] [Comment("คะแนนเต็มภาค ก")]
public double? PointTotalA { get; set; } public double? PointTotalA { get; set; }

View file

@ -7,9 +7,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
public class Prefix : EntityBase public class Prefix : EntityBase
{ {
[Required, MaxLength(50), Column(Order = 2), Comment("รายละเอียดคำนำหน้า")] [Required, MaxLength(50), Column(Order = 2), Comment("รายละเอียดคำนำหน้า")]
public string Name { get; set; } = string.Empty; public string name { get; set; } = string.Empty;
[Column(Order = 3), Comment("สถานะการใช้งาน")] // [Column(Order = 3), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true; // public bool IsActive { get; set; } = true;
} }
} }

View file

@ -7,11 +7,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
public class Province : EntityBase public class Province : EntityBase
{ {
[Required, MaxLength(150), Column(Order = 1), Comment("จังหวัด")] [Required, MaxLength(150), Column(Order = 1), Comment("จังหวัด")]
public string Name { get; set; } = string.Empty; public string name { get; set; } = string.Empty;
[Column(Order = 2), Comment("สถานะการใช้งาน")] // [Column(Order = 2), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true; // public bool IsActive { get; set; } = true;
public virtual List<District> Districts { get; set; } = new(); // public virtual List<District> Districts { get; set; } = new();
} }
} }

View file

@ -7,8 +7,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Models;
public class Relationship : EntityBase public class Relationship : EntityBase
{ {
[Required, MaxLength(50), Column(Order = 1), Comment("ชื่อความสัมพันธ์")] [Required, MaxLength(50), Column(Order = 1), Comment("ชื่อความสัมพันธ์")]
public string Name { get; set; } = string.Empty; public string name { get; set; } = string.Empty;
[Column(Order = 2), Comment("สถานะการใช้งาน")] // [Column(Order = 2), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true; // public bool IsActive { get; set; } = true;
} }

View file

@ -7,9 +7,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
public class Religion : EntityBase public class Religion : EntityBase
{ {
[Required, MaxLength(100), Column(Order = 1), Comment("ศาสนา")] [Required, MaxLength(100), Column(Order = 1), Comment("ศาสนา")]
public string Name { get; set; } = string.Empty; public string name { get; set; } = string.Empty;
[Column(Order = 2), Comment("สถานะการใช้งาน")] // [Column(Order = 2), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true; // public bool IsActive { get; set; } = true;
} }
} }

View file

@ -7,14 +7,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
public class SubDistrict : EntityBase public class SubDistrict : EntityBase
{ {
[Required, MaxLength(150), Column(Order = 1), Comment("เขต/อำเภอ")] [Required, MaxLength(150), Column(Order = 1), Comment("เขต/อำเภอ")]
public string Name { get; set; } = string.Empty; public string name { get; set; } = string.Empty;
[Required, MaxLength(10), Column(Order = 2), Comment("รหัสไปรษณีย์")] [Required, MaxLength(10), Column(Order = 2), Comment("รหัสไปรษณีย์")]
public string ZipCode { get; set; } = string.Empty; public string zipCode { get; set; } = string.Empty;
[Column(Order = 3), Comment("สถานะการใช้งาน")] // [Column(Order = 3), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true; // public bool IsActive { get; set; } = true;
public virtual District? District { get; set; } // public virtual District? District { get; set; }
} }
} }

View file

@ -65,6 +65,9 @@ builder.Host.UseSerilog();
var examConnection = builder.Configuration.GetConnectionString("ExamConnection"); var examConnection = builder.Configuration.GetConnectionString("ExamConnection");
builder.Services.AddDbContext<ApplicationDbContext>(options => builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseMySql(examConnection, ServerVersion.AutoDetect(examConnection))); options.UseMySql(examConnection, ServerVersion.AutoDetect(examConnection)));
var orgConnection = builder.Configuration.GetConnectionString("OrgConnection");
builder.Services.AddDbContext<OrgDbContext>(options =>
options.UseMySql(orgConnection, ServerVersion.AutoDetect(orgConnection)));
var defaultConnection = builder.Configuration.GetConnectionString("DefaultConnection"); var defaultConnection = builder.Configuration.GetConnectionString("DefaultConnection");
builder.Services.AddDbContext<MetadataDbContext>(options => builder.Services.AddDbContext<MetadataDbContext>(options =>
options.UseMySql(defaultConnection, ServerVersion.AutoDetect(defaultConnection))); options.UseMySql(defaultConnection, ServerVersion.AutoDetect(defaultConnection)));

View file

@ -19,6 +19,8 @@
public static string PersonalCardExpireDate = "CusIDExpireDate"; public static string PersonalCardExpireDate = "CusIDExpireDate";
public static string ApplyDate = "DateTime"; public static string ApplyDate = "DateTime";
public static string PositionName = "PositionName"; public static string PositionName = "PositionName";
public static string PositionType = "PositionType";
public static string PositionLevel = "PositionLevel";
// Address // Address
public static string Address = "Address"; public static string Address = "Address";

View file

@ -11,7 +11,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public bool CheckDisability { get; set; } public bool CheckDisability { get; set; }
public int? Round { get; set; } public int? Round { get; set; }
public int? Year { get; set; } public int? Year { get; set; }
public Guid? OcId { get; set; }
public string CreatedUserId { get; set; } public string CreatedUserId { get; set; }
public float? Fee { get; set; } public float? Fee { get; set; }
public DateTime? RegisterStartDate { get; set; } public DateTime? RegisterStartDate { get; set; }

View file

@ -19,7 +19,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
#region " Fields " #region " Fields "
private readonly ApplicationDbContext _context; private readonly ApplicationDbContext _context;
private readonly MetadataDbContext _contextMetadata; private readonly OrgDbContext _contextOrg;
private readonly IHttpContextAccessor _httpContextAccessor; private readonly IHttpContextAccessor _httpContextAccessor;
private readonly MinIOService _minioService; private readonly MinIOService _minioService;
@ -28,12 +28,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
#region " Constructor and Destructor " #region " Constructor and Destructor "
public CMSCandidateService(ApplicationDbContext context, public CMSCandidateService(ApplicationDbContext context,
MetadataDbContext contextMetadata, OrgDbContext contextOrg,
IHttpContextAccessor httpContextAccessor, IHttpContextAccessor httpContextAccessor,
MinIOService minioService) MinIOService minioService)
{ {
_context = context; _context = context;
_contextMetadata = contextMetadata; _contextOrg = contextOrg;
_httpContextAccessor = httpContextAccessor; _httpContextAccessor = httpContextAccessor;
_minioService = minioService; _minioService = minioService;
} }
@ -139,39 +139,39 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (updated.ProvinceId != null) if (updated.ProvinceId != null)
{ {
var province = await _contextMetadata.Provinces.AsQueryable() var province = await _contextOrg.province.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ProvinceId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ProvinceId));
if (province == null) if (province == null)
throw new Exception(GlobalMessages.ProvinceNotFound); throw new Exception(GlobalMessages.ProvinceNotFound);
cms.ProvinceId = province.Id; cms.ProvinceId = province.Id;
cms.ProvinceName = province.Name; cms.ProvinceName = province.name;
} }
if (updated.DistrictId != null) if (updated.DistrictId != null)
{ {
var pistrict = await _contextMetadata.Districts.AsQueryable() var pistrict = await _contextOrg.district.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.DistrictId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.DistrictId));
if (pistrict == null) if (pistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound); throw new Exception(GlobalMessages.DistrictNotFound);
cms.DistrictId = pistrict.Id; cms.DistrictId = pistrict.Id;
cms.DistrictName = pistrict.Name; cms.DistrictName = pistrict.name;
} }
if (updated.SubDistrictId != null) if (updated.SubDistrictId != null)
{ {
var subDistrict = await _contextMetadata.SubDistricts.AsQueryable() var subDistrict = await _contextOrg.subDistrict.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.SubDistrictId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.SubDistrictId));
if (subDistrict == null) if (subDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound); throw new Exception(GlobalMessages.SubDistrictNotFound);
cms.SubDistrictId = subDistrict.Id; cms.SubDistrictId = subDistrict.Id;
cms.SubDistrictName = subDistrict.Name; cms.SubDistrictName = subDistrict.name;
cms.ZipCode = subDistrict.ZipCode; cms.ZipCode = subDistrict.zipCode;
} }
cms.About = updated.About; cms.About = updated.About;

View file

@ -1,5 +1,4 @@
using System.Security.Claims; using System.Security.Claims;
using BMA.EHR.Domain.Models.Placement;
using BMA.EHR.Recurit.Exam.Service.Extensions; using BMA.EHR.Recurit.Exam.Service.Extensions;
using BMA.EHR.Recurit.Exam.Service.Core; using BMA.EHR.Recurit.Exam.Service.Core;
using BMA.EHR.Recurit.Exam.Service.Data; using BMA.EHR.Recurit.Exam.Service.Data;
@ -7,7 +6,6 @@ using BMA.EHR.Recurit.Exam.Service.Models;
using BMA.EHR.Recurit.Exam.Service.Request; using BMA.EHR.Recurit.Exam.Service.Request;
using BMA.EHR.Recurit.Exam.Service.Response; using BMA.EHR.Recurit.Exam.Service.Response;
using BMA.EHR.Recurit.Exam.Service.Responses.Document; using BMA.EHR.Recurit.Exam.Service.Responses.Document;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Recurit.Exam.Service.Services namespace BMA.EHR.Recurit.Exam.Service.Services
@ -17,7 +15,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
#region " Fields " #region " Fields "
private readonly ApplicationDbContext _context; private readonly ApplicationDbContext _context;
private readonly MetadataDbContext _contextMetadata; private readonly OrgDbContext _contextOrg;
private readonly IHttpContextAccessor _httpContextAccessor; private readonly IHttpContextAccessor _httpContextAccessor;
private readonly MinIOService _minioService; private readonly MinIOService _minioService;
private readonly MailService _mailService; private readonly MailService _mailService;
@ -27,13 +25,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
#region " Constructor and Destructor " #region " Constructor and Destructor "
public CandidateService(ApplicationDbContext context, public CandidateService(ApplicationDbContext context,
MetadataDbContext contextMetadata, OrgDbContext contextOrg,
IHttpContextAccessor httpContextAccessor, IHttpContextAccessor httpContextAccessor,
MinIOService minioService, MinIOService minioService,
MailService mailService) MailService mailService)
{ {
_context = context; _context = context;
_contextMetadata = contextMetadata; _contextOrg = contextOrg;
_httpContextAccessor = httpContextAccessor; _httpContextAccessor = httpContextAccessor;
_minioService = minioService; _minioService = minioService;
_mailService = mailService; _mailService = mailService;
@ -742,112 +740,112 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (updated.PrefixId != null) if (updated.PrefixId != null)
{ {
var prefix = await _contextMetadata.Prefixes.AsQueryable() var prefix = await _contextOrg.prefixe.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId));
if (prefix == null) if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound); throw new Exception(GlobalMessages.PrefixNotFound);
candidate.PrefixId = prefix.Id; candidate.PrefixId = prefix.Id;
candidate.PrefixName = prefix.Name; candidate.PrefixName = prefix.name;
} }
if (updated.ContactPrefixId != null) if (updated.ContactPrefixId != null)
{ {
var prefix = await _contextMetadata.Prefixes.AsQueryable() var prefix = await _contextOrg.prefixe.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.ContactPrefixId); .FirstOrDefaultAsync(x => x.Id == updated.ContactPrefixId);
if (prefix == null) if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound); throw new Exception(GlobalMessages.PrefixNotFound);
candidate.ContactPrefixId = prefix.Id; candidate.ContactPrefixId = prefix.Id;
candidate.ContactPrefixName = prefix.Name; candidate.ContactPrefixName = prefix.name;
} }
if (updated.ReligionId != null) if (updated.ReligionId != null)
{ {
var religion = await _contextMetadata.Religions.AsQueryable() var religion = await _contextOrg.religion.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ReligionId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ReligionId));
if (religion == null) if (religion == null)
throw new Exception(GlobalMessages.ReligionNotFound); throw new Exception(GlobalMessages.ReligionNotFound);
candidate.ReligionId = religion.Id; candidate.ReligionId = religion.Id;
candidate.ReligionName = religion.Name; candidate.ReligionName = religion.name;
} }
if (updated.RegistProvinceId != null) if (updated.RegistProvinceId != null)
{ {
var registProvince = await _contextMetadata.Provinces.AsQueryable() var registProvince = await _contextOrg.province.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistProvinceId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistProvinceId));
if (registProvince == null) if (registProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound); throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.RegistProvinceId = registProvince.Id; candidate.RegistProvinceId = registProvince.Id;
candidate.RegistProvinceName = registProvince.Name; candidate.RegistProvinceName = registProvince.name;
} }
if (updated.RegistDistrictId != null) if (updated.RegistDistrictId != null)
{ {
var registDistrict = await _contextMetadata.Districts.AsQueryable() var registDistrict = await _contextOrg.district.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistDistrictId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistDistrictId));
if (registDistrict == null) if (registDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound); throw new Exception(GlobalMessages.DistrictNotFound);
candidate.RegistDistrictId = registDistrict.Id; candidate.RegistDistrictId = registDistrict.Id;
candidate.RegistDistrictName = registDistrict.Name; candidate.RegistDistrictName = registDistrict.name;
} }
if (updated.RegistSubDistrictId != null) if (updated.RegistSubDistrictId != null)
{ {
var registSubDistrict = await _contextMetadata.SubDistricts.AsQueryable() var registSubDistrict = await _contextOrg.subDistrict.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistSubDistrictId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistSubDistrictId));
if (registSubDistrict == null) if (registSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound); throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.RegistSubDistrictId = registSubDistrict.Id; candidate.RegistSubDistrictId = registSubDistrict.Id;
candidate.RegistSubDistrictName = registSubDistrict.Name; candidate.RegistSubDistrictName = registSubDistrict.name;
candidate.RegistZipCode = registSubDistrict.ZipCode; candidate.RegistZipCode = registSubDistrict.zipCode;
} }
if (updated.CurrentProvinceId != null) if (updated.CurrentProvinceId != null)
{ {
var currentProvince = await _contextMetadata.Provinces.AsQueryable() var currentProvince = await _contextOrg.province.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentProvinceId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentProvinceId));
if (currentProvince == null) if (currentProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound); throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CurrentProvinceId = currentProvince.Id; candidate.CurrentProvinceId = currentProvince.Id;
candidate.CurrentProvinceName = currentProvince.Name; candidate.CurrentProvinceName = currentProvince.name;
} }
if (updated.CurrentDistrictId != null) if (updated.CurrentDistrictId != null)
{ {
var currentDistrict = await _contextMetadata.Districts.AsQueryable() var currentDistrict = await _contextOrg.district.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentDistrictId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentDistrictId));
if (currentDistrict == null) if (currentDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound); throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CurrentDistrictId = currentDistrict.Id; candidate.CurrentDistrictId = currentDistrict.Id;
candidate.CurrentDistrictName = currentDistrict.Name; candidate.CurrentDistrictName = currentDistrict.name;
} }
if (updated.CurrentSubDistrictId != null) if (updated.CurrentSubDistrictId != null)
{ {
var currentSubDistrict = await _contextMetadata.SubDistricts.AsQueryable() var currentSubDistrict = await _contextOrg.subDistrict.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentSubDistrictId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentSubDistrictId));
if (currentSubDistrict == null) if (currentSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound); throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.CurrentSubDistrictId = currentSubDistrict.Id; candidate.CurrentSubDistrictId = currentSubDistrict.Id;
candidate.CurrentSubDistrictName = currentSubDistrict.Name; candidate.CurrentSubDistrictName = currentSubDistrict.name;
candidate.CurrentZipCode = currentSubDistrict.ZipCode; candidate.CurrentZipCode = currentSubDistrict.zipCode;
} }
candidate.FirstName = updated.FirstName; candidate.FirstName = updated.FirstName;
@ -896,24 +894,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
}; };
if (updated.EducationLevelExamId != null) if (updated.EducationLevelExamId != null)
{ {
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null) if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
education.EducationLevelExamId = educationLevelExam.Id; education.EducationLevelExamId = educationLevelExam.Id;
education.EducationLevelExamName = educationLevelExam.Name; education.EducationLevelExamName = educationLevelExam.name;
} }
if (updated.EducationLevelHighId != null) if (updated.EducationLevelHighId != null)
{ {
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
if (educationLevelHigh == null) if (educationLevelHigh == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
education.EducationLevelHighId = educationLevelHigh.Id; education.EducationLevelHighId = educationLevelHigh.Id;
education.EducationLevelHighName = educationLevelHigh.Name; education.EducationLevelHighName = educationLevelHigh.name;
} }
await _context.Educations.AddAsync(education); await _context.Educations.AddAsync(education);
} }
@ -930,24 +928,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? ""; candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
if (updated.EducationLevelExamId != null) if (updated.EducationLevelExamId != null)
{ {
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null) if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id; candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name; candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.name;
} }
if (updated.EducationLevelHighId != null) if (updated.EducationLevelHighId != null)
{ {
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
if (educationLevelHigh == null) if (educationLevelHigh == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id; candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name; candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.name;
} }
} }
@ -966,112 +964,112 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (updated.PrefixId != null) if (updated.PrefixId != null)
{ {
var prefix = await _contextMetadata.Prefixes.AsQueryable() var prefix = await _contextOrg.prefixe.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId));
if (prefix == null) if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound); throw new Exception(GlobalMessages.PrefixNotFound);
candidate.PrefixId = prefix.Id; candidate.PrefixId = prefix.Id;
candidate.PrefixName = prefix.Name; candidate.PrefixName = prefix.name;
} }
if (updated.ContactPrefixId != null) if (updated.ContactPrefixId != null)
{ {
var prefix = await _contextMetadata.Prefixes.AsQueryable() var prefix = await _contextOrg.prefixe.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.ContactPrefixId); .FirstOrDefaultAsync(x => x.Id == updated.ContactPrefixId);
if (prefix == null) if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound); throw new Exception(GlobalMessages.PrefixNotFound);
candidate.ContactPrefixId = prefix.Id; candidate.ContactPrefixId = prefix.Id;
candidate.ContactPrefixName = prefix.Name; candidate.ContactPrefixName = prefix.name;
} }
if (updated.ReligionId != null) if (updated.ReligionId != null)
{ {
var religion = await _contextMetadata.Religions.AsQueryable() var religion = await _contextOrg.religion.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ReligionId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ReligionId));
if (religion == null) if (religion == null)
throw new Exception(GlobalMessages.ReligionNotFound); throw new Exception(GlobalMessages.ReligionNotFound);
candidate.ReligionId = religion.Id; candidate.ReligionId = religion.Id;
candidate.ReligionName = religion.Name; candidate.ReligionName = religion.name;
} }
if (updated.RegistProvinceId != null) if (updated.RegistProvinceId != null)
{ {
var registProvince = await _contextMetadata.Provinces.AsQueryable() var registProvince = await _contextOrg.province.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistProvinceId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistProvinceId));
if (registProvince == null) if (registProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound); throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.RegistProvinceId = registProvince.Id; candidate.RegistProvinceId = registProvince.Id;
candidate.RegistProvinceName = registProvince.Name; candidate.RegistProvinceName = registProvince.name;
} }
if (updated.RegistDistrictId != null) if (updated.RegistDistrictId != null)
{ {
var registDistrict = await _contextMetadata.Districts.AsQueryable() var registDistrict = await _contextOrg.district.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistDistrictId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistDistrictId));
if (registDistrict == null) if (registDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound); throw new Exception(GlobalMessages.DistrictNotFound);
candidate.RegistDistrictId = registDistrict.Id; candidate.RegistDistrictId = registDistrict.Id;
candidate.RegistDistrictName = registDistrict.Name; candidate.RegistDistrictName = registDistrict.name;
} }
if (updated.RegistSubDistrictId != null) if (updated.RegistSubDistrictId != null)
{ {
var registSubDistrict = await _contextMetadata.SubDistricts.AsQueryable() var registSubDistrict = await _contextOrg.subDistrict.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistSubDistrictId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistSubDistrictId));
if (registSubDistrict == null) if (registSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound); throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.RegistSubDistrictId = registSubDistrict.Id; candidate.RegistSubDistrictId = registSubDistrict.Id;
candidate.RegistSubDistrictName = registSubDistrict.Name; candidate.RegistSubDistrictName = registSubDistrict.name;
candidate.RegistZipCode = registSubDistrict.ZipCode; candidate.RegistZipCode = registSubDistrict.zipCode;
} }
if (updated.CurrentProvinceId != null) if (updated.CurrentProvinceId != null)
{ {
var currentProvince = await _contextMetadata.Provinces.AsQueryable() var currentProvince = await _contextOrg.province.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentProvinceId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentProvinceId));
if (currentProvince == null) if (currentProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound); throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CurrentProvinceId = currentProvince.Id; candidate.CurrentProvinceId = currentProvince.Id;
candidate.CurrentProvinceName = currentProvince.Name; candidate.CurrentProvinceName = currentProvince.name;
} }
if (updated.CurrentDistrictId != null) if (updated.CurrentDistrictId != null)
{ {
var currentDistrict = await _contextMetadata.Districts.AsQueryable() var currentDistrict = await _contextOrg.district.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentDistrictId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentDistrictId));
if (currentDistrict == null) if (currentDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound); throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CurrentDistrictId = currentDistrict.Id; candidate.CurrentDistrictId = currentDistrict.Id;
candidate.CurrentDistrictName = currentDistrict.Name; candidate.CurrentDistrictName = currentDistrict.name;
} }
if (updated.CurrentSubDistrictId != null) if (updated.CurrentSubDistrictId != null)
{ {
var currentSubDistrict = await _contextMetadata.SubDistricts.AsQueryable() var currentSubDistrict = await _contextOrg.subDistrict.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentSubDistrictId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentSubDistrictId));
if (currentSubDistrict == null) if (currentSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound); throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.CurrentSubDistrictId = currentSubDistrict.Id; candidate.CurrentSubDistrictId = currentSubDistrict.Id;
candidate.CurrentSubDistrictName = currentSubDistrict.Name; candidate.CurrentSubDistrictName = currentSubDistrict.name;
candidate.CurrentZipCode = currentSubDistrict.ZipCode; candidate.CurrentZipCode = currentSubDistrict.zipCode;
} }
candidate.FirstName = updated.FirstName; candidate.FirstName = updated.FirstName;
@ -1121,24 +1119,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
}; };
if (updated.EducationLevelExamId != null) if (updated.EducationLevelExamId != null)
{ {
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null) if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
education.EducationLevelExamId = educationLevelExam.Id; education.EducationLevelExamId = educationLevelExam.Id;
education.EducationLevelExamName = educationLevelExam.Name; education.EducationLevelExamName = educationLevelExam.name;
} }
if (updated.EducationLevelHighId != null) if (updated.EducationLevelHighId != null)
{ {
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
if (educationLevelHigh == null) if (educationLevelHigh == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
education.EducationLevelHighId = educationLevelHigh.Id; education.EducationLevelHighId = educationLevelHigh.Id;
education.EducationLevelHighName = educationLevelHigh.Name; education.EducationLevelHighName = educationLevelHigh.name;
} }
await _context.Educations.AddAsync(education); await _context.Educations.AddAsync(education);
} }
@ -1155,24 +1153,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? ""; candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
if (updated.EducationLevelExamId != null) if (updated.EducationLevelExamId != null)
{ {
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null) if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id; candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name; candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.name;
} }
if (updated.EducationLevelHighId != null) if (updated.EducationLevelHighId != null)
{ {
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
if (educationLevelHigh == null) if (educationLevelHigh == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id; candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name; candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.name;
} }
} }
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
@ -1190,50 +1188,50 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (updated.PrefixId != null) if (updated.PrefixId != null)
{ {
var prefix = await _contextMetadata.Prefixes.AsQueryable() var prefix = await _contextOrg.prefixe.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId));
if (prefix == null) if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound); throw new Exception(GlobalMessages.PrefixNotFound);
candidate.PrefixId = prefix.Id; candidate.PrefixId = prefix.Id;
candidate.PrefixName = prefix.Name; candidate.PrefixName = prefix.name;
} }
if (updated.RelationshipId != null) if (updated.RelationshipId != null)
{ {
var relationship = await _contextMetadata.Relationships.AsQueryable() var relationship = await _contextOrg.relationship.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RelationshipId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RelationshipId));
if (relationship == null) if (relationship == null)
throw new Exception(GlobalMessages.RelationshipNotFound); throw new Exception(GlobalMessages.RelationshipNotFound);
candidate.RelationshipId = relationship.Id; candidate.RelationshipId = relationship.Id;
candidate.RelationshipName = relationship.Name; candidate.RelationshipName = relationship.name;
} }
if (updated.CitizenProvinceId != null) if (updated.CitizenProvinceId != null)
{ {
var citizenProvince = await _contextMetadata.Provinces.AsQueryable() var citizenProvince = await _contextOrg.province.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenProvinceId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenProvinceId));
if (citizenProvince == null) if (citizenProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound); throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CitizenProvinceId = citizenProvince.Id; candidate.CitizenProvinceId = citizenProvince.Id;
candidate.CitizenProvinceName = citizenProvince.Name; candidate.CitizenProvinceName = citizenProvince.name;
} }
if (updated.CitizenDistrictId != null) if (updated.CitizenDistrictId != null)
{ {
var citizenDistrict = await _contextMetadata.Districts.AsQueryable() var citizenDistrict = await _contextOrg.district.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenDistrictId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenDistrictId));
if (citizenDistrict == null) if (citizenDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound); throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CitizenDistrictId = citizenDistrict.Id; candidate.CitizenDistrictId = citizenDistrict.Id;
candidate.CitizenDistrictName = citizenDistrict.Name; candidate.CitizenDistrictName = citizenDistrict.name;
} }
candidate.FirstName = updated.FirstName; candidate.FirstName = updated.FirstName;
@ -1310,76 +1308,76 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (updated.RegistProvinceId != null) if (updated.RegistProvinceId != null)
{ {
var registProvince = await _contextMetadata.Provinces.AsQueryable() var registProvince = await _contextOrg.province.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistProvinceId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistProvinceId));
if (registProvince == null) if (registProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound); throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.RegistProvinceId = registProvince.Id; candidate.RegistProvinceId = registProvince.Id;
candidate.RegistProvinceName = registProvince.Name; candidate.RegistProvinceName = registProvince.name;
} }
if (updated.RegistDistrictId != null) if (updated.RegistDistrictId != null)
{ {
var registDistrict = await _contextMetadata.Districts.AsQueryable() var registDistrict = await _contextOrg.district.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistDistrictId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistDistrictId));
if (registDistrict == null) if (registDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound); throw new Exception(GlobalMessages.DistrictNotFound);
candidate.RegistDistrictId = registDistrict.Id; candidate.RegistDistrictId = registDistrict.Id;
candidate.RegistDistrictName = registDistrict.Name; candidate.RegistDistrictName = registDistrict.name;
} }
if (updated.RegistSubDistrictId != null) if (updated.RegistSubDistrictId != null)
{ {
var registSubDistrict = await _contextMetadata.SubDistricts.AsQueryable() var registSubDistrict = await _contextOrg.subDistrict.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistSubDistrictId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistSubDistrictId));
if (registSubDistrict == null) if (registSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound); throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.RegistSubDistrictId = registSubDistrict.Id; candidate.RegistSubDistrictId = registSubDistrict.Id;
candidate.RegistSubDistrictName = registSubDistrict.Name; candidate.RegistSubDistrictName = registSubDistrict.name;
candidate.RegistZipCode = registSubDistrict.ZipCode; candidate.RegistZipCode = registSubDistrict.zipCode;
} }
if (updated.CurrentProvinceId != null) if (updated.CurrentProvinceId != null)
{ {
var currentProvince = await _contextMetadata.Provinces.AsQueryable() var currentProvince = await _contextOrg.province.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentProvinceId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentProvinceId));
if (currentProvince == null) if (currentProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound); throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CurrentProvinceId = currentProvince.Id; candidate.CurrentProvinceId = currentProvince.Id;
candidate.CurrentProvinceName = currentProvince.Name; candidate.CurrentProvinceName = currentProvince.name;
} }
if (updated.CurrentDistrictId != null) if (updated.CurrentDistrictId != null)
{ {
var currentDistrict = await _contextMetadata.Districts.AsQueryable() var currentDistrict = await _contextOrg.district.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentDistrictId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentDistrictId));
if (currentDistrict == null) if (currentDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound); throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CurrentDistrictId = currentDistrict.Id; candidate.CurrentDistrictId = currentDistrict.Id;
candidate.CurrentDistrictName = currentDistrict.Name; candidate.CurrentDistrictName = currentDistrict.name;
} }
if (updated.CurrentSubDistrictId != null) if (updated.CurrentSubDistrictId != null)
{ {
var currentSubDistrict = await _contextMetadata.SubDistricts.AsQueryable() var currentSubDistrict = await _contextOrg.subDistrict.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentSubDistrictId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentSubDistrictId));
if (currentSubDistrict == null) if (currentSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound); throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.CurrentSubDistrictId = currentSubDistrict.Id; candidate.CurrentSubDistrictId = currentSubDistrict.Id;
candidate.CurrentSubDistrictName = currentSubDistrict.Name; candidate.CurrentSubDistrictName = currentSubDistrict.name;
candidate.CurrentZipCode = currentSubDistrict.ZipCode; candidate.CurrentZipCode = currentSubDistrict.zipCode;
} }
candidate.RegistAddress = updated.RegistAddress; candidate.RegistAddress = updated.RegistAddress;
@ -1401,38 +1399,38 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (updated.MarryPrefixId != null) if (updated.MarryPrefixId != null)
{ {
var prefix = await _contextMetadata.Prefixes.AsQueryable() var prefix = await _contextOrg.prefixe.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MarryPrefixId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MarryPrefixId));
if (prefix == null) if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound); throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MarryPrefixId = prefix.Id; candidate.MarryPrefixId = prefix.Id;
candidate.MarryPrefixName = prefix.Name; candidate.MarryPrefixName = prefix.name;
} }
if (updated.FatherPrefixId != null) if (updated.FatherPrefixId != null)
{ {
var prefix = await _contextMetadata.Prefixes.AsQueryable() var prefix = await _contextOrg.prefixe.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.FatherPrefixId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.FatherPrefixId));
if (prefix == null) if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound); throw new Exception(GlobalMessages.PrefixNotFound);
candidate.FatherPrefixId = prefix.Id; candidate.FatherPrefixId = prefix.Id;
candidate.FatherPrefixName = prefix.Name; candidate.FatherPrefixName = prefix.name;
} }
if (updated.MotherPrefixId != null) if (updated.MotherPrefixId != null)
{ {
var prefix = await _contextMetadata.Prefixes.AsQueryable() var prefix = await _contextOrg.prefixe.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MotherPrefixId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MotherPrefixId));
if (prefix == null) if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound); throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MotherPrefixId = prefix.Id; candidate.MotherPrefixId = prefix.Id;
candidate.MotherPrefixName = prefix.Name; candidate.MotherPrefixName = prefix.name;
} }
candidate.Marry = updated.Marry == null ? null : updated.Marry; candidate.Marry = updated.Marry == null ? null : updated.Marry;
@ -1485,14 +1483,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (updated.ContactPrefixId != null) if (updated.ContactPrefixId != null)
{ {
var prefix = await _contextMetadata.Prefixes.AsQueryable() var prefix = await _contextOrg.prefixe.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.ContactPrefixId); .FirstOrDefaultAsync(x => x.Id == updated.ContactPrefixId);
if (prefix == null) if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound); throw new Exception(GlobalMessages.PrefixNotFound);
candidate.ContactPrefixId = prefix.Id; candidate.ContactPrefixId = prefix.Id;
candidate.ContactPrefixName = prefix.Name; candidate.ContactPrefixName = prefix.name;
} }
candidate.ContactFirstname = updated.ContactFirstname; candidate.ContactFirstname = updated.ContactFirstname;
candidate.ContactLastname = updated.ContactLastname; candidate.ContactLastname = updated.ContactLastname;
@ -1681,24 +1679,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
}; };
if (updated.EducationLevelExamId != null) if (updated.EducationLevelExamId != null)
{ {
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null) if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
education.EducationLevelExamId = educationLevelExam.Id; education.EducationLevelExamId = educationLevelExam.Id;
education.EducationLevelExamName = educationLevelExam.Name; education.EducationLevelExamName = educationLevelExam.name;
} }
if (updated.EducationLevelHighId != null) if (updated.EducationLevelHighId != null)
{ {
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
if (educationLevelHigh == null) if (educationLevelHigh == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
education.EducationLevelHighId = educationLevelHigh.Id; education.EducationLevelHighId = educationLevelHigh.Id;
education.EducationLevelHighName = educationLevelHigh.Name; education.EducationLevelHighName = educationLevelHigh.name;
} }
await _context.Educations.AddAsync(education); await _context.Educations.AddAsync(education);
} }
@ -1715,24 +1713,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? ""; candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
if (updated.EducationLevelExamId != null) if (updated.EducationLevelExamId != null)
{ {
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null) if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id; candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name; candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.name;
} }
if (updated.EducationLevelHighId != null) if (updated.EducationLevelHighId != null)
{ {
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
if (educationLevelHigh == null) if (educationLevelHigh == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id; candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name; candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.name;
} }
} }
@ -1767,24 +1765,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
}; };
if (updated.EducationLevelExamId != null) if (updated.EducationLevelExamId != null)
{ {
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null) if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
education.EducationLevelExamId = educationLevelExam.Id; education.EducationLevelExamId = educationLevelExam.Id;
education.EducationLevelExamName = educationLevelExam.Name; education.EducationLevelExamName = educationLevelExam.name;
} }
if (updated.EducationLevelHighId != null) if (updated.EducationLevelHighId != null)
{ {
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
if (educationLevelHigh == null) if (educationLevelHigh == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
education.EducationLevelHighId = educationLevelHigh.Id; education.EducationLevelHighId = educationLevelHigh.Id;
education.EducationLevelHighName = educationLevelHigh.Name; education.EducationLevelHighName = educationLevelHigh.name;
} }
await _context.Educations.AddAsync(education); await _context.Educations.AddAsync(education);
} }
@ -1801,24 +1799,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? ""; candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
if (updated.EducationLevelExamId != null) if (updated.EducationLevelExamId != null)
{ {
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null) if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id; candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name; candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.name;
} }
if (updated.EducationLevelHighId != null) if (updated.EducationLevelHighId != null)
{ {
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable() var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId); .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
if (educationLevelHigh == null) if (educationLevelHigh == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id; candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name; candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.name;
} }
} }
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
@ -1868,7 +1866,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
// if (education == null) // if (education == null)
// throw new Exception(GlobalMessages.EducationNotFound); // throw new Exception(GlobalMessages.EducationNotFound);
// var educationLevel = await _contextMetadata.EducationLevels.AsQueryable() // var educationLevel = await _contextOrg.educationLevel.AsQueryable()
// .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.EducationLevelId)); // .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.EducationLevelId));
// if (educationLevel == null) // if (educationLevel == null)

View file

@ -1,18 +1,14 @@
using System.Security.Claims; using System.Security.Claims;
using System.Text.Json;
using BMA.EHR.Domain.Models.Placement; using BMA.EHR.Domain.Models.Placement;
using BMA.EHR.Recurit.Exam.Service.Extensions; using BMA.EHR.Recurit.Exam.Service.Extensions;
using BMA.EHR.Recurit.Exam.Service.Core; using BMA.EHR.Recurit.Exam.Service.Core;
using BMA.EHR.Recurit.Exam.Service.Data; using BMA.EHR.Recurit.Exam.Service.Data;
using BMA.EHR.Recurit.Exam.Service.Models; using BMA.EHR.Recurit.Exam.Service.Models;
using BMA.EHR.Recurit.Exam.Service.Models.Documents;
using BMA.EHR.Recurit.Exam.Service.Request; using BMA.EHR.Recurit.Exam.Service.Request;
using BMA.EHR.Recurit.Exam.Service.Response; using BMA.EHR.Recurit.Exam.Service.Response;
using BMA.EHR.Recurit.Exam.Service.Responses.Document; using BMA.EHR.Recurit.Exam.Service.Responses.Document;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json.Linq;
using OfficeOpenXml; using OfficeOpenXml;
using BMA.EHR.Domain.Models.Placement;
using OfficeOpenXml.Style; using OfficeOpenXml.Style;
using System.Text; using System.Text;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -26,6 +22,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
private readonly ApplicationDbContext _context; private readonly ApplicationDbContext _context;
private readonly MetadataDbContext _contextMetadata; private readonly MetadataDbContext _contextMetadata;
private readonly OrgDbContext _contextOrg;
private readonly IHttpContextAccessor _httpContextAccessor; private readonly IHttpContextAccessor _httpContextAccessor;
private readonly MinIOService _minioService; private readonly MinIOService _minioService;
private readonly MailService _mailService; private readonly MailService _mailService;
@ -37,6 +34,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
public PeriodExamService(ApplicationDbContext context, public PeriodExamService(ApplicationDbContext context,
MetadataDbContext contextMetadata, MetadataDbContext contextMetadata,
OrgDbContext contextOrg,
IHttpContextAccessor httpContextAccessor, IHttpContextAccessor httpContextAccessor,
MinIOService minioService, MinIOService minioService,
MailService mailService, MailService mailService,
@ -44,6 +42,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{ {
_context = context; _context = context;
_contextMetadata = contextMetadata; _contextMetadata = contextMetadata;
_contextOrg = contextOrg;
_httpContextAccessor = httpContextAccessor; _httpContextAccessor = httpContextAccessor;
_minioService = minioService; _minioService = minioService;
_mailService = mailService; _mailService = mailService;
@ -92,33 +91,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
} }
} }
private List<Guid?> GetAllIdByRoot(Guid id)
{
try
{
var ret = new List<Guid?>();
var oc = _contextMetadata.Organizations.FirstOrDefault(x => x.Id == id && x.IsActive);
if (oc != null)
ret.Add(oc.Id);
var child = _contextMetadata.Organizations.AsQueryable().Where(x => x.ParentId == id && x.IsActive).ToList();
if (child.Any())
{
foreach (var item in child)
{
ret.AddRange(GetAllIdByRoot(item.Id));
}
}
return ret;
}
catch
{
throw;
}
}
public async Task<IEnumerable<PeriodExamCandidateResponseItem>> GetsAsync(string type, bool showAll = true) public async Task<IEnumerable<PeriodExamCandidateResponseItem>> GetsAsync(string type, bool showAll = true)
{ {
var periodExams = await _context.PeriodExams.AsQueryable() var periodExams = await _context.PeriodExams.AsQueryable()
@ -126,11 +98,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(p => p.CheckDisability == false) .Where(p => p.CheckDisability == false)
.Where(p => type.ToUpper() == "ALL" ? (p.AnnouncementExam == true || p.AnnouncementExam == false) : (type.ToUpper() == "EXAM" ? p.AnnouncementExam == true : p.AnnouncementExam == false)) .Where(p => type.ToUpper() == "ALL" ? (p.AnnouncementExam == true || p.AnnouncementExam == false) : (type.ToUpper() == "EXAM" ? p.AnnouncementExam == true : p.AnnouncementExam == false))
.OrderByDescending(d => d.CreatedAt).ToListAsync(); .OrderByDescending(d => d.CreatedAt).ToListAsync();
var profileOrganizations = await _contextMetadata.ProfileOrganizations.AsQueryable()
.ToListAsync();
var _periodExams = (from x in periodExams var _periodExams = (from x in periodExams
join po in profileOrganizations on Guid.Parse(x.CreatedUserId) equals po?.UserId into poGroup
from po in poGroup.DefaultIfEmpty()
select new PeriodExamCandidateResponseItem select new PeriodExamCandidateResponseItem
{ {
ExamDate = x.ExamDate, ExamDate = x.ExamDate,
@ -161,30 +129,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Round = x.Round, Round = x.Round,
SetSeat = x.SetSeat, SetSeat = x.SetSeat,
Year = x.Year, Year = x.Year,
OcId = po == null ? null : po.OrganizationId,
CreatedUserId = x.CreatedUserId, CreatedUserId = x.CreatedUserId,
}).AsQueryable() }).AsQueryable()
.ToList(); .ToList();
var roles = _httpContextAccessor?.HttpContext?.User?.FindAll(ClaimTypes.Role)?.Select(c => c.Value).ToList(); var roles = _httpContextAccessor?.HttpContext?.User?.FindAll(ClaimTypes.Role)?.Select(c => c.Value).ToList();
// if (!roles.Contains("head"))
// {
// var criteria = new List<Guid?>();
// var profileOrganization = await _contextMetadata.ProfileOrganizations.AsQueryable()
// .FirstOrDefaultAsync(x => x.UserId == Guid.Parse(UserId));
// if (profileOrganization == null)
// return new List<PeriodExamCandidateResponseItem>();
// var ocId = _contextMetadata.Organizations.AsQueryable()
// .FirstOrDefault(x => x.Id == profileOrganization.OrganizationId);
// if (ocId == null)
// return new List<PeriodExamCandidateResponseItem>();
// criteria = GetAllIdByRoot(ocId.Id);
// if (criteria.Any())
// _periodExams = _periodExams.Where(x => x.CreatedUserId == UserId || criteria.Contains(x.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OcId)).ToList();
// }
return _periodExams; return _periodExams;
} }
@ -1810,7 +1759,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
} }
if (careers.Count == 0) if (careers.Count == 0)
row++; row++;
Console.WriteLine(num);
num = num + 1; num = num + 1;
} }
summarySheet.Cells[summarySheet.Dimension.Address].AutoFitColumns(); summarySheet.Cells[summarySheet.Dimension.Address].AutoFitColumns();
@ -2080,13 +2028,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
throw new Exception(GlobalMessages.ExamNotFound); throw new Exception(GlobalMessages.ExamNotFound);
var _placement = await _contextMetadata.Placements.AsQueryable() var _placement = await _contextMetadata.Placements.AsQueryable()
.FirstOrDefaultAsync(x => x.Name == periodExam.Name && x.Year == ((int)(periodExam.Year == null ? 0 : periodExam.Year))); .FirstOrDefaultAsync(x => x.PlacementType.Name == "สอบคัดเลือก" && x.RefId == periodExam.Id);
if (_placement != null) if (_placement != null)
throw new Exception("รอบการสอบนี้ได้ทำการบรรจุไปแล้ว"); throw new Exception("รอบการสอบนี้ได้ทำการบรรจุไปแล้ว");
var placement = new Placement var placement = new Placement
{ {
Name = periodExam.Name, Name = periodExam.Name,
RefId = periodExam.Id,
Round = periodExam.Round == null ? "" : periodExam.Round.ToString(), Round = periodExam.Round == null ? "" : periodExam.Round.ToString(),
Year = (int)(periodExam.Year == null ? 0 : periodExam.Year), Year = (int)(periodExam.Year == null ? 0 : periodExam.Year),
Number = periodExam.Candidate.Where(x => x.Status.Contains("done")).Count(), Number = periodExam.Candidate.Where(x => x.Status.Contains("done")).Count(),
@ -2126,65 +2075,50 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
} }
} }
var profile = await _contextMetadata.Profiles
.Include(x => x.Salaries)
.FirstOrDefaultAsync(p => p.CitizenId == candidate.CitizenId);
var Prefix = await _contextMetadata.Prefixes.Where(x => x.Id == candidate.PrefixId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.PrefixId).FirstOrDefaultAsync();
var Religion = await _contextMetadata.Religions.Where(x => x.Id == candidate.ReligionId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.ReligionId).FirstOrDefaultAsync();
var CitizenDistrict = await _contextMetadata.Districts.Where(x => x.Id == candidate.CitizenDistrictId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.CitizenDistrictId).FirstOrDefaultAsync();
var CitizenProvince = await _contextMetadata.Provinces.Where(x => x.Id == candidate.CitizenProvinceId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.CitizenProvinceId).FirstOrDefaultAsync();
var RegistProvince = await _contextMetadata.Provinces.Where(x => x.Id == candidate.RegistProvinceId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.RegistProvinceId).FirstOrDefaultAsync();
var RegistDistrict = await _contextMetadata.Districts.Where(x => x.Id == candidate.RegistDistrictId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.RegistDistrictId).FirstOrDefaultAsync();
var RegistSubDistrict = await _contextMetadata.SubDistricts.Where(x => x.Id == candidate.RegistSubDistrictId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.RegistSubDistrictId).FirstOrDefaultAsync();
var CurrentProvince = await _contextMetadata.Provinces.Where(x => x.Id == candidate.CurrentProvinceId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.CurrentProvinceId).FirstOrDefaultAsync();
var CurrentDistrict = await _contextMetadata.Districts.Where(x => x.Id == candidate.CurrentDistrictId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.CurrentDistrictId).FirstOrDefaultAsync();
var CurrentSubDistrict = await _contextMetadata.SubDistricts.Where(x => x.Id == candidate.CurrentSubDistrictId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.CurrentSubDistrictId).FirstOrDefaultAsync();
var MarryPrefix = await _contextMetadata.Prefixes.Where(x => x.Id == candidate.MarryPrefixId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.MarryPrefixId).FirstOrDefaultAsync();
var FatherPrefix = await _contextMetadata.Prefixes.Where(x => x.Id == candidate.FatherPrefixId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.FatherPrefixId).FirstOrDefaultAsync();
var MotherPrefix = await _contextMetadata.Prefixes.Where(x => x.Id == candidate.MotherPrefixId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.MotherPrefixId).FirstOrDefaultAsync();
var placementProfile = new PlacementProfile var placementProfile = new PlacementProfile
{ {
Placement = placement, Placement = placement,
PositionCandidate = await _contextMetadata.PositionPaths.FirstOrDefaultAsync(x => x.Id == (candidate.PositionExam == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : candidate.PositionExam.PositionId)), PositionCandidate = candidate?.PositionExam?.PositionName ?? null,
positionName = candidate.PositionExam.PositionName, PositionLevel = candidate?.PositionExam?.PositionLevelName ?? null,
Prefix = Prefix == null ? null : Prefix.Name, PositionType = candidate.PositionExam == null ? null : (candidate.PositionExam.HighDegree == null ? null : (candidate.PositionExam.HighDegree == true ? "วิชาการ" : "ทั่วไป")),
ProfileImg = candidate.ProfileImg, Prefix = candidate.PrefixName,
// ProfileImg = candidate.ProfileImg,
Firstname = candidate.FirstName, Firstname = candidate.FirstName,
Lastname = candidate.LastName, Lastname = candidate.LastName,
Nationality = candidate.Nationality, Nationality = candidate.Nationality,
DateOfBirth = candidate.DateOfBirth, DateOfBirth = candidate.DateOfBirth,
Religion = Religion == null ? null : Religion.Name, Religion = candidate.ReligionName,
Email = candidate.Email, Email = candidate.Email,
CitizenId = candidate.CitizenId, CitizenId = candidate.CitizenId,
CitizenDistrictId = CitizenDistrict == null ? null : CitizenDistrict.Id.ToString(), CitizenDistrictId = candidate.CitizenDistrictId,
CitizenProvinceId = CitizenProvince == null ? null : CitizenProvince.Id.ToString(), CitizenProvinceId = candidate.CitizenProvinceId,
CitizenDate = candidate.CitizenDate, CitizenDate = candidate.CitizenDate,
Telephone = candidate.Telephone, Telephone = candidate.Telephone,
MobilePhone = candidate.MobilePhone, MobilePhone = candidate.MobilePhone,
Knowledge = candidate.Knowledge, Knowledge = candidate.Knowledge,
RegistAddress = candidate.RegistAddress, RegistAddress = candidate.RegistAddress,
RegistProvinceId = RegistProvince == null ? null : RegistProvince.Id.ToString(), RegistProvinceId = candidate.RegistProvinceId,
RegistDistrictId = RegistDistrict == null ? null : RegistDistrict.Id.ToString(), RegistDistrictId = candidate.RegistDistrictId,
RegistSubDistrictId = RegistSubDistrict == null ? null : RegistSubDistrict.Id.ToString(), RegistSubDistrictId = candidate.RegistSubDistrictId,
RegistZipCode = candidate.RegistZipCode, RegistZipCode = candidate.RegistZipCode,
RegistSame = candidate.RegistSame, RegistSame = candidate.RegistSame,
CurrentAddress = candidate.CurrentAddress, CurrentAddress = candidate.CurrentAddress,
CurrentProvinceId = CurrentProvince == null ? null : CurrentProvince.Id.ToString(), CurrentProvinceId = candidate.CurrentProvinceId,
CurrentDistrictId = CurrentDistrict == null ? null : CurrentDistrict.Id.ToString(), CurrentDistrictId = candidate.CurrentDistrictId,
CurrentSubDistrictId = CurrentSubDistrict == null ? null : CurrentSubDistrict.Id.ToString(), CurrentSubDistrictId = candidate.CurrentSubDistrictId,
CurrentZipCode = candidate.CurrentZipCode, CurrentZipCode = candidate.CurrentZipCode,
Marry = candidate.Marry, Marry = candidate.Marry,
MarryPrefix = MarryPrefix == null ? null : MarryPrefix.Name, MarryPrefix = candidate.MarryPrefixName,
MarryFirstName = candidate.MarryFirstName, MarryFirstName = candidate.MarryFirstName,
MarryLastName = candidate.MarryLastName, MarryLastName = candidate.MarryLastName,
MarryOccupation = candidate.MarryOccupation, MarryOccupation = candidate.MarryOccupation,
MarryNationality = candidate.MarryNationality, MarryNationality = candidate.MarryNationality,
FatherPrefix = FatherPrefix == null ? null : FatherPrefix.Name, FatherPrefix = candidate.FatherPrefixName,
FatherFirstName = candidate.FatherFirstName, FatherFirstName = candidate.FatherFirstName,
FatherLastName = candidate.FatherLastName, FatherLastName = candidate.FatherLastName,
FatherOccupation = candidate.FatherOccupation, FatherOccupation = candidate.FatherOccupation,
FatherNationality = candidate.FatherNationality, FatherNationality = candidate.FatherNationality,
MotherPrefix = MotherPrefix == null ? null : MotherPrefix.Name, MotherPrefix = candidate.MotherPrefixName,
MotherFirstName = candidate.MotherFirstName, MotherFirstName = candidate.MotherFirstName,
MotherLastName = candidate.MotherLastName, MotherLastName = candidate.MotherLastName,
MotherOccupation = candidate.MotherOccupation, MotherOccupation = candidate.MotherOccupation,
@ -2195,8 +2129,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
OccupationSalary = candidate.OccupationSalary, OccupationSalary = candidate.OccupationSalary,
OccupationPosition = candidate.OccupationPosition, OccupationPosition = candidate.OccupationPosition,
OccupationPositionType = candidate.OccupationPositionType, OccupationPositionType = candidate.OccupationPositionType,
PositionLevel = candidate.PositionExam.PositionLevelName,
PositionType = candidate.PositionExam == null ? null : (candidate.PositionExam.HighDegree == null ? null : (candidate.PositionExam.HighDegree == true ? "วิชาการ":"ทั่วไป")),
OccupationTelephone = candidate.OccupationTelephone, OccupationTelephone = candidate.OccupationTelephone,
PointTotalA = candidate.PointTotalA == null ? null : Convert.ToDouble(candidate.PointTotalA), PointTotalA = candidate.PointTotalA == null ? null : Convert.ToDouble(candidate.PointTotalA),
PointA = candidate.PointA == null ? null : Convert.ToDouble(candidate.PointA), PointA = candidate.PointA == null ? null : Convert.ToDouble(candidate.PointA),
@ -2210,9 +2142,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
PlacementStatus = "UN-CONTAIN", PlacementStatus = "UN-CONTAIN",
Pass = candidate.Pass, Pass = candidate.Pass,
RemarkHorizontal = "โดยมีเงื่อนไขว่าต้องปฏิบัติงานให้กรุงเทพมหานครเป็นระยะเวลาไม่น้อยกว่า ๕ ปี นับแต่วันที่ได้รับการบรรจุและแต่งตั้ง โดยห้ามโอนไปหน่วยงานหรือส่วนราชการอื่น เว้นเเต่ลาออกจากราชการ", RemarkHorizontal = "โดยมีเงื่อนไขว่าต้องปฏิบัติงานให้กรุงเทพมหานครเป็นระยะเวลาไม่น้อยกว่า ๕ ปี นับแต่วันที่ได้รับการบรรจุและแต่งตั้ง โดยห้ามโอนไปหน่วยงานหรือส่วนราชการอื่น เว้นเเต่ลาออกจากราชการ",
Amount = org == null || org.result == null ? null : org.result.amount, Amount = org?.result?.amount ?? null,
PositionSalaryAmount = org == null || org.result == null ? null : org.result.positionSalaryAmount, PositionSalaryAmount = org?.result?.positionSalaryAmount ?? null,
MouthSalaryAmount = org == null || org.result == null ? null : org.result.mouthSalaryAmount, MouthSalaryAmount = org?.result?.mouthSalaryAmount ?? null,
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "", CreatedUserId = UserId ?? "",
CreatedFullName = FullName ?? "", CreatedFullName = FullName ?? "",
@ -2220,36 +2152,34 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
LastUpdateUserId = UserId ?? "", LastUpdateUserId = UserId ?? "",
LastUpdateFullName = FullName ?? "", LastUpdateFullName = FullName ?? "",
IsOfficer = IsOfficer, IsOfficer = IsOfficer,
profileId = org == null || org.result == null ? null : org.result.profileId, profileId = org?.result?.profileId ?? null,
IsOld = org == null || org.result == null ? false : true, IsOld = org == null || org.result == null ? false : true,
AmountOld = org == null || org.result == null ? null : org.result.AmountOld, AmountOld = org?.result?.AmountOld ?? null,
nodeOld = org == null || org.result == null ? null : org.result.node, nodeOld = org?.result?.node ?? null,
nodeIdOld = org == null || org.result == null ? null : org.result.nodeId, nodeIdOld = org?.result?.nodeId ?? null,
posmasterIdOld = org == null || org.result == null ? null : org.result.posmasterId, posmasterIdOld = org?.result?.posmasterId ?? null,
rootOld = org == null || org.result == null ? null : org.result.root, rootOld = org?.result?.root ?? null,
rootIdOld = org == null || org.result == null ? null : org.result.rootId, rootIdOld = org?.result?.rootId ?? null,
rootShortNameOld = org == null || org.result == null ? null : org.result.rootShortName, rootShortNameOld = org?.result?.rootShortName ?? null,
child1Old = org == null || org.result == null ? null : org.result.child1, child1Old = org?.result?.child1 ?? null,
child1IdOld = org == null || org.result == null ? null : org.result.child1Id, child1IdOld = org?.result?.child1Id ?? null,
child1ShortNameOld = org == null || org.result == null ? null : org.result.child1ShortName, child1ShortNameOld = org?.result?.child1ShortName ?? null,
child2Old = org == null || org.result == null ? null : org.result.child2, child2Old = org?.result?.child2 ?? null,
child2IdOld = org == null || org.result == null ? null : org.result.child2Id, child2IdOld = org?.result?.child2Id ?? null,
child2ShortNameOld = org == null || org.result == null ? null : org.result.child2ShortName, child2ShortNameOld = org?.result?.child2ShortName ?? null,
child3Old = org == null || org.result == null ? null : org.result.child3, child3Old = org?.result?.child3 ?? null,
child3IdOld = org == null || org.result == null ? null : org.result.child3Id, child3IdOld = org?.result?.child3Id ?? null,
child3ShortNameOld = org == null || org.result == null ? null : org.result.child3ShortName, child3ShortNameOld = org?.result?.child3ShortName ?? null,
child4Old = org == null || org.result == null ? null : org.result.child4, child4Old = org?.result?.child4 ?? null,
child4IdOld = org == null || org.result == null ? null : org.result.child4Id, child4IdOld = org?.result?.child4Id ?? null,
child4ShortNameOld = org == null || org.result == null ? null : org.result.child4ShortName, child4ShortNameOld = org?.result?.child4ShortName ?? null,
orgRevisionIdOld = org == null || org.result == null ? null : org.result.orgRevisionId, orgRevisionIdOld = org?.result?.orgRevisionId ?? null,
// positionIdOld = org == null || org.result == null ? null : org.result.positionIdOld, posMasterNoOld = org?.result?.posMasterNo ?? null,
posMasterNoOld = org == null || org.result == null ? null : org.result.posMasterNo, positionNameOld = org?.result?.position ?? null,
positionNameOld = org == null || org.result == null ? null : org.result.position, posTypeIdOld = org?.result?.posTypeId ?? null,
// positionFieldOld = org == null || org.result == null ? null : org.result.positionFieldOld, posTypeNameOld = org?.result?.posTypeName ?? null,
posTypeIdOld = org == null || org.result == null ? null : org.result.posTypeId, posLevelIdOld = org?.result?.posLevelId ?? null,
posTypeNameOld = org == null || org.result == null ? null : org.result.posTypeName, posLevelNameOld = org?.result?.posLevelName ?? null,
posLevelIdOld = org == null || org.result == null ? null : org.result.posLevelId,
posLevelNameOld = org == null || org.result == null ? null : org.result.posLevelName,
}; };
await _contextMetadata.PlacementProfiles.AddAsync(placementProfile); await _contextMetadata.PlacementProfiles.AddAsync(placementProfile);
@ -2258,7 +2188,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var placementEducation = new PlacementEducation var placementEducation = new PlacementEducation
{ {
PlacementProfile = placementProfile, PlacementProfile = placementProfile,
EducationLevel = await _contextMetadata.EducationLevels.FirstOrDefaultAsync(x => x.Id == education.EducationLevelExamId), EducationLevelId = education.EducationLevelExamId,
EducationLevelName = education.EducationLevelExamName,
Field = education.EducationMajor, Field = education.EducationMajor,
Gpa = education.EducationScores, Gpa = education.EducationScores,
Institute = education.EducationLocation, Institute = education.EducationLocation,
@ -2287,13 +2218,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
throw new Exception(GlobalMessages.ExamNotFound); throw new Exception(GlobalMessages.ExamNotFound);
var _placement = await _contextMetadata.Placements.AsQueryable() var _placement = await _contextMetadata.Placements.AsQueryable()
.FirstOrDefaultAsync(x => x.Name == periodExam.Name && x.Year == ((int)(periodExam.Year == null ? 0 : periodExam.Year))); .FirstOrDefaultAsync(x => x.PlacementType.Name == "คัดเลือกคนพิการ" && x.RefId == periodExam.Id);
if (_placement != null) if (_placement != null)
throw new Exception("รอบการสอบนี้ได้ทำการบรรจุไปแล้ว"); throw new Exception("รอบการสอบนี้ได้ทำการบรรจุไปแล้ว");
var placement = new Placement var placement = new Placement
{ {
Name = periodExam.Name, Name = periodExam.Name,
RefId = periodExam.Id,
Round = periodExam.Round == null ? "" : periodExam.Round.ToString(), Round = periodExam.Round == null ? "" : periodExam.Round.ToString(),
Year = (int)(periodExam.Year == null ? 0 : periodExam.Year), Year = (int)(periodExam.Year == null ? 0 : periodExam.Year),
Number = await _context.Disables.AsQueryable().Where(x => x.PeriodExam == periodExam).CountAsync(), Number = await _context.Disables.AsQueryable().Where(x => x.PeriodExam == periodExam).CountAsync(),
@ -2356,21 +2288,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.FirstOrDefaultAsync(x => x.ExamId == candidate.ExamId && x.ScoreImport == scoreImport); .FirstOrDefaultAsync(x => x.ExamId == candidate.ExamId && x.ScoreImport == scoreImport);
if (disableScore == null) if (disableScore == null)
continue; continue;
var profile = await _contextMetadata.Profiles
.Include(x => x.Salaries)
.FirstOrDefaultAsync(p => p.CitizenId == candidate.CitizenId);
var CitizenProvince = await _contextMetadata.Provinces.Where(x => x.Name == candidate.CitizenCardIssuer).FirstOrDefaultAsync();
var RegistProvince = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.Provinces.Where(x => x.Name == candidate.Addresses.FirstOrDefault().Province).FirstOrDefaultAsync();
var RegistDistrict = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.Districts.Where(x => x.Name == candidate.Addresses.FirstOrDefault().District).FirstOrDefaultAsync();
var RegistSubDistrict = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.SubDistricts.Where(x => x.Name == candidate.Addresses.FirstOrDefault().Amphur).FirstOrDefaultAsync();
var CurrentProvince = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.Provinces.Where(x => x.Name == candidate.Addresses.FirstOrDefault().Province1).FirstOrDefaultAsync();
var CurrentDistrict = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.Districts.Where(x => x.Name == candidate.Addresses.FirstOrDefault().District1).FirstOrDefaultAsync();
var CurrentSubDistrict = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.SubDistricts.Where(x => x.Name == candidate.Addresses.FirstOrDefault().Amphur1).FirstOrDefaultAsync();
var placementProfile = new PlacementProfile var placementProfile = new PlacementProfile
{ {
Placement = placement, Placement = placement,
PositionCandidate = await _contextMetadata.PositionPaths.FirstOrDefaultAsync(x => x.Name == candidate.PositionName), PositionCandidate = candidate.PositionName,
positionName = candidate.PositionName, PositionType = candidate.PositionType,
PositionLevel = candidate.PositionLevel,
Prefix = candidate.Prefix, Prefix = candidate.Prefix,
Firstname = candidate.FirstName, Firstname = candidate.FirstName,
Lastname = candidate.LastName, Lastname = candidate.LastName,
@ -2380,48 +2303,27 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Religion = candidate.Religion, Religion = candidate.Religion,
DateOfBirth = candidate.DateOfBirth, DateOfBirth = candidate.DateOfBirth,
Relationship = candidate.Marry, Relationship = candidate.Marry,
// Email = candidate.Email,
CitizenId = candidate.CitizenId, CitizenId = candidate.CitizenId,
// CitizenDistrict = await _contextMetadata.Districts.FirstOrDefaultAsync(x => x.Id == candidate.CitizenDistrictId), CitizenProvinceId = _contextOrg.province.FirstOrDefault(x => x.name == candidate.CitizenCardIssuer)?.Id ?? null,
CitizenProvinceId = CitizenProvince == null ? null : CitizenProvince.Id.ToString(),
CitizenDate = candidate.CitizenCardExpireDate, CitizenDate = candidate.CitizenCardExpireDate,
Telephone = candidate.Addresses.FirstOrDefault() == null ? null : candidate.Addresses.FirstOrDefault().Telephone, Telephone = candidate?.Addresses?.FirstOrDefault()?.Telephone ?? null,
MobilePhone = candidate.Addresses.FirstOrDefault() == null ? null : candidate.Addresses.FirstOrDefault().Mobile, MobilePhone = candidate?.Addresses?.FirstOrDefault()?.Mobile ?? null,
// Knowledge = candidate.Knowledge,
RegistAddress = $"{Address}{Moo}{Soi}{Road}", RegistAddress = $"{Address}{Moo}{Soi}{Road}",
RegistProvinceId = RegistProvince == null ? null : RegistProvince.Id.ToString(), RegistProvinceId = _contextOrg.province.FirstOrDefault(x => x.name == (candidate!.Addresses!.FirstOrDefault()!.Province ?? ""))?.Id ?? null,
RegistDistrictId = RegistDistrict == null ? null : RegistDistrict.Id.ToString(), RegistDistrictId = _contextOrg.district.FirstOrDefault(x => x.name == (candidate!.Addresses!.FirstOrDefault()!.District ?? ""))?.Id ?? null,
RegistSubDistrictId = RegistSubDistrict == null ? null : RegistSubDistrict.Id.ToString(), RegistSubDistrictId = _contextOrg.subDistrict.FirstOrDefault(x => x.name == (candidate!.Addresses!.FirstOrDefault()!.Soi ?? ""))?.Id ?? null,
RegistZipCode = candidate.Addresses.FirstOrDefault() == null ? null : candidate.Addresses.FirstOrDefault().ZipCode, RegistZipCode = candidate?.Addresses?.FirstOrDefault()?.ZipCode ?? null,
RegistSame = false, RegistSame = false,
CurrentAddress = $"{Address1}{Moo1}{Soi1}{Road1}", CurrentAddress = $"{Address1}{Moo1}{Soi1}{Road1}",
CurrentProvinceId = CurrentProvince == null ? null : CurrentProvince.Id.ToString(), CurrentProvinceId = _contextOrg.province.FirstOrDefault(x => x.name == (candidate!.Addresses!.FirstOrDefault()!.Province1 ?? ""))?.Id ?? null,
CurrentDistrictId = CurrentDistrict == null ? null : CurrentDistrict.Id.ToString(), CurrentDistrictId = _contextOrg.district.FirstOrDefault(x => x.name == (candidate!.Addresses!.FirstOrDefault()!.District1 ?? ""))?.Id ?? null,
CurrentSubDistrictId = CurrentSubDistrict == null ? null : CurrentSubDistrict.Id.ToString(), CurrentSubDistrictId = _contextOrg.subDistrict.FirstOrDefault(x => x.name == (candidate!.Addresses!.FirstOrDefault()!.Soi1 ?? ""))?.Id ?? null,
CurrentZipCode = candidate.Addresses.FirstOrDefault() == null ? null : candidate.Addresses.FirstOrDefault().ZipCode1, CurrentZipCode = candidate?.Addresses?.FirstOrDefault()?.ZipCode1 ?? null,
Marry = candidate.Marry.Contains("สมรส"), Marry = candidate?.Marry?.Contains("สมรส") ?? false,
// MarryPrefix = await _contextMetadata.Prefixes.FirstOrDefaultAsync(x => x.Id == candidate.MarryPrefixId),
// MarryFirstName = candidate.MarryFirstName,
// MarryLastName = candidate.MarryLastName,
// MarryOccupation = candidate.MarryOccupation,
// MarryNationality = candidate.MarryNationality,
// FatherPrefix = await _contextMetadata.Prefixes.FirstOrDefaultAsync(x => x.Id == candidate.FatherPrefixId),
// FatherFirstName = candidate.FatherFirstName,
// FatherLastName = candidate.FatherLastName,
// FatherOccupation = candidate.FatherOccupation,
// FatherNationality = candidate.FatherNationality,
// MotherPrefix = await _contextMetadata.Prefixes.FirstOrDefaultAsync(x => x.Id == candidate.MotherPrefixId),
// MotherFirstName = candidate.MotherFirstName,
// MotherLastName = candidate.MotherLastName,
// MotherOccupation = candidate.MotherOccupation,
// MotherNationality = candidate.MotherNationality,
OccupationPositionType = "other", OccupationPositionType = "other",
// OccupationCompany = candidate.OccupationCompany, OccupationTelephone = candidate?.Occupations?.FirstOrDefault()?.Telephone ?? null,
// OccupationDepartment = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Workplace, OccupationPosition = candidate?.Occupations?.FirstOrDefault()?.Position ?? null,
// OccupationEmail = candidate.OccupationEmail,
OccupationTelephone = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Telephone,
OccupationPosition = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Position,
PointTotalA = disableScore == null ? null : Convert.ToDouble(disableScore.FullA), PointTotalA = disableScore == null ? null : Convert.ToDouble(disableScore.FullA),
PointA = disableScore == null ? null : Convert.ToDouble(disableScore.SumA), PointA = disableScore == null ? null : Convert.ToDouble(disableScore.SumA),
@ -2435,10 +2337,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
PlacementStatus = "UN-CONTAIN", PlacementStatus = "UN-CONTAIN",
Pass = disableScore == null ? null : disableScore.ExamStatus, Pass = disableScore == null ? null : disableScore.ExamStatus,
RemarkHorizontal = "โดยมีเงื่อนไขว่าต้องปฏิบัติงานให้กรุงเทพมหานครเป็นระยะเวลาไม่น้อยกว่า ๕ ปี นับแต่วันที่ได้รับการบรรจุและแต่งตั้ง โดยห้ามโอนไปหน่วยงานหรือส่วนราชการอื่น เว้นเเต่ลาออกจากราชการ", RemarkHorizontal = "โดยมีเงื่อนไขว่าต้องปฏิบัติงานให้กรุงเทพมหานครเป็นระยะเวลาไม่น้อยกว่า ๕ ปี นับแต่วันที่ได้รับการบรรจุและแต่งตั้ง โดยห้ามโอนไปหน่วยงานหรือส่วนราชการอื่น เว้นเเต่ลาออกจากราชการ",
// ReportingDate = DateTime.Now, Amount = org?.result?.amount ?? null,
Amount = org == null || org.result == null ? null : org.result.amount, PositionSalaryAmount = org?.result?.positionSalaryAmount ?? null,
PositionSalaryAmount = org == null || org.result == null ? null : org.result.positionSalaryAmount, MouthSalaryAmount = org?.result?.mouthSalaryAmount ?? null,
MouthSalaryAmount = org == null || org.result == null ? null : org.result.mouthSalaryAmount,
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "", CreatedUserId = UserId ?? "",
CreatedFullName = FullName ?? "", CreatedFullName = FullName ?? "",
@ -2446,56 +2347,48 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
LastUpdateUserId = UserId ?? "", LastUpdateUserId = UserId ?? "",
LastUpdateFullName = FullName ?? "", LastUpdateFullName = FullName ?? "",
IsOfficer = IsOfficer, IsOfficer = IsOfficer,
profileId = org == null || org.result == null ? null : org.result.profileId, profileId = org?.result?.profileId ?? null,
IsOld = org == null || org.result == null ? false : true, IsOld = org == null || org.result == null ? false : true,
AmountOld = org == null || org.result == null ? null : org.result.AmountOld, AmountOld = org?.result?.AmountOld ?? null,
nodeOld = org == null || org.result == null ? null : org.result.node, nodeOld = org?.result?.node ?? null,
nodeIdOld = org == null || org.result == null ? null : org.result.nodeId, nodeIdOld = org?.result?.nodeId ?? null,
posmasterIdOld = org == null || org.result == null ? null : org.result.posmasterId, posmasterIdOld = org?.result?.posmasterId ?? null,
rootOld = org == null || org.result == null ? null : org.result.root, rootOld = org?.result?.root ?? null,
rootIdOld = org == null || org.result == null ? null : org.result.rootId, rootIdOld = org?.result?.rootId ?? null,
rootShortNameOld = org == null || org.result == null ? null : org.result.rootShortName, rootShortNameOld = org?.result?.rootShortName ?? null,
child1Old = org == null || org.result == null ? null : org.result.child1, child1Old = org?.result?.child1 ?? null,
child1IdOld = org == null || org.result == null ? null : org.result.child1Id, child1IdOld = org?.result?.child1Id ?? null,
child1ShortNameOld = org == null || org.result == null ? null : org.result.child1ShortName, child1ShortNameOld = org?.result?.child1ShortName ?? null,
child2Old = org == null || org.result == null ? null : org.result.child2, child2Old = org?.result?.child2 ?? null,
child2IdOld = org == null || org.result == null ? null : org.result.child2Id, child2IdOld = org?.result?.child2Id ?? null,
child2ShortNameOld = org == null || org.result == null ? null : org.result.child2ShortName, child2ShortNameOld = org?.result?.child2ShortName ?? null,
child3Old = org == null || org.result == null ? null : org.result.child3, child3Old = org?.result?.child3 ?? null,
child3IdOld = org == null || org.result == null ? null : org.result.child3Id, child3IdOld = org?.result?.child3Id ?? null,
child3ShortNameOld = org == null || org.result == null ? null : org.result.child3ShortName, child3ShortNameOld = org?.result?.child3ShortName ?? null,
child4Old = org == null || org.result == null ? null : org.result.child4, child4Old = org?.result?.child4 ?? null,
child4IdOld = org == null || org.result == null ? null : org.result.child4Id, child4IdOld = org?.result?.child4Id ?? null,
child4ShortNameOld = org == null || org.result == null ? null : org.result.child4ShortName, child4ShortNameOld = org?.result?.child4ShortName ?? null,
orgRevisionIdOld = org == null || org.result == null ? null : org.result.orgRevisionId, orgRevisionIdOld = org?.result?.orgRevisionId ?? null,
// positionIdOld = org == null || org.result == null ? null : org.result.positionIdOld, posMasterNoOld = org?.result?.posMasterNo ?? null,
posMasterNoOld = org == null || org.result == null ? null : org.result.posMasterNo, positionNameOld = org?.result?.position ?? null,
positionNameOld = org == null || org.result == null ? null : org.result.position, posTypeIdOld = org?.result?.posTypeId ?? null,
// positionFieldOld = org == null || org.result == null ? null : org.result.positionFieldOld, posTypeNameOld = org?.result?.posTypeName ?? null,
posTypeIdOld = org == null || org.result == null ? null : org.result.posTypeId, posLevelIdOld = org?.result?.posLevelId ?? null,
posTypeNameOld = org == null || org.result == null ? null : org.result.posTypeName, posLevelNameOld = org?.result?.posLevelName ?? null,
posLevelIdOld = org == null || org.result == null ? null : org.result.posLevelId,
posLevelNameOld = org == null || org.result == null ? null : org.result.posLevelName,
}; };
await _contextMetadata.PlacementProfiles.AddAsync(placementProfile); await _contextMetadata.PlacementProfiles.AddAsync(placementProfile);
var placementEducation = new PlacementEducation var placementEducation = new PlacementEducation
{ {
PlacementProfile = placementProfile, PlacementProfile = placementProfile,
EducationLevel = await _contextMetadata.EducationLevels.FirstOrDefaultAsync(x => x.Name == (candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().HighDegree)), EducationLevelId = _contextOrg.educationLevel.FirstOrDefault(x => x.name == (candidate!.Educations!.FirstOrDefault()!.HighDegree ?? ""))?.Id ?? null,
Field = candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().Major, EducationLevelName = _contextOrg.educationLevel.FirstOrDefault(x => x.name == (candidate!.Educations!.FirstOrDefault()!.HighDegree ?? ""))?.name ?? null,
Gpa = candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().GPA.ToString(), Field = candidate?.Educations?.FirstOrDefault()?.Major ?? null,
Institute = candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().University, Gpa = candidate?.Educations?.FirstOrDefault()?.GPA!.ToString() ?? null,
Degree = candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().Degree, Institute = candidate?.Educations?.FirstOrDefault()?.University ?? null,
// Country = education.Name, Degree = candidate?.Educations?.FirstOrDefault()?.Degree ?? null,
// Duration = education.Name, FinishDate = candidate?.Educations?.FirstOrDefault()?.BachelorDate ?? null,
// Other = education.Name,
// FundName = education.Name,
// DurationYear = education.Name,
FinishDate = candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().BachelorDate,
IsDate = true, IsDate = true,
// StartDate = education.DurationStart,
// EndDate = education.DurationEnd,
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "", CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now, LastUpdatedAt = DateTime.Now,
@ -2508,11 +2401,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var placementCertificate = new PlacementCertificate var placementCertificate = new PlacementCertificate
{ {
PlacementProfile = placementProfile, PlacementProfile = placementProfile,
CertificateNo = candidate.Certificates.FirstOrDefault() == null ? null : candidate.Certificates.FirstOrDefault().CertificateNo, CertificateNo = candidate?.Certificates?.FirstOrDefault()?.CertificateNo ?? null,
// Issuer = candidate.Certificates.FirstOrDefault() == null ? null : candidate.Certificates.FirstOrDefault().Issuer, IssueDate = candidate?.Certificates?.FirstOrDefault()?.IssueDate ?? null,
IssueDate = candidate.Certificates.FirstOrDefault() == null ? null : candidate.Certificates.FirstOrDefault().IssueDate, ExpireDate = candidate?.Certificates?.FirstOrDefault()?.ExpiredDate ?? null,
ExpireDate = candidate.Certificates.FirstOrDefault() == null ? null : candidate.Certificates.FirstOrDefault().ExpiredDate, CertificateType = candidate?.Certificates?.FirstOrDefault()?.Description ?? null,
CertificateType = candidate.Certificates.FirstOrDefault() == null ? null : candidate.Certificates.FirstOrDefault().Description,
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "", CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now, LastUpdatedAt = DateTime.Now,

View file

@ -13,16 +13,17 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"DefaultConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"ExamConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"LeaveConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_leave_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"DisciplineConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_discipline;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "DisciplineConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_discipline_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"RecruitConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_recruit;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "RecruitConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_recruit_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"HistoryConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_history;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" "OrgConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_organization_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"HistoryConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_history_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
}, },
"Jwt": { "Jwt": {
"Key": "j7C9RO_p4nRtuwCH4z9Db_A_6We42tkD_p4lZtDrezc", "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"Issuer": "https://hrms-id.chin.in.th/realms/hrms" "Issuer": "https://id.frappet.synology.me/realms/bma-ehr"
}, },
"EPPlus": { "EPPlus": {
"ExcelPackage": { "ExcelPackage": {
@ -30,10 +31,10 @@
} }
}, },
"MinIO": { "MinIO": {
"Endpoint": "https://hrms-s3.chin.in.th/", "Endpoint": "http://127.0.0.1:9000",
"AccessKey": "QtXsmeR4mBqOO5RFisKo", "AccessKey": "ZQOGEjHxDesiVIHR",
"SecretKey": "Fdu7UDCr9Js7iP9SFMT44GjcldD3Ud0SU32PvCOA", "SecretKey": "vKTpcxY0Wjjp775aDwNn1q6VWJu8EFb6",
"BucketName": "hrms-fpt" "BucketName": "bma-recruit"
}, },
"Protocol": "HTTPS", "Protocol": "HTTPS",
"KeycloakCron": { "KeycloakCron": {
@ -75,8 +76,8 @@
} }
] ]
}, },
"APIPROBATION": "https://hrms.chin.in.th/api/v1/probation", "APIPROBATION": "https://bma-ehr.frappet.synology.me/api/v1/probation",
"API": "https://hrms.chin.in.th/api/v1", "API": "https://bma-ehr.frappet.synology.me/api/v1",
"APIV2": "https://hrms.chin.in.th/api/v2", "APIV2": "https://bma-ehr.frappet.synology.me/api/v2",
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz" "API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
} }

View file

@ -13,16 +13,17 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"DefaultConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database==bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"ExamConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database==bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"LeaveConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database==bma_ehr_leave_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"DisciplineConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_discipline;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "DisciplineConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database==bma_ehr_discipline_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"RecruitConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_recruit;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "RecruitConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database==bma_ehr_recruit_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"HistoryConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_history;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" "OrgConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_organization_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"HistoryConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database==bma_ehr_history_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
}, },
"Jwt": { "Jwt": {
"Key": "j7C9RO_p4nRtuwCH4z9Db_A_6We42tkD_p4lZtDrezc", "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"Issuer": "https://hrms-id.chin.in.th/realms/hrms" "Issuer": "https://id.frappet.synology.me/realms/bma-ehr"
}, },
"EPPlus": { "EPPlus": {
"ExcelPackage": { "ExcelPackage": {
@ -30,10 +31,10 @@
} }
}, },
"MinIO": { "MinIO": {
"Endpoint": "https://hrms-s3.chin.in.th/", "Endpoint": "http://127.0.0.1:9000",
"AccessKey": "QtXsmeR4mBqOO5RFisKo", "AccessKey": "ZQOGEjHxDesiVIHR",
"SecretKey": "Fdu7UDCr9Js7iP9SFMT44GjcldD3Ud0SU32PvCOA", "SecretKey": "vKTpcxY0Wjjp775aDwNn1q6VWJu8EFb6",
"BucketName": "hrms-fpt" "BucketName": "bma-recruit"
}, },
"Protocol": "HTTPS", "Protocol": "HTTPS",
"KeycloakCron": { "KeycloakCron": {
@ -75,8 +76,8 @@
} }
] ]
}, },
"APIPROBATION": "https://hrms.chin.in.th/api/v1/probation", "APIPROBATION": "https://bma-ehr.frappet.synology.me/api/v1/probation",
"API": "https://hrms.chin.in.th/api/v1", "API": "https://bma-ehr.frappet.synology.me/api/v1",
"APIV2": "https://hrms.chin.in.th/api/v2", "APIV2": "https://bma-ehr.frappet.synology.me/api/v2",
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz" "API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
} }

View file

@ -13,16 +13,17 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"DefaultConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"ExamConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"LeaveConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_leave_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"DisciplineConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_discipline;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "DisciplineConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_discipline_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"RecruitConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_recruit;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "RecruitConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_recruit_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"HistoryConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_history;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" "OrgConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_organization_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"HistoryConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_history_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
}, },
"Jwt": { "Jwt": {
"Key": "j7C9RO_p4nRtuwCH4z9Db_A_6We42tkD_p4lZtDrezc", "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"Issuer": "https://hrms-id.chin.in.th/realms/hrms" "Issuer": "https://id.frappet.synology.me/realms/bma-ehr"
}, },
"EPPlus": { "EPPlus": {
"ExcelPackage": { "ExcelPackage": {
@ -30,10 +31,10 @@
} }
}, },
"MinIO": { "MinIO": {
"Endpoint": "https://hrms-s3.chin.in.th/", "Endpoint": "http://127.0.0.1:9000",
"AccessKey": "QtXsmeR4mBqOO5RFisKo", "AccessKey": "ZQOGEjHxDesiVIHR",
"SecretKey": "Fdu7UDCr9Js7iP9SFMT44GjcldD3Ud0SU32PvCOA", "SecretKey": "vKTpcxY0Wjjp775aDwNn1q6VWJu8EFb6",
"BucketName": "hrms-fpt" "BucketName": "bma-recruit"
}, },
"Protocol": "HTTPS", "Protocol": "HTTPS",
"KeycloakCron": { "KeycloakCron": {
@ -75,8 +76,8 @@
} }
] ]
}, },
"APIPROBATION": "https://hrms.chin.in.th/api/v1/probation", "APIPROBATION": "https://bma-ehr.frappet.synology.me/api/v1/probation",
"API": "https://hrms.chin.in.th/api/v1", "API": "https://bma-ehr.frappet.synology.me/api/v1",
"APIV2": "https://hrms.chin.in.th/api/v2", "APIV2": "https://bma-ehr.frappet.synology.me/api/v2",
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz" "API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
} }

View file

@ -13,16 +13,17 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"DefaultConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database==bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"ExamConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database==bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"LeaveConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database==bma_ehr_leave_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"DisciplineConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_discipline;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "DisciplineConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database==bma_ehr_discipline_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"RecruitConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_recruit;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "RecruitConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database==bma_ehr_recruit_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"HistoryConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_history;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" "OrgConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_organization_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"HistoryConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database==bma_ehr_history_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
}, },
"Jwt": { "Jwt": {
"Key": "j7C9RO_p4nRtuwCH4z9Db_A_6We42tkD_p4lZtDrezc", "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"Issuer": "https://hrms-id.chin.in.th/realms/hrms" "Issuer": "https://id.frappet.synology.me/realms/bma-ehr"
}, },
"EPPlus": { "EPPlus": {
"ExcelPackage": { "ExcelPackage": {
@ -30,10 +31,10 @@
} }
}, },
"MinIO": { "MinIO": {
"Endpoint": "https://hrms-s3.chin.in.th/", "Endpoint": "http://127.0.0.1:9000",
"AccessKey": "QtXsmeR4mBqOO5RFisKo", "AccessKey": "ZQOGEjHxDesiVIHR",
"SecretKey": "Fdu7UDCr9Js7iP9SFMT44GjcldD3Ud0SU32PvCOA", "SecretKey": "vKTpcxY0Wjjp775aDwNn1q6VWJu8EFb6",
"BucketName": "hrms-fpt" "BucketName": "bma-recruit"
}, },
"Protocol": "HTTPS", "Protocol": "HTTPS",
"KeycloakCron": { "KeycloakCron": {
@ -75,8 +76,8 @@
} }
] ]
}, },
"APIPROBATION": "https://hrms.chin.in.th/api/v1/probation", "APIPROBATION": "https://bma-ehr.frappet.synology.me/api/v1/probation",
"API": "https://hrms.chin.in.th/api/v1", "API": "https://bma-ehr.frappet.synology.me/api/v1",
"APIV2": "https://hrms.chin.in.th/api/v2", "APIV2": "https://bma-ehr.frappet.synology.me/api/v2",
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz" "API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
} }