เพิ่มฟิวตำแหน่งตอนสร้างรอบสมัคร
This commit is contained in:
parent
dee47f326d
commit
bed23f911a
19 changed files with 3228 additions and 568 deletions
|
|
@ -2,6 +2,7 @@
|
|||
using BMA.EHR.Recurit.Exam.Service.Core;
|
||||
using BMA.EHR.Recurit.Exam.Service.Data;
|
||||
using BMA.EHR.Recurit.Exam.Service.Models;
|
||||
using BMA.EHR.Recurit.Exam.Service.Request;
|
||||
using BMA.EHR.Recurit.Exam.Service.Response;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
|
|
@ -61,18 +62,29 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
return periodExam;
|
||||
}
|
||||
|
||||
public async Task CreateAsync(PeriodExam inserted)
|
||||
public async Task CreateAsync(RequestPeriodExam inserted)
|
||||
{
|
||||
var periodExam = new PeriodExam
|
||||
{
|
||||
Name = inserted.Name,
|
||||
StartDate = inserted.StartDate,
|
||||
EndDate = inserted.EndDate,
|
||||
CheckDocument = inserted.CheckDocument,
|
||||
CheckDisability = inserted.CheckDisability,
|
||||
Round = inserted.Round,
|
||||
Fee = inserted.Fee,
|
||||
Year = inserted.Year,
|
||||
Fee = inserted.Fee,
|
||||
RegisterStartDate = inserted.RegisterStartDate,
|
||||
RegisterEndDate = inserted.RegisterEndDate,
|
||||
PaymentStartDate = inserted.PaymentStartDate,
|
||||
PaymentEndDate = inserted.PaymentEndDate,
|
||||
AnnouncementStartDate = inserted.AnnouncementStartDate,
|
||||
AnnouncementEndDate = inserted.AnnouncementEndDate,
|
||||
OrganizationCodeId = inserted.OrganizationCodeId,
|
||||
OrganizationCodeName = inserted.OrganizationCodeName,
|
||||
OrganizationId = inserted.OrganizationId,
|
||||
OrganizationName = inserted.OrganizationName,
|
||||
PaymentKrungThai = inserted.PaymentKrungThai,
|
||||
Detail = inserted.Detail,
|
||||
AnnounceDate = inserted.AnnounceDate,
|
||||
Note = inserted.Note,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
|
|
@ -81,12 +93,48 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
LastUpdateFullName = FullName ?? "",
|
||||
};
|
||||
|
||||
foreach (var bank in inserted.BankExam)
|
||||
{
|
||||
var bankExam = new BankExam
|
||||
{
|
||||
PeriodExam = periodExam,
|
||||
AccountName = bank.AccountName,
|
||||
AccountNumber = bank.AccountNumber,
|
||||
BankName = bank.BankName,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "",
|
||||
LastUpdateFullName = FullName ?? "",
|
||||
};
|
||||
await _context.BankExams.AddAsync(bankExam);
|
||||
}
|
||||
|
||||
foreach (var position in inserted.PositionExam)
|
||||
{
|
||||
var positionExam = new PositionExam
|
||||
{
|
||||
PeriodExam = periodExam,
|
||||
PositionId = position.PositionId,
|
||||
PositionName = position.PositionName,
|
||||
TypeName = position.TypeName,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "",
|
||||
LastUpdateFullName = FullName ?? "",
|
||||
};
|
||||
await _context.PositionExams.AddAsync(positionExam);
|
||||
}
|
||||
|
||||
await _context.PeriodExams.AddAsync(periodExam);
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task UpdateAsync(string examId, PeriodExam updated)
|
||||
public async Task UpdateAsync(string examId, RequestPeriodExam updated)
|
||||
{
|
||||
var periodExam = await _context.PeriodExams.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
|
||||
|
|
@ -95,16 +143,29 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
|
||||
periodExam.Name = updated.Name;
|
||||
periodExam.StartDate = updated.StartDate;
|
||||
periodExam.EndDate = updated.EndDate;
|
||||
periodExam.CheckDocument = updated.CheckDocument;
|
||||
periodExam.CheckDisability = updated.CheckDisability;
|
||||
periodExam.Round = updated.Round;
|
||||
periodExam.Fee = updated.Fee;
|
||||
periodExam.Year = updated.Year;
|
||||
periodExam.Fee = updated.Fee;
|
||||
periodExam.RegisterStartDate = updated.RegisterStartDate;
|
||||
periodExam.RegisterEndDate = updated.RegisterEndDate;
|
||||
periodExam.PaymentStartDate = updated.PaymentStartDate;
|
||||
periodExam.PaymentEndDate = updated.PaymentEndDate;
|
||||
periodExam.AnnouncementStartDate = updated.AnnouncementStartDate;
|
||||
periodExam.AnnouncementEndDate = updated.AnnouncementEndDate;
|
||||
periodExam.OrganizationCodeId = updated.OrganizationCodeId;
|
||||
periodExam.OrganizationCodeName = updated.OrganizationCodeName;
|
||||
periodExam.OrganizationId = updated.OrganizationId;
|
||||
periodExam.OrganizationName = updated.OrganizationName;
|
||||
periodExam.PaymentKrungThai = updated.PaymentKrungThai;
|
||||
periodExam.Detail = updated.Detail;
|
||||
periodExam.AnnounceDate = updated.AnnounceDate;
|
||||
periodExam.IsActive = updated.IsActive;
|
||||
periodExam.Note = updated.Note;
|
||||
periodExam.CreatedAt = DateTime.Now;
|
||||
periodExam.CreatedUserId = UserId ?? "";
|
||||
periodExam.LastUpdatedAt = DateTime.Now;
|
||||
periodExam.LastUpdateUserId = UserId ?? "";
|
||||
periodExam.CreatedFullName = FullName ?? "";
|
||||
periodExam.LastUpdateFullName = FullName ?? "";
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue