- Timestamp:
- 01/17/18 15:24:44 (7 years ago)
- Location:
- branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/AssignedProjectResourceDao.cs
r15577 r15628 107 107 WHERE ProjectId IN ({0}) 108 108 "; 109 // tested 109 110 private const string CheckProjectGrantedForResourcesQueryString = @" 110 111 WITH rtree AS … … 125 126 FROM rtree, [AssignedProjectResource] apr 126 127 WHERE rtree.ParentResourceId = apr.ResourceId 127 AND apr.ProjectId = {0}128 AND apr.ProjectId = '{0}' 128 129 UNION 129 130 SELECT apr.ResourceId 130 131 FROM [AssignedProjectResource] apr 131 WHERE apr.ProjectId = {0}132 WHERE apr.ProjectId = '{0}' 132 133 ) 133 134 "; … … 146 147 WHERE rtree.ParentResourceId = apr.ResourceId 147 148 AND rtree.ResourceId = res.ResourceId 148 AND apr.ProjectId = {0}149 AND apr.ProjectId = '{0}' 149 150 UNION 150 151 SELECT res.* 151 152 FROM [AssignedProjectResource] apr, [Resource] res 152 153 WHERE apr.ResourceId = res.ResourceId 153 AND apr.ProjectId = {0}154 AND apr.ProjectId = '{0}' 154 155 "; 155 156 private const string GetAllGrantedResourceIdsByProjectIdQueryString = @" … … 166 167 FROM rtree, [AssignedProjectResource] apr 167 168 WHERE rtree.ParentResourceId = apr.ResourceId 168 AND apr.ProjectId = {0}169 AND apr.ProjectId = '{0}' 169 170 UNION 170 171 SELECT apr.ResourceId 171 172 FROM [AssignedProjectResource] apr 172 WHERE apr.ProjectId = {0}173 WHERE apr.ProjectId = '{0}' 173 174 "; 174 175 private const string GetAllGrantedResourceIdsOfOwnedParentProjectsQueryString = @" -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/ProjectPermissionDao.cs
r15577 r15628 74 74 private const string DeleteByProjectIdAndGrantedUserIdsQueryString = @" 75 75 DELETE FROM [ProjectPermission] 76 WHERE ProjectId = '{0}'76 WHERE ProjectId = {0} 77 77 AND GrantedUserId IN ({1}); 78 78 "; … … 85 85 SELECT COUNT(pp.ProjectId) 86 86 FROM [ProjectPermission] pp 87 WHERE pp.ProjectId = {0}87 WHERE pp.ProjectId = '{0}' 88 88 AND pp.GrantedUserId IN ({1}) 89 89 "; -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/TaskDao.cs
r15497 r15628 64 64 /// <param name="finished">if true, all parent task which have FinishWhenChildJobsFinished=true are returned, otherwise only FinishWhenChildJobsFinished=false are returned</param> 65 65 /// <returns></returns> 66 public IEnumerable<Task> GetParentTasks (IEnumerable<Guid> resourceIds, int count, bool finished) {66 public IEnumerable<Task> GetParentTasks_Old(IEnumerable<Guid> resourceIds, int count, bool finished) { 67 67 var query = from ar in AssignedTaskResourceTable 68 68 where resourceIds.Contains(ar.ResourceId) … … 83 83 } 84 84 85 /// <summary> 86 /// returns all parent tasks which are waiting for their child tasks to finish 87 /// </summary> 88 /// <param name="resourceIds">list of resourceids which for which the task should be valid</param> 89 /// <param name="count">maximum number of task to return</param> 90 /// <param name="finished">if true, all parent task which have FinishWhenChildJobsFinished=true are returned, otherwise only FinishWhenChildJobsFinished=false are returned</param> 91 /// <returns></returns> 92 public IEnumerable<Task> GetParentTasks(IEnumerable<Guid> resourceIds, int count, bool finished) { 93 var query = from t in Table 94 where t.State == TaskState.Waiting 95 && t.IsParentTask 96 && !t.Job.AssignedJobResources.Select(x => x.ResourceId).Except(resourceIds).Any() 97 && t.FinishWhenChildJobsFinished == finished 98 && t.ChildJobs.Any() 99 && t.ChildJobs.All(x => 100 x.State == TaskState.Finished 101 || x.State == TaskState.Aborted 102 || x.State == TaskState.Failed) 103 orderby t.Priority descending 104 select t; 105 return count == 0 ? query.ToArray() : query.Take(count).ToArray(); 106 } 107 85 108 public void UpdateExecutionTime(Guid taskId, double executionTime) { 86 109 DataContext.ExecuteCommand(UpdateExecutionTimeQuery, executionTime, DateTime.Now, taskId); … … 96 119 97 120 #region String queries 121 private const string GetParentTasksQueryString = @" 122 SELECT t.* FROM [Task] t, [Job] j, [AssignedJobResource] ajr 123 WHERE t.IsParentTask = 1 124 AND t.TaskState = 'Waiting' 125 AND t.JobId = j.JobId 126 AND j.JobId = ajr.JobId 127 AND t.FinishWhenChildJobsFinished = 1 128 ... TODO (not necessary) 129 "; 98 130 private const string GetWaitingTasksQueryString = @" 99 131 WITH pr AS (
Note: See TracChangeset
for help on using the changeset viewer.