From 90a958addedd35d35682874e7a281e0933689d32 Mon Sep 17 00:00:00 2001 From: kittapath Date: Wed, 25 Dec 2024 22:57:15 +0700 Subject: [PATCH] no message --- .../Repositories/InsigniaPeriodsRepository.cs | 358 ++++++++++-------- .../Profiles/GetProfileByKeycloakIdDto.cs | 10 +- 2 files changed, 195 insertions(+), 173 deletions(-) diff --git a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs index d2cb59ac..bca46caf 100644 --- a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs +++ b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs @@ -264,7 +264,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, @@ -282,9 +282,9 @@ namespace BMA.EHR.Application.Repositories : p.ProfileInsignia!.OrderByDescending(x => x.Year).FirstOrDefault()!.InsigniaId.Value, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PositionSalaryAmount = p.PositionSalaryAmount, @@ -371,7 +371,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, @@ -393,9 +393,9 @@ namespace BMA.EHR.Application.Repositories : p.ProfileInsignia!.OrderByDescending(x => x.Year).FirstOrDefault()!.InsigniaId.Value, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, IsHigherLevel = IsHigherLevel(p.ProfileInsignia.ToList() @@ -476,7 +476,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, @@ -496,9 +496,9 @@ namespace BMA.EHR.Application.Repositories : p.ProfileInsignia!.OrderByDescending(x => x.Year).FirstOrDefault()!.InsigniaId.Value, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, IsHigherLevel = IsHigherLevel(p.ProfileInsignia.ToList() @@ -661,7 +661,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, @@ -679,9 +679,9 @@ namespace BMA.EHR.Application.Repositories : p.ProfileInsignia!.OrderByDescending(x => x.Year).FirstOrDefault()!.InsigniaId.Value, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PositionSalaryAmount = p.PositionSalaryAmount, @@ -767,7 +767,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, @@ -785,9 +785,9 @@ namespace BMA.EHR.Application.Repositories : p.ProfileInsignia!.OrderByDescending(x => x.Year).FirstOrDefault()!.InsigniaId.Value, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, IsHigherLevel = IsHigherLevel(p.ProfileInsignia.ToList() @@ -871,7 +871,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, @@ -889,9 +889,9 @@ namespace BMA.EHR.Application.Repositories : p.ProfileInsignia!.OrderByDescending(x => x.Year).FirstOrDefault()!.InsigniaId.Value, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, IsHigherLevel = IsHigherLevel(p.ProfileInsignia.ToList() @@ -1036,11 +1036,15 @@ namespace BMA.EHR.Application.Repositories { try { + Console.WriteLine("11asd1112"); var period = await _dbContext.Set().FirstOrDefaultAsync(p => p.Id == periodId); + Console.WriteLine("11asd1112z"); if (period == null) throw new Exception(GlobalMessages.CoinPeriodNotFound); + Console.WriteLine("11asdz111qwe2"); var CurrentRetireDate = new DateTime(period.Year, 9, 30); + Console.WriteLine("11asdz1cad112"); var inst_profile = allProfilesByRoot .Select(p => new { @@ -1053,10 +1057,10 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - PosNo = p.PosNo, + PosNo = p.PosNo ?? "", PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -1078,9 +1082,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, ProfileInsignia = p.ProfileInsignia, @@ -1090,6 +1094,16 @@ namespace BMA.EHR.Application.Repositories Root = p.Root, }); + Console.WriteLine("11asdz1qweqwdgfafs112"); + Console.WriteLine(inst_profile); + Console.WriteLine("11asdz1qweqwdgfafs1112"); + Console.WriteLine(allProfilesByRoot); + Console.WriteLine("11asdz1qweqwdgfafs1212"); + Console.WriteLine(JsonConvert.SerializeObject(allProfilesByRoot)); + Console.WriteLine("11asdz1qweqwdgfafs3112"); + Console.WriteLine(JsonConvert.SerializeObject(inst_profile)); + Console.WriteLine("11asdz1qweqwdgfafs1412"); + Console.WriteLine("11asdz1112"); // check วันที่บรรจะต้องน้อยกว่า 29/5/ปี-5 var s1 = ((from p in inst_profile where p.ProfileDateAppoint <= new DateTime(period.Year - 5, 5, 29) @@ -1113,7 +1127,7 @@ namespace BMA.EHR.Application.Repositories FullName = p.FullName, Position = p.Position, PosNo = p.PosNo, - Rank = p.Rank, + Rank = p.Rank ?? "", GovAge = p.GovAge, LastInsignia = p.LastInsignia, LastInsigniaId = p.LastInsigniaId, @@ -1135,6 +1149,7 @@ namespace BMA.EHR.Application.Repositories } })).ToList(); + Console.WriteLine("11ased1112"); var s2 = (from p in allProfilesByRoot where p.PosType == "ทั่วไป" && p.PosLevel == "ปฏิบัติงาน" @@ -1153,10 +1168,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", - Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Position = p.Position == null ? "" : p.Position, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -1175,13 +1190,13 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, - PosNo = p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + PosNo = p.PosNo ?? "", + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -1244,6 +1259,7 @@ namespace BMA.EHR.Application.Repositories }) .ToList(); + Console.WriteLine("11atsd1112"); var s3 = (from p in allProfilesByRoot where p.PosType == "ทั่วไป" && p.PosLevel == "ปฏิบัติงาน" @@ -1262,10 +1278,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", - Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Position = p.Position == null ? "" : p.Position, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -1284,13 +1300,13 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, - PosNo = p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + PosNo = p.PosNo ?? "", + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -1352,6 +1368,7 @@ namespace BMA.EHR.Application.Repositories }) .ToList(); + Console.WriteLine("11hasd1112"); var s4 = (from p in allProfilesByRoot where p.PosType == "ทั่วไป" && p.PosLevel == "ปฏิบัติงาน" @@ -1370,10 +1387,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", - Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Position = p.Position == null ? "" : p.Position, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -1392,13 +1409,13 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, - PosNo = p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + PosNo = p.PosNo ?? "", + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -1468,8 +1485,10 @@ namespace BMA.EHR.Application.Repositories .ToList(); + Console.WriteLine("11asd1fs112"); var result_candidate = new List(); + Console.WriteLine("11aqfassd1112"); foreach (var r in s4) { var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); @@ -1488,6 +1507,7 @@ namespace BMA.EHR.Application.Repositories } } + Console.WriteLine("11asdxcd1112"); foreach (var r in s3) { var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); @@ -1506,6 +1526,7 @@ namespace BMA.EHR.Application.Repositories } } + Console.WriteLine("11asdqwfds1112"); foreach (var r in s2) { var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); @@ -1524,6 +1545,7 @@ namespace BMA.EHR.Application.Repositories } } + Console.WriteLine("11aszxcsdd1112"); foreach (var r in s1) { var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); @@ -1542,6 +1564,7 @@ namespace BMA.EHR.Application.Repositories } } + Console.WriteLine("11asqgtyud1112"); return result_candidate; } catch @@ -1588,7 +1611,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -1607,9 +1630,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -1696,7 +1719,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -1715,9 +1738,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -1876,7 +1899,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -1895,9 +1918,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -1989,7 +2012,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -2008,9 +2031,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -2170,7 +2193,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -2189,9 +2212,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -2284,7 +2307,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -2303,9 +2326,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -2407,7 +2430,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -2426,9 +2449,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -2615,7 +2638,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -2634,9 +2657,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -2782,7 +2805,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -2801,9 +2824,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -2902,7 +2925,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -2921,9 +2944,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -3025,7 +3048,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -3044,9 +3067,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year - 5, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year - 5, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year - 5, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year - 5, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -3232,7 +3255,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -3251,9 +3274,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -3348,7 +3371,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -3367,9 +3390,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -3544,7 +3567,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -3563,9 +3586,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -3665,7 +3688,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -3684,9 +3707,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -3788,7 +3811,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -3807,9 +3830,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -3993,7 +4016,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -4013,9 +4036,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -4122,7 +4145,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -4142,9 +4165,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo == null ? "" : p.PosNo, @@ -4251,7 +4274,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -4271,9 +4294,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, @@ -4461,7 +4484,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -4481,9 +4504,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -4590,7 +4613,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -4610,9 +4633,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -4719,7 +4742,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -4739,9 +4762,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -4923,10 +4946,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", - Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Position = p.Position == null ? "" : p.Position, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -4946,13 +4969,13 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo == null ? "" : p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -5042,10 +5065,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", - Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Position = p.Position == null ? "" : p.Position, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -5065,13 +5088,13 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -5232,10 +5255,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", - Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Position = p.Position == null ? "" : p.Position, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -5255,13 +5278,13 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -5355,10 +5378,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", - Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Position = p.Position == null ? "" : p.Position, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -5378,13 +5401,13 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -5479,10 +5502,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -5502,13 +5525,13 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -5685,7 +5708,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -5705,9 +5728,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -5808,7 +5831,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -5828,9 +5851,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -5931,7 +5954,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -5951,9 +5974,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -6105,7 +6128,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -6125,9 +6148,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -6234,7 +6257,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -6254,9 +6277,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -6363,7 +6386,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -6383,9 +6406,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -6527,8 +6550,7 @@ namespace BMA.EHR.Application.Repositories try { var result_candidate = new List(); - var allOfficerProfilesByRoot = - (await _userProfileRepository.GetOfficerProfileByRootIdAsync(ocId, AccessToken)); + var allOfficerProfilesByRoot = await _userProfileRepository.GetOfficerProfileByRootIdAsync(ocId, AccessToken); //var allEmployeeProfileByRoot = // (await _userProfileRepository.GetEmployeeProfileByRootIdAsync(ocId, AccessToken)); Console.WriteLine("111111"); @@ -6555,15 +6577,15 @@ namespace BMA.EHR.Application.Repositories Console.WriteLine("1111111"); var type2_level9_2 = await GetInsigniaCandidate_Type2_Level9_2(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("1111112"); + Console.WriteLine("a1111112"); var type3_level10 = await GetInsigniaCandidate_Type3_Level10(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("1111113"); + Console.WriteLine("111s1113"); var type3_level11 = await GetInsigniaCandidate_Type3_Level11(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("1111114"); + Console.WriteLine("111s1114"); var type4_level10 = await GetInsigniaCandidate_Type4_Level10(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("1111115"); + Console.WriteLine("1d111115"); var type4_level11 = await GetInsigniaCandidate_Type4_Level11(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("1111116"); + Console.WriteLine("1a111116"); // union result foreach (var r in type_coin) @@ -6728,7 +6750,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, @@ -6753,9 +6775,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PositionSalaryAmount = p.PositionSalaryAmount, @@ -6783,7 +6805,7 @@ namespace BMA.EHR.Application.Repositories FullName = p.FullName, Position = p.Position, PosNo = p.PosNo, - Rank = p.Rank, + Rank = p.Rank ?? "", GovAge = p.GovAge, LastInsignia = p.LastInsignia, LastInsigniaId = p.LastInsigniaId, diff --git a/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs b/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs index 5f92679a..d43b35bf 100644 --- a/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs +++ b/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs @@ -94,7 +94,7 @@ namespace BMA.EHR.Application.Responses.Profiles public Guid? LastUpdateUserId { get; set; } public string? CreatedFullName { get; set; } public string? LastUpdateFullName { get; set; } - public string PosNo { get; set; } = string.Empty; + public string? PosNo { get; set; } = string.Empty; public double? Amount { get; set; } @@ -102,15 +102,15 @@ namespace BMA.EHR.Application.Responses.Profiles public double? MouthSalaryAmount { get; set; } - public int Order { get; set; } + public int? Order { get; set; } public DateTime? Date { get; set; } - public string PositionLevel { get; set; } = string.Empty; + public string? PositionLevel { get; set; } = string.Empty; - public string PositionType { get; set; } = string.Empty; + public string? PositionType { get; set; } = string.Empty; - public string Position { get; set; } = string.Empty; + public string? Position { get; set; } = string.Empty; }