Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/19/17 13:22:47 (7 years ago)
Author:
jzenisek
Message:

#2839 worked on ProjectResource assignment: (cascading) assigning & unassigning

File:
1 edited

Legend:

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

    r15540 r15546  
    3737    }
    3838
    39     public void DeleteByProjectAndGrantedUserId(Guid projectId, IEnumerable<Guid> resourceIds) {
     39    public void DeleteByProjectIdAndResourceIds(Guid projectId, IEnumerable<Guid> resourceIds) {
    4040      string paramIds = string.Join(",", resourceIds.Select(x => string.Format("'{0}'", x)));
    4141      if (!string.IsNullOrWhiteSpace(paramIds)) {
    42         string query = string.Format(DeleteByGrantedUserQuery, projectId, paramIds);
     42        string query = string.Format(DeleteByProjectIdAndResourceIdsQueryString, projectId, paramIds);
     43        DataContext.ExecuteCommand(query);
     44      }
     45    }
     46
     47    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)) {
     51        string query = string.Format(DeleteByProjectIdsAndResourceIdsQueryString, paramProjectIds, paramResourceIds);
    4352        DataContext.ExecuteCommand(query);
    4453      }
     
    7685
    7786    #region String queries
    78     private const string DeleteByGrantedUserQuery =
     87    private const string DeleteByProjectIdAndResourceIdsQueryString =
    7988      @"DELETE FROM [AssignedProjectResource]
    8089         WHERE ProjectId = '{0}'
    8190           AND ResourceId IN ({1});";
     91    private const string DeleteByProjectIdsAndResourceIdsQueryString =
     92      @"DELETE FROM [AssignedProjectResource]
     93             WHERE ProjectId IN ({0})
     94               AND ResourceId IN ({1});";
    8295    private const string CheckProjectGrantedForResourcesQueryString = @"
    8396    WITH rtree AS
Note: See TracChangeset for help on using the changeset viewer.