diff --git a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs index ddee97cb..1c0741cb 100644 --- a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs +++ b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs @@ -280,8 +280,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", Rank = p.PosLevel ?? "", - ProfileDateAppoint = p.DateAppoint.Value, - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, @@ -425,8 +425,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", Rank = p.PosLevel ?? "", - ProfileDateAppoint = p.DateAppoint.Value, - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, @@ -571,8 +571,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", Rank = p.PosLevel ?? "", - ProfileDateAppoint = p.DateAppoint.Value, - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, PositionLevelId = p.PosLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") @@ -794,8 +794,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", Rank = p.PosLevel ?? "", - ProfileDateAppoint = p.DateAppoint.Value, - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, @@ -939,8 +939,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", Rank = p.PosLevel ?? "", - ProfileDateAppoint = p.DateAppoint.Value, - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, @@ -1081,8 +1081,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", Rank = p.PosLevel ?? "", - ProfileDateAppoint = p.DateAppoint.Value, - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, @@ -1301,8 +1301,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", Rank = p.PosLevel ?? "", - ProfileDateAppoint = p.DateAppoint.Value, - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo ?? "", PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, @@ -1443,8 +1443,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? "" : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -1591,8 +1591,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? "" : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -1738,8 +1738,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? "" : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -1992,8 +1992,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -2139,8 +2139,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -2358,8 +2358,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -2510,8 +2510,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -2730,8 +2730,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -2883,8 +2883,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -3045,8 +3045,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -3292,8 +3292,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -3498,8 +3498,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -3657,8 +3657,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -3819,8 +3819,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -4065,8 +4065,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -4207,8 +4207,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -4442,8 +4442,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -4602,8 +4602,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -4764,8 +4764,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -5008,8 +5008,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -5176,8 +5176,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -5344,8 +5344,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -5594,8 +5594,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -5762,8 +5762,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -5930,8 +5930,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -6176,8 +6176,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? "" : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -6334,8 +6334,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? "" : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -6563,8 +6563,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? "" : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -6725,8 +6725,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? "" : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -6888,8 +6888,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -7130,8 +7130,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -7292,8 +7292,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -7454,8 +7454,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -7667,8 +7667,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -7835,8 +7835,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -8003,8 +8003,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, Rank = p.PosLevel ?? "", - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - ProfileDateAppoint = p.DateAppoint.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : p.ProfileInsignia .Where(x => x.InsigniaId.HasValue && x.InsigniaId.Value != GetInsigniaByName("เหรียญจักรพรรดิมาลา")?.Id) @@ -8625,8 +8625,8 @@ namespace BMA.EHR.Application.Repositories FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", Rank = p.PosLevel ?? "", - ProfileDateAppoint = p.DateAppoint.Value, - GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), + ProfileDateAppoint = p.DateAppoint!.Value, + GovAge = p.DateStart!.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, diff --git a/BMA.EHR.Application/Repositories/Leaves/LeaveRequests/LeaveBeginingRepository.cs b/BMA.EHR.Application/Repositories/Leaves/LeaveRequests/LeaveBeginingRepository.cs index c2d08f70..ec280b48 100644 --- a/BMA.EHR.Application/Repositories/Leaves/LeaveRequests/LeaveBeginingRepository.cs +++ b/BMA.EHR.Application/Repositories/Leaves/LeaveRequests/LeaveBeginingRepository.cs @@ -108,7 +108,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests throw new Exception(GlobalMessages.DataNotFound); } - var govAge = (pf?.DateAppoint?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date); + var govAge = (pf?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date); var leaveType = await _dbContext.Set().FirstOrDefaultAsync(x => x.Id == typeId); @@ -174,7 +174,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests public async Task GetByYearAndTypeIdForUser(int year, Guid typeId, GetProfileByKeycloakIdDto? pf) { - var govAge = (pf?.DateAppoint?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date); + var govAge = (pf?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date); var leaveType = await _dbContext.Set().FirstOrDefaultAsync(x => x.Id == typeId); @@ -247,7 +247,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests return null; } - var govAge = (pf?.DateAppoint?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date); + var govAge = (pf?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date); var leaveType = await _dbContext.Set().FirstOrDefaultAsync(x => x.Id == typeId); @@ -337,7 +337,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests return null; } - var govAge = (pf?.DateAppoint?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date); + var govAge = (pf?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date); var leaveType = await _dbContext.Set().FirstOrDefaultAsync(x => x.Id == typeId); diff --git a/BMA.EHR.Leave/Controllers/LeaveRequestController.cs b/BMA.EHR.Leave/Controllers/LeaveRequestController.cs index a961bfa2..a90ad763 100644 --- a/BMA.EHR.Leave/Controllers/LeaveRequestController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveRequestController.cs @@ -869,7 +869,7 @@ namespace BMA.EHR.Leave.Service.Controllers return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound); } - var govAge = (profile?.DateAppoint?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date); + var govAge = (profile?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date); var leaveType = await _leaveTypeRepository.GetByIdAsync(req.Type); if (leaveType == null) @@ -985,7 +985,7 @@ namespace BMA.EHR.Leave.Service.Controllers // var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken); var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(userId, AccessToken); - var govAge = (profile?.DateAppoint?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date); + var govAge = (profile?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date); var thisYear = DateTime.Now.Year; var message = string.Empty; @@ -1542,7 +1542,7 @@ namespace BMA.EHR.Leave.Service.Controllers return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound); } - var govAge = (profile?.DateAppoint?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date); + var govAge = (profile?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date); var userCalendar = await _userCalendarRepository.GetExist(profile.Id); var category = userCalendar == null ? "NORMAL" : userCalendar.Calendar;