public async Task <IActionResult> DeleteLink(int projectID, int projectLinkID) { ProjectLink thisPL = ((_context.ProjectLinks.Where(i => (i.Projects.ProjectID == projectID) && (i.ProjectLinkID == projectLinkID)).FirstOrDefault())); _context.ProjectLinks.Remove(thisPL); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Projects")); }
private void RemoveRecentProject(ProjectLink link) { if (link == null) { return; } ProjectLinkList.Links.Remove(link); Properties.Settings.Default.Save(); }
private void AddProjectBtnClick(object sender, RoutedEventArgs e) { var dialog = new CommonOpenFileDialog { IsFolderPicker = true, AddToMostRecentlyUsedList = false, InitialDirectory = ProjectLocationTxt.Text, Multiselect = true }; if (dialog.ShowDialog() == CommonFileDialogResult.Ok) { var folders = dialog.FileNames; var failedList = ""; foreach (var folder in folders) { // Get the last 5 digits of parent folder var projectCode = Path.GetFileName(folder)?.Substring(Path.GetFileName(folder).Length - 5); var rgx = new Regex(@"^[a-zA-Z0-9]\d{4}$"); // Check the string matches convention if (projectCode != null && rgx.IsMatch(projectCode)) { var projectName = Path.GetFileName(folder); var projectPath = folder; var projectLinks = XmlHandler.GetRepProjects(SelectedRep.Initial); // Attempt to name the project by the proper project name if the folder is available var supervisorFolder = Path.Combine(folder, "Plans", "Supervisor File"); if (Directory.Exists(supervisorFolder)) { var dirs = Directory.GetDirectories(supervisorFolder); if (dirs.Length == 1) { projectName = Path.GetFileName(dirs[0]); } } if (projectLinks.Any(pl => pl.ProjectCode == projectCode)) { failedList += projectName + "\n"; } else { var newProjectLink = new ProjectLink { Backup = true, RepInitials = SelectedRep.Initial, ProjectName = projectName, ProjectPath = projectPath, ProjectCode = projectCode }; XmlHandler.CreateProjectLink(newProjectLink); _projectLinks.Add(newProjectLink); CopyBtn.IsEnabled = _projectLinks.Count() != 0; } } } if (failedList != "") { MessageBox.Show($"The following projects were not added.\n \n {failedList} \n Reason: Duplicates"); } } }
public Object SubmitImage([FromBody] Submission submission) { Log dbLog = GenerateLog(submission.Images.Count.ToString() + " images submitted"); List <Image> images = new List <Image>(); try { _context.Add(dbLog); _context.SaveChanges(); } catch (Exception e) { Console.Write(e); return(BadRequest("malform request log")); } foreach (string imageid in submission.Images) { try { Image image = (Image)_context.Image.Where(i => i.IId == imageid).First(); image.Submitted = true; ProjectLink dbProjectLink = GenerateProjectLink(image, submission.Project); LogLink dbLogLink = GenerateLogLink(image, dbLog); _context.Add(dbLogLink); _context.Add(dbProjectLink); _context.SaveChanges(); } catch (Exception e) { Console.Write(e); return(BadRequest("malform request project")); } } try { var username = HttpContext.User.FindFirstValue("name"); var logLink = "https://aeimagehub.azurewebsites.net/logview?src=%22" + dbLog.LId + "%22"; sendEmail(User.FindFirst(ClaimTypes.Email)?.Value, username, logLink); } catch (Exception e) { Console.Write(e.Message); } return(Ok()); }
private void CreateProjectLinks(string[] createdLinkLabels, string[] createdLinkUrls, Project newProject) { if (createdLinkLabels != null) { for (var i = 0; i < createdLinkLabels.Length; i++) { ProjectLink newContact = new ProjectLink { ProjectLinkLabel = createdLinkLabels[i], ProjectLinkUrl = createdLinkUrls[i], Projects = newProject }; _context.Add(newContact); } } }
private IResponse GenerateUserList(ICruiseRequest request, string message, string error) { Hashtable velocityContext = new Hashtable(); velocityContext["message"] = message; velocityContext["error"] = error; var links = new List <IAbsoluteLink>(); links.Add(new ServerLink(request.UrlBuilder, request.ServerSpecifier, "User List", ActionName)); ProjectStatusListAndExceptions projects = farmService.GetProjectStatusListAndCaptureExceptions(request.ServerSpecifier, request.RetrieveSessionToken()); foreach (ProjectStatusOnServer projectStatusOnServer in projects.StatusAndServerList) { DefaultProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(projectStatusOnServer.ServerSpecifier, projectStatusOnServer.ProjectStatus.Name); links.Add(new ProjectLink(request.UrlBuilder, projectSpecifier, projectSpecifier.ProjectName, ServerUserListServerPlugin.ActionName)); } velocityContext["projectLinks"] = links; string sessionToken = request.RetrieveSessionToken(sessionRetriever); List <UserDetails> allUsers = farmService.ListAllUsers(request.ServerSpecifier, sessionToken); foreach (UserDetails user in allUsers) { if (user.DisplayName == null) { user.DisplayName = string.Empty; } } velocityContext["users"] = allUsers; if (!string.IsNullOrEmpty(request.ProjectName)) { velocityContext["currentProject"] = request.ProjectName; velocityContext["diagnosticsCall"] = new ProjectLink(request.UrlBuilder, request.ProjectSpecifier, string.Empty, DiagnosticsActionName); } else { velocityContext["diagnosticsCall"] = new ServerLink(request.UrlBuilder, request.ServerSpecifier, string.Empty, DiagnosticsActionName); } return(viewGenerator.GenerateView(@"UserList.vm", velocityContext)); }
public void ShouldGetLinkedProject() { MockIVsSolution solution = new MockIVsSolution(); TestableProjectLinkTracker tracker = new TestableProjectLinkTracker(new MockDocumentTracker(), solution); MockVsHierarchy project1VsHierarchy = new MockVsHierarchy(); MockVsHierarchy project2VsHierarchy = new MockVsHierarchy(); solution.Hierarchies.Add(project1VsHierarchy); solution.Hierarchies.Add(project2VsHierarchy); tracker.AddProjectLink(project1VsHierarchy, project2VsHierarchy); IEnumerable <ProjectLink> projectLinks = tracker.GetProjectLinks(); Assert.AreEqual(1, projectLinks.Count()); ProjectLink projectLink = projectLinks.ElementAt(0); Assert.AreEqual(project1VsHierarchy.GetPropertyProjectIdGuidValue, projectLink.SourceProjectId); Assert.AreEqual(project2VsHierarchy.GetPropertyProjectIdGuidValue, projectLink.TargetProjectId); }
private void CreateProjectLinks(string[] createdLinkLabels, string[] createdLinkUrls, Project newProject) { if (createdLinkLabels != null) { for (var i = 0; i < createdLinkLabels.Length; i++) { createdLinkUrls[i] = createdLinkUrls[i].ToLower(); if (!createdLinkUrls[i].Contains("constellation.citwdd.net") && !(createdLinkUrls[i].Contains("http://") || createdLinkUrls[i].Contains("https://"))) { createdLinkUrls[i] = "http://" + createdLinkUrls[i]; } ProjectLink newContact = new ProjectLink { ProjectLinkLabel = createdLinkLabels[i], ProjectLinkUrl = createdLinkUrls[i], Projects = newProject }; _context.Add(newContact); } } }
public void Setup() { projectSpecifier = new DefaultProjectSpecifier(new DefaultServerSpecifier(serverName), projectName); urlBuilderMock = new Mock <ICruiseUrlBuilder>(); projectLink = new ProjectLink((ICruiseUrlBuilder)urlBuilderMock.Object, projectSpecifier, description, this.action); }
public void Setup() { projectSpecifier = new DefaultProjectSpecifier(new DefaultServerSpecifier(serverName), projectName); urlBuilderMock = new DynamicMock(typeof(ICruiseUrlBuilder)); projectLink = new ProjectLink((ICruiseUrlBuilder)urlBuilderMock.MockInstance, projectSpecifier, description, this.action); }