diff --git a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs index 7edb2d48..01de8382 100644 --- a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs +++ b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs @@ -87,8 +87,8 @@ namespace BMA.EHR.Application.Repositories Id = i.Id, Name = i.Name, ShortName = i.ShortName, - Level = i.InsigniaType.Name, - LevelId = i.InsigniaType.Id + Level = i.InsigniaType?.Name ?? "", + LevelId = i.InsigniaType?.Id ?? null }) .FirstOrDefault(); @@ -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,13 +282,13 @@ 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, - Amount = p.Amount, + PositionSalaryAmount = p.PositionSalaryAmount ?? 0, + Amount = p.Amount ?? 0, RootId = p.RootId, Root = p.Root, }); @@ -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, @@ -380,8 +380,8 @@ namespace BMA.EHR.Application.Repositories PositionTypeId = p.PosTypeId, PositionTypeName = p.PosType, Gender = p.Gender ?? "", - PositionSalaryAmount = p.PositionSalaryAmount, - Amount = p.Amount, + PositionSalaryAmount = p.PositionSalaryAmount ?? 0, + Amount = p.Amount ?? 0, RootId = p.RootId, Root = p.Root, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 @@ -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() @@ -511,8 +511,8 @@ namespace BMA.EHR.Application.Repositories .FirstOrDefault() == null ? 0 : p.ProfileInsignia.Where(x => x.InsigniaId.Value == bcmRoyal.Id).OrderBy(x => x.Year) .FirstOrDefault().Year, - PositionSalaryAmount = p.PositionSalaryAmount, - Amount = p.Amount, + PositionSalaryAmount = p.PositionSalaryAmount ?? 0, + Amount = p.Amount ?? 0, RootId = p.RootId, Root = p.Root, }) @@ -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,13 +679,13 @@ 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, - Amount = p.Amount, + PositionSalaryAmount = p.PositionSalaryAmount ?? 0, + Amount = p.Amount ?? 0, RootId = p.RootId, Root = p.Root, }); @@ -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() @@ -800,8 +800,8 @@ namespace BMA.EHR.Application.Repositories .FirstOrDefault() == null ? 0 : p.ProfileInsignia.Where(x => x.InsigniaId.Value == bcpRoyal.Id).OrderBy(x => x.Year) .FirstOrDefault().Year, - PositionSalaryAmount = p.PositionSalaryAmount, - Amount = p.Amount, + PositionSalaryAmount = p.PositionSalaryAmount ?? 0, + Amount = p.Amount ?? 0, RootId = p.RootId, Root = p.Root, }) @@ -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() @@ -935,8 +935,8 @@ namespace BMA.EHR.Application.Repositories RequestInsignia = GetInsigniaByName("จัตุรถาภรณ์ช้างเผือก"), Seq = 2, Gender = p.Gender, - PositionSalaryAmount = p.PositionSalaryAmount, - Amount = p.Amount, + PositionSalaryAmount = p.PositionSalaryAmount ?? 0, + Amount = p.Amount ?? 0, RootId = p.RootId, Root = p.Root, MatchingConditions = new List @@ -1053,10 +1053,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 +1078,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, @@ -1113,7 +1113,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, @@ -1153,10 +1153,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 +1175,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, @@ -1262,10 +1262,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 +1284,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, @@ -1370,10 +1370,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 +1392,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, @@ -1588,7 +1588,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 +1607,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 +1696,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 +1715,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 +1876,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 +1895,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 +1989,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 +2008,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 +2170,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 +2189,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 +2284,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 +2303,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 +2407,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 +2426,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 +2615,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 +2634,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 +2782,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 +2801,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 +2902,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 +2921,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 +3025,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 +3044,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 +3232,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 +3251,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 +3348,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 +3367,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 +3544,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 +3563,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 +3665,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 +3684,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 +3788,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 +3807,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 +3993,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 +4013,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 +4122,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 +4142,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 +4251,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 +4271,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 +4461,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 +4481,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 +4590,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 +4610,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 +4719,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 +4739,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 +4923,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 +4946,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 +5042,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 +5065,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 +5232,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 +5255,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 +5355,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 +5378,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 +5479,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 +5502,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 +5685,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 +5705,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 +5808,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 +5828,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 +5931,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 +5951,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 +6105,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 +6125,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 +6234,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 +6254,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 +6363,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 +6383,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, @@ -6529,8 +6529,9 @@ namespace BMA.EHR.Application.Repositories var result_candidate = new List(); var allOfficerProfilesByRoot = (await _userProfileRepository.GetOfficerProfileByRootIdAsync(ocId, AccessToken)); - //var allEmployeeProfileByRoot = - // (await _userProfileRepository.GetEmployeeProfileByRootIdAsync(ocId, AccessToken)); + + var allEmployeeProfileByRoot = + (await _userProfileRepository.GetEmployeeProfileByRootIdAsync(ocId, AccessToken)); var type_coin = await GetCoinCandidate(periodId, ocId, allOfficerProfilesByRoot); var type1_level1 = await GetInsigniaCandidate_Type1_Level1(periodId, ocId, allOfficerProfilesByRoot); @@ -6550,6 +6551,10 @@ namespace BMA.EHR.Application.Repositories var type4_level10 = await GetInsigniaCandidate_Type4_Level10(periodId, ocId, allOfficerProfilesByRoot); var type4_level11 = await GetInsigniaCandidate_Type4_Level11(periodId, ocId, allOfficerProfilesByRoot); + + var employee_type1 = await GetEmployeeInsignia_Type1(periodId, ocId, allEmployeeProfileByRoot); + var employee_type2 = await GetEmployeeInsignia_Type2(periodId, ocId, allEmployeeProfileByRoot); + // union result foreach (var r in type_coin) { @@ -6656,20 +6661,19 @@ namespace BMA.EHR.Application.Repositories result_candidate.Add(r); } - // TODO : Remove for Test Error - //foreach (var r in employee_type2) - //{ - // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); - // if (old == null) - // result_candidate.Add(r); - //} + foreach (var r in employee_type2) + { + var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + if (old == null) + result_candidate.Add(r); + } - //foreach (var r in employee_type1) - //{ - // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); - // if (old == null) - // result_candidate.Add(r); - //} + foreach (var r in employee_type1) + { + var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + if (old == null) + result_candidate.Add(r); + } //foreach (var r in type) @@ -6710,7 +6714,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, @@ -6735,9 +6739,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, @@ -6763,7 +6767,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; } diff --git a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs index 36028d83..9662aa45 100644 --- a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs +++ b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs @@ -1039,13 +1039,15 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new { - fullName = _null, - positionname = r.RemarkHorizontal, - positionno = _null, - organizationname = _null, - salary = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new { + fullName = _null, + positionname = r.RemarkHorizontal, + positionno = _null, + organizationname = _null, + salary = _null, + }); + } } return Success(result); } diff --git a/BMA.EHR.Domain/Models/Discipline/DisciplineComplaint_Appeal.cs b/BMA.EHR.Domain/Models/Discipline/DisciplineComplaint_Appeal.cs index 3f653f9f..7bea750a 100644 --- a/BMA.EHR.Domain/Models/Discipline/DisciplineComplaint_Appeal.cs +++ b/BMA.EHR.Domain/Models/Discipline/DisciplineComplaint_Appeal.cs @@ -45,6 +45,9 @@ namespace BMA.EHR.Domain.Models.Discipline [Comment("สังกัดผู้อุทธรณ์/ร้องทุกข์")] public string? Oc { get; set; } + [Comment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")] + public string? profileType { get; set; } + public virtual List DisciplineComplaint_Appeal_Docs { get; set; } = new List(); public virtual List DisciplineComplaint_Appeal_Historys { get; set; } = new List(); } diff --git a/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20241226172314_update table disciplinecom add profiletype.Designer.cs b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20241226172314_update table disciplinecom add profiletype.Designer.cs new file mode 100644 index 00000000..3192c4eb --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20241226172314_update table disciplinecom add profiletype.Designer.cs @@ -0,0 +1,3379 @@ +// +using System; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb +{ + [DbContext(typeof(DisciplineDbContext))] + [Migration("20241226172314_update table disciplinecom add profiletype")] + partial class updatetabledisciplinecomaddprofiletype + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.9") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Appellant") + .HasColumnType("longtext") + .HasComment("ผู้ร้องเรียน"); + + b.Property("ComplaintFrom") + .HasColumnType("longtext") + .HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)"); + + b.Property("ConsideredAgency") + .HasColumnType("longtext") + .HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง"); + + b.Property("ConsideredAgencyId") + .HasColumnType("longtext") + .HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateConsideration") + .HasColumnType("datetime(6)") + .HasComment("วันที่กำหนดพิจารณา"); + + b.Property("DateNotification") + .HasColumnType("datetime(6)") + .HasComment("วันแจ้งเตือนล่วงหน้า"); + + b.Property("DateReceived") + .HasColumnType("datetime(6)") + .HasComment("วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"); + + b.Property("Description") + .HasColumnType("text") + .HasComment("รายละเอียดของเรื่องร้องเรียน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("LevelConsideration") + .HasColumnType("longtext") + .HasComment("ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)"); + + b.Property("OffenseDetails") + .HasColumnType("longtext") + .HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"); + + b.Property("Organization") + .HasColumnType("longtext") + .HasComment("กรณีหน่วยงานใส่หน่วยงาน"); + + b.Property("OrganizationId") + .HasColumnType("longtext") + .HasComment("กรณีหน่วยงานใส่หน่วยงาน id"); + + b.Property("RespondentType") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)"); + + b.Property("Result") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบ"); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text") + .HasComment("เรื่องที่ร้องเรียน"); + + b.Property("activeId") + .HasColumnType("longtext") + .HasComment("version หน่วยงาน"); + + b.HasKey("Id"); + + b.ToTable("DisciplineComplaints"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CaseNumber") + .HasColumnType("longtext") + .HasComment("คดีเลขที่"); + + b.Property("CaseType") + .HasColumnType("longtext") + .HasComment("ประเภทคดี"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Description") + .HasColumnType("text") + .HasComment("รายละเอียดของเรื่องอุทธรณ์/ร้องทุกข์"); + + b.Property("Fullname") + .HasColumnType("longtext") + .HasComment("ชื่อ-นามสกุลผู้อุทธรณ์/ร้องทุกข์"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Oc") + .HasColumnType("longtext") + .HasComment("สังกัดผู้อุทธรณ์/ร้องทุกข์"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่งผู้อุทธรณ์/ร้องทุกข์"); + + b.Property("ProfileId") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ProfileId"); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะอุทธรณ์/ร้องทุกข์"); + + b.Property("Title") + .HasColumnType("text") + .HasComment("เรื่องที่อุทธรณ์/ร้องทุกข์"); + + b.Property("Type") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ประเภทอุทธรณ์หรือร้องทุกข์"); + + b.Property("Year") + .HasColumnType("int") + .HasComment("ปีงบประมาณ"); + + b.Property("profileType") + .HasColumnType("longtext") + .HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)"); + + b.HasKey("Id"); + + b.ToTable("DisciplineComplaint_Appeals"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal_Doc", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineComplaint_AppealId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineComplaint_AppealId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineComplaint_Appeal_Docs"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal_History", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineComplaint_AppealId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะอุทธรณ์/ร้องทุกข์"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineComplaint_AppealId"); + + b.ToTable("DisciplineComplaint_Appeal_Historys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Channel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ชื่อประเภทการร้องเรียน"); + + b.HasKey("Id"); + + b.ToTable("DisciplineComplaint_Channels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Doc", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineComplaintId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineComplaintId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineComplaint_Docs"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Profile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineComplaintId") + .HasColumnType("char(36)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("IsAncestorDNA") + .HasColumnType("tinyint(1)") + .HasComment("รายการเก่า"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Organization") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("PersonId") + .HasColumnType("longtext") + .HasComment("id อ้างอิง profile"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("Salary") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("child1") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child1"); + + b.Property("child1Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child1"); + + b.Property("child1ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child1"); + + b.Property("child2") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child2"); + + b.Property("child2Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child2"); + + b.Property("child2ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child2"); + + b.Property("child3") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child3"); + + b.Property("child3Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child3"); + + b.Property("child3ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child3"); + + b.Property("child4") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child4"); + + b.Property("child4Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child4"); + + b.Property("child4ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child4"); + + b.Property("posLevelId") + .HasColumnType("longtext") + .HasComment("id ระดับตำแหน่ง"); + + b.Property("posLevelName") + .HasColumnType("longtext") + .HasComment("ชื่อระดับตำแหน่ง"); + + b.Property("posMasterNo") + .HasColumnType("int") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("posTypeId") + .HasColumnType("longtext") + .HasComment("id ประเภทตำแหน่ง"); + + b.Property("posTypeName") + .HasColumnType("longtext") + .HasComment("ชื่อประเภทตำแหน่ง"); + + b.Property("profileType") + .HasColumnType("longtext") + .HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)"); + + b.Property("root") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน root"); + + b.Property("rootId") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน root"); + + b.Property("rootShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน root"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineComplaintId"); + + b.ToTable("DisciplineComplaint_Profiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Email") + .HasColumnType("longtext") + .HasComment("อีเมล"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ชื่อ"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Phone") + .HasColumnType("longtext") + .HasComment("เบอร์โทรศัพท์"); + + b.Property("Position") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("Prefix") + .IsRequired() + .HasColumnType("longtext") + .HasComment("คำนำหน้าชื่อ"); + + b.Property("Qualification") + .HasColumnType("longtext") + .HasComment("คุณวุฒิ"); + + b.HasKey("Id"); + + b.ToTable("DisciplineDirectors"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Appellant") + .HasColumnType("longtext") + .HasComment("ผู้ร้องเรียน"); + + b.Property("ComplaintFrom") + .HasColumnType("longtext") + .HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)"); + + b.Property("ConsideredAgency") + .HasColumnType("longtext") + .HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง"); + + b.Property("ConsideredAgencyId") + .HasColumnType("longtext") + .HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateConsideration") + .HasColumnType("datetime(6)") + .HasComment("วันที่กำหนดพิจารณา"); + + b.Property("DateNotification") + .HasColumnType("datetime(6)") + .HasComment("วันแจ้งเตือนล่วงหน้า"); + + b.Property("DateReceived") + .HasColumnType("datetime(6)") + .HasComment("วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"); + + b.Property("Description") + .HasColumnType("text") + .HasComment("รายละเอียดของเรื่องร้องเรียน"); + + b.Property("DisciplinaryCaseFault") + .HasColumnType("longtext") + .HasComment("กรณีความผิด"); + + b.Property("DisciplinaryCauseText") + .HasColumnType("longtext") + .HasComment("ผลการสอบสวน กรณีมีมูล"); + + b.Property("DisciplinaryDateAllegation") + .HasColumnType("datetime(6)") + .HasComment("วันที่รับทราบข้อกล่าวหา"); + + b.Property("DisciplinaryDateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุดการสอบสวน"); + + b.Property("DisciplinaryDateEvident") + .HasColumnType("datetime(6)") + .HasComment("วันที่สรุปพยานหลักฐาน"); + + b.Property("DisciplinaryDateInvestigation") + .HasColumnType("datetime(6)") + .HasComment("วันที่มีคำสั่งให้สอบสวน"); + + b.Property("DisciplinaryDateResult") + .HasColumnType("datetime(6)") + .HasComment("วันที่รายงานผลการสอบสวน"); + + b.Property("DisciplinaryDateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่มการสอบสวน"); + + b.Property("DisciplinaryDaysExtend") + .HasColumnType("int") + .HasComment("จำนวนวันที่ขยาย"); + + b.Property("DisciplinaryExtendStatus") + .HasColumnType("tinyint(1)") + .HasComment("ขยายเวลา"); + + b.Property("DisciplinaryFaultLevel") + .HasColumnType("longtext") + .HasComment("ระดับโทษความผิด กรณีไม่ร้ายแรง: ภาคทัณฑ์, ตัดเงินเดือน, ลดขั้นเงินเดือน | กรณีร้ายแรง: ปลดออก, ไล่ออก"); + + b.Property("DisciplinaryFaultLevelOther") + .HasColumnType("longtext") + .HasComment("ระดับโทษความผิดกรณีอื่นๆ"); + + b.Property("DisciplinaryInvestigateAt") + .HasColumnType("longtext") + .HasComment("สอบสวนที่"); + + b.Property("DisciplinaryRecordAccuser") + .HasColumnType("longtext") + .HasComment("บันทึกถ้อยคำของผู้กล่าวหา"); + + b.Property("DisciplinaryRefLaw") + .HasColumnType("longtext") + .HasComment("อ้างอิงมาตราตามกฎหมาย"); + + b.Property("DisciplinaryResult") + .HasColumnType("longtext") + .HasComment("ผลการสอบสวน เหตุผล"); + + b.Property("DisciplinaryStatusResult") + .HasColumnType("longtext") + .HasComment("ผลการสอบสวน ผล"); + + b.Property("DisciplinarySummaryEvidence") + .HasColumnType("longtext") + .HasComment("สรุปพยานหลักฐานสนับสนุนข้อกล่าวหา"); + + b.Property("DisciplinaryWitnesses") + .HasColumnType("longtext") + .HasComment("พยานและบันทึกถ้อยคำพยาน"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("InvestigationCauseText") + .HasColumnType("longtext") + .HasComment("กรณีมีมูลต้องเลือกว่า 'ร้ายแรง' หรือ 'ไม่ร้ายแรง'"); + + b.Property("InvestigationDateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุดการสืบสวน"); + + b.Property("InvestigationDateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่มการสืบสวน"); + + b.Property("InvestigationDaysExtend") + .HasColumnType("int") + .HasComment("จำนวนวันที่ต้องการขยาย"); + + b.Property("InvestigationDescription") + .HasColumnType("longtext") + .HasComment("รายละเอียดเกี่ยวกับการสืบสวน"); + + b.Property("InvestigationDetail") + .HasColumnType("longtext") + .HasComment("ลักษณะการสืบสวน (APPOINT_DIRECTORS คือ แต่งตั้งกรรมการสืบสวน, SECRET_INVESTIGATION คือ สืบสวนทางลับ, OTHER คือ อื่น ๆ)"); + + b.Property("InvestigationDetailOther") + .HasColumnType("longtext") + .HasComment("ลักษณะการสืบสวนกรณีเลือกอื่นๆ"); + + b.Property("InvestigationExtendStatus") + .HasColumnType("tinyint(1)") + .HasComment("ขยายเวลา"); + + b.Property("InvestigationStatusResult") + .HasColumnType("longtext") + .HasComment("สถานะหรือผลการสืบสวน (NOT_SPECIFIED คือ ยังไม่ระบุ, HAVE_CAUSE คือ มีมูล, NO_CAUSE คือ ไม่มีมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("LevelConsideration") + .HasColumnType("longtext") + .HasComment("ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)"); + + b.Property("OffenseDetails") + .HasColumnType("longtext") + .HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"); + + b.Property("Organization") + .HasColumnType("longtext") + .HasComment("กรณีหน่วยงานใส่หน่วยงาน"); + + b.Property("OrganizationId") + .HasColumnType("longtext") + .HasComment("กรณีหน่วยงานใส่หน่วยงาน id"); + + b.Property("RespondentType") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)"); + + b.Property("Result") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบ"); + + b.Property("ResultComplaint") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบเรื่องร้องเรียน"); + + b.Property("ResultDescription") + .HasColumnType("longtext") + .HasComment("สรุปผลการพิจารณา"); + + b.Property("ResultDisciplineType") + .HasColumnType("longtext") + .HasComment("ประเภทวินัย"); + + b.Property("ResultInvestigate") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบเรื่องสืบสวน"); + + b.Property("ResultOc") + .HasColumnType("longtext") + .HasComment("หน่วยงาย/ส่วนราชการ"); + + b.Property("ResultTitleType") + .HasColumnType("longtext") + .HasComment("ประเภทของเรื่อง"); + + b.Property("ResultYear") + .HasColumnType("int") + .HasComment("ปีงบประมาณ"); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text") + .HasComment("เรื่องที่ร้องเรียน"); + + b.Property("activeId") + .HasColumnType("longtext") + .HasComment("version หน่วยงาน"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineInvestigateId"); + + b.ToTable("DisciplineDisciplinarys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinaryExtend", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุด"); + + b.Property("DateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่ม"); + + b.Property("DaysExtend") + .HasColumnType("int") + .HasComment("จำนวนวันที่การขยาย"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasColumnType("longtext") + .HasComment("ชื่อการขยาย"); + + b.Property("Num") + .HasColumnType("int") + .HasComment("ครั้งที่ขยาย"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.ToTable("DisciplineDisciplinaryExtends"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DirectorInvestigate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CommandNo") + .HasColumnType("longtext") + .HasComment("เลขที่คำสั่ง"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDirectorId") + .HasColumnType("char(36)"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("Duty") + .HasColumnType("longtext") + .HasComment("หน้าที่"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDirectorId"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.ToTable("DisciplineDisciplinary_DirectorInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocComplaintInvestigate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocComplaintInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocInvestigate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocInvestigateRelevant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocInvestigateRelevants"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocOther", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocOthers"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocRecordAccuser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocRecordAccusers"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocRelevant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocRelevants"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocResult", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocResults"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocSummaryEvidence", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocSummaryEvidences"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocWitnesses", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocWitnessess"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_ProfileComplaintInvestigate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("CommandTypeDiscardId") + .HasColumnType("char(36)") + .HasComment("ประเภทออกคำสั่งงดโทด"); + + b.Property("CommandTypeId") + .HasColumnType("char(36)") + .HasComment("ประเภทออกคำสั่ง"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("IsAncestorDNA") + .HasColumnType("tinyint(1)") + .HasComment("รายการเก่า"); + + b.Property("IsReport") + .HasColumnType("longtext") + .HasComment("ส่งไปยุติเรื่อง"); + + b.Property("IsSuspend") + .HasColumnType("longtext") + .HasComment("ส่งไปพักราชการ"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Organization") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("PersonId") + .HasColumnType("longtext") + .HasComment("id อ้างอิง profile"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("Salary") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("Status") + .HasColumnType("longtext") + .HasComment("สถานะออกคำสั่ง"); + + b.Property("StatusDiscard") + .HasColumnType("longtext") + .HasComment("สถานะออกคำสั่งงดโทด"); + + b.Property("child1") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child1"); + + b.Property("child1Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child1"); + + b.Property("child1ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child1"); + + b.Property("child2") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child2"); + + b.Property("child2Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child2"); + + b.Property("child2ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child2"); + + b.Property("child3") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child3"); + + b.Property("child3Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child3"); + + b.Property("child3ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child3"); + + b.Property("child4") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child4"); + + b.Property("child4Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child4"); + + b.Property("child4ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child4"); + + b.Property("posLevelId") + .HasColumnType("longtext") + .HasComment("id ระดับตำแหน่ง"); + + b.Property("posLevelName") + .HasColumnType("longtext") + .HasComment("ชื่อระดับตำแหน่ง"); + + b.Property("posMasterNo") + .HasColumnType("int") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("posTypeId") + .HasColumnType("longtext") + .HasComment("id ประเภทตำแหน่ง"); + + b.Property("posTypeName") + .HasColumnType("longtext") + .HasComment("ชื่อประเภทตำแหน่ง"); + + b.Property("profileType") + .HasColumnType("longtext") + .HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)"); + + b.Property("root") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน root"); + + b.Property("rootId") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน root"); + + b.Property("rootShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน root"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.ToTable("DisciplineDisciplinary_ProfileComplaintInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Appellant") + .HasColumnType("longtext") + .HasComment("ผู้ร้องเรียน"); + + b.Property("ComplaintFrom") + .HasColumnType("longtext") + .HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)"); + + b.Property("ConsideredAgency") + .HasColumnType("longtext") + .HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง"); + + b.Property("ConsideredAgencyId") + .HasColumnType("longtext") + .HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateConsideration") + .HasColumnType("datetime(6)") + .HasComment("วันที่กำหนดพิจารณา"); + + b.Property("DateNotification") + .HasColumnType("datetime(6)") + .HasComment("วันแจ้งเตือนล่วงหน้า"); + + b.Property("DateReceived") + .HasColumnType("datetime(6)") + .HasComment("วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"); + + b.Property("Description") + .HasColumnType("text") + .HasComment("รายละเอียดของเรื่องร้องเรียน"); + + b.Property("DisciplineComplaintId") + .HasColumnType("char(36)"); + + b.Property("InvestigationCauseText") + .HasColumnType("longtext") + .HasComment("กรณีมีมูลต้องเลือกว่า 'ร้ายแรง' หรือ 'ไม่ร้ายแรง'"); + + b.Property("InvestigationDateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุดการสืบสวน"); + + b.Property("InvestigationDateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่มการสืบสวน"); + + b.Property("InvestigationDaysExtend") + .HasColumnType("int") + .HasComment("จำนวนวันที่ต้องการขยาย"); + + b.Property("InvestigationDescription") + .HasColumnType("longtext") + .HasComment("รายละเอียดเกี่ยวกับการสืบสวน"); + + b.Property("InvestigationDetail") + .HasColumnType("longtext") + .HasComment("ลักษณะการสืบสวน (appoint_directors คือ แต่งตั้งกรรมการสืบสวน, secret_investigation คือ สืบสวนทางลับ, other คือ อื่น ๆ)"); + + b.Property("InvestigationDetailOther") + .HasColumnType("longtext") + .HasComment("ลักษณะการสืบสวนกรณีเลือกอื่นๆ"); + + b.Property("InvestigationExtendStatus") + .HasColumnType("tinyint(1)") + .HasComment("ขยายเวลา"); + + b.Property("InvestigationStatusResult") + .HasColumnType("longtext") + .HasComment("สถานะหรือผลการสืบสวน (not_specified คือ ยังไม่ระบุ, have_cause คือ มีมูล, no_cause คือ ไม่มีมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("LevelConsideration") + .HasColumnType("longtext") + .HasComment("ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)"); + + b.Property("OffenseDetails") + .HasColumnType("longtext") + .HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"); + + b.Property("Organization") + .HasColumnType("longtext") + .HasComment("กรณีหน่วยงานใส่หน่วยงาน"); + + b.Property("OrganizationId") + .HasColumnType("longtext") + .HasComment("กรณีหน่วยงานใส่หน่วยงาน id"); + + b.Property("RespondentType") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)"); + + b.Property("Result") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบ"); + + b.Property("ResultComplaint") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบเรื่องร้องเรียน"); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text") + .HasComment("เรื่องที่ร้องเรียน"); + + b.Property("activeId") + .HasColumnType("longtext") + .HasComment("version หน่วยงาน"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineComplaintId"); + + b.ToTable("DisciplineInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigateExtend", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุด"); + + b.Property("DateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่ม"); + + b.Property("DaysExtend") + .HasColumnType("int") + .HasComment("จำนวนวันที่การขยาย"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasColumnType("longtext") + .HasComment("ชื่อการขยาย"); + + b.Property("Num") + .HasColumnType("int") + .HasComment("ครั้งที่ขยาย"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineInvestigateId"); + + b.ToTable("DisciplineInvestigateExtends"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigateRelevant_Doc", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineInvestigateId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineInvestigateRelevant_Docs"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_Director", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CommandNo") + .HasColumnType("longtext") + .HasComment("เลขที่คำสั่ง"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineDirectorId") + .HasColumnType("char(36)"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("Duty") + .HasColumnType("longtext") + .HasComment("หน้าที่"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDirectorId"); + + b.HasIndex("DisciplineInvestigateId"); + + b.ToTable("DisciplineInvestigate_Directors"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_Doc", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineInvestigateId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineInvestigate_Docs"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_DocComplaint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineInvestigateId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineInvestigate_DocComplaints"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_ProfileComplaint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("IsAncestorDNA") + .HasColumnType("tinyint(1)") + .HasComment("รายการเก่า"); + + b.Property("IsDisciplinary") + .HasColumnType("tinyint(1)") + .HasComment("ส่งไปสอบสวน"); + + b.Property("IsReport") + .HasColumnType("longtext") + .HasComment("ส่งไปยุติเรื่อง"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Organization") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("PersonId") + .HasColumnType("longtext") + .HasComment("id อ้างอิง profile"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("Salary") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("child1") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child1"); + + b.Property("child1Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child1"); + + b.Property("child1ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child1"); + + b.Property("child2") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child2"); + + b.Property("child2Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child2"); + + b.Property("child2ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child2"); + + b.Property("child3") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child3"); + + b.Property("child3Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child3"); + + b.Property("child3ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child3"); + + b.Property("child4") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child4"); + + b.Property("child4Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child4"); + + b.Property("child4ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child4"); + + b.Property("posLevelId") + .HasColumnType("longtext") + .HasComment("id ระดับตำแหน่ง"); + + b.Property("posLevelName") + .HasColumnType("longtext") + .HasComment("ชื่อระดับตำแหน่ง"); + + b.Property("posMasterNo") + .HasColumnType("int") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("posTypeId") + .HasColumnType("longtext") + .HasComment("id ประเภทตำแหน่ง"); + + b.Property("posTypeName") + .HasColumnType("longtext") + .HasComment("ชื่อประเภทตำแหน่ง"); + + b.Property("profileType") + .HasColumnType("longtext") + .HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)"); + + b.Property("root") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน root"); + + b.Property("rootId") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน root"); + + b.Property("rootShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน root"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineInvestigateId"); + + b.ToTable("DisciplineInvestigate_ProfileComplaints"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineReport_Profile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("CommandTypeId") + .HasColumnType("char(36)") + .HasComment("ประเภทออกคำสั่ง"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DescriptionSuspend") + .HasColumnType("longtext") + .HasComment("เหตุที่ถูกสั่งพักราชการ/ออกจากราชการไว้ก่อน"); + + b.Property("DisciplinaryCaseFault") + .HasColumnType("longtext") + .HasComment("กรณีความผิด"); + + b.Property("DisciplinaryFaultLevel") + .HasColumnType("longtext") + .HasComment("ระดับโทษความผิด กรณีไม่ร้ายแรง: ภาคทัณฑ์, ตัดเงินเดือน, ลดขั้นเงินเดือน | กรณีร้ายแรง: ปลดออก, ไล่ออก"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("EndDateSuspend") + .HasColumnType("datetime(6)") + .HasComment("วันสิ้นสุดการสั่งพักราชการ/ให้ออกจากราชการไว้ก่อน"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OffenseDetails") + .HasColumnType("longtext") + .HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"); + + b.Property("Organization") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("PersonId") + .HasColumnType("longtext") + .HasComment("id อ้างอิง profile"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionLevel") + .HasColumnType("longtext") + .HasComment("ระดับ"); + + b.Property("PositionType") + .HasColumnType("longtext") + .HasComment("ประเภท"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("Salary") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("StartDateSuspend") + .HasColumnType("datetime(6)") + .HasComment("วันที่สั่งพักราชการ/ให้ออกจากราชการไว้ก่อน"); + + b.Property("Status") + .HasColumnType("longtext") + .HasComment("สถานะออกคำสั่ง"); + + b.Property("Title") + .HasColumnType("text") + .HasComment("เรื่องที่ร้องเรียน"); + + b.Property("child1") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child1"); + + b.Property("child1Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child1"); + + b.Property("child1ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child1"); + + b.Property("child2") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child2"); + + b.Property("child2Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child2"); + + b.Property("child2ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child2"); + + b.Property("child3") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child3"); + + b.Property("child3Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child3"); + + b.Property("child3ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child3"); + + b.Property("child4") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child4"); + + b.Property("child4Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child4"); + + b.Property("child4ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child4"); + + b.Property("posLevelId") + .HasColumnType("longtext") + .HasComment("id ระดับตำแหน่ง"); + + b.Property("posLevelName") + .HasColumnType("longtext") + .HasComment("ชื่อระดับตำแหน่ง"); + + b.Property("posMasterNo") + .HasColumnType("int") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("posTypeId") + .HasColumnType("longtext") + .HasComment("id ประเภทตำแหน่ง"); + + b.Property("posTypeName") + .HasColumnType("longtext") + .HasComment("ชื่อประเภทตำแหน่ง"); + + b.Property("profileType") + .HasColumnType("longtext") + .HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)"); + + b.Property("root") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน root"); + + b.Property("rootId") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน root"); + + b.Property("rootShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน root"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.ToTable("DisciplineReport_Profiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Detail") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("FileSize") + .HasColumnType("int"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ObjectRefId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal_Doc", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal", "DisciplineComplaint_Appeal") + .WithMany("DisciplineComplaint_Appeal_Docs") + .HasForeignKey("DisciplineComplaint_AppealId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineComplaint_Appeal"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal_History", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal", "DisciplineComplaint_Appeal") + .WithMany("DisciplineComplaint_Appeal_Historys") + .HasForeignKey("DisciplineComplaint_AppealId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineComplaint_Appeal"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Doc", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", "DisciplineComplaint") + .WithMany("DisciplineComplaint_Docs") + .HasForeignKey("DisciplineComplaintId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineComplaint"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Profile", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", "DisciplineComplaint") + .WithMany("DisciplineComplaint_Profiles") + .HasForeignKey("DisciplineComplaintId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineComplaint"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineDisciplinarys") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinaryExtend", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinaryExtends") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DirectorInvestigate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", "DisciplineDirector") + .WithMany("DisciplineDisciplinary_DirectorInvestigates") + .HasForeignKey("DisciplineDirectorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DirectorInvestigates") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDirector"); + + b.Navigation("DisciplineDisciplinary"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocComplaintInvestigate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocComplaintInvestigates") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocInvestigate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocInvestigates") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocInvestigateRelevant", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocInvestigateRelevants") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocOther", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocOthers") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocRecordAccuser", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocRecordAccusers") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocRelevant", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocRelevants") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocResult", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocResults") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocSummaryEvidence", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocSummaryEvidences") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocWitnesses", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocWitnessess") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_ProfileComplaintInvestigate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_ProfileComplaintInvestigates") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", "DisciplineComplaint") + .WithMany("DisciplineInvestigates") + .HasForeignKey("DisciplineComplaintId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineComplaint"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigateExtend", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigateExtends") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigateRelevant_Doc", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigateRelevant_Docs") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_Director", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", "DisciplineDirector") + .WithMany("DisciplineInvestigate_Directors") + .HasForeignKey("DisciplineDirectorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigate_Directors") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDirector"); + + b.Navigation("DisciplineInvestigate"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_Doc", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigate_Docs") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_DocComplaint", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigate_DocComplaints") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_ProfileComplaint", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigate_ProfileComplaints") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineReport_Profile", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany() + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", b => + { + b.Navigation("DisciplineComplaint_Docs"); + + b.Navigation("DisciplineComplaint_Profiles"); + + b.Navigation("DisciplineInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal", b => + { + b.Navigation("DisciplineComplaint_Appeal_Docs"); + + b.Navigation("DisciplineComplaint_Appeal_Historys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", b => + { + b.Navigation("DisciplineDisciplinary_DirectorInvestigates"); + + b.Navigation("DisciplineInvestigate_Directors"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", b => + { + b.Navigation("DisciplineDisciplinaryExtends"); + + b.Navigation("DisciplineDisciplinary_DirectorInvestigates"); + + b.Navigation("DisciplineDisciplinary_DocComplaintInvestigates"); + + b.Navigation("DisciplineDisciplinary_DocInvestigateRelevants"); + + b.Navigation("DisciplineDisciplinary_DocInvestigates"); + + b.Navigation("DisciplineDisciplinary_DocOthers"); + + b.Navigation("DisciplineDisciplinary_DocRecordAccusers"); + + b.Navigation("DisciplineDisciplinary_DocRelevants"); + + b.Navigation("DisciplineDisciplinary_DocResults"); + + b.Navigation("DisciplineDisciplinary_DocSummaryEvidences"); + + b.Navigation("DisciplineDisciplinary_DocWitnessess"); + + b.Navigation("DisciplineDisciplinary_ProfileComplaintInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", b => + { + b.Navigation("DisciplineDisciplinarys"); + + b.Navigation("DisciplineInvestigateExtends"); + + b.Navigation("DisciplineInvestigateRelevant_Docs"); + + b.Navigation("DisciplineInvestigate_Directors"); + + b.Navigation("DisciplineInvestigate_DocComplaints"); + + b.Navigation("DisciplineInvestigate_Docs"); + + b.Navigation("DisciplineInvestigate_ProfileComplaints"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20241226172314_update table disciplinecom add profiletype.cs b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20241226172314_update table disciplinecom add profiletype.cs new file mode 100644 index 00000000..1acab7fd --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20241226172314_update table disciplinecom add profiletype.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb +{ + /// + public partial class updatetabledisciplinecomaddprofiletype : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "profileType", + table: "DisciplineComplaint_Appeals", + type: "longtext", + nullable: true, + comment: "สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)") + .Annotation("MySql:CharSet", "utf8mb4"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "profileType", + table: "DisciplineComplaint_Appeals"); + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/DisciplineDb/DisciplineDbContextModelSnapshot.cs b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/DisciplineDbContextModelSnapshot.cs index c34f85d7..5e6e4c43 100644 --- a/BMA.EHR.Infrastructure/Migrations/DisciplineDb/DisciplineDbContextModelSnapshot.cs +++ b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/DisciplineDbContextModelSnapshot.cs @@ -241,6 +241,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb .HasColumnType("int") .HasComment("ปีงบประมาณ"); + b.Property("profileType") + .HasColumnType("longtext") + .HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)"); + b.HasKey("Id"); b.ToTable("DisciplineComplaint_Appeals"); diff --git a/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs b/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs index 009e6e41..ee25953e 100644 --- a/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs +++ b/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs @@ -411,6 +411,9 @@ namespace BMA.EHR.Insignia.Service.Controllers if (organization == null) continue; + // TODO - Comment This + //if (organization.Id.ToString() != "e93c0ed3-7b80-42aa-8626-8abf0042f618") continue; + var result = await _repository.GetInsigniaRequest(insigniaPeriodId, organization.Id); if (result != null) { diff --git a/BMA.EHR.Insignia/appsettings.json b/BMA.EHR.Insignia/appsettings.json index 18131c5b..8af3f8ff 100644 --- a/BMA.EHR.Insignia/appsettings.json +++ b/BMA.EHR.Insignia/appsettings.json @@ -14,14 +14,16 @@ "AllowedHosts": "*", "ConnectionStrings": { //"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB", - //"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" - //"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", - "DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", - "ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", - "LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_leave_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", - "DisciplineConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_discipline_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" + "DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" + //"DefaultConnection": "server=hrms.chin.in.th;user=root;password=adminVM123;port=53636;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + //"DefaultConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + //"ExamConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + //"LeaveConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + //"DisciplineConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_discipline;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" }, "Jwt": { + //"Key": "j7C9RO_p4nRtuwCH4z9Db_A_6We42tkD_p4lZtDrezc", + //"Issuer": "https://hrms-id.chin.in.th/realms/hrms" "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI", "Issuer": "https://id.frappet.synology.me/realms/bma-ehr" }, diff --git a/BMA.EHR.MetaData.Service/Controllers/MainController.cs b/BMA.EHR.MetaData.Service/Controllers/MainController.cs new file mode 100644 index 00000000..27a5cecd --- /dev/null +++ b/BMA.EHR.MetaData.Service/Controllers/MainController.cs @@ -0,0 +1,97 @@ +using BMA.EHR.Domain.Common; +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.MetaData.Service.Request; +using BMA.EHR.MetaData.Service.Services; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; + +namespace BMA.EHR.MetaData.Service.Controllers +{ + [Route("api/v{version:apiVersion}/metadata/main")] + [ApiVersion("1.0")] + [ApiController] + [Produces("application/json")] + [Authorize] + [SwaggerTag("จัดการข้อมูลตำแหน่ง เพื่อนำไปใช้งานในระบบ")] + public class MainController : BaseController + { + #region " Fields " + + private readonly BloodGroupService _bloodGroupService; + private readonly EducationLevelService _educationLevelService; + private readonly GenderService _genderService; + private readonly ProvinceService _provinceService; + private readonly PrefixService _prefixService; + private readonly RelationshipService _relationshipService; + private readonly ReligionService _religionService; + + #endregion + + #region " Constructor and Destructor " + + public MainController( + BloodGroupService bloodGroupService, + ProvinceService provinceService, + EducationLevelService educationLevelService, + GenderService genderService, + PrefixService prefixService, + RelationshipService relationshipService, + ReligionService religionService) + { + _bloodGroupService = bloodGroupService; + _provinceService = provinceService; + _educationLevelService = educationLevelService; + _genderService = genderService; + _prefixService = prefixService; + _relationshipService = relationshipService; + _religionService = religionService; + } + + #endregion + + #region " Methods " + + /// + /// อ่านข้อมูล ข้อมูลเกี่ยวกับบุคคล + /// + /// + /// อ่านข้อมูล ข้อมูลเกี่ยวกับบุคคล สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("person")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> GetsMainPersonAsync() + { + try + { + var bloodGroups = await _bloodGroupService.GetsAsync(showAll: false); + var provinces = await _provinceService.GetsAsync(showAll: false); + var educationLevels = await _educationLevelService.GetsAsync(showAll: false); + var genders = await _genderService.GetsAsync(showAll: false); + var prefixs = await _prefixService.GetsAsync(showAll: false); + var relationships = await _relationshipService.GetsAsync(showAll: false); + var religions = await _religionService.GetsAsync(showAll: false); + + return Success(new + { + bloodGroups, + provinces, + educationLevels, + genders, + prefixs, + relationships, + religions, + }); + } + catch (Exception ex) + { + return Error(ex); + } + } + + #endregion + } +} diff --git a/BMA.EHR.MetaData.Service/Program.cs b/BMA.EHR.MetaData.Service/Program.cs index 7a34cf83..6032b868 100644 --- a/BMA.EHR.MetaData.Service/Program.cs +++ b/BMA.EHR.MetaData.Service/Program.cs @@ -89,6 +89,14 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); + + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); builder.Services.AddControllers(options => { options.SuppressAsyncSuffixInActionNames = false; diff --git a/BMA.EHR.MetaData.Service/Services/BloodGroupService.cs b/BMA.EHR.MetaData.Service/Services/BloodGroupService.cs new file mode 100644 index 00000000..8a689920 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Services/BloodGroupService.cs @@ -0,0 +1,92 @@ +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using System.Security.Claims; + +namespace BMA.EHR.MetaData.Service.Services +{ + public class BloodGroupService + { + #region " Fields " + + private readonly ApplicationDBContext _context; + private readonly IHttpContextAccessor _httpContextAccessor; + private readonly ILogger _logger; + + #endregion + + #region " Constructor and Destructor " + + public BloodGroupService(ApplicationDBContext context, + IHttpContextAccessor httpContextAccessor, + ILogger logger) + { + _context = context; + _httpContextAccessor = httpContextAccessor; + _logger = logger; + } + + #endregion + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + #region " Methods " + + public async Task> GetsAsync(bool showAll = true) + { + if (showAll) + return await _context.BloodGroups.AsQueryable() + .OrderBy(d => d.Name) + .ToListAsync(); + else + return await _context.BloodGroups.AsQueryable() + .Where(p => p.IsActive) + .OrderBy(d => d.Name) + .ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _context.BloodGroups.FirstOrDefaultAsync(x => x.Id == id); + } + + public async Task UpdateAsync(Guid id, BloodGroup updated) + { + var existData = await _context.BloodGroups.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + if (existData.Name != updated.Name || existData.IsActive != updated.IsActive) + { + existData.Name = updated.Name; + existData.IsActive = updated.IsActive; + existData.LastUpdatedAt = DateTime.Now; + existData.LastUpdateUserId = UserId ?? ""; + existData.LastUpdateFullName = FullName ?? ""; + } + await _context.SaveChangesAsync(); + } + } + + public async Task CreateAsync(BloodGroup inserted) + { + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + + await _context.BloodGroups.AddAsync(inserted); + + await _context.SaveChangesAsync(); + } + + #endregion + } +} diff --git a/BMA.EHR.MetaData.Service/Services/EducationLevelService.cs b/BMA.EHR.MetaData.Service/Services/EducationLevelService.cs new file mode 100644 index 00000000..ac034480 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Services/EducationLevelService.cs @@ -0,0 +1,90 @@ +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using System.Security.Claims; + + +namespace BMA.EHR.MetaData.Service.Services +{ + public class EducationLevelService + { + #region " Fields " + + private readonly ApplicationDBContext _context; + private readonly IHttpContextAccessor _httpContextAccessor; + + #endregion + + #region " Constructor and Destructor " + + public EducationLevelService(ApplicationDBContext context, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _httpContextAccessor = httpContextAccessor; + } + + #endregion + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + #region " Methods " + + public async Task> GetsAsync(bool showAll = true) + { + if (showAll) + return await _context.EducationLevels.AsQueryable() + .OrderBy(d => d.Name) + .ToListAsync(); + else + return await _context.EducationLevels.AsQueryable() + .Where(p => p.IsActive) + .OrderBy(d => d.Name) + .ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _context.EducationLevels.FirstOrDefaultAsync(x => x.Id == id); + } + + public async Task UpdateAsync(Guid id, EducationLevel updated) + { + var existData = await _context.EducationLevels.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + if (existData.Name != updated.Name || existData.IsActive != updated.IsActive) + { + existData.Name = updated.Name; + existData.IsActive = updated.IsActive; + existData.LastUpdatedAt = DateTime.Now; + existData.LastUpdateUserId = UserId ?? ""; + existData.LastUpdateFullName = FullName ?? ""; + } + await _context.SaveChangesAsync(); + } + } + + public async Task CreateAsync(EducationLevel inserted) + { + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + + await _context.EducationLevels.AddAsync(inserted); + + await _context.SaveChangesAsync(); + } + + #endregion + } +} diff --git a/BMA.EHR.MetaData.Service/Services/GenderService.cs b/BMA.EHR.MetaData.Service/Services/GenderService.cs new file mode 100644 index 00000000..59588160 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Services/GenderService.cs @@ -0,0 +1,90 @@ +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using System.Security.Claims; + + +namespace BMA.EHR.MetaData.Service.Services +{ + public class GenderService + { + #region " Fields " + + private readonly ApplicationDBContext _context; + private readonly IHttpContextAccessor _httpContextAccessor; + + #endregion + + #region " Constructor and Destructor " + + public GenderService(ApplicationDBContext context, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _httpContextAccessor = httpContextAccessor; + } + + #endregion + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + #region " Methods " + + public async Task> GetsAsync(bool showAll = true) + { + if (showAll) + return await _context.Genders.AsQueryable() + .OrderBy(d => d.Name) + .ToListAsync(); + else + return await _context.Genders.AsQueryable() + .Where(p => p.IsActive) + .OrderBy(d => d.Name) + .ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _context.Genders.FirstOrDefaultAsync(x => x.Id == id); + } + + public async Task UpdateAsync(Guid id, Gender updated) + { + var existData = await _context.Genders.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + if (existData.Name != updated.Name || existData.IsActive != updated.IsActive) + { + existData.Name = updated.Name; + existData.IsActive = updated.IsActive; + existData.LastUpdatedAt = DateTime.Now; + existData.LastUpdateUserId = UserId ?? ""; + existData.LastUpdateFullName = FullName ?? ""; + } + await _context.SaveChangesAsync(); + } + } + + public async Task CreateAsync(Gender inserted) + { + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + + await _context.Genders.AddAsync(inserted); + + await _context.SaveChangesAsync(); + } + + #endregion + } +} diff --git a/BMA.EHR.MetaData.Service/Services/PrefixService.cs b/BMA.EHR.MetaData.Service/Services/PrefixService.cs new file mode 100644 index 00000000..44477c61 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Services/PrefixService.cs @@ -0,0 +1,90 @@ +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using System.Security.Claims; + + +namespace BMA.EHR.MetaData.Service.Services +{ + public class PrefixService + { + #region " Fields " + + private readonly ApplicationDBContext _context; + private readonly IHttpContextAccessor _httpContextAccessor; + + #endregion + + #region " Constructor and Destructor " + + public PrefixService(ApplicationDBContext context, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _httpContextAccessor = httpContextAccessor; + } + + #endregion + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + #region " Methods " + + public async Task> GetsAsync(bool showAll = true) + { + if (showAll) + return await _context.Prefixes.AsQueryable() + .OrderBy(d => d.Name) + .ToListAsync(); + else + return await _context.Prefixes.AsQueryable() + .Where(p => p.IsActive) + .OrderBy(d => d.Name) + .ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _context.Prefixes.FirstOrDefaultAsync(x => x.Id == id); + } + + public async Task UpdateAsync(Guid id, Prefix updated) + { + var existData = await _context.Prefixes.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + if (existData.Name != updated.Name || existData.IsActive != updated.IsActive) + { + existData.Name = updated.Name; + existData.IsActive = updated.IsActive; + existData.LastUpdateUserId = UserId ?? ""; + existData.LastUpdateFullName = FullName ?? ""; + existData.LastUpdatedAt = DateTime.Now; + } + await _context.SaveChangesAsync(); + } + } + + public async Task CreateAsync(Prefix inserted) + { + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + + await _context.Prefixes.AddAsync(inserted); + + await _context.SaveChangesAsync(); + } + + #endregion + } +} diff --git a/BMA.EHR.MetaData.Service/Services/ProvinceService.cs b/BMA.EHR.MetaData.Service/Services/ProvinceService.cs new file mode 100644 index 00000000..ade9fb6f --- /dev/null +++ b/BMA.EHR.MetaData.Service/Services/ProvinceService.cs @@ -0,0 +1,93 @@ +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using System.Security.Claims; + + +namespace BMA.EHR.MetaData.Service.Services +{ + public class ProvinceService + { + #region " Fields " + + private readonly ApplicationDBContext _context; + private readonly IHttpContextAccessor _httpContextAccessor; + + #endregion + + #region " Constructor and Destructor " + + public ProvinceService(ApplicationDBContext context, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _httpContextAccessor = httpContextAccessor; + } + + #endregion + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + #region " Methods " + + public async Task> GetsAsync(bool showAll = true) + { + if (showAll) + return await _context.Provinces.AsQueryable() + .OrderBy(d => d.Name) + .ToListAsync(); + else + return await _context.Provinces.AsQueryable() + .Where(p => p.IsActive) + .OrderBy(d => d.Name) + .ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _context.Provinces + .AsQueryable() + .Include(x => x.Districts) + .FirstOrDefaultAsync(x => x.Id == id); + } + + public async Task UpdateAsync(Guid id, Province updated) + { + var existData = await _context.Provinces.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + if (existData.Name != updated.Name || existData.IsActive != updated.IsActive) + { + existData.Name = updated.Name; + existData.IsActive = updated.IsActive; + existData.LastUpdatedAt = DateTime.Now; + existData.LastUpdateUserId = UserId ?? ""; + existData.LastUpdateFullName = FullName ?? ""; + } + await _context.SaveChangesAsync(); + } + } + + public async Task CreateAsync(Province inserted) + { + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + + await _context.Provinces.AddAsync(inserted); + + await _context.SaveChangesAsync(); + } + + #endregion + } +} \ No newline at end of file diff --git a/BMA.EHR.MetaData.Service/Services/RelationshipService.cs b/BMA.EHR.MetaData.Service/Services/RelationshipService.cs new file mode 100644 index 00000000..8b60132f --- /dev/null +++ b/BMA.EHR.MetaData.Service/Services/RelationshipService.cs @@ -0,0 +1,89 @@ +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using System.Security.Claims; + + +namespace BMA.EHR.MetaData.Service.Services; + +public class RelationshipService +{ + #region " Fields " + + private readonly ApplicationDBContext _context; + private readonly IHttpContextAccessor _httpContextAccessor; + + #endregion + + #region " Constructor and Destructor " + + public RelationshipService(ApplicationDBContext context, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _httpContextAccessor = httpContextAccessor; + } + + #endregion + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + #region " Methods " + + public async Task> GetsAsync(bool showAll = true) + { + if (showAll) + return await _context.Relationships.AsQueryable() + .OrderBy(d => d.Name) + .ToListAsync(); + else + return await _context.Relationships.AsQueryable() + .Where(p => p.IsActive) + .OrderBy(d => d.Name) + .ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _context.Relationships.FirstOrDefaultAsync(x => x.Id == id); + } + + public async Task UpdateAsync(Guid id, Relationship updated) + { + var existData = await _context.Relationships.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + if (existData.Name != updated.Name || existData.IsActive != updated.IsActive) + { + existData.Name = updated.Name; + existData.IsActive = updated.IsActive; + existData.LastUpdateUserId = UserId ?? ""; + existData.LastUpdateFullName = FullName ?? ""; + existData.LastUpdatedAt = DateTime.Now; + } + await _context.SaveChangesAsync(); + } + } + + public async Task CreateAsync(Relationship inserted) + { + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + + await _context.Relationships.AddAsync(inserted); + + await _context.SaveChangesAsync(); + } + + #endregion +} \ No newline at end of file diff --git a/BMA.EHR.MetaData.Service/Services/ReligionService.cs b/BMA.EHR.MetaData.Service/Services/ReligionService.cs new file mode 100644 index 00000000..f646bc44 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Services/ReligionService.cs @@ -0,0 +1,90 @@ +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using System.Security.Claims; + + +namespace BMA.EHR.MetaData.Service.Services +{ + public class ReligionService + { + #region " Fields " + + private readonly ApplicationDBContext _context; + private readonly IHttpContextAccessor _httpContextAccessor; + + #endregion + + #region " Constructor and Destructor " + + public ReligionService(ApplicationDBContext context, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _httpContextAccessor = httpContextAccessor; + } + + #endregion + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + #region " Methods " + + public async Task> GetsAsync(bool showAll = true) + { + if (showAll) + return await _context.Religions.AsQueryable() + .OrderBy(d => d.Name) + .ToListAsync(); + else + return await _context.Religions.AsQueryable() + .Where(p => p.IsActive) + .OrderBy(d => d.Name) + .ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _context.Religions.FirstOrDefaultAsync(x => x.Id == id); + } + + public async Task UpdateAsync(Guid id, Religion updated) + { + var existData = await _context.Religions.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + if (existData.Name != updated.Name || existData.IsActive != updated.IsActive) + { + existData.Name = updated.Name; + existData.IsActive = updated.IsActive; + existData.LastUpdateUserId = UserId ?? ""; + existData.LastUpdateFullName = FullName ?? ""; + existData.LastUpdatedAt = DateTime.Now; + } + await _context.SaveChangesAsync(); + } + } + + public async Task CreateAsync(Religion inserted) + { + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + + await _context.Religions.AddAsync(inserted); + + await _context.SaveChangesAsync(); + } + + #endregion + } +} diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs index fa8e7b28..fc25fa13 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs @@ -844,27 +844,29 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - LeaveDate = _null, - NewOc = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + LeaveDate = _null, + NewOc = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -1054,27 +1056,29 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - LeaveDate = _null, - NewOc = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + LeaveDate = _null, + NewOc = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -1261,21 +1265,23 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - OldOrganization = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - NewOc = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + OldOrganization = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + NewOc = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -1464,21 +1470,23 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - OldOc = _null, - OldPositionNumber = _null, - OldSalary = _null, - NewOc = _null, - NewPositionNumber = _null, - NewSalary = _null, - ReportingDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + OldOc = _null, + OldPositionNumber = _null, + OldSalary = _null, + NewOc = _null, + NewPositionNumber = _null, + NewSalary = _null, + ReportingDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -1678,26 +1686,28 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - NewOc = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + NewOc = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs index 0736477f..bc7a4883 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs @@ -727,7 +727,7 @@ namespace BMA.EHR.Placement.Service.Controllers .FirstOrDefaultAsync(x => x.Id == req.PersonalId); if (person == null) return Error(GlobalMessages.DataNotFound, 404); - + bool? _nullBool = null; person.OrganizationPosition = null; person.PositionNumber = null; person.PositionPath = null; @@ -762,7 +762,7 @@ namespace BMA.EHR.Placement.Service.Controllers person.child4ShortName = null; person.orgRevisionId = null; person.posMasterNo = null; - person.positionName = null; + //person.positionName = null; person.positionField = null; person.posTypeId = null; person.posTypeName = null; @@ -772,7 +772,7 @@ namespace BMA.EHR.Placement.Service.Controllers person.nodeId = null; person.posmasterId = null; person.positionId = null; - person.Draft = false; + person.Draft = _nullBool; person.typeCommand = null; await _context.SaveChangesAsync(); @@ -1623,27 +1623,30 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - PositionName = _null, - ExamNumber = _null, - PlacementName = _null, - Oc = _null, - PositionType = _null, - PositionLevel = _null, - PositionNumber = _null, - Salary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - OccupationPosition = _null, - PositionCandidate = _null, - OcCandidate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + PositionName = _null, + ExamNumber = _null, + PlacementName = _null, + Oc = _null, + PositionType = _null, + PositionLevel = _null, + PositionNumber = _null, + Salary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + OccupationPosition = _null, + PositionCandidate = _null, + OcCandidate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -1927,26 +1930,28 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - PositionName = _null, - ExamNumber = _null, - PlacementName = _null, - Oc = _null, - PositionType = _null, - PositionLevel = _null, - PositionNumber = _null, - Salary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - OccupationPosition = _null, - PositionCandidate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + PositionName = _null, + ExamNumber = _null, + PlacementName = _null, + Oc = _null, + PositionType = _null, + PositionLevel = _null, + PositionNumber = _null, + Salary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + OccupationPosition = _null, + PositionCandidate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -2250,28 +2255,30 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - OldPosition = _null, - NewOc = _null, - NewPosition = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + OldPosition = _null, + NewOc = _null, + NewPosition = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -2476,28 +2483,30 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPosition = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - NewOc = _null, - NewPosition = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPosition = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + NewOc = _null, + NewPosition = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -2693,26 +2702,28 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - LeaveDate = _null, - NewOc = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + LeaveDate = _null, + NewOc = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs index 67a4149e..217a2d06 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs @@ -628,18 +628,20 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - PositionName = _null, - Organization = _null, - StartDate = _null, - EndDate = _null, - Reason = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + PositionName = _null, + Organization = _null, + StartDate = _null, + EndDate = _null, + Reason = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs index 4e581132..33e31c73 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs @@ -342,7 +342,7 @@ namespace BMA.EHR.Placement.Service.Controllers data.PositionTypeOld, data.PositionLevelOld, data.PositionNumberOld, - organizationPositionOld = data.OrganizationPositionOld == "/" || data.OrganizationPositionOld == null ? null: data.OrganizationPositionOld, + organizationPositionOld = data.OrganizationPositionOld == "/" || data.OrganizationPositionOld == null ? null : data.OrganizationPositionOld, data.IsActive, data.rootOld, @@ -489,7 +489,7 @@ namespace BMA.EHR.Placement.Service.Controllers placementReceive.posLevelNameOld = org.result.posLevelName; // placementReceive.EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}"; - // placementReceive.AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount; + placementReceive.AmountOld = org.result.Amount; placementReceive.PositionOld = org.result.position; placementReceive.PositionLevelOld = org.result.posLevelName; @@ -974,26 +974,29 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOrg = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldSalary = _null, - NewOc = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOrg = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldSalary = _null, + NewOc = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -1035,7 +1038,7 @@ namespace BMA.EHR.Placement.Service.Controllers email = (String?)null, phone = (String?)null, keycloak = string.Empty, - isProbation = true, + isProbation = false, isLeave = false, dateRetire = (DateTime?)null, dateAppoint = r.commandAffectDate, diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs index d0828a85..045be807 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs @@ -838,22 +838,24 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - OldOc = _null, - PositionType = _null, - PositionLevel = _null, - PositionNumber = _null, - Salary = _null, - ReceiveOrganizationName = _null, - ActiveDate = _null, - CommandExcecuteDate = _null, - Reason = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + OldOc = _null, + PositionType = _null, + PositionLevel = _null, + PositionNumber = _null, + Salary = _null, + ReceiveOrganizationName = _null, + ActiveDate = _null, + CommandExcecuteDate = _null, + Reason = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } diff --git a/BMA.EHR.Placement.Service/Requests/OrgRequest.cs b/BMA.EHR.Placement.Service/Requests/OrgRequest.cs index 61e77526..219566df 100644 --- a/BMA.EHR.Placement.Service/Requests/OrgRequest.cs +++ b/BMA.EHR.Placement.Service/Requests/OrgRequest.cs @@ -42,6 +42,7 @@ namespace BMA.EHR.Placement.Service.Requests public string? posLevelName { get; set; } public double? salary { get; set; } public string? education { get; set; } + public double? Amount { get; set; } } } \ No newline at end of file diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs index bb6c5aca..87e2be80 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs @@ -1280,5 +1280,49 @@ namespace BMA.EHR.Retirement.Service.Controllers await _context.SaveChangesAsync(); return Success(true); } + + /// + /// report1 + /// + /// + /// + /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("report1")] + public async Task> report1(string? nodeId = null, int? node = 0, DateOnly? startDate = null, DateOnly? startEnd = null) + { + var data = new + { + template = "retirement01", + reportName = "xlsx-report", + data = "" + }; + + return Success(data); + } + + /// + /// report2 + /// + /// + /// + /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("report2")] + public async Task> report2(string? nodeId = null, int? node = 0, DateOnly? startDate = null, DateOnly? startEnd = null) + { + + var data = new + { + template = "retirement02", + reportName = "xlsx-report", + data = "" + + }; + + return Success(data); + } } } diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs index 3ee9b641..81bc5bce 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs @@ -721,27 +721,29 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - LeaveDate = _null, - NewOc = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + LeaveDate = _null, + NewOc = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -925,28 +927,30 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - LeaveDate = _null, - MilitaryDate = _null, - NewOc = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + LeaveDate = _null, + MilitaryDate = _null, + NewOc = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs index 31eecadd..960075ed 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs @@ -946,7 +946,7 @@ namespace BMA.EHR.Retirement.Service.Controllers retirementResign.posTypeNameOld = org.result.posTypeName; retirementResign.posLevelOldId = org.result.posLevelId; retirementResign.posLevelNameOld = org.result.posLevelName; - + retirementResign.AmountOld = org.result.salary; retirementResign.PositionOld = org.result.position; retirementResign.PositionLevelOld = org.result.posLevelName; retirementResign.PositionTypeOld = org.result.posTypeName; @@ -2394,22 +2394,25 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { - No = _null, - FullName = r.RemarkHorizontal, - CitizenId = _null, - PositionName = _null, - Organization = _null, - PositionLevel = _null, - PositionType = _null, - PositionNumber = _null, - ActiveDate = _null, - Salary = _null, - Remark = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + CitizenId = _null, + PositionName = _null, + Organization = _null, + PositionLevel = _null, + PositionType = _null, + PositionNumber = _null, + ActiveDate = _null, + Salary = _null, + Remark = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -2575,22 +2578,25 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { - No = _null, - FullName = r.RemarkHorizontal, - CitizenId = _null, - PositionName = _null, - Organization = _null, - PositionLevel = _null, - PositionType = _null, - PositionNumber = _null, - ActiveDate = _null, - Salary = _null, - Remark = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + CitizenId = _null, + PositionName = _null, + Organization = _null, + PositionLevel = _null, + PositionType = _null, + PositionNumber = _null, + ActiveDate = _null, + Salary = _null, + Remark = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs index 4e50079f..001a020c 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs @@ -889,7 +889,7 @@ namespace BMA.EHR.Retirement.Service.Controllers retirementResignEmployee.posTypeNameOld = org.result.posTypeName; retirementResignEmployee.posLevelOldId = org.result.posLevelId; retirementResignEmployee.posLevelNameOld = org.result.posLevelName; - + retirementResignEmployee.AmountOld = org.result.salary; retirementResignEmployee.PositionOld = org.result.position; retirementResignEmployee.PositionLevelOld = org.result.posLevelName; retirementResignEmployee.PositionTypeOld = org.result.posTypeName; @@ -2337,22 +2337,25 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { - No = _null, - FullName = r.RemarkHorizontal, - CitizenId = _null, - PositionName = _null, - Organization = _null, - PositionLevel = _null, - PositionType = _null, - PositionNumber = _null, - ActiveDate = _null, - Salary = _null, - Remark = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + CitizenId = _null, + PositionName = _null, + Organization = _null, + PositionLevel = _null, + PositionType = _null, + PositionNumber = _null, + ActiveDate = _null, + Salary = _null, + Remark = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -2518,22 +2521,25 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { - No = _null, - FullName = r.RemarkHorizontal, - CitizenId = _null, - PositionName = _null, - Organization = _null, - PositionLevel = _null, - PositionType = _null, - PositionNumber = _null, - ActiveDate = _null, - Salary = _null, - Remark = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + CitizenId = _null, + PositionName = _null, + Organization = _null, + PositionLevel = _null, + PositionType = _null, + PositionNumber = _null, + ActiveDate = _null, + Salary = _null, + Remark = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); }