Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16060


Ignore:
Timestamp:
08/07/18 15:34:23 (6 years ago)
Author:
jkarder
Message:

#2839: worked on hive project management

  • added .ToList() calls within some service methods to prevent TransactionExceptions
  • added check for InvokeRequired
  • improved RunInHiveMenuItem
  • removed .resx files from projects
Location:
branches/2839_HiveProjectManagement
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/HeuristicLab.Clients.Hive.Administrator-3.3.csproj

    r15966 r16060  
    294294    </ProjectReference>
    295295  </ItemGroup>
    296   <ItemGroup>
    297     <EmbeddedResource Include="Views\ProjectJobsView.resx">
    298       <DependentUpon>ProjectJobsView.cs</DependentUpon>
    299     </EmbeddedResource>
    300   </ItemGroup>
    301296  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    302297  <PropertyGroup>
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectJobsView.Designer.cs

    r15966 r16060  
    1919 */
    2020#endregion
     21
    2122using HeuristicLab.Data.Views;
    22 using System;
    2323
    2424namespace HeuristicLab.Clients.Hive.Administrator.Views {
     
    4848    private void InitializeComponent() {
    4949      this.components = new System.ComponentModel.Container();
    50       System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProjectJobsView));
    5150      this.refreshButton = new System.Windows.Forms.Button();
    5251      this.removeButton = new System.Windows.Forms.Button();
     
    5756      // refreshButton
    5857      //
    59       this.refreshButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshButton.Image")));
     58      this.refreshButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh;
    6059      this.refreshButton.Location = new System.Drawing.Point(3, 3);
    6160      this.refreshButton.Name = "refreshButton";
     
    6867      // removeButton
    6968      //
    70       this.removeButton.Image = ((System.Drawing.Image)(resources.GetObject("removeButton.Image")));
     69      this.removeButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Remove;
    7170      this.removeButton.Location = new System.Drawing.Point(33, 3);
    7271      this.removeButton.Name = "removeButton";
     
    7978      // matrixView
    8079      //
    81       this.matrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    82             | System.Windows.Forms.AnchorStyles.Left) 
     80      this.matrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     81            | System.Windows.Forms.AnchorStyles.Left)
    8382            | System.Windows.Forms.AnchorStyles.Right)));
    8483      this.matrixView.Caption = "StringConvertibleMatrix View";
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs

    r16043 r16060  
    2828using HeuristicLab.Core.Views;
    2929using HeuristicLab.MainForm;
    30 using System.Drawing;
    3130
    3231namespace HeuristicLab.Clients.Hive.Administrator.Views {
     
    115114
    116115        indefiniteCheckBox.Checked = !Content.EndDate.HasValue;
    117         if(!indefiniteCheckBox.Checked) endDateTimePicker.Value = Content.EndDate.Value;
     116        if (!indefiniteCheckBox.Checked) endDateTimePicker.Value = Content.EndDate.Value;
    118117        else endDateTimePicker.Value = Content.StartDate;
    119118        endDateTimePicker.Enabled = !indefiniteCheckBox.Checked;
     
    134133      indefiniteCheckBox.Enabled = enabled;
    135134
    136       if(Content != null) {
     135      if (Content != null) {
    137136        var parentProject = HiveAdminClient.Instance.GetAvailableProjectAncestors(Content.Id).LastOrDefault();
    138137        if (parentProject == null || parentProject.EndDate.HasValue) {
     
    152151    #region Event Handlers
    153152    private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e) {
    154       OnContentChanged();
     153      if (InvokeRequired) Invoke((Action<object, PropertyChangedEventArgs>)Content_PropertyChanged, sender, e);
     154      else OnContentChanged();
    155155    }
    156156
     
    220220        Content.Name = nameTextBox.Text;
    221221        RegisterContentEvents();
    222       }       
     222      }
    223223    }
    224224
     
    228228        Content.Description = descriptionTextBox.Text;
    229229        RegisterContentEvents();
    230       }       
     230      }
    231231    }
    232232
     
    238238        Content.OwnerUserId = selectedOwnerUserId;
    239239        RegisterContentEvents();
    240       }       
     240      }
    241241    }
    242242
     
    248248        var parentProject = HiveAdminClient.Instance.GetAvailableProjectAncestors(Content.Id).LastOrDefault();
    249249        if (parentProject != null) {
    250           if(startDateTimePicker.Value < parentProject.StartDate)
     250          if (startDateTimePicker.Value < parentProject.StartDate)
    251251            startDateTimePicker.Value = parentProject.StartDate;
    252252        } else {
     
    261261        Content.StartDate = startDateTimePicker.Value;
    262262        RegisterContentEvents();
    263       }       
     263      }
    264264
    265265      startDateTimePicker.ValueChanged += startDateTimePicker_ValueChanged;
     
    276276            endDateTimePicker.Value = parentProject.EndDate.Value;
    277277          }
    278         } else if(Content.EndDate.HasValue) {
     278        } else if (Content.EndDate.HasValue) {
    279279          endDateTimePicker.Value = Content.EndDate.Value;
    280280        }
     
    287287        Content.EndDate = endDateTimePicker.Value;
    288288        RegisterContentEvents();
    289       }       
     289      }
    290290
    291291      endDateTimePicker.ValueChanged += endDateTimePicker_ValueChanged;
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/HeuristicLab.Clients.Hive.JobManager-3.3.csproj

    r15992 r16060  
    247247  </ItemGroup>
    248248  <ItemGroup>
    249     <EmbeddedResource Include="Views\RefreshableHiveJobView.resx">
    250       <DependentUpon>RefreshableHiveJobView.cs</DependentUpon>
     249    <EmbeddedResource Include="Views\RefreshableHiveJobListView.resx">
     250      <DependentUpon>RefreshableHiveJobListView.cs</DependentUpon>
    251251    </EmbeddedResource>
    252252  </ItemGroup>
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/RunInHiveMenuItem.cs

    r16057 r16060  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Linq;
    2425using System.Threading;
     26using System.Windows.Forms;
     27using HeuristicLab.Clients.Hive.JobManager.Views;
    2528using HeuristicLab.Core;
    2629using HeuristicLab.MainForm;
     
    2831using HeuristicLab.Optimizer;
    2932using HeuristicLab.PluginInfrastructure;
    30 using HeuristicLab.Clients.Hive.JobManager.Views;
    31 using System.Windows.Forms;
    32 using System.Linq;
    3333
    3434namespace HeuristicLab.Clients.Hive.JobManager {
     
    8585      task.ItemTask.ComputeInParallel = content is Experiment || content is BatchRun;
    8686
     87      if (HiveClient.Instance.Projects.Count == 1) {
     88        var project = HiveClient.Instance.Projects.FirstOrDefault();
     89        if (project != null && project.Id != Guid.Empty)
     90          rJob.Job.ProjectId = project.Id;
     91      }
    8792
    8893      var hiveResourceSelectorDialog = new HiveResourceSelectorDialog(rJob.Job.Id, rJob.Job.ProjectId);
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.Designer.cs

    r16057 r16060  
    4646    private void InitializeComponent() {
    4747      this.components = new System.ComponentModel.Container();
    48       System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RefreshableHiveJobView));
    4948      this.tabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl();
    5049      this.tasksTabPage = new System.Windows.Forms.TabPage();
     
    150149      // refreshPermissionsButton
    151150      //
    152       this.refreshPermissionsButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshPermissionsButton.Image")));
     151      this.refreshPermissionsButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh;
    153152      this.refreshPermissionsButton.Location = new System.Drawing.Point(3, 3);
    154153      this.refreshPermissionsButton.Name = "refreshPermissionsButton";
     
    253252      //
    254253      this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    255       this.startButton.Image = ((System.Drawing.Image)(resources.GetObject("startButton.Image")));
     254      this.startButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Play;
    256255      this.startButton.Location = new System.Drawing.Point(0, 564);
    257256      this.startButton.Name = "startButton";
     
    265264      //
    266265      this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    267       this.stopButton.Image = ((System.Drawing.Image)(resources.GetObject("stopButton.Image")));
     266      this.stopButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Stop;
    268267      this.stopButton.Location = new System.Drawing.Point(60, 564);
    269268      this.stopButton.Name = "stopButton";
     
    297296      this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    298297      this.pauseButton.Enabled = false;
    299       this.pauseButton.Image = ((System.Drawing.Image)(resources.GetObject("pauseButton.Image")));
     298      this.pauseButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Pause;
    300299      this.pauseButton.Location = new System.Drawing.Point(30, 564);
    301300      this.pauseButton.Name = "pauseButton";
     
    366365      // refreshButton
    367366      //
    368       this.refreshButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshButton.Image")));
     367      this.refreshButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh;
    369368      this.refreshButton.Location = new System.Drawing.Point(3, 0);
    370369      this.refreshButton.Name = "refreshButton";
     
    377376      // updateButton
    378377      //
    379       this.updateButton.Image = ((System.Drawing.Image)(resources.GetObject("updateButton.Image")));
     378      this.updateButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Save;
    380379      this.updateButton.Location = new System.Drawing.Point(30, 0);
    381380      this.updateButton.Name = "updateButton";
     
    388387      // UnloadButton
    389388      //
    390       this.UnloadButton.Image = ((System.Drawing.Image)(resources.GetObject("UnloadButton.Image")));
     389      this.UnloadButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Disconnect;
    391390      this.UnloadButton.Location = new System.Drawing.Point(57, 0);
    392391      this.UnloadButton.Name = "UnloadButton";
     
    399398      // searchButton
    400399      //
    401       this.searchButton.Image = ((System.Drawing.Image)(resources.GetObject("searchButton.Image")));
     400      this.searchButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Zoom;
    402401      this.searchButton.Location = new System.Drawing.Point(71, 79);
    403402      this.searchButton.Name = "searchButton";
  • branches/2839_HiveProjectManagement/HeuristicLab.Services.Hive/3.3/HiveService.cs

    r16057 r16060  
    333333            .Where(x => x.State == DA.JobState.Online
    334334                          && (x.OwnerUserId == currentUserId
    335                             || x.JobPermissions.Count(y => y.Permission != DA.Permission.NotAllowed 
     335                            || x.JobPermissions.Count(y => y.Permission != DA.Permission.NotAllowed
    336336                              && y.GrantedUserId == currentUserId) > 0)
    337337                          )
     
    359359            .ToList();
    360360
    361           if(administrationGrantedProjects.Select(x => x.ProjectId).Contains(projectId)) {
     361          if (administrationGrantedProjects.Select(x => x.ProjectId).Contains(projectId)) {
    362362            var jobs = jobDao.GetByProjectId(projectId)
    363363            .Select(x => x.ToDto())
     
    388388          var requestedAndGrantedProjectIds = projectIds.Intersect(administrationGrantedProjectIds);
    389389
    390           if(requestedAndGrantedProjectIds.Any()) {
     390          if (requestedAndGrantedProjectIds.Any()) {
    391391            var jobs = jobDao.GetByProjectIds(requestedAndGrantedProjectIds)
    392392              .Select(x => x.ToDto())
     
    415415      // check project - resources
    416416      AuthorizationManager.AuthorizeProjectForResourcesUse(jobDto.ProjectId, resourceIds);
    417      
     417
    418418      using (new PerformanceLogger("AddJob")) {
    419419        var jobDao = pm.JobDao;
     
    426426
    427427          // add resource assignments
    428           if (resourceIds != null && resourceIds.Any()) {           
     428          if (resourceIds != null && resourceIds.Any()) {
    429429            newJob.AssignedJobResources.AddRange(resourceIds.Select(
    430430              x => new DA.AssignedJobResource {
     
    467467            exists = false;
    468468            job = new DA.Job();
    469           } else if(job.State != DA.JobState.Online) {
     469          } else if (job.State != DA.JobState.Online) {
    470470            throw new InvalidOperationException(NO_JOB_UPDATE_POSSIBLE);
    471471          }
     
    480480                x => new DA.AssignedJobResource {
    481481                  ResourceId = x
    482               }));
     482                }));
    483483            }
    484484            jobDao.Save(job);
    485           } else if(resourceIds != null) {
     485          } else if (resourceIds != null) {
    486486            var addedJobResourceIds = resourceIds.Except(job.AssignedJobResources.Select(x => x.ResourceId));
    487487            var removedJobResourceIds = job.AssignedJobResources
     
    489489              .Except(resourceIds)
    490490              .ToArray();
    491            
     491
    492492            // remove resource assignments
    493             foreach(var rid in removedJobResourceIds) {
     493            foreach (var rid in removedJobResourceIds) {
    494494              var ajr = job.AssignedJobResources.Where(x => x.ResourceId == rid).SingleOrDefault();
    495495              if (ajr != null) job.AssignedJobResources.Remove(ajr);
     
    515515        pm.UseTransaction(() => {
    516516          var job = jobDao.GetById(jobId);
    517           if(job != null) {
     517          if (job != null) {
    518518            var jobStateEntity = jobState.ToEntity();
    519519            // note: allow solely state changes from "Online" to "StatisticsPending" = deletion request by user for HiveStatisticGenerator
     
    521521            if (job.State == DA.JobState.Online && jobStateEntity == DA.JobState.StatisticsPending) {
    522522              job.State = jobStateEntity;
    523               foreach(var task in job.Tasks
    524               .Where(x => x.State == DA.TaskState.Waiting 
    525                 || x.State == DA.TaskState.Paused 
     523              foreach (var task in job.Tasks
     524              .Where(x => x.State == DA.TaskState.Waiting
     525                || x.State == DA.TaskState.Paused
    526526                || x.State == DA.TaskState.Offline)) {
    527527                task.State = DA.TaskState.Aborted;
    528528              }
    529529              pm.SubmitChanges();
    530             } else if(job.State == DA.JobState.StatisticsPending && jobStateEntity == DA.JobState.DeletionPending) {
     530            } else if (job.State == DA.JobState.StatisticsPending && jobStateEntity == DA.JobState.DeletionPending) {
    531531              job.State = jobStateEntity;
    532532              pm.SubmitChanges();
    533             } 
     533            }
    534534          }
    535535        });
     
    549549        var projectDao = pm.ProjectDao;
    550550        pm.UseTransaction(() => {
    551           foreach(var jobId in jobIds) {
     551          foreach (var jobId in jobIds) {
    552552            var job = jobDao.GetById(jobId);
    553553            if (job != null) {
     
    560560              if (isAdministrator || administrationGrantedProjects.Contains(job.Project)) {
    561561                // note: allow solely state changes from "Online" to "StatisticsPending" = deletion request by user for HiveStatisticGenerator
    562                 if (job.State == DA.JobState.Online) { 
     562                if (job.State == DA.JobState.Online) {
    563563                  job.State = DA.JobState.StatisticsPending;
    564564                  foreach (var task in job.Tasks
     
    566566                    || x.State == DA.TaskState.Paused
    567567                    || x.State == DA.TaskState.Offline)) {
    568                       task.State = DA.TaskState.Aborted;
     568                    task.State = DA.TaskState.Aborted;
    569569                  }
    570570                  pm.SubmitChanges();
     
    772772      bool isAdmin = RoleVerifier.IsInRole(HiveRoles.Administrator);
    773773      if (!isAdmin) {
    774         if(projectDto != null && projectDto.ParentProjectId.HasValue) {
     774        if (projectDto != null && projectDto.ParentProjectId.HasValue) {
    775775          AuthorizationManager.AuthorizeForProjectAdministration(projectDto.ParentProjectId.Value, false);
    776776        } else {
     
    794794          var project = projectDao.Save(projectDto.ToEntity());
    795795
    796           var parentProjects = projectDao.GetParentProjectsById(project.ProjectId);
     796          var parentProjects = projectDao.GetParentProjectsById(project.ProjectId).ToList();
    797797          bool isParent = parentProjects.Select(x => x.OwnerUserId == UserManager.CurrentUserId).Any();
    798798
     
    826826      // check if current (non-admin) user is owner of the project or the projectDto's-parents
    827827      // note: non-admin users are not allowed to administer root projects (i.e. projects without parental entry)
    828       bool isAdmin = RoleVerifier.IsInRole(HiveRoles.Administrator);     
     828      bool isAdmin = RoleVerifier.IsInRole(HiveRoles.Administrator);
    829829      if (!isAdmin) {
    830830        if (projectDto != null && projectDto.ParentProjectId.HasValue) {
    831           AuthorizationManager.AuthorizeForProjectAdministration(projectDto.Id, false);         
     831          AuthorizationManager.AuthorizeForProjectAdministration(projectDto.Id, false);
    832832        } else {
    833833          throw new SecurityException(NOT_AUTHORIZED_USERPROJECT);
     
    836836
    837837      // check that non-admins can not be set as owner of root projects
    838       if(projectDto != null && !projectDto.ParentProjectId.HasValue) {
     838      if (projectDto != null && !projectDto.ParentProjectId.HasValue) {
    839839        var owner = UserManager.GetUserById(projectDto.OwnerUserId);
    840         if(owner == null || !RoleVerifier.IsUserInRole(owner.UserName, HiveRoles.Administrator)) {
     840        if (owner == null || !RoleVerifier.IsUserInRole(owner.UserName, HiveRoles.Administrator)) {
    841841          throw new SecurityException(NOT_AUTHORIZED_PROJECTOWNER);
    842842        }
    843843      }
    844      
     844
    845845      var pm = PersistenceManager;
    846846      using (new PerformanceLogger("UpdateProject")) {
     
    850850          var project = projectDao.GetById(projectDto.Id);
    851851          if (project != null) { // (1) update existent project
    852             var parentProjects = projectDao.GetParentProjectsById(project.ProjectId);
     852            var parentProjects = projectDao.GetParentProjectsById(project.ProjectId).ToList();
    853853            bool isParent = parentProjects.Select(x => x.OwnerUserId == UserManager.CurrentUserId).Any();
    854854
     
    893893            var newProject = projectDao.Save(projectDto.ToEntity());
    894894
    895             var parentProjects = projectDao.GetParentProjectsById(project.ProjectId);
     895            var parentProjects = projectDao.GetParentProjectsById(project.ProjectId).ToList();
    896896            bool isParent = parentProjects.Select(x => x.OwnerUserId == UserManager.CurrentUserId).Any();
    897897
     
    925925      // check if current (non-admin) user is owner of one of the projectDto's-parents
    926926      // note: non-admin users are not allowed to administer root projects (i.e. projects without parental entry)
    927       if (!RoleVerifier.IsInRole(HiveRoles.Administrator)) {       
     927      if (!RoleVerifier.IsInRole(HiveRoles.Administrator)) {
    928928        AuthorizationManager.AuthorizeForProjectAdministration(projectId, true);
    929929      }
     
    942942            .ToList();
    943943
    944           if(jobs.Count > 0) {
     944          if (jobs.Count > 0) {
    945945            throw new InvalidOperationException("There are " + jobs.Count + " job(s) using this project and/or child-projects. It is necessary to delete them before the project.");
    946946          } else {
     
    966966          .Where(x => x.ProjectId == projectId)
    967967          .Select(x => x.ToDto())
    968           .SingleOrDefault(); 
     968          .SingleOrDefault();
    969969        });
    970970      }
     
    995995      using (new PerformanceLogger("GetProjectsForAdministration")) {
    996996        var projectDao = pm.ProjectDao;
    997        
    998         return pm.UseTransaction(() => {
    999           if(isAdministrator) {
     997
     998        return pm.UseTransaction(() => {
     999          if (isAdministrator) {
    10001000            return projectDao.GetAll().Select(x => x.ToDto()).ToList();
    10011001          } else {
     
    10121012      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    10131013      var pm = PersistenceManager;
    1014       using(new PerformanceLogger("GetProjectGenealogy")) {
     1014      using (new PerformanceLogger("GetProjectGenealogy")) {
    10151015        var projectDao = pm.ProjectDao;
    10161016        var projectAncestors = new Dictionary<Guid, HashSet<Guid>>();
     
    10201020          foreach (var p in projects) {
    10211021            var parentProject = p.ParentProject;
    1022             while(parentProject != null) {
     1022            while (parentProject != null) {
    10231023              projectAncestors[p.ProjectId].Add(parentProject.ProjectId);
    10241024              parentProject = parentProject.ParentProject;
     
    10391039          projectDao
    10401040            .GetAll().ToList()
    1041             .ForEach(p=> projectNames.Add(p.ProjectId, p.Name));
     1041            .ForEach(p => projectNames.Add(p.ProjectId, p.Name));
    10421042          return projectNames;
    10431043        });
     
    10631063
    10641064          // guarantee that project owner is always permitted
    1065           if(!grantedUserIds.Contains(project.OwnerUserId)) {
     1065          if (!grantedUserIds.Contains(project.OwnerUserId)) {
    10661066            grantedUserIds.Add(project.OwnerUserId);
    10671067          }
     
    11151115          // add project permissions
    11161116          foreach (var id in grantedUserIds) {
    1117             if(project.ProjectPermissions.All(x => x.GrantedUserId != id)) {
     1117            if (project.ProjectPermissions.All(x => x.GrantedUserId != id)) {
    11181118              project.ProjectPermissions.Add(new DA.ProjectPermission {
    11191119                GrantedUserId = id,
     
    11351135            }
    11361136
    1137             foreach(var p in childProjects) {
     1137            foreach (var p in childProjects) {
    11381138              var cpAssignedPermissions = p.ProjectPermissions.Select(x => x.GrantedUserId).ToList();
    11391139              // guarantee that project owner is always permitted
     
    11441144
    11451145              // remove left-over job assignments (for non-reassignments)
    1146               if(!reassignCascading) {
     1146              if (!reassignCascading) {
    11471147                assignedJobResourceDao.DeleteByProjectIdAndUserIds(p.ProjectId, cpRemovedPermissions);
    11481148              }
     
    11521152                p.ProjectPermissions.Clear();
    11531153              } else {
    1154                 foreach(var item in p.ProjectPermissions
    1155                   .Where(x => x.GrantedUserId != p.OwnerUserId 
     1154                foreach (var item in p.ProjectPermissions
     1155                  .Where(x => x.GrantedUserId != p.OwnerUserId
    11561156                    && (removedPermissions.Contains(x.GrantedUserId) || cpRemovedPermissions.Contains(x.GrantedUserId)))
    11571157                  .ToList()) {
     
    12371237        pm.UseTransaction(() => {
    12381238          var project = projectDao.GetById(projectId);
    1239          
    1240           var parentProjects = projectDao.GetParentProjectsById(project.ProjectId);
     1239
     1240          var parentProjects = projectDao.GetParentProjectsById(project.ProjectId).ToList();
    12411241          bool isParent = parentProjects.Select(x => x.OwnerUserId == UserManager.CurrentUserId).Any();
    12421242
     
    12461246
    12471247          // if user is admin or owner of parent project(s)
    1248           if(isAdmin || isParent) {
     1248          if (isAdmin || isParent) {
    12491249            // remove job and project assignments
    12501250            if (reassign) {
     
    12881288
    12891289              // remove left-over job assignments (for non-reassignments)
    1290               if(!reassignCascading) {
     1290              if (!reassignCascading) {
    12911291                assignedJobResourceDao.DeleteByProjectIdAndResourceIds(p.ProjectId, cpRemovedAssignments);
    12921292              }
     
    13061306              // add project assignments
    13071307              foreach (var id in resourceIds) {
    1308                 if(p.AssignedProjectResources.All(x => x.ResourceId != id)) {
     1308                if (p.AssignedProjectResources.All(x => x.ResourceId != id)) {
    13091309                  p.AssignedProjectResources.Add(new DA.AssignedProjectResource {
    13101310                    ResourceId = id
     
    13731373    public IEnumerable<DT.AssignedProjectResource> GetAssignedResourcesForProjectsAdministration(IEnumerable<Guid> projectIds) {
    13741374      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    1375       foreach(var id in projectIds)
     1375      foreach (var id in projectIds)
    13761376        AuthorizationManager.AuthorizeForProjectAdministration(id, false);
    13771377
     
    15721572          var resources = resourceDao.GetAll().ToList();
    15731573          resources.ForEach(r => resourceAncestors.Add(r.ResourceId, new HashSet<Guid>()));
    1574          
    1575           foreach(var r in resources) {
     1574
     1575          foreach (var r in resources) {
    15761576            var parentResource = r.ParentResource;
    1577             while(parentResource != null) {
     1577            while (parentResource != null) {
    15781578              resourceAncestors[r.ResourceId].Add(parentResource.ResourceId);
    15791579              parentResource = parentResource.ParentResource;
     
    18151815      return user != null ? (Guid?)user.ProviderUserKey ?? Guid.Empty : Guid.Empty;
    18161816    }
    1817    
     1817
    18181818    public Dictionary<Guid, HashSet<Guid>> GetUserGroupTree() {
    18191819      var userGroupTree = new Dictionary<Guid, HashSet<Guid>>();
    18201820      var userGroupMapping = UserManager.GetUserGroupMapping();
    18211821
    1822       foreach(var ugm in userGroupMapping) {
     1822      foreach (var ugm in userGroupMapping) {
    18231823        if (ugm.Parent == null || ugm.Child == null) continue;
    18241824
     
    18361836      bool isAdministrator = RoleVerifier.IsInRole(HiveRoles.Administrator);
    18371837      var pm = PersistenceManager;
    1838       using(new PerformanceLogger("CheckAccessToAdminAreaGranted")) {
     1838      using (new PerformanceLogger("CheckAccessToAdminAreaGranted")) {
    18391839        if (isAdministrator) {
    18401840          return true;
     
    19071907      if (jobs == null || !jobs.Any()) return;
    19081908
    1909       var currentUserId = UserManager.CurrentUserId;     
     1909      var currentUserId = UserManager.CurrentUserId;
    19101910      var taskDao = pm.TaskDao;
    19111911      var jobPermissionDao = pm.JobPermissionDao;
Note: See TracChangeset for help on using the changeset viewer.