From fb282915d18c69eba1472889f79d9e7dc7daecc6 Mon Sep 17 00:00:00 2001 From: Adisak Date: Mon, 22 Dec 2025 13:45:11 +0700 Subject: [PATCH] #2146 and #2147 --- .../AdditionalCheckRequestRepository.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/AdditionalCheckRequestRepository.cs b/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/AdditionalCheckRequestRepository.cs index 04c0c921..12f51207 100644 --- a/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/AdditionalCheckRequestRepository.cs +++ b/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/AdditionalCheckRequestRepository.cs @@ -9,6 +9,8 @@ using BMA.EHR.Domain.Shared; using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; +using Serilog; +using System.Diagnostics; namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants { @@ -174,15 +176,19 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants else if (role == "PARENT") { data = data - .Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null).ToList(); + .Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null && x.Child1DnaId != Guid.Empty).ToList(); } else if (role == "NORMAL") { data = data.Where(x => - node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null : - node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null : - node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null : - node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null : + node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && + (x.Child1DnaId == Guid.Empty || x.Child1DnaId == null) : + node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && + (x.Child2DnaId == Guid.Empty || x.Child2DnaId == null) : + node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && + (x.Child3DnaId == Guid.Empty || x.Child3DnaId == null) : + node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && + (x.Child4DnaId == Guid.Empty || x.Child4DnaId == null) : node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : true ).ToList();