- Timestamp:
- 12/06/17 16:16:01 (7 years ago)
- Location:
- branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/ResourceDao.cs
r14185 r15497 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Data.Linq; 24 25 using System.Linq; … … 40 41 } 41 42 43 public IEnumerable<Guid> GetResourceIdsByParentId(Guid id) { 44 return DataContext.ExecuteQuery<Guid>(GetResourceIdsByParentIdQuery, id); 45 } 46 47 public IEnumerable<Resource> GetResourcesByParentId(Guid id) { 48 return DataContext.ExecuteQuery<Resource>(GetResourcesByParentIdQuery, id); 49 } 50 42 51 #region Compiled queries 43 52 private static readonly Func<DataContext, Guid, Resource> GetByIdQuery = … … 53 62 select resource).FirstOrDefault()); 54 63 #endregion 64 65 #region String queries 66 private const string GetResourcesByParentIdQuery = @" 67 WITH rtree AS 68 ( 69 SELECT ResourceId, ParentResourceId 70 FROM [Resource] 71 UNION ALL 72 SELECT rt.ResourceId, r.ParentResourceId 73 FROM [Resource] r 74 JOIN rtree rt ON rt.ParentResourceId = r.ResourceId AND r.ParentResourceId <> r.ResourceId AND rt.ParentResourceId <> rt.ResourceId 75 ) 76 SELECT DISTINCT rtree.ResourceId 77 FROM rtree 78 WHERE rtree.ParentResourceId = ({0}) 79 "; 80 private const string GetResourceIdsByParentIdQuery = @" 81 WITH rtree AS 82 ( 83 SELECT ResourceId, ParentResourceId 84 FROM [Resource] 85 UNION ALL 86 SELECT rt.ResourceId, r.ParentResourceId 87 FROM [Resource] r 88 JOIN rtree rt ON rt.ParentResourceId = r.ResourceId AND r.ParentResourceId <> r.ResourceId AND rt.ParentResourceId <> rt.ResourceId 89 ) 90 SELECT DISTINCT res.* 91 FROM rtree, [Resource] res 92 WHERE rtree.ParentResourceId = ({0}) 93 AND rtree.ResourceId = res.ResourceId 94 "; 95 #endregion 55 96 } 56 97 } -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/ResourcePermissionDao.cs
r15496 r15497 56 56 ( 57 57 SELECT ResourceId, ParentResourceId 58 FROM [ dbo].Resource58 FROM [Resource] 59 59 UNION ALL 60 60 SELECT rt.ResourceId, r.ParentResourceId 61 FROM [ dbo].Resourcer61 FROM [Resource] r 62 62 JOIN rtree rt ON rt.ParentResourceId = r.ResourceId AND r.ParentResourceId <> r.ResourceId AND rt.ParentResourceId <> rt.ResourceId 63 63 ) 64 SELECT DISTINCT rtree.ResourceId FROM rtree, ResourcePermission rp65 WHERE rtree.ParentResourceId = rp.ResourceId66 AND rp.GrantedUserId IN ({0})64 SELECT DISTINCT rtree.ResourceId 65 FROM rtree, [ResourcePermission] rp 66 WHERE rtree.ParentResourceId = rp.ResourceId AND rp.GrantedUserId IN ({0}) 67 67 UNION ALL 68 68 SELECT rp.ResourceId 69 FROM ResourcePermissionrp69 FROM [ResourcePermission] rp 70 70 WHERE rp.GrantedUserId IN ({0}) 71 71 ;"; -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/TaskDao.cs
r15411 r15497 106 106 ) 107 107 SELECT DISTINCT t.TaskId, t.JobId, t.Priority 108 FROM pr JOIN AssignedTaskResource sar ON ar.ResourceId = pr.ResourceId108 FROM pr JOIN AssignedTaskResource ar ON ar.ResourceId = pr.ResourceId 109 109 JOIN Task t ON t.TaskId = ar.TaskId 110 110 WHERE NOT (t.IsParentTask = 1 AND t.FinishWhenChildJobsFinished = 1) -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Interfaces/IPersistenceManager.cs
r15411 r15497 43 43 RequiredPluginDao RequiredPluginDao { get; } 44 44 ResourceDao ResourceDao { get; } 45 ResourcePermissionDao ResourcePermissionDao { get; } 45 46 SlaveDao SlaveDao { get; } 46 47 SlaveGroupDao SlaveGroupDao { get; } -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Manager/PersistenceManager.cs
r15411 r15497 83 83 } 84 84 85 private ProjectPermissionDao resourcePermissionDao;85 private ProjectPermissionDao projectPermissionDao; 86 86 public ProjectPermissionDao ProjectPermissionDao { 87 get { return resourcePermissionDao ?? (resourcePermissionDao = new ProjectPermissionDao(dataContext)); }87 get { return projectPermissionDao ?? (projectPermissionDao = new ProjectPermissionDao(dataContext)); } 88 88 } 89 89 … … 96 96 public ResourceDao ResourceDao { 97 97 get { return resourceDao ?? (resourceDao = new ResourceDao(dataContext)); } 98 } 99 100 private ResourcePermissionDao resourcePermissionDao; 101 public ResourcePermissionDao ResourcePermissionDao { 102 get { return resourcePermissionDao ?? (resourcePermissionDao = new ResourcePermissionDao(dataContext)); } 98 103 } 99 104
Note: See TracChangeset
for help on using the changeset viewer.