- Timestamp:
- 09/25/17 15:36:54 (7 years ago)
- Location:
- branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3
- Files:
-
- 1 added
- 5 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/ProjectPermissionDao.cs
r15378 r15379 26 26 27 27 namespace HeuristicLab.Services.Hive.DataAccess.Daos { 28 public class ResourcePermissionDao : GenericDao<Guid, ResourcePermission> {29 public ResourcePermissionDao(DataContext dataContext) : base(dataContext) { }28 public class ProjectPermissionDao : GenericDao<Guid, ProjectPermission> { 29 public ProjectPermissionDao(DataContext dataContext) : base(dataContext) { } 30 30 31 public override ResourcePermission GetById(Guid id) {31 public override ProjectPermission GetById(Guid id) { 32 32 throw new NotImplementedException(); 33 33 } 34 34 35 public IEnumerable< ResourcePermission> GetByResourceId(Guid id) {36 return GetBy ResourceIdGetByIdQuery(DataContext, id);35 public IEnumerable<ProjectPermission> GetByProjectId(Guid id) { 36 return GetByProjectIdGetByIdQuery(DataContext, id); 37 37 } 38 38 39 public void DeleteBy ResourceAndGrantedUserId(Guid resourceId, IEnumerable<Guid> grantedUserId) {39 public void DeleteByProjectAndGrantedUserId(Guid projectId, IEnumerable<Guid> grantedUserId) { 40 40 string paramIds = string.Join(",", grantedUserId.Select(x => string.Format("'{0}'", x))); 41 41 if (!string.IsNullOrWhiteSpace(paramIds)) { 42 string query = string.Format(DeleteByGrantedUserQuery, resourceId, paramIds);42 string query = string.Format(DeleteByGrantedUserQuery, projectId, paramIds); 43 43 DataContext.ExecuteCommand(query); 44 44 } … … 46 46 47 47 #region Compiled queries 48 private static readonly Func<DataContext, Guid, IEnumerable< ResourcePermission>> GetByResourceIdGetByIdQuery =49 CompiledQuery.Compile((DataContext db, Guid resourceId) =>50 from resourcePermission in db.GetTable<ResourcePermission>()51 where resourcePermission.ResourceId == resourceId52 select resourcePermission);48 private static readonly Func<DataContext, Guid, IEnumerable<ProjectPermission>> GetByProjectIdGetByIdQuery = 49 CompiledQuery.Compile((DataContext db, Guid projectId) => 50 from projectPermission in db.GetTable<ProjectPermission>() 51 where projectPermission.ProjectId == projectId 52 select projectPermission); 53 53 #endregion 54 54 55 55 #region String queries 56 56 private const string DeleteByGrantedUserQuery = 57 @"DELETE FROM [ ResourcePermission]58 WHERE ResourceId = '{0}'57 @"DELETE FROM [ProjectPermission] 58 WHERE ProjectId = '{0}' 59 59 AND GrantedUserId IN ({1});"; 60 60 #endregion -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HeuristicLab.Services.Hive.DataAccess-3.3.csproj
r12878 r15379 118 118 <Compile Include="Daos\PluginDao.cs" /> 119 119 <Compile Include="Daos\PluginDataDao.cs" /> 120 <Compile Include="Daos\ProjectDao.cs" /> 121 <Compile Include="Daos\ProjectPermissionDao.cs" /> 120 122 <Compile Include="Daos\RequiredPluginDao.cs" /> 121 123 <Compile Include="Daos\ResourceDao.cs" /> 122 <Compile Include="Daos\ResourcePermissionDao.cs" />123 124 <Compile Include="Daos\SlaveDao.cs" /> 124 125 <Compile Include="Daos\SlaveGroupDao.cs" /> -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml
r15378 r15379 265 265 <Column Name="OwnerUserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" /> 266 266 <Column Name="StartDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" /> 267 <Column Name="EndDate" Type="System.DateTime" DbType="DateTime" CanBeNull=" false" />267 <Column Name="EndDate" Type="System.DateTime" DbType="DateTime" CanBeNull="true" /> 268 268 <Association Name="Project_AssignedResource" Member="AssignedResources" ThisKey="ProjectId" OtherKey="ProjectId" Type="AssignedResource" /> 269 269 <Association Name="Project_Job" Member="Jobs" ThisKey="ProjectId" OtherKey="ProjectId" Type="Job" /> -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.designer.cs
r15378 r15379 5681 5681 private System.DateTime _StartDate; 5682 5682 5683 private System. DateTime_EndDate;5683 private System.Nullable<System.DateTime> _EndDate; 5684 5684 5685 5685 private EntitySet<AssignedResource> _AssignedResources; … … 5711 5711 partial void OnStartDateChanging(System.DateTime value); 5712 5712 partial void OnStartDateChanged(); 5713 partial void OnEndDateChanging(System. DateTimevalue);5713 partial void OnEndDateChanging(System.Nullable<System.DateTime> value); 5714 5714 partial void OnEndDateChanged(); 5715 5715 #endregion … … 5870 5870 5871 5871 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EndDate", DbType="DateTime")] 5872 public System. DateTimeEndDate5872 public System.Nullable<System.DateTime> EndDate 5873 5873 { 5874 5874 get -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Interfaces/IPersistenceManager.cs
r14185 r15379 38 38 PluginDao PluginDao { get; } 39 39 PluginDataDao PluginDataDao { get; } 40 ProjectDao ProjectDao { get; } 41 ProjectPermissionDao ProjectPermissionDao { get; } 40 42 RequiredPluginDao RequiredPluginDao { get; } 41 43 ResourceDao ResourceDao { get; } 42 ResourcePermissionDao ResourcePermissionDao { get; }43 44 SlaveDao SlaveDao { get; } 44 45 SlaveGroupDao SlaveGroupDao { get; } -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Manager/PersistenceManager.cs
r14185 r15379 73 73 } 74 74 75 private ProjectDao projectDao; 76 public ProjectDao ProjectDao { 77 get { return projectDao ?? (projectDao = new ProjectDao(dataContext)); } 78 } 79 80 private ProjectPermissionDao resourcePermissionDao; 81 public ProjectPermissionDao ProjectPermissionDao { 82 get { return resourcePermissionDao ?? (resourcePermissionDao = new ProjectPermissionDao(dataContext)); } 83 } 84 75 85 private RequiredPluginDao requiredPluginDao; 76 86 public RequiredPluginDao RequiredPluginDao { … … 81 91 public ResourceDao ResourceDao { 82 92 get { return resourceDao ?? (resourceDao = new ResourceDao(dataContext)); } 83 }84 85 private ResourcePermissionDao resourcePermissionDao;86 public ResourcePermissionDao ResourcePermissionDao {87 get { return resourcePermissionDao ?? (resourcePermissionDao = new ResourcePermissionDao(dataContext)); }88 93 } 89 94
Note: See TracChangeset
for help on using the changeset viewer.