apiจัดสรร
This commit is contained in:
parent
0aa0aedba9
commit
15931fbaca
27 changed files with 64051 additions and 120 deletions
|
|
@ -3,6 +3,7 @@ using System.Security.Claims;
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Requests;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
using BMA.EHR.Domain.Models.Insignias;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
|
|
@ -125,6 +126,73 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
private async Task<List<ImportReceiveRequest>> ReadExcelImportReceive(IFormFile formFile)
|
||||
{
|
||||
var list = new List<ImportReceiveRequest>();
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
await formFile.CopyToAsync(stream);
|
||||
using (var package = new ExcelPackage(stream))
|
||||
{
|
||||
for (int i = 0; i < package.Workbook.Worksheets.Count(); i++)
|
||||
{
|
||||
ExcelWorksheet worksheet = package.Workbook.Worksheets[i];
|
||||
var rowCount = worksheet.Dimension.Rows;
|
||||
for (int row = 2; row <= rowCount; row++)
|
||||
{
|
||||
list.Add(new ImportReceiveRequest
|
||||
{
|
||||
Number = worksheet.Cells[row, 1].Value != null ? worksheet.Cells[row, 1].Value.ToString() : null,
|
||||
RequestInsignia = worksheet.Cells[row, 2].Value != null ? worksheet.Cells[row, 2].Value.ToString() : null,
|
||||
CitizanId = worksheet.Cells[row, 3].Value != null ? worksheet.Cells[row, 3].Value.ToString() : null,
|
||||
Prefix = worksheet.Cells[row, 4].Value != null ? worksheet.Cells[row, 4].Value.ToString() : null,
|
||||
FullName = worksheet.Cells[row, 5].Value != null ? worksheet.Cells[row, 5].Value.ToString() : null,
|
||||
Position = worksheet.Cells[row, 6].Value != null ? worksheet.Cells[row, 6].Value.ToString() : null,
|
||||
DateReceive = worksheet.Cells[row, 7].Value != null ? DateTime.Parse(worksheet.Cells[row, 7].Value.ToString()) : null,
|
||||
OrgSend = worksheet.Cells[row, 8].Value != null ? worksheet.Cells[row, 8].Value.ToString() : null,
|
||||
OrgReceive = worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : null,
|
||||
Date = worksheet.Cells[row, 10].Value != null ? DateTime.Parse(worksheet.Cells[row, 10].Value.ToString()) : null,
|
||||
VolumeNo = worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : null,
|
||||
Section = worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : null,
|
||||
Page = worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : null,
|
||||
No = worksheet.Cells[row, 14].Value != null ? worksheet.Cells[row, 14].Value.ToString() : null,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private async Task<List<ImportInvoiceRequest>> ReadExcelImportInvoice(IFormFile formFile)
|
||||
{
|
||||
var list = new List<ImportInvoiceRequest>();
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
await formFile.CopyToAsync(stream);
|
||||
using (var package = new ExcelPackage(stream))
|
||||
{
|
||||
for (int i = 0; i < package.Workbook.Worksheets.Count(); i++)
|
||||
{
|
||||
ExcelWorksheet worksheet = package.Workbook.Worksheets[i];
|
||||
var rowCount = worksheet.Dimension.Rows;
|
||||
for (int row = 2; row <= rowCount; row++)
|
||||
{
|
||||
list.Add(new ImportInvoiceRequest
|
||||
{
|
||||
CitizanId = worksheet.Cells[row, 1].Value != null ? worksheet.Cells[row, 1].Value.ToString() : null,
|
||||
Number = worksheet.Cells[row, 2].Value != null ? worksheet.Cells[row, 2].Value.ToString() : null,
|
||||
DatePayment = worksheet.Cells[row, 3].Value != null ? DateTime.Parse(worksheet.Cells[row, 3].Value.ToString()) : null,
|
||||
TypePayment = worksheet.Cells[row, 4].Value != null ? worksheet.Cells[row, 4].Value.ToString() : null,
|
||||
Address = worksheet.Cells[row, 5].Value != null ? worksheet.Cells[row, 5].Value.ToString() : null,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " ดึงเครื่องราชฯ ล่าสุดของครู (GetInsigniaLast) "
|
||||
|
|
@ -1272,6 +1340,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
if (profile == null)
|
||||
return Error(GlobalMessages.DataNotFound);
|
||||
var insignia = await _context.Insignias
|
||||
.Include(x => x.InsigniaType)
|
||||
.FirstOrDefaultAsync(x => x.Id == req.InsigniaId);
|
||||
if (insignia == null)
|
||||
return Error(GlobalMessages.InsigniaNotFound);
|
||||
|
|
@ -1313,7 +1382,29 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
//////////////บันทึกลงทะเบียน
|
||||
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||
{
|
||||
Year = insigniaNote.Year,
|
||||
No = req.No,
|
||||
Issue = req.VolumeNo,
|
||||
VolumeNo = req.VolumeNo,
|
||||
// Volume = req.Volume,
|
||||
Section = req.Section,
|
||||
Page = req.Page,
|
||||
DateAnnounce = req.DateReceive,
|
||||
ReceiveDate = req.Date,
|
||||
InsigniaType = insignia.InsigniaType == null ? null : insignia.InsigniaType.Name,
|
||||
Insignia = insignia,
|
||||
// RefCommandNo = req.RefCommandNo,
|
||||
// RefCommandDate = req.RefCommandDate,
|
||||
Profile = profile,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1434,6 +1525,9 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
.ThenInclude(x => x.Profile)
|
||||
.Include(x => x.InsigniaNoteProfiles)
|
||||
.ThenInclude(x => x.RequestInsignia)
|
||||
.ThenInclude(x => x.InsigniaType)
|
||||
.Include(x => x.InsigniaNoteProfiles)
|
||||
.ThenInclude(x => x.Profile)
|
||||
.FirstOrDefaultAsync(x => x.Id == insigniaNoteId);
|
||||
if (insigniaNote == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
|
|
@ -1461,7 +1555,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
var _insignia = await _context.Insignias.FirstOrDefaultAsync(x => x.Name == item.RequestInsignia);
|
||||
if (_insignia == null)
|
||||
continue;
|
||||
await _context.InsigniaNoteProfiles.AddAsync(new InsigniaNoteProfile
|
||||
profile = new InsigniaNoteProfile
|
||||
{
|
||||
RequestDate = DateTime.Now,
|
||||
Salary = _profile.Salaries.Count() == 0 ? null : _profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
|
|
@ -1480,7 +1574,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
};
|
||||
await _context.InsigniaNoteProfiles.AddAsync(profile);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1497,7 +1592,29 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = DateTime.Now;
|
||||
}
|
||||
//////////////บันทึกลงทะเบียน
|
||||
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||
{
|
||||
Year = insigniaNote.Year,
|
||||
No = profile.No,
|
||||
Issue = profile.VolumeNo,
|
||||
VolumeNo = profile.VolumeNo,
|
||||
// Volume = profile.Volume,
|
||||
Section = profile.Section,
|
||||
Page = profile.Page,
|
||||
DateAnnounce = profile.DateReceive,
|
||||
ReceiveDate = profile.Date,
|
||||
InsigniaType = profile.RequestInsignia.InsigniaType == null ? null : profile.RequestInsignia.InsigniaType.Name,
|
||||
Insignia = profile.RequestInsignia,
|
||||
// RefCommandNo = req.RefCommandNo,
|
||||
// RefCommandDate = req.RefCommandDate,
|
||||
Profile = profile.Profile,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
|
|
@ -1551,71 +1668,223 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
return Success();
|
||||
}
|
||||
|
||||
private async Task<List<ImportReceiveRequest>> ReadExcelImportReceive(IFormFile formFile)
|
||||
/// <summary>
|
||||
/// preview บันทึกผลการได้รับเครื่องราชฯ
|
||||
/// </summary>
|
||||
/// <param name="insigniaNoteId">Id รอบบันทึกผลเครื่องราช</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("preview/receice/{insigniaNoteId:length(36)}"), DisableRequestSizeLimit]
|
||||
public async Task<ActionResult<ResponseObject>> PreviewReceiceProfile([FromForm] ImportFileRequest req, Guid insigniaNoteId)
|
||||
{
|
||||
var list = new List<ImportReceiveRequest>();
|
||||
using (var stream = new MemoryStream())
|
||||
var insigniaNote = await _context.InsigniaNotes
|
||||
.Include(x => x.InsigniaNoteProfiles)
|
||||
.ThenInclude(x => x.Profile)
|
||||
.Include(x => x.InsigniaNoteProfiles)
|
||||
.ThenInclude(x => x.RequestInsignia)
|
||||
.ThenInclude(x => x.InsigniaType)
|
||||
.Include(x => x.InsigniaNoteProfiles)
|
||||
.ThenInclude(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.Include(x => x.InsigniaNoteProfiles)
|
||||
.ThenInclude(x => x.Profile)
|
||||
.ThenInclude(x => x.Position)
|
||||
.FirstOrDefaultAsync(x => x.Id == insigniaNoteId);
|
||||
if (insigniaNote == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
|
||||
if (Request.Form.Files == null || Request.Form.Files.Count == 0)
|
||||
{
|
||||
await formFile.CopyToAsync(stream);
|
||||
using (var package = new ExcelPackage(stream))
|
||||
{
|
||||
for (int i = 0; i < package.Workbook.Worksheets.Count(); i++)
|
||||
{
|
||||
ExcelWorksheet worksheet = package.Workbook.Worksheets[i];
|
||||
var rowCount = worksheet.Dimension.Rows;
|
||||
for (int row = 2; row <= rowCount; row++)
|
||||
{
|
||||
list.Add(new ImportReceiveRequest
|
||||
{
|
||||
Number = worksheet.Cells[row, 1].Value != null ? worksheet.Cells[row, 1].Value.ToString() : null,
|
||||
RequestInsignia = worksheet.Cells[row, 2].Value != null ? worksheet.Cells[row, 2].Value.ToString() : null,
|
||||
CitizanId = worksheet.Cells[row, 3].Value != null ? worksheet.Cells[row, 3].Value.ToString() : null,
|
||||
Prefix = worksheet.Cells[row, 4].Value != null ? worksheet.Cells[row, 4].Value.ToString() : null,
|
||||
FullName = worksheet.Cells[row, 5].Value != null ? worksheet.Cells[row, 5].Value.ToString() : null,
|
||||
Position = worksheet.Cells[row, 6].Value != null ? worksheet.Cells[row, 6].Value.ToString() : null,
|
||||
DateReceive = worksheet.Cells[row, 7].Value != null ? DateTime.Parse(worksheet.Cells[row, 7].Value.ToString()) : null,
|
||||
OrgSend = worksheet.Cells[row, 8].Value != null ? worksheet.Cells[row, 8].Value.ToString() : null,
|
||||
OrgReceive = worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : null,
|
||||
Date = worksheet.Cells[row, 10].Value != null ? DateTime.Parse(worksheet.Cells[row, 10].Value.ToString()) : null,
|
||||
VolumeNo = worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : null,
|
||||
Section = worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : null,
|
||||
Page = worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : null,
|
||||
No = worksheet.Cells[row, 14].Value != null ? worksheet.Cells[row, 14].Value.ToString() : null,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return Error(GlobalMessages.NoFileToUpload);
|
||||
}
|
||||
return list;
|
||||
var file = Request.Form.Files[0];
|
||||
if (!Path.GetExtension(file.FileName).Equals(".xlsx", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return Error("นามสกุลไฟล์ต้องเป็น .xlsx!");
|
||||
}
|
||||
var items = await ReadExcelImportReceive(file);
|
||||
var _insigniaNoteProfiles = new List<dynamic>();
|
||||
foreach (var item in items)
|
||||
{
|
||||
var profile = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.Profile.CitizenId == item.CitizanId);
|
||||
if (profile == null)
|
||||
{
|
||||
var _profile = await _context.Profiles
|
||||
.Include(x => x.Salaries)
|
||||
.FirstOrDefaultAsync(x => x.CitizenId == item.CitizanId);
|
||||
if (_profile == null)
|
||||
continue;
|
||||
var _insignia = await _context.Insignias.FirstOrDefaultAsync(x => x.Name == item.RequestInsignia);
|
||||
if (_insignia == null)
|
||||
continue;
|
||||
profile = new InsigniaNoteProfile
|
||||
{
|
||||
RequestDate = DateTime.Now,
|
||||
Salary = _profile.Salaries.Count() == 0 ? null : _profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
IsApprove = true,
|
||||
Status = "DONE",
|
||||
Number = item.Number,
|
||||
RequestInsignia = _insignia,
|
||||
DateReceive = item.DateReceive,
|
||||
Date = item.Date,
|
||||
VolumeNo = item.VolumeNo,
|
||||
Section = item.Section,
|
||||
Page = item.Page,
|
||||
No = item.No,
|
||||
Profile = _profile,
|
||||
InsigniaNote = insigniaNote,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
profile.Status = "DONE";
|
||||
profile.Number = item.Number;
|
||||
profile.RequestInsignia = await _context.Insignias.FirstOrDefaultAsync(x => x.Name == item.RequestInsignia) == null ? profile.RequestInsignia : await _context.Insignias.FirstOrDefaultAsync(x => x.Name == item.RequestInsignia);
|
||||
profile.DateReceive = item.DateReceive;
|
||||
profile.Date = item.Date;
|
||||
profile.VolumeNo = item.VolumeNo;
|
||||
profile.Section = item.Section;
|
||||
profile.Page = item.Page;
|
||||
profile.No = item.No;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = DateTime.Now;
|
||||
}
|
||||
_insigniaNoteProfiles.Add(
|
||||
new
|
||||
{
|
||||
profile.Id,
|
||||
Prefix = profile.Profile.Prefix == null ? null : profile.Profile.Prefix.Name,
|
||||
Position = profile.Profile.Position == null ? null : profile.Profile.Position.Name,
|
||||
profile.Profile.CitizenId,
|
||||
profile.Profile.ProfileType,
|
||||
FullName = $"{profile.Profile.FirstName} {profile.Profile.LastName}",
|
||||
RequestInsignia = profile.RequestInsignia == null ? null : profile.RequestInsignia.Name,
|
||||
RequestInsigniaId = profile.RequestInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : profile.RequestInsignia.Id,
|
||||
RequestInsigniaShortName = profile.RequestInsignia == null ? null : profile.RequestInsignia.ShortName,
|
||||
profile.DateReceive,
|
||||
profile.OrganizationOrganizationSend,
|
||||
profile.OrganizationOrganizationReceive,
|
||||
profile.Status,
|
||||
profile.Issue,
|
||||
profile.Date,
|
||||
profile.VolumeNo,
|
||||
profile.Section,
|
||||
profile.Page,
|
||||
profile.No,
|
||||
profile.DatePayment,
|
||||
profile.TypePayment,
|
||||
profile.Address,
|
||||
profile.Number,
|
||||
profile.Salary,
|
||||
}
|
||||
);
|
||||
}
|
||||
return Success(_insigniaNoteProfiles);
|
||||
}
|
||||
|
||||
private async Task<List<ImportInvoiceRequest>> ReadExcelImportInvoice(IFormFile formFile)
|
||||
/// <summary>
|
||||
/// preview บันทึกผลใบกำกับเครื่องราชฯ
|
||||
/// </summary>
|
||||
/// <param name="insigniaNoteId">Id รอบบันทึกผลเครื่องราช</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("preview/invoice/{insigniaNoteId:length(36)}"), DisableRequestSizeLimit]
|
||||
public async Task<ActionResult<ResponseObject>> PreviewInvoiceProfile([FromForm] ImportFileRequest req, Guid insigniaNoteId)
|
||||
{
|
||||
var list = new List<ImportInvoiceRequest>();
|
||||
using (var stream = new MemoryStream())
|
||||
var insigniaNote = await _context.InsigniaNotes
|
||||
.Include(x => x.InsigniaNoteProfiles)
|
||||
.ThenInclude(x => x.Profile)
|
||||
.Include(x => x.InsigniaNoteProfiles)
|
||||
.ThenInclude(x => x.RequestInsignia)
|
||||
.ThenInclude(x => x.InsigniaType)
|
||||
.Include(x => x.InsigniaNoteProfiles)
|
||||
.ThenInclude(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.Include(x => x.InsigniaNoteProfiles)
|
||||
.ThenInclude(x => x.Profile)
|
||||
.ThenInclude(x => x.Position)
|
||||
.FirstOrDefaultAsync(x => x.Id == insigniaNoteId);
|
||||
if (insigniaNote == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
|
||||
if (Request.Form.Files == null || Request.Form.Files.Count == 0)
|
||||
{
|
||||
await formFile.CopyToAsync(stream);
|
||||
using (var package = new ExcelPackage(stream))
|
||||
{
|
||||
for (int i = 0; i < package.Workbook.Worksheets.Count(); i++)
|
||||
{
|
||||
ExcelWorksheet worksheet = package.Workbook.Worksheets[i];
|
||||
var rowCount = worksheet.Dimension.Rows;
|
||||
for (int row = 2; row <= rowCount; row++)
|
||||
{
|
||||
list.Add(new ImportInvoiceRequest
|
||||
{
|
||||
CitizanId = worksheet.Cells[row, 1].Value != null ? worksheet.Cells[row, 1].Value.ToString() : null,
|
||||
Number = worksheet.Cells[row, 2].Value != null ? worksheet.Cells[row, 2].Value.ToString() : null,
|
||||
DatePayment = worksheet.Cells[row, 3].Value != null ? DateTime.Parse(worksheet.Cells[row, 3].Value.ToString()) : null,
|
||||
TypePayment = worksheet.Cells[row, 4].Value != null ? worksheet.Cells[row, 4].Value.ToString() : null,
|
||||
Address = worksheet.Cells[row, 5].Value != null ? worksheet.Cells[row, 5].Value.ToString() : null,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return Error(GlobalMessages.NoFileToUpload);
|
||||
}
|
||||
return list;
|
||||
var file = Request.Form.Files[0];
|
||||
if (!Path.GetExtension(file.FileName).Equals(".xlsx", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return Error("นามสกุลไฟล์ต้องเป็น .xlsx!");
|
||||
}
|
||||
var items = await ReadExcelImportInvoice(file);
|
||||
foreach (var item in items)
|
||||
{
|
||||
var profile = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.Profile.CitizenId == item.CitizanId);
|
||||
if (profile == null)
|
||||
continue;
|
||||
profile.Number = item.Number;
|
||||
profile.DatePayment = item.DatePayment;
|
||||
profile.TypePayment = item.TypePayment;
|
||||
profile.Address = item.Address;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = DateTime.Now;
|
||||
}
|
||||
var _insigniaNoteProfiles = new List<dynamic>();
|
||||
foreach (var item in items)
|
||||
{
|
||||
var profile = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.Profile.CitizenId == item.CitizanId);
|
||||
if (profile == null)
|
||||
continue;
|
||||
profile.Status = "DONE";
|
||||
profile.Number = item.Number;
|
||||
profile.DatePayment = item.DatePayment;
|
||||
profile.TypePayment = item.TypePayment;
|
||||
profile.Address = item.Address;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = DateTime.Now;
|
||||
_insigniaNoteProfiles.Add(
|
||||
new
|
||||
{
|
||||
profile.Id,
|
||||
Prefix = profile.Profile.Prefix == null ? null : profile.Profile.Prefix.Name,
|
||||
Position = profile.Profile.Position == null ? null : profile.Profile.Position.Name,
|
||||
profile.Profile.CitizenId,
|
||||
profile.Profile.ProfileType,
|
||||
FullName = $"{profile.Profile.FirstName} {profile.Profile.LastName}",
|
||||
RequestInsignia = profile.RequestInsignia == null ? null : profile.RequestInsignia.Name,
|
||||
RequestInsigniaId = profile.RequestInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : profile.RequestInsignia.Id,
|
||||
RequestInsigniaShortName = profile.RequestInsignia == null ? null : profile.RequestInsignia.ShortName,
|
||||
profile.DateReceive,
|
||||
profile.OrganizationOrganizationSend,
|
||||
profile.OrganizationOrganizationReceive,
|
||||
profile.Status,
|
||||
profile.Issue,
|
||||
profile.Date,
|
||||
profile.VolumeNo,
|
||||
profile.Section,
|
||||
profile.Page,
|
||||
profile.No,
|
||||
profile.DatePayment,
|
||||
profile.TypePayment,
|
||||
profile.Address,
|
||||
profile.Number,
|
||||
profile.Salary,
|
||||
}
|
||||
);
|
||||
}
|
||||
return Success(_insigniaNoteProfiles);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue