แมพฟิลด์ DumpDb

This commit is contained in:
Bright 2024-06-21 14:58:00 +07:00
parent 89b4c71dbd
commit c60c647a81

View file

@ -5,6 +5,7 @@ using BMA.EHR.Application.Responses;
using BMA.EHR.Domain.Extensions; using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.Commands.Core; using BMA.EHR.Domain.Models.Commands.Core;
using BMA.EHR.Domain.Models.HR; using BMA.EHR.Domain.Models.HR;
using BMA.EHR.Domain.Models.Leave.Commons;
using BMA.EHR.Domain.Models.MetaData; using BMA.EHR.Domain.Models.MetaData;
using BMA.EHR.Domain.Models.Notifications; using BMA.EHR.Domain.Models.Notifications;
using BMA.EHR.Domain.Models.OrganizationEmployee; using BMA.EHR.Domain.Models.OrganizationEmployee;
@ -12270,7 +12271,7 @@ namespace BMA.EHR.Application.Repositories.Commands
/// <summary> /// <summary>
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private async Task DumpDB(string token = "") public async Task DumpDB(string token = "")
{ {
try try
{ {
@ -12375,6 +12376,8 @@ namespace BMA.EHR.Application.Repositories.Commands
//profileId = JsonConvert.DeserializeAnonymousType(_result, new { result = "" }).result; /*แบบใหม่*/ //profileId = JsonConvert.DeserializeAnonymousType(_result, new { result = "" }).result; /*แบบใหม่*/
} }
#region profileData
if (profile.ChangeNames.Count > 0) if (profile.ChangeNames.Count > 0)
{ {
var apiUrlChgName = $"{_baseAPI}/org/profile/changeName"; var apiUrlChgName = $"{_baseAPI}/org/profile/changeName";
@ -12386,7 +12389,7 @@ namespace BMA.EHR.Application.Repositories.Commands
var _res = await client.PostAsJsonAsync(apiUrlChgName, new var _res = await client.PostAsJsonAsync(apiUrlChgName, new
{ {
profileId = profileId, profileId = profileId,
prefixId = chg.Prefix, prefixId = string.Empty, //where in node
prefix = chg.Prefix, prefix = chg.Prefix,
firstName = chg.FirstName, firstName = chg.FirstName,
lastName = chg.LastName, lastName = chg.LastName,
@ -12410,12 +12413,12 @@ namespace BMA.EHR.Application.Repositories.Commands
var _res = await client.PostAsJsonAsync(apiUrlFather, new var _res = await client.PostAsJsonAsync(apiUrlFather, new
{ {
profileId = profileId, profileId = profileId,
fatherPrefix = father.Prefix,//ส่งคำนำหน้าไปแทน fatherPrefix = father.Prefix,
fatherFirstName = father.FirstName, fatherFirstName = father.FirstName,
fatherLastName = father.LastName, fatherLastName = father.LastName,
fatherCareer = father.Career, fatherCareer = father.Career,
fatherCitizenId = (String?)null, fatherCitizenId = string.Empty,
fatherLive = false, fatherLive = true,
}); });
var _result = await _res.Content.ReadAsStringAsync(); var _result = await _res.Content.ReadAsStringAsync();
} }
@ -12437,8 +12440,8 @@ namespace BMA.EHR.Application.Repositories.Commands
motherFirstName = mother.FirstName, motherFirstName = mother.FirstName,
motherLastName = mother.LastName, motherLastName = mother.LastName,
motherCareer = mother.Career, motherCareer = mother.Career,
motherCitizenId = (String?)null, motherCitizenId = string.Empty,
motherLive = false, motherLive = true,
}); });
var _result = await _res.Content.ReadAsStringAsync(); var _result = await _res.Content.ReadAsStringAsync();
} }
@ -12459,11 +12462,11 @@ namespace BMA.EHR.Application.Repositories.Commands
couplePrefix = couple.Prefix, couplePrefix = couple.Prefix,
coupleFirstName = couple.FirstName, coupleFirstName = couple.FirstName,
coupleLastName = couple.LastName, coupleLastName = couple.LastName,
coupleLastNameOld = (String?)null, coupleLastNameOld = string.Empty,
coupleCareer = couple.Career, coupleCareer = couple.Career,
coupleCitizenId = (String?)null, coupleCitizenId = string.Empty,
coupleLive = false, coupleLive = true,
relationship = (String?)null, relationship = string.Empty,
}); });
var _result = await _res.Content.ReadAsStringAsync(); var _result = await _res.Content.ReadAsStringAsync();
} }
@ -12486,7 +12489,7 @@ namespace BMA.EHR.Application.Repositories.Commands
childrenLastName = children.ChildrenLastName, childrenLastName = children.ChildrenLastName,
childrenPrefix = children.ChildrenPrefix, childrenPrefix = children.ChildrenPrefix,
childrenLive = true, childrenLive = true,
childrenCitizenId = (String?)null, childrenCitizenId = string.Empty,
}); });
var _result = await _res.Content.ReadAsStringAsync(); var _result = await _res.Content.ReadAsStringAsync();
} }
@ -12518,7 +12521,7 @@ namespace BMA.EHR.Application.Repositories.Commands
endDate = edu.EndDate, endDate = edu.EndDate,
educationLevel = edu.EducationLevel, educationLevel = edu.EducationLevel,
educationLevelId = string.Empty, //where in node educationLevelId = string.Empty, //where in node
positionPath = edu.PositionPath == null ? null : edu.PositionPath, positionPath = edu.PositionPath,
positionPathId = string.Empty, //where in node positionPathId = string.Empty, //where in node
isDate = false, isDate = false,
isEducation = false, isEducation = false,
@ -12568,7 +12571,7 @@ namespace BMA.EHR.Application.Repositories.Commands
detail = discipline.Detail, detail = discipline.Detail,
refCommandDate = discipline.RefCommandDate, refCommandDate = discipline.RefCommandDate,
refCommandNo = discipline.RefCommandNo, refCommandNo = discipline.RefCommandNo,
unStigma = (String?)null, unStigma = string.Empty,
}); });
var _result = await _res.Content.ReadAsStringAsync(); 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 ", "")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
foreach (var leave in profile.Leaves) foreach (var leave in profile.Leaves)
{ {
var TypeLeaveName = await _dbContext.Set<ProfileLeave>()
.Include(x => x.TypeLeave).Where(x => x.Id == leave.Id).Select(x => x.TypeLeave.Name).FirstOrDefaultAsync();
var _res = await client.PostAsJsonAsync(apiUrlLeave, new var _res = await client.PostAsJsonAsync(apiUrlLeave, new
{ {
profileId = profileId, profileId = profileId,
leaveTypeId = leave.TypeLeave,//ส่งชื่อประเภทการลาไปแทน leaveTypeId = TypeLeaveName == null ? string.Empty : TypeLeaveName, //where in node
dateLeaveStart = leave.DateStartLeave, dateLeaveStart = leave.DateStartLeave,
dateLeaveEnd = leave.DateEndLeave, dateLeaveEnd = leave.DateEndLeave,
leaveDays = leave.SumLeave, leaveDays = leave.SumLeave,
@ -12615,8 +12621,8 @@ namespace BMA.EHR.Application.Repositories.Commands
dateEnd = duty.DateEnd, dateEnd = duty.DateEnd,
detail = duty.Detail, detail = duty.Detail,
reference = duty.Reference, reference = duty.Reference,
refCommandDate = (String?)null, refCommandDate = string.Empty,
refCommandNo = (String?)null, refCommandNo = string.Empty,
}); });
var _result = await _res.Content.ReadAsStringAsync(); var _result = await _res.Content.ReadAsStringAsync();
@ -12668,8 +12674,8 @@ namespace BMA.EHR.Application.Repositories.Commands
date = nopaid.Date, date = nopaid.Date,
detail = nopaid.Detail, detail = nopaid.Detail,
reference = nopaid.Reference, reference = nopaid.Reference,
refCommandDate = nopaid.Date ?? null, //ไม่มีฟิลด์ เอกสารอ้างอิง (ลงวันที่) refCommandDate = (DateTime?)null,
refCommandNo = string.Empty, //ไม่มีฟิลด์ เอกสารอ้างอิง (เลขที่คำสั่ง) refCommandNo = string.Empty,
}); });
var _result = await _res.Content.ReadAsStringAsync(); var _result = await _res.Content.ReadAsStringAsync();
@ -12744,7 +12750,7 @@ namespace BMA.EHR.Application.Repositories.Commands
section = insignia.Section, section = insignia.Section,
page = insignia.Page, page = insignia.Page,
receiveDate = insignia.ReceiveDate, receiveDate = insignia.ReceiveDate,
insigniaId = insignia.InsigniaType, //ส่งชื่อเครื่องราชฯไปแทน insigniaId = insignia.InsigniaType, //where in node
dateAnnounce = insignia.DateAnnounce, dateAnnounce = insignia.DateAnnounce,
issue = insignia.Issue, issue = insignia.Issue,
volumeNo = insignia.VolumeNo, volumeNo = insignia.VolumeNo,
@ -12771,8 +12777,8 @@ namespace BMA.EHR.Application.Repositories.Commands
detail = honor.Detail, detail = honor.Detail,
issueDate = honor.IssueDate, issueDate = honor.IssueDate,
issuer = honor.Issuer, issuer = honor.Issuer,
refCommandDate = (String?)null, refCommandDate = (DateTime?)null,
refCommandNo = (String?)null, refCommandNo = string.Empty,
isDate = honor.IsDate, isDate = honor.IsDate,
}); });
var _result = await _res.Content.ReadAsStringAsync(); var _result = await _res.Content.ReadAsStringAsync();
@ -12823,8 +12829,11 @@ namespace BMA.EHR.Application.Repositories.Commands
} }
} }
} }
//profile.PlacementStatus = "CONTAIN"; //profile.PlacementStatus = "CONTAIN";
//await _dbContext.SaveChangesAsync(); //await _dbContext.SaveChangesAsync();
#endregion
} }
//return ""; //return "";
} }