- Timestamp:
- 01/26/18 08:51:30 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/AssignedProjectResourceDao.cs
r15628 r15658 77 77 public IEnumerable<Guid> GetAllGrantedResourceIdsByProjectId(Guid projectId) { 78 78 return DataContext.ExecuteQuery<Guid>(GetAllGrantedResourceIdsByProjectIdQueryString, projectId); 79 } 80 81 public IEnumerable<Resource> GetAllGrantedResourcesByProjectIds(IEnumerable<Guid> projectIds) { 82 string paramProjectIds = string.Join(",", projectIds.ToList().Select(x => string.Format("'{0}'", x))); 83 if (!string.IsNullOrWhiteSpace(paramProjectIds)) { 84 string queryString = string.Format(GetAllGrantedResourcesByProjectIdsQueryString, paramProjectIds); 85 return DataContext.ExecuteQuery<Resource>(queryString); 86 } 87 return Enumerable.Empty<Resource>(); 79 88 } 80 89 … … 173 182 WHERE apr.ProjectId = '{0}' 174 183 "; 184 private const string GetAllGrantedResourcesByProjectIdsQueryString = @" 185 WITH rtree AS 186 ( 187 SELECT ResourceId, ParentResourceId 188 FROM [Resource] 189 UNION ALL 190 SELECT rt.ResourceId, r.ParentResourceId 191 FROM [Resource] r 192 JOIN rtree rt ON rt.ParentResourceId = r.ResourceId 193 ) 194 SELECT res.* 195 FROM rtree, [AssignedProjectResource] apr, [Resource] res 196 WHERE rtree.ParentResourceId = apr.ResourceId 197 AND rtree.ResourceId = res.ResourceId 198 AND apr.ProjectId IN ({0}) 199 UNION 200 SELECT res.* 201 FROM [AssignedProjectResource] apr, [Resource] res 202 WHERE apr.ResourceId = res.ResourceId 203 AND apr.ProjectId IN ({0}) 204 "; 175 205 private const string GetAllGrantedResourceIdsOfOwnedParentProjectsQueryString = @" 176 206 WITH pbranch AS
Note: See TracChangeset
for help on using the changeset viewer.