Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/05/18 15:13:25 (5 years ago)
Author:
jzenisek
Message:

#2839 worked on service side mgmt of project-resource assignments and project-user permissions

File:
1 edited

Legend:

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

    r15546 r15577  
    3838
    3939    public void DeleteByProjectIdAndResourceIds(Guid projectId, IEnumerable<Guid> resourceIds) {
    40       string paramIds = string.Join(",", resourceIds.Select(x => string.Format("'{0}'", x)));
     40      string paramIds = string.Join(",", resourceIds.ToList().Select(x => string.Format("'{0}'", x)));
    4141      if (!string.IsNullOrWhiteSpace(paramIds)) {
    4242        string query = string.Format(DeleteByProjectIdAndResourceIdsQueryString, projectId, paramIds);
     
    4646
    4747    public void DeleteByProjectIdsAndResourceIds(IEnumerable<Guid> projectIds, IEnumerable<Guid> resourceIds) {
    48       string paramProjectIds = string.Join(",", projectIds.Select(x => string.Format("'{0}'", x)));
    49       string paramResourceIds = string.Join(",", resourceIds.Select(x => string.Format("'{0}'", x)));
    50       if (!string.IsNullOrWhiteSpace(paramResourceIds)) {
     48      string paramProjectIds = string.Join(",", projectIds.ToList().Select(x => string.Format("'{0}'", x)));
     49      string paramResourceIds = string.Join(",", resourceIds.ToList().Select(x => string.Format("'{0}'", x)));
     50      if (!string.IsNullOrWhiteSpace(paramProjectIds) && !string.IsNullOrWhiteSpace(paramResourceIds)) {
    5151        string query = string.Format(DeleteByProjectIdsAndResourceIdsQueryString, paramProjectIds, paramResourceIds);
    5252        DataContext.ExecuteCommand(query);
     
    5454    }
    5555
     56    public void DeleteByProjectIds(IEnumerable<Guid> projectIds) {
     57      string paramProjectIds = string.Join(",", projectIds.ToList().Select(x => string.Format("'{0}'", x)));
     58      if (!string.IsNullOrWhiteSpace(paramProjectIds)) {
     59        string query = string.Format(DeleteByProjectIdsQueryString, paramProjectIds);
     60        DataContext.ExecuteCommand(query);
     61      }
     62    }
     63
    5664    public bool CheckProjectGrantedForResources(Guid projectId, IEnumerable<Guid> resourceIds) {
    57       string paramResourceIds = string.Join(",", resourceIds.Select(x => string.Format("'{0}'", x)));
     65      string paramResourceIds = string.Join(",", resourceIds.ToList().Select(x => string.Format("'{0}'", x)));
    5866      if (!string.IsNullOrWhiteSpace(paramResourceIds)) {
    5967        string queryString = string.Format(CheckProjectGrantedForResourcesQueryString, projectId, paramResourceIds);
     
    8593
    8694    #region String queries
    87     private const string DeleteByProjectIdAndResourceIdsQueryString =
    88       @"DELETE FROM [AssignedProjectResource]
    89          WHERE ProjectId = '{0}'
    90            AND ResourceId IN ({1});";
    91     private const string DeleteByProjectIdsAndResourceIdsQueryString =
    92       @"DELETE FROM [AssignedProjectResource]
    93              WHERE ProjectId IN ({0})
    94                AND ResourceId IN ({1});";
     95    private const string DeleteByProjectIdAndResourceIdsQueryString = @"
     96      DELETE FROM [AssignedProjectResource]
     97        WHERE ProjectId = '{0}'
     98        AND ResourceId IN ({1});
     99    ";
     100    private const string DeleteByProjectIdsAndResourceIdsQueryString = @"
     101      DELETE FROM [AssignedProjectResource]
     102        WHERE ProjectId IN ({0})
     103        AND ResourceId IN ({1});
     104    ";
     105    private const string DeleteByProjectIdsQueryString = @"
     106      DELETE FROM [AssignedProjectResource]
     107        WHERE ProjectId IN ({0})
     108    ";
    95109    private const string CheckProjectGrantedForResourcesQueryString = @"
    96110    WITH rtree AS
Note: See TracChangeset for help on using the changeset viewer.