Ignore:
Timestamp:
12/18/17 17:38:05 (5 years ago)
Author:
jzenisek
Message:

#2839 added checks for the administration of project-resource assignments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/ProjectDao.cs

    r15527 r15540  
    153153      FROM pbranch
    154154    ";
     155    private const string GetNearestOwnedParentProjectByIdQuery = @"
     156      WITH pbranch AS
     157      (
     158        SELECT ProjectId, ParentProjectId, CAST(ProjectId AS NVARCHAR(MAX)) Path, 1 Distance
     159        FROM [Project]
     160        WHERE ProjectId = {0}
     161        UNION ALL
     162        SELECT pb.ProjectId, p.ParentProjectId, pb.Path + N', ' + CAST(pb.ProjectId AS NVARCHAR(MAX)), pb.Distance + 1
     163        FROM [Project] p
     164        JOIN pbranch pb ON pb.ParentProjectId = p.ProjectId AND p.ParentProjectId <> p.ProjectId AND pb.ParentProjectId <> pb.ProjectId
     165      )
     166      SELECT TOP(1) pro.*
     167      FROM pbranch, [Project] pro
     168      WHERE pbranch.ParentProjectId = pro.ProjectId
     169      AND pro.OwnerUserId = {1}
     170      ORDER BY pbranch.Distance
     171    ";
     172    private const string GetFarestOwnedParentProjectIdByIdQuery = @"
     173      WITH pbranch AS
     174      (
     175        SELECT ProjectId, ParentProjectId, CAST(ProjectId AS NVARCHAR(MAX)) Path, 1 Distance
     176        FROM [Project]
     177        WHERE ProjectId = {0}
     178        UNION ALL
     179        SELECT pb.ProjectId, p.ParentProjectId, pb.Path + N', ' + CAST(pb.ProjectId AS NVARCHAR(MAX)), pb.Distance + 1
     180        FROM [Project] p
     181        JOIN pbranch pb ON pb.ParentProjectId = p.ProjectId AND p.ParentProjectId <> p.ProjectId AND pb.ParentProjectId <> pb.ProjectId
     182      )
     183      SELECT TOP(1) pro.*
     184      FROM pbranch, [Project] pro
     185      WHERE pbranch.ParentProjectId = pro.ProjectId
     186      AND pro.OwnerUserId = {1}
     187      ORDER BY pbranch.Distance DESC
     188    ";
    155189    #endregion
    156190  }
Note: See TracChangeset for help on using the changeset viewer.