แก้ api ลา
This commit is contained in:
parent
d08b4ca723
commit
4822110533
20 changed files with 20695 additions and 2783 deletions
|
|
@ -283,7 +283,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
.Select(p => new
|
||||
{
|
||||
Id = p.Id,
|
||||
OrganizationOrganization = _userProfileRepository.GetOc(p.OrganizationId, 0, AccessToken) == null ? "" : _userProfileRepository.GetOc(p.OrganizationId, 0, AccessToken)!.Root,
|
||||
OrganizationOrganization = p.Organization,
|
||||
Total = p.Total,
|
||||
Allocate = p.InsigniaManageProfiles.Where(x => x.Status == false).Count(),
|
||||
Remain = p.Total - p.InsigniaManageProfiles.Where(x => x.Status == false).Count(),
|
||||
|
|
@ -312,36 +312,26 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
|
||||
var organization = _userProfileRepository.GetOc(req.OrganizationOrganizationId, 0, AccessToken);
|
||||
|
||||
//var organization = await _context.Organizations.AsQueryable()
|
||||
// .Include(x => x.OrganizationOrganization)
|
||||
// .FirstOrDefaultAsync(x => x.Id == req.OrganizationOrganizationId);
|
||||
if (organization == null)
|
||||
return Error(GlobalMessages.OrganizationNotFound);
|
||||
//if (organization.OrganizationOrganization == null)
|
||||
// return Error(GlobalMessages.OrganizationNotFound);
|
||||
|
||||
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
||||
.Include(x => x.InsigniaManageOrganiations)
|
||||
//.ThenInclude(x => x.OrganizationOrganization)
|
||||
.FirstOrDefaultAsync(x => x.Id == req.insigniaManageId);
|
||||
if (insigniaManage == null)
|
||||
return Error(GlobalMessages.InsigniaManageNotFound);
|
||||
|
||||
var insigniaManageOrganiation = await _context.InsigniaManageOrganiations.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.OrganizationId == organization.RootId && x.InsigniaManage == insigniaManage);
|
||||
.FirstOrDefaultAsync(x => x.OrganizationId == req.OrganizationOrganizationId && x.InsigniaManage == insigniaManage);
|
||||
if (insigniaManageOrganiation != null)
|
||||
return Error(GlobalMessages.InsigniaManageOrgDupicate);
|
||||
|
||||
var total = insigniaManage.InsigniaManageOrganiations.Where(x => x.OrganizationId != organization.RootId).Sum(x => x.Total);
|
||||
var total = insigniaManage.InsigniaManageOrganiations.Where(x => x.OrganizationId != req.OrganizationOrganizationId).Sum(x => x.Total);
|
||||
if (req.Total + total > insigniaManage.Total)
|
||||
return Error(GlobalMessages.InsigniaManageOrgLimit);
|
||||
var root = _userProfileRepository.GetOc(req.OrganizationOrganizationId, 0, AccessToken)?.Root ?? null;
|
||||
await _context.InsigniaManageOrganiations.AddAsync(
|
||||
new InsigniaManageOrganiation
|
||||
{
|
||||
//OrganizationOrganization = organization.OrganizationOrganization,
|
||||
OrganizationId = organization.RootId ?? Guid.Empty,
|
||||
OrganizationId = req.OrganizationOrganizationId,
|
||||
Organization = root,
|
||||
Total = req.Total,
|
||||
InsigniaManage = insigniaManage,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
|
|
@ -404,7 +394,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
var uppdated = await _context.InsigniaManageOrganiations.AsQueryable()
|
||||
//.Include(x => x.OrganizationOrganization)
|
||||
.Include(x => x.InsigniaManage)
|
||||
.FirstOrDefaultAsync(x => x.Id == insigniaManageOrgId);
|
||||
if (uppdated == null)
|
||||
|
|
@ -412,7 +401,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
||||
.Include(x => x.InsigniaManageOrganiations)
|
||||
//.ThenInclude(x => x.OrganizationOrganization)
|
||||
.FirstOrDefaultAsync(x => x.Id == uppdated.InsigniaManage.Id);
|
||||
if (insigniaManage == null)
|
||||
return Error(GlobalMessages.InsigniaManageNotFound);
|
||||
|
|
@ -496,26 +484,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
if (insigniaNoteProfile.Status != "DONE")
|
||||
return Error(GlobalMessages.InsigniaNoBorrow);
|
||||
|
||||
var userProfile = _userProfileRepository.GetOfficerProfileById(insigniaNoteProfile.ProfileId.Value, AccessToken);
|
||||
|
||||
//var _organization = await _context.Organizations.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.Id == insigniaNoteProfile.Profile.OcId);
|
||||
|
||||
//TODO : Hardcode OCId ต้องแก้ให้ดึงมาจากคน Login
|
||||
var user_oc = _userProfileRepository.GetUserOCId(userProfile.Keycloak.Value, AccessToken);
|
||||
if (req.BorrowOrganizationId == null) req.BorrowOrganizationId = user_oc;
|
||||
//if (req.BorrowOrganizationId == null) req.BorrowOrganizationId = Guid.Parse("e8493cd1-d371-402e-add6-566e68d5d1b3");
|
||||
|
||||
var organization = _userProfileRepository.GetOc(req.BorrowOrganizationId.Value, 0, AccessToken);
|
||||
//if (organization == null)
|
||||
// return Error(GlobalMessages.OrganizationNotFound);
|
||||
|
||||
//var organization = await _context.Organizations.AsQueryable()
|
||||
// .Include(x => x.OrganizationOrganization)
|
||||
// .FirstOrDefaultAsync(x => x.Id == _organization.OrganizationAgencyId);
|
||||
//if (organization == null)
|
||||
// return Error(GlobalMessages.OrganizationNotFound);
|
||||
|
||||
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Year == insigniaNoteProfile.InsigniaNote.Year && x.Insignia == insigniaNoteProfile.RequestInsignia);
|
||||
if (insigniaManage == null)
|
||||
|
|
@ -523,7 +491,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
var insigniaManageOrganiation = await _context.InsigniaManageOrganiations.AsQueryable()
|
||||
.Include(x => x.InsigniaManageProfiles)
|
||||
.FirstOrDefaultAsync(x => x.OrganizationId == organization.RootId && x.InsigniaManage == insigniaManage);
|
||||
.FirstOrDefaultAsync(x => x.OrganizationId == insigniaNoteProfile.RootId && x.InsigniaManage == insigniaManage);
|
||||
if (insigniaManageOrganiation == null)
|
||||
return Error(GlobalMessages.InsigniaManageOrgNotFound);
|
||||
|
||||
|
|
@ -540,7 +508,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
{
|
||||
Status = false,
|
||||
InsigniaManageOrganiation = insigniaManageOrganiation,
|
||||
BorrowOrganizationId = organization.RootId,
|
||||
BorrowOrganizationId = insigniaNoteProfile.RootId,
|
||||
BorrowOrganization = insigniaNoteProfile.Root,
|
||||
BorrowDate = req.BorrowDate,
|
||||
InsigniaNoteProfile = insigniaNoteProfile,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
|
|
@ -575,26 +544,14 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
var uppdated = await _context.InsigniaManageProfiles.AsQueryable()
|
||||
//.Include(x => x.BorrowOrganization)
|
||||
.FirstOrDefaultAsync(x => x.Id == insigniaManageProfileId);
|
||||
if (uppdated == null)
|
||||
return Error(GlobalMessages.InsigniaManageNotFound);
|
||||
|
||||
uppdated.Status = true;
|
||||
uppdated.ReturnDate = req.ReturnDate;
|
||||
// if (req.ReturnOrganizationId == Guid.Parse("00000000-0000-0000-0000-000000000000"))
|
||||
// {
|
||||
uppdated.ReturnOrganizationId = uppdated.BorrowOrganizationId;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var organization = await _context.Organizations.AsQueryable()
|
||||
// .Include(x => x.OrganizationOrganization)
|
||||
// .FirstOrDefaultAsync(x => x.Id == req.ReturnOrganizationId);
|
||||
// if (organization == null)
|
||||
// return Error(GlobalMessages.OrganizationNotFound);
|
||||
// uppdated.ReturnOrganization = organization.OrganizationOrganization;
|
||||
// }
|
||||
uppdated.ReturnOrganization = uppdated.BorrowOrganization;
|
||||
uppdated.ReturnReason = req.ReturnReason;
|
||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
uppdated.LastUpdateUserId = UserId ?? "";
|
||||
|
|
@ -637,9 +594,17 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
.Select(p => new
|
||||
{
|
||||
Id = p.Id,
|
||||
BorrowOrganization = p.BorrowOrganizationId == null ? null : _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken),
|
||||
ReturnOrganization = p.ReturnOrganizationId == null ? null : _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken),
|
||||
Profile = p.InsigniaNoteProfile.ProfileId == null ? null : _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken),
|
||||
BorrowOrganization = p.BorrowOrganization,
|
||||
BorrowOrganizationId = p.BorrowOrganizationId,
|
||||
ReturnOrganization = p.ReturnOrganization,
|
||||
ReturnOrganizationId = p.ReturnOrganizationId,
|
||||
Profile = p.InsigniaNoteProfile!.ProfileId ?? Guid.Empty,
|
||||
CitizenId = p.InsigniaNoteProfile!.CitizenId ?? string.Empty,
|
||||
Prefix = p.InsigniaNoteProfile!.Prefix ?? string.Empty,
|
||||
FirstName = p.InsigniaNoteProfile!.FirstName ?? string.Empty,
|
||||
LastName = p.InsigniaNoteProfile!.LastName ?? string.Empty,
|
||||
ProfileType = p.InsigniaNoteProfile!.ProfileType ?? string.Empty,
|
||||
Position = p.InsigniaNoteProfile!.Position ?? string.Empty,
|
||||
|
||||
Status = p.Status,
|
||||
BorrowDate = p.BorrowDate,
|
||||
|
|
@ -675,21 +640,21 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
{
|
||||
p.Id,
|
||||
p.Status,
|
||||
BorrowOrganization = p.BorrowOrganization == null ? "" : p.BorrowOrganization.Root,
|
||||
BorrowOrganizationId = p.BorrowOrganization == null ? Guid.Empty : p.BorrowOrganization.RootId,
|
||||
BorrowOrganization = p.BorrowOrganization,
|
||||
BorrowOrganizationId = p.BorrowOrganizationId,
|
||||
p.BorrowDate,
|
||||
p.ReturnDate,
|
||||
ReturnOrganization = p.ReturnOrganization == null ? "" : p.ReturnOrganization.Root,
|
||||
ReturnOrganizationId = p.ReturnOrganization == null ? Guid.Empty : p.ReturnOrganization.RootId,
|
||||
ReturnOrganization = p.ReturnOrganization,
|
||||
ReturnOrganizationId = p.ReturnOrganizationId,
|
||||
p.ReturnReason,
|
||||
p.LastUpdatedAt,
|
||||
p.CreatedAt,
|
||||
p.InsigniaNoteProfileId,
|
||||
CitizenId = p.Profile == null ? "" : p.Profile.CitizenId,
|
||||
Prefix = p.Profile == null ? "" : p.Profile.Prefix,
|
||||
Position = p.Profile == null ? "" : p.Profile.Position,
|
||||
FullName = p.Profile == null ? "" : $"{p.Profile.Prefix}{p.Profile.FirstName} {p.Profile.LastName}",
|
||||
ProfileType = p.Profile == null ? "" : p.Profile.ProfileType,
|
||||
CitizenId = p.CitizenId,
|
||||
Prefix = p.Prefix,
|
||||
Position = p.Position,
|
||||
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
||||
ProfileType = p.ProfileType,
|
||||
p.RequestInsignia,
|
||||
p.RequestInsigniaId,
|
||||
p.RequestInsigniaShortName,
|
||||
|
|
@ -712,51 +677,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
})
|
||||
.ToList();
|
||||
|
||||
//var data = await _context.InsigniaManageProfiles.AsQueryable()
|
||||
// .Where(x => x.InsigniaNoteProfile.RequestInsignia.InsigniaType == insigniaType)
|
||||
// .Where(x => year == 0 ? x.Id != null : x.InsigniaManageOrganiation.InsigniaManage.Year == year)
|
||||
// .OrderByDescending(x => x.CreatedAt)
|
||||
// .Select(p => new
|
||||
// {
|
||||
// Id = p.Id,
|
||||
// Status = p.Status,
|
||||
// BorrowOrganization = _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken) == null ? null : _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken).Root,
|
||||
// BorrowOrganizationId = _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken) == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken).RootId,
|
||||
// BorrowDate = p.BorrowDate,
|
||||
// ReturnDate = p.ReturnDate,
|
||||
// ReturnOrganization = _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken) == null ? null : _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken).Root,
|
||||
// ReturnOrganizationId = _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken) == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken).RootId,
|
||||
// ReturnReason = p.ReturnReason,
|
||||
// LastUpdatedAt = p.LastUpdatedAt,
|
||||
// CreatedAt = p.CreatedAt,
|
||||
|
||||
// InsigniaNoteProfileId = p.InsigniaNoteProfile.Id,
|
||||
// Prefix = _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).Prefix,
|
||||
// Position = _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).Position,
|
||||
// _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).CitizenId,
|
||||
// _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).ProfileType,
|
||||
// FullName = $"{_userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).Prefix}{_userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).FirstName} {_userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).LastName}",
|
||||
// RequestInsignia = p.InsigniaNoteProfile.RequestInsignia == null ? null : p.InsigniaNoteProfile.RequestInsignia.Name,
|
||||
// RequestInsigniaId = p.InsigniaNoteProfile.RequestInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.InsigniaNoteProfile.RequestInsignia.Id,
|
||||
// RequestInsigniaShortName = p.InsigniaNoteProfile.RequestInsignia == null ? null : p.InsigniaNoteProfile.RequestInsignia.ShortName,
|
||||
// p.InsigniaNoteProfile.DateReceive,
|
||||
// p.InsigniaNoteProfile.OrganizationOrganizationSend,
|
||||
// p.InsigniaNoteProfile.OrganizationOrganizationReceive,
|
||||
// InsigniaNoteProfileStatus = p.InsigniaNoteProfile.Status,
|
||||
// p.InsigniaNoteProfile.Issue,
|
||||
// p.InsigniaNoteProfile.Date,
|
||||
// p.InsigniaNoteProfile.VolumeNo,
|
||||
// p.InsigniaNoteProfile.Section,
|
||||
// p.InsigniaNoteProfile.Page,
|
||||
// p.InsigniaNoteProfile.No,
|
||||
// p.InsigniaNoteProfile.DatePayment,
|
||||
// p.InsigniaNoteProfile.TypePayment,
|
||||
// p.InsigniaNoteProfile.Address,
|
||||
// p.InsigniaNoteProfile.Number,
|
||||
// p.InsigniaNoteProfile.Salary,
|
||||
// })
|
||||
// .ToListAsync();
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
|
||||
|
|
@ -778,12 +698,12 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
{
|
||||
Id = p.Id,
|
||||
Status = p.Status,
|
||||
BorrowOrganization = _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken) == null ? null : _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken).Root,
|
||||
BorrowOrganizationId = _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken) == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken).RootId,
|
||||
BorrowOrganization = p.BorrowOrganization,
|
||||
BorrowOrganizationId = p.BorrowOrganizationId,
|
||||
BorrowDate = p.BorrowDate,
|
||||
ReturnDate = p.ReturnDate,
|
||||
ReturnOrganization = _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken) == null ? null : _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken).Root,
|
||||
ReturnOrganizationId = _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken) == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken).RootId,
|
||||
ReturnOrganization = p.ReturnOrganization,
|
||||
ReturnOrganizationId = p.ReturnOrganizationId,
|
||||
ReturnReason = p.ReturnReason,
|
||||
LastUpdatedAt = p.LastUpdatedAt,
|
||||
CreatedAt = p.CreatedAt,
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
var insigniaPeriods = await _context.InsigniaPeriods.AsQueryable()
|
||||
// .Where(x => x.Type == type)
|
||||
.OrderByDescending(x => x.Year)
|
||||
.ThenByDescending(x => x.StartDate)
|
||||
.Select(p => new
|
||||
|
|
@ -234,7 +233,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
|
||||
RevisionId = revisionId ?? Guid.Empty
|
||||
};
|
||||
await _context.InsigniaPeriods.AddAsync(period);
|
||||
|
|
@ -248,7 +246,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
period.ReliefDoc = doc;
|
||||
}
|
||||
|
||||
// await _context.InsigniaPeriods.AddAsync(period);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
|
|||
|
|
@ -57,87 +57,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
}
|
||||
else
|
||||
{
|
||||
// var request = _context.InsigniaRequestProfiles
|
||||
// .Include(x => x.Request)
|
||||
// .ThenInclude(x => x.Period)
|
||||
// .Include(x => x.RequestInsignia)
|
||||
// .ThenInclude(x => x.InsigniaType)
|
||||
// .Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.AcademicStanding)
|
||||
// .Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.Position)
|
||||
// .Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.Insignias)
|
||||
// .ThenInclude(x => x.Insignia)
|
||||
// .ThenInclude(x => x.InsigniaType)
|
||||
// .Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.PositionNumber)
|
||||
// .Where(x => x.Request.Period.Id == result.PeriodId)
|
||||
// .Where(x => x.Request.RequestStatus == "st5p")
|
||||
// .Where(x => x.IsApprove)
|
||||
// .Select(p => new
|
||||
// {
|
||||
// Profile = p.Profile.Id,
|
||||
// Name = $"{p.Profile.Prefix} {p.Profile.FirstName} {p.Profile.LastName}",
|
||||
// Insignia = p.RequestInsignia,
|
||||
// Type = p.RequestInsignia.InsigniaType,
|
||||
// IsApprove = p.IsApprove,
|
||||
// InsigniaId = p.RequestInsignia.Id,
|
||||
// Year = p.Request.Period.Year,
|
||||
// Special = p.Special,
|
||||
// LastInsignia = p.Profile.Insignias.AsQueryable()
|
||||
// .Include(x => x.Insignia)
|
||||
// .Where(x => x.Insignia.Id == p.RequestInsignia.Id)
|
||||
// .Where(x => x.Year == p.Request.Period.Year)
|
||||
// .FirstOrDefault()
|
||||
// })
|
||||
// .ToList()
|
||||
// .Select(r => new InsigniaReceiveResponse
|
||||
// {
|
||||
// Profile = r.Profile,
|
||||
// Name = r.Name,
|
||||
// Insignia = r.Insignia.Name,
|
||||
// TypeId = r.Type == null ? null : r.Type.Id,
|
||||
// TypeName = r.Type == null ? "" : r.Type.Description,
|
||||
// IsApprove = r.IsApprove,
|
||||
// InsigniaId = r.InsigniaId,
|
||||
// InsigniaPage = r.LastInsignia == null ? "" : r.LastInsignia.Page,
|
||||
// InsigniaNo = r.LastInsignia == null ? "" : r.LastInsignia.No,
|
||||
// InsigniaIssue = r.LastInsignia == null ? "" : r.LastInsignia.Issue,
|
||||
// InsigniaVolumeno = r.LastInsignia == null ? "" : r.LastInsignia.VolumeNo,
|
||||
// InsigniaVolume = r.LastInsignia == null ? "" : r.LastInsignia.Volume,
|
||||
// InsigniaSection = r.LastInsignia == null ? "" : r.LastInsignia.Section,
|
||||
// InsigniaDatereceive = r.LastInsignia == null ? null : r.LastInsignia.DateReceive,
|
||||
// InsigniaDateannounce = r.LastInsignia == null ? null : r.LastInsignia.DateAnnounce,
|
||||
// Special = r.Special
|
||||
// })
|
||||
// .ToList()
|
||||
// .GroupBy(r => new { r.TypeId, r.TypeName })
|
||||
// .Select(r => new
|
||||
// {
|
||||
// TypeId = r.Key.TypeId,
|
||||
// InsigniaIssue = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaIssue : "",
|
||||
// InsigniaVolumeno = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaVolumeno : null,
|
||||
// InsigniaVolume = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaVolume : "",
|
||||
// InsigniaSection = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaSection : "",
|
||||
// InsigniaDatereceive = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaDatereceive : null,
|
||||
// InsigniaDateannounce = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaDateannounce : null,
|
||||
// TypeName = r.Key.TypeName,
|
||||
// Profile = r.Select(r => new
|
||||
// {
|
||||
// Profile = r.Profile,
|
||||
// Name = r.Name,
|
||||
// Insignia = r.Insignia,
|
||||
// InsigniaId = r.InsigniaId,
|
||||
// InsigniaPage = r.InsigniaPage,
|
||||
// InsigniaNo = r.InsigniaNo,
|
||||
// //Special = bool.Parse(r.Special)
|
||||
// }).ToList(),
|
||||
// Docs = new List<dynamic>()
|
||||
// });
|
||||
|
||||
return Success();
|
||||
// return Success(request);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -179,68 +99,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
}, AccessToken);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// foreach (var i in items.Profile)
|
||||
// {
|
||||
// var profile = _context.Profiles.AsQueryable()
|
||||
// .Include(x => x.Insignias)
|
||||
// .ThenInclude(x => x.Insignia)
|
||||
// .Where(x => x.Id == i.FkProfileId)
|
||||
// .FirstOrDefault();
|
||||
// if (profile != null)
|
||||
// {
|
||||
// var kp7 = profile.Insignias.AsQueryable()
|
||||
// .Where(x => x.Insignia.Id == i.Kp7InsigniaId)
|
||||
// .FirstOrDefault();
|
||||
|
||||
// if (kp7 != null)
|
||||
// {
|
||||
// // exit item update to database
|
||||
// kp7.DateReceive = items.InsigniaDatereceive.Value;
|
||||
// kp7.Level = items.InsigniaLevel;
|
||||
// kp7.Issue = items.InsigniaIssue;
|
||||
// kp7.VolumeNo = items.InsigniaVolumeno.Value.ToString();
|
||||
// kp7.Volume = items.InsigniaVolume;
|
||||
// kp7.Section = items.InsigniaSection;
|
||||
// kp7.DateAnnounce = items.InsigniaDateannounce.Value;
|
||||
// kp7.Page = i.InsigniaPage;
|
||||
// kp7.No = i.InsigniaNo;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // insert new item to kp7
|
||||
// var insignia_item = _context.Insignias.FirstOrDefault(x => x.Id == i.Kp7InsigniaId);
|
||||
// var result = _repository.GetInsigniaRequest(type, items.OCId);
|
||||
|
||||
// var period = _context.InsigniaPeriods.FirstOrDefault(x => x.Id == result.PeriodId);
|
||||
|
||||
// kp7 = new Models.HR.ProfileInsignia
|
||||
// {
|
||||
// Order = profile.Insignias.ToList().Count + 1,
|
||||
// Year = period.Year,
|
||||
// Insignia = insignia_item,
|
||||
// DateReceive = items.InsigniaDatereceive.Value,
|
||||
// DateStamp = DateTime.Now,
|
||||
// Level = items.InsigniaLevel,
|
||||
// Issue = items.InsigniaIssue,
|
||||
// VolumeNo = items.InsigniaVolumeno.Value.ToString(),
|
||||
// Volume = items.InsigniaVolume,
|
||||
// Section = items.InsigniaSection,
|
||||
// DateAnnounce = items.InsigniaDateannounce.Value,
|
||||
// Page = i.InsigniaPage,
|
||||
// No = i.InsigniaNo,
|
||||
// };
|
||||
// profile.Insignias.Add(kp7);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// return NotFound("Profile not found!!!");
|
||||
// }
|
||||
}
|
||||
//_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue