Changeset 16089 for branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views
- Timestamp:
- 08/28/18 09:48:33 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs
r16072 r16089 111 111 base.SetEnabledStateOfControls(); 112 112 bool selectedProjectExists = selectedProject != null && selectedProject.Id != Guid.Empty && Content.Contains(selectedProject); 113 bool projectIsNew = selectedProject != null && selectedProject.Id == Guid.Empty; 113 114 bool locked = Content == null || selectedProject == null || Locked || ReadOnly; 114 115 bool parentOwner = HiveAdminClient.Instance.CheckOwnershipOfParentProject(selectedProject, UserInformation.Instance.User.Id); 115 116 bool saveLocked = locked || (!IsAdmin() && selectedProject.OwnerUserId != UserInformation.Instance.User.Id && !parentOwner); 116 bool addLocked = saveLocked || selectedProject.Id == Guid.Empty;117 bool addLocked = saveLocked || projectIsNew || selectedProject.Id == Guid.Empty; 117 118 bool deleteLocked = locked || (!IsAdmin() && !parentOwner) || Content.Where(x => x.ParentProjectId == selectedProject.Id).Any(); 119 120 var now = DateTime.Now; 121 if (!addLocked && (now < selectedProject.StartDate || now > selectedProject.EndDate)) addLocked = true; 118 122 119 123 addButton.Enabled = !addLocked; … … 124 128 projectResourcesView.Enabled = !locked; 125 129 projectJobsView.Enabled = !locked; 130 131 projectView.Locked = locked; 132 projectPermissionsView.Locked = locked; 133 projectResourcesView.Locked = locked; 134 projectJobsView.Locked = locked; 126 135 } 127 136 #endregion … … 504 513 projectResourcesView.Content = project; 505 514 projectJobsView.Content = project; 506 507 bool projectIsNew = project != null && project.Id == Guid.Empty;508 bool locked = project == null || projectIsNew;509 510 // if the project is new, or:511 // the project does have any descendant projects and512 // the user is an admin or owner of a parent project513 bool deleteEnabled = project != null && (514 projectIsNew515 || (!HiveAdminClient.Instance.ProjectDescendants[project.Id].Any()516 && (HiveAdminClient.Instance.CheckOwnershipOfParentProject(project, UserInformation.Instance.User.Id)517 || IsAdmin())518 )519 );520 521 bool addEnabled = !locked;522 if(addEnabled) {523 var now = DateTime.Now;524 if (now < project.StartDate || now > project.EndDate) addEnabled = false;525 }526 527 bool saveEnabled = project != null;528 if (!IsAdmin() && !project.ParentProjectId.HasValue) saveEnabled = false;529 530 addButton.Enabled = addEnabled;531 removeButton.Enabled = deleteEnabled;532 saveProjectButton.Enabled = saveEnabled;533 projectPermissionsView.Locked = locked;534 projectResourcesView.Locked = locked;535 projectJobsView.Locked = locked;536 515 selectedProject = project; 516 SetEnabledStateOfControls(); 537 517 } 538 518
Note: See TracChangeset
for help on using the changeset viewer.