From c60c647a816db3b8af513b85bed8fe7a5fd93fa7 Mon Sep 17 00:00:00 2001 From: Bright Date: Fri, 21 Jun 2024 14:58:00 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=A1=E0=B8=9E=E0=B8=9F=E0=B8=B4?= =?UTF-8?q?=E0=B8=A5=E0=B8=94=E0=B9=8C=20DumpDb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Commands/CommandRepository.cs | 53 +++++++++++-------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs index d4c66fd3..bbba1ab2 100644 --- a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs +++ b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs @@ -5,6 +5,7 @@ using BMA.EHR.Application.Responses; using BMA.EHR.Domain.Extensions; using BMA.EHR.Domain.Models.Commands.Core; using BMA.EHR.Domain.Models.HR; +using BMA.EHR.Domain.Models.Leave.Commons; using BMA.EHR.Domain.Models.MetaData; using BMA.EHR.Domain.Models.Notifications; using BMA.EHR.Domain.Models.OrganizationEmployee; @@ -12270,7 +12271,7 @@ namespace BMA.EHR.Application.Repositories.Commands /// /// /// - private async Task DumpDB(string token = "") + public async Task DumpDB(string token = "") { try { @@ -12375,6 +12376,8 @@ namespace BMA.EHR.Application.Repositories.Commands //profileId = JsonConvert.DeserializeAnonymousType(_result, new { result = "" }).result; /*แบบใหม่*/ } + #region profileData + if (profile.ChangeNames.Count > 0) { var apiUrlChgName = $"{_baseAPI}/org/profile/changeName"; @@ -12386,7 +12389,7 @@ namespace BMA.EHR.Application.Repositories.Commands var _res = await client.PostAsJsonAsync(apiUrlChgName, new { profileId = profileId, - prefixId = chg.Prefix, + prefixId = string.Empty, //where in node prefix = chg.Prefix, firstName = chg.FirstName, lastName = chg.LastName, @@ -12410,12 +12413,12 @@ namespace BMA.EHR.Application.Repositories.Commands var _res = await client.PostAsJsonAsync(apiUrlFather, new { profileId = profileId, - fatherPrefix = father.Prefix,//ส่งคำนำหน้าไปแทน + fatherPrefix = father.Prefix, fatherFirstName = father.FirstName, fatherLastName = father.LastName, fatherCareer = father.Career, - fatherCitizenId = (String?)null, - fatherLive = false, + fatherCitizenId = string.Empty, + fatherLive = true, }); var _result = await _res.Content.ReadAsStringAsync(); } @@ -12437,8 +12440,8 @@ namespace BMA.EHR.Application.Repositories.Commands motherFirstName = mother.FirstName, motherLastName = mother.LastName, motherCareer = mother.Career, - motherCitizenId = (String?)null, - motherLive = false, + motherCitizenId = string.Empty, + motherLive = true, }); var _result = await _res.Content.ReadAsStringAsync(); } @@ -12459,11 +12462,11 @@ namespace BMA.EHR.Application.Repositories.Commands couplePrefix = couple.Prefix, coupleFirstName = couple.FirstName, coupleLastName = couple.LastName, - coupleLastNameOld = (String?)null, + coupleLastNameOld = string.Empty, coupleCareer = couple.Career, - coupleCitizenId = (String?)null, - coupleLive = false, - relationship = (String?)null, + coupleCitizenId = string.Empty, + coupleLive = true, + relationship = string.Empty, }); var _result = await _res.Content.ReadAsStringAsync(); } @@ -12486,7 +12489,7 @@ namespace BMA.EHR.Application.Repositories.Commands childrenLastName = children.ChildrenLastName, childrenPrefix = children.ChildrenPrefix, childrenLive = true, - childrenCitizenId = (String?)null, + childrenCitizenId = string.Empty, }); var _result = await _res.Content.ReadAsStringAsync(); } @@ -12518,7 +12521,7 @@ namespace BMA.EHR.Application.Repositories.Commands endDate = edu.EndDate, educationLevel = edu.EducationLevel, educationLevelId = string.Empty, //where in node - positionPath = edu.PositionPath == null ? null : edu.PositionPath, + positionPath = edu.PositionPath, positionPathId = string.Empty, //where in node isDate = false, isEducation = false, @@ -12568,7 +12571,7 @@ namespace BMA.EHR.Application.Repositories.Commands detail = discipline.Detail, refCommandDate = discipline.RefCommandDate, refCommandNo = discipline.RefCommandNo, - unStigma = (String?)null, + unStigma = string.Empty, }); var _result = await _res.Content.ReadAsStringAsync(); } @@ -12583,10 +12586,13 @@ namespace BMA.EHR.Application.Repositories.Commands client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); foreach (var leave in profile.Leaves) { + var TypeLeaveName = await _dbContext.Set() + .Include(x => x.TypeLeave).Where(x => x.Id == leave.Id).Select(x => x.TypeLeave.Name).FirstOrDefaultAsync(); + var _res = await client.PostAsJsonAsync(apiUrlLeave, new { profileId = profileId, - leaveTypeId = leave.TypeLeave,//ส่งชื่อประเภทการลาไปแทน + leaveTypeId = TypeLeaveName == null ? string.Empty : TypeLeaveName, //where in node dateLeaveStart = leave.DateStartLeave, dateLeaveEnd = leave.DateEndLeave, leaveDays = leave.SumLeave, @@ -12615,8 +12621,8 @@ namespace BMA.EHR.Application.Repositories.Commands dateEnd = duty.DateEnd, detail = duty.Detail, reference = duty.Reference, - refCommandDate = (String?)null, - refCommandNo = (String?)null, + refCommandDate = string.Empty, + refCommandNo = string.Empty, }); var _result = await _res.Content.ReadAsStringAsync(); @@ -12668,8 +12674,8 @@ namespace BMA.EHR.Application.Repositories.Commands date = nopaid.Date, detail = nopaid.Detail, reference = nopaid.Reference, - refCommandDate = nopaid.Date ?? null, //ไม่มีฟิลด์ เอกสารอ้างอิง (ลงวันที่) - refCommandNo = string.Empty, //ไม่มีฟิลด์ เอกสารอ้างอิง (เลขที่คำสั่ง) + refCommandDate = (DateTime?)null, + refCommandNo = string.Empty, }); var _result = await _res.Content.ReadAsStringAsync(); @@ -12744,7 +12750,7 @@ namespace BMA.EHR.Application.Repositories.Commands section = insignia.Section, page = insignia.Page, receiveDate = insignia.ReceiveDate, - insigniaId = insignia.InsigniaType, //ส่งชื่อเครื่องราชฯไปแทน + insigniaId = insignia.InsigniaType, //where in node dateAnnounce = insignia.DateAnnounce, issue = insignia.Issue, volumeNo = insignia.VolumeNo, @@ -12771,8 +12777,8 @@ namespace BMA.EHR.Application.Repositories.Commands detail = honor.Detail, issueDate = honor.IssueDate, issuer = honor.Issuer, - refCommandDate = (String?)null, - refCommandNo = (String?)null, + refCommandDate = (DateTime?)null, + refCommandNo = string.Empty, isDate = honor.IsDate, }); var _result = await _res.Content.ReadAsStringAsync(); @@ -12823,8 +12829,11 @@ namespace BMA.EHR.Application.Repositories.Commands } } } + //profile.PlacementStatus = "CONTAIN"; //await _dbContext.SaveChangesAsync(); + + #endregion } //return ""; }