public ProjectsCommonSettings UpdateSettings(bool?everebodyCanCreate, bool?hideEntitiesInPausedProjects, StartModuleType?startModule, object folderId) { if (everebodyCanCreate.HasValue || hideEntitiesInPausedProjects.HasValue) { if (!ProjectSecurity.CurrentUserAdministrator) { ProjectSecurity.CreateSecurityException(); } var settings = ProjectsCommonSettings.Load(); if (everebodyCanCreate.HasValue) { settings.EverebodyCanCreate = everebodyCanCreate.Value; } if (hideEntitiesInPausedProjects.HasValue) { settings.HideEntitiesInPausedProjects = hideEntitiesInPausedProjects.Value; } settings.Save(); return(settings); } if (startModule.HasValue || folderId != null) { if (!ProjectSecurity.IsProjectsEnabled(CurrentUserId)) { ProjectSecurity.CreateSecurityException(); } var settings = ProjectsCommonSettings.LoadForCurrentUser(); if (startModule.HasValue) { settings.StartModuleType = startModule.Value; } if (folderId != null) { settings.FolderId = folderId; } settings.SaveForCurrentUser(); return(settings); } return(null); }
protected void Page_Load(object sender, EventArgs e) { Page.RegisterBodyScripts(PathProvider.GetFileStaticRelativePath("projectaction.js")); _hintPopupDeleteProject.Options.IsPopup = true; _hintPopupActiveTasks.Options.IsPopup = true; _hintPopupActiveMilestones.Options.IsPopup = true; TemplatesCount = Page.EngineFactory.TemplateEngine.GetCount(); HideChooseTeam = CoreContext.UserManager.GetUsers().All(r => r.ID == SecurityContext.CurrentAccount.ID); if (Project != null) { ProjectManagerName = CoreContext.UserManager.GetUsers(Project.Responsible).DisplayUserName(); UrlProject = "tasks.aspx?prjID=" + Project.ID; ActiveTasksCount = Page.EngineFactory.TaskEngine.GetByProject(Project.ID, TaskStatus.Open, Guid.Empty).Count(); ActiveMilestonesCount = Page.EngineFactory.MilestoneEngine.GetByProject(Project.ID).Count(m => m.Status == MilestoneStatus.Open); IsEditingProjectAvailable = true; PageTitle = ProjectResource.EditProject; ActiveTasksUrl = string.Format("tasks.aspx?prjID={0}#status=open", Project.ID); ActiveMilestonesUrl = string.Format("milestones.aspx?prjID={0}#status=open", Project.ID); ProjectActionButtonTitle = ProjectResource.SaveProject; RenderProjectPrivacyCheckboxValue = Project.Private; ProjectManagerId = Project.Responsible.ToString(); projectTitle.Text = Project.Title; projectDescription.Text = Project.Description; var tags = Page.EngineFactory.TagEngine.GetProjectTags(Project.ID).Select(r => r.Value.HtmlEncode()).ToArray(); ProjectTags = string.Join(", ", tags); ProjectStatusTitle = Project.Status.ToString(); ProjectStatusList = string.Join(";", string.Join(",", (int)ProjectStatus.Open, ProjectStatus.Open), string.Join(",", (int)ProjectStatus.Paused, ProjectStatus.Paused), string.Join(",", (int)ProjectStatus.Closed, ProjectStatus.Closed)); Page.Title = HeaderStringHelper.GetPageTitle(Project.Title); } else { if (TemplatesCount > 0) { ControlPlaceHolder.Controls.Add(LoadControl("../Common/AddMilestoneContainer.ascx")); } projectTitle.Attributes.Add("deftext", ProjectTemplatesResource.DefaultProjTitle); _hintPopupDeleteProject.Options.IsPopup = true; _hintPopupActiveTasks.Options.IsPopup = true; _hintPopupActiveMilestones.Options.IsPopup = true; PageTitle = ProjectResource.CreateNewProject; ProjectActionButtonTitle = ProjectResource.AddNewProject; RenderProjectPrivacyCheckboxValue = true; ProjectManagerName = ProjectResource.AddProjectManager; var users = CoreContext.UserManager.GetUsers().Where(r => ProjectSecurity.IsProjectsEnabled(r.ID)).ToList(); if (users.Count == 1) { var manager = users.First(); ProjectManagerId = manager.ID.ToString(); ProjectManagerName = manager.DisplayUserName(); } Page.Title = HeaderStringHelper.GetPageTitle(PageTitle); Page.Master.RegisterCRMResources(); } }