diff --git a/Data/EHRDbContext.cs b/Data/EHRDbContext.cs index 569edd4..86a7e7a 100644 --- a/Data/EHRDbContext.cs +++ b/Data/EHRDbContext.cs @@ -1,4 +1,5 @@ using BMA.EHR.MetaData.Service.Models; +using BMA.EHR.Organization.Service.Models; using BMA.EHR.Organization.Service.Models.Report2; using BMA.EHR.Profile.Service.Models; using BMA.EHR.Profile.Service.Models.HR; diff --git a/Extensions/ListObjectExtensions.cs b/Extensions/ListObjectExtensions.cs new file mode 100644 index 0000000..ce84b2f --- /dev/null +++ b/Extensions/ListObjectExtensions.cs @@ -0,0 +1,62 @@ + + +namespace BMA.EHR.Organization.Service.Extensions +{ + + public class PositionPathSideObject + { + public Guid? Id { get; set; } + + public string Name { get; set; } = string.Empty; + + public string Note { get; set; } = string.Empty; + } + + public class PositionExecutiveSideObject + { + public Guid? Id { get; set; } + + public string Name { get; set; } = string.Empty; + + public string Note { get; set; } = string.Empty; + } + + public static class ListObjectExtensions + { + public static string GetNameList(this List list) + { + if (list == null || list.Count == 0) return ""; + else + { + var ret = string.Empty; + + foreach (var p in list) + { + ret += $"{p.Name} หรือ\r\n"; + } + + ret = $"({ret.Substring(0, ret.Length - 7)})"; + + return ret; + } + } + + public static string GetNameList(this List list) + { + if (list == null || list.Count == 0) return ""; + else + { + var ret = string.Empty; + + foreach (var p in list) + { + ret += $"{p.Name} หรือ\r\n"; + } + + ret = $"({ret.Substring(0, ret.Length - 7)})"; + + return ret; + } + } + } +} diff --git a/Models/AvailablePositionLevelEntity.cs b/Models/AvailablePositionLevelEntity.cs index b797d9d..7610c1c 100644 --- a/Models/AvailablePositionLevelEntity.cs +++ b/Models/AvailablePositionLevelEntity.cs @@ -1,4 +1,5 @@  +using BMA.EHR.Organization.Service.Models; using BMA.EHR.Report.Service.Models; using Microsoft.EntityFrameworkCore; using System.ComponentModel.DataAnnotations; diff --git a/Models/OrganizationPositionEntity.cs b/Models/OrganizationPositionEntity.cs index be30531..1249286 100644 --- a/Models/OrganizationPositionEntity.cs +++ b/Models/OrganizationPositionEntity.cs @@ -1,4 +1,5 @@ -using BMA.EHR.Report.Service.Models; +using BMA.EHR.Organization.Service.Models; +using BMA.EHR.Report.Service.Models; using Microsoft.EntityFrameworkCore; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/Models/PositionMasterEntity.cs b/Models/PositionMasterEntity.cs index 219ab6d..65d5857 100644 --- a/Models/PositionMasterEntity.cs +++ b/Models/PositionMasterEntity.cs @@ -1,9 +1,9 @@ using Microsoft.EntityFrameworkCore; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using BMA.EHR.Report.Service.Models; +using BMA.EHR.MetaData.Service.Models; -namespace BMA.EHR.Profile.Service.Models +namespace BMA.EHR.Organization.Service.Models { public class PositionMasterEntity : EntityBase { @@ -65,8 +65,12 @@ namespace BMA.EHR.Profile.Service.Models [Column(Order = 14), Comment("IsDirector")] public bool? IsDirector { get; set; } - //public List AvailablePositionLevels { get; } = new(); + public string? PositionPathSideObject { get; set; } + public string? PositionExecutiveSideObject { get; set; } + + //public List AvailablePositionLevels { get; } = new(); + //public List PositionMasterHistorys { get; } = new(); } } diff --git a/Report/Organization/rptAccount1.trdp b/Report/Organization/rptAccount1.trdp index 4636979..454dcbd 100644 Binary files a/Report/Organization/rptAccount1.trdp and b/Report/Organization/rptAccount1.trdp differ diff --git a/Services/OrganizationReportService.cs b/Services/OrganizationReportService.cs index 0d885df..f92b295 100644 --- a/Services/OrganizationReportService.cs +++ b/Services/OrganizationReportService.cs @@ -1,5 +1,6 @@ using Amazon.Internal; using BMA.EHR.Extensions; +using BMA.EHR.Organization.Service.Extensions; using BMA.EHR.Profile.Service.Services; using BMA.EHR.Report.Service.Data; using Microsoft.EntityFrameworkCore; @@ -102,10 +103,10 @@ namespace BMA.EHR.Report.Service.Services ShortName = sn.Name, PositionNumber = pn.Name, PositionLevel = _profileService.GetPositionLevel(pm.Id), - PositionName = pp.Name, - PositionSide = pp_pps == null ? "" : $"({pp_pps.Name})", - PositionExecutive = pm_exp == null ? "" : pm_exp.Name, - PositionExecutiveSide = pm_exp_s == null ? "" : $"({pm_exp_s.Name})", + PositionName = $"{pp.Name}\r\n", + PositionSide = pm.PositionPathSideObject is null ? "" : Newtonsoft.Json.JsonConvert.DeserializeObject>(pm.PositionPathSideObject).GetNameList(), + PositionExecutive = pm_exp == null ? "" : $"{pm_exp.Name}\r\n", + PositionExecutiveSide = pm.PositionExecutiveSideObject is null ? "" : Newtonsoft.Json.JsonConvert.DeserializeObject>(pm.PositionExecutiveSideObject).GetNameList(), Remark = op.PositionUserNote, OcOrder = oc.OrganizationOrder.Value, PositionType = pt.Name