diff --git a/SGGL/BLL/CQMS/ProcessControl/InspectionManagementService.cs b/SGGL/BLL/CQMS/ProcessControl/InspectionManagementService.cs index 7f21b9bd..2ed2dba6 100644 --- a/SGGL/BLL/CQMS/ProcessControl/InspectionManagementService.cs +++ b/SGGL/BLL/CQMS/ProcessControl/InspectionManagementService.cs @@ -407,11 +407,15 @@ namespace BLL List InspectionMangementList = (from x in Funs.DB.ProcessControl_InspectionManagement where x.ProjectId == projectId select x).ToList(); if (isOnceQualified == true) { - InspectionMangementList = (from x in InspectionMangementList where x.IsOnceQualified == null || x.IsOnceQualified == true select x).ToList(); + InspectionMangementList = InspectionMangementList.Where(x => x.IsOnceQualified == null || x.IsOnceQualified == true).ToList(); } - if (startDate != null && SoptDate != null) + if (startDate != null) { - InspectionMangementList = (from x in InspectionMangementList where x.InspectionDate >= startDate && x.InspectionDate <= SoptDate select x).ToList(); + InspectionMangementList = InspectionMangementList.Where(x => x.InspectionDate >= startDate).ToList(); + } + if (SoptDate != null) + { + InspectionMangementList = InspectionMangementList.Where(x => x.InspectionDate <= SoptDate || x.InspectionDate == null).ToList(); } return InspectionMangementList; } @@ -422,19 +426,23 @@ namespace BLL if (!string.IsNullOrEmpty(projectId)) { - InspectionMangementList = (from x in InspectionMangementList where x.ProjectId == projectId select x).ToList(); + InspectionMangementList = InspectionMangementList.Where(x => x.ProjectId == projectId).ToList(); } if (!string.IsNullOrEmpty(cNProfessionalId) && cNProfessionalId != "0") { - InspectionMangementList = (from x in InspectionMangementList where x.CNProfessionalId == cNProfessionalId select x).ToList(); + InspectionMangementList = InspectionMangementList.Where(x => x.CNProfessionalId == cNProfessionalId).ToList(); } if (isOnceQualified == true) { - InspectionMangementList = (from x in InspectionMangementList where x.IsOnceQualified == null || x.IsOnceQualified == true select x).ToList(); + InspectionMangementList = InspectionMangementList.Where(x => x.IsOnceQualified == null || x.IsOnceQualified == true).ToList(); } - if (startDate != null && SoptDate != null) + if (startDate != null) { - InspectionMangementList = (from x in InspectionMangementList where x.InspectionDate >= startDate && x.InspectionDate <= SoptDate select x).ToList(); + InspectionMangementList = InspectionMangementList.Where(x => x.InspectionDate >= startDate).ToList(); + } + if (SoptDate != null) + { + InspectionMangementList = InspectionMangementList.Where(x => x.InspectionDate <= SoptDate || x.InspectionDate == null).ToList(); } return InspectionMangementList; @@ -445,15 +453,19 @@ namespace BLL List InspectionMangementList = (from x in Funs.DB.ProcessControl_InspectionManagement where x.ProjectId == projectId select x).ToList(); if (!string.IsNullOrEmpty(unitId) && unitId != "0") { - InspectionMangementList = (from x in InspectionMangementList where x.UnitId == unitId select x).ToList(); + InspectionMangementList = InspectionMangementList.Where(x => x.UnitId == unitId).ToList(); } if (isOnceQualified == true) { - InspectionMangementList = (from x in InspectionMangementList where x.IsOnceQualified == null || x.IsOnceQualified == true select x).ToList(); + InspectionMangementList = InspectionMangementList.Where(x => x.IsOnceQualified == null || x.IsOnceQualified == true).ToList(); } - if (startDate != null && SoptDate != null) + if (startDate != null) { - InspectionMangementList = (from x in InspectionMangementList where x.InspectionDate >= startDate && x.InspectionDate <= SoptDate select x).ToList(); + InspectionMangementList = InspectionMangementList.Where(x => x.InspectionDate >= startDate).ToList(); + } + if (SoptDate != null) + { + InspectionMangementList = InspectionMangementList.Where(x => x.InspectionDate <= SoptDate || x.InspectionDate == null).ToList(); } return InspectionMangementList; @@ -466,19 +478,23 @@ namespace BLL if (!string.IsNullOrEmpty(projectId)) { - InspectionMangementList = (from x in InspectionMangementList where x.ProjectId == projectId select x).ToList(); + InspectionMangementList = InspectionMangementList.Where(x => x.ProjectId == projectId).ToList(); } if (!string.IsNullOrEmpty(cNProfessionalId) && cNProfessionalId != "0") { - InspectionMangementList = (from x in InspectionMangementList where x.CNProfessionalId == cNProfessionalId select x).ToList(); + InspectionMangementList = InspectionMangementList.Where(x => x.CNProfessionalId == cNProfessionalId).ToList(); } if (isOnceQualified == true) { - InspectionMangementList = (from x in InspectionMangementList where x.IsOnceQualified == null || x.IsOnceQualified == true select x).ToList(); + InspectionMangementList = InspectionMangementList.Where(x => x.IsOnceQualified == null || x.IsOnceQualified == true).ToList(); } - if (startDate != null && SoptDate != null) + if (startDate != null) { - InspectionMangementList = (from x in InspectionMangementList where x.InspectionDate >= startDate && x.InspectionDate <= SoptDate select x).ToList(); + InspectionMangementList = InspectionMangementList.Where(x => x.InspectionDate >= startDate).ToList(); + } + if (SoptDate != null) + { + InspectionMangementList = InspectionMangementList.Where(x => x.InspectionDate <= SoptDate || x.InspectionDate == null).ToList(); } return InspectionMangementList;