/// <summary> /// Dependent type names of this entity /// </summary> public void DeleteChildren(DatabaseEntities dbContext) { foreach (var x in ProjectTags.ToList()) { x.DeleteFull(dbContext); } }
///// <summary> ///// Retrieves source code of the check specified by check name. ///// This source code can be later compiled into binary assembly by OSLEBot. ///// </summary> ///// <param name="checkName">Name of the check whose source code needs to be retrieved.</param> ///// <returns>Source code string. This should be written into a temporary *.cs file if you want to have OSLEBot compile it.</returns> ///// <exception cref="ArgumentOutOfRangeException">Thrown when a check with the specified name is not found.</exception> ///// <exception cref="ArgumentException">Thrown when more than 1 check matches the specified name. This indicates data inconsistency.</exception> //public string GetCheckSourceCode(string checkName) //{ // var matches = from check in Checks // where check.Name == checkName // select check; // if (matches.Count() == 0) // throw new ArgumentOutOfRangeException("checkName", "The specified check not found"); // if (matches.Count() > 1) // throw new ArgumentException("Data inconsistency. Found more than 1 check with the same name.", // "checkName"); // return matches.Single().SourceCode; //} /// <summary> /// Fills this data set with test (sample) data. /// </summary> public void FillWithTestData() { Clear(); var check1 = Checks.AddChecksRow("FedericaTest.cs", "Test for Federica", ""); var check2 = Checks.AddChecksRow("Branding.cs", "This is check 2", ""); var check3 = Checks.AddChecksRow("PseudoLoc.cs", "This is check 3", ""); var check4 = Checks.AddChecksRow("InvalidLocVer.cs", "This is global check for testing globality detection", ""); var check5 = Checks.AddChecksRow("EACheck.cs", "This is a check that is global for all languages", ""); var check6 = Checks.AddChecksRow("WordTemplatesMailMerge.cs", "This is a second check that is global for all languages", ""); var enUS = Languages.AddLanguagesRow("en-us"); var frFR = Languages.AddLanguagesRow("fr-fr"); var deDE = Languages.AddLanguagesRow("de-de"); var pseudo = Languages.AddLanguagesRow("ja-jp.pseudo"); var plPL = Languages.AddLanguagesRow("pl-pl"); var jaJP = Languages.AddLanguagesRow("ja-jp"); var brBR = Languages.AddLanguagesRow("br-BR"); var msoProject = Projects.AddProjectsRow("mso"); var wordProject = Projects.AddProjectsRow("word"); var excelProject = Projects.AddProjectsRow("excel"); var accessProject = Projects.AddProjectsRow("access"); LocGroups.AddLocGroupsRow("main_dll", msoProject); LocGroups.AddLocGroupsRow("main_dll", wordProject); LocGroups.AddLocGroupsRow("main_dll", excelProject); var wordTemplates = LocGroups.AddLocGroupsRow("wordtemplates", wordProject); var xlintl = LocGroups.AddLocGroupsRow("xlintl", excelProject); var accintl = LocGroups.AddLocGroupsRow("acc_intl", accessProject); ConfigItems.AddConfigItemsRow(pseudo, check1, wordTemplates); ConfigItems.AddConfigItemsRow(pseudo, check1, xlintl); ConfigItems.AddConfigItemsRow(plPL, check1, wordTemplates); ConfigItems.AddConfigItemsRow(enUS, check2, xlintl); ConfigItems.AddConfigItemsRow(frFR, check3, accintl); ConfigItems.AddConfigItemsRow(frFR, check2, wordTemplates); foreach (var lg in LocGroups) { ConfigItems.AddConfigItemsRow(plPL, check4, lg); ConfigItems.AddConfigItemsRow(brBR, check4, lg); ConfigItems.AddConfigItemsRow(jaJP, check1, lg); } SetCheckGlobalForAllLanguages(check5); SetCheckGlobalForAllLanguages(check6); var allChecksTag = Tags.AddTagsRow("All checks"); Checks.ToList().ForEach(check => CheckTags.AddCheckTagsRow(check, allChecksTag)); var eaLanguagesTag = Tags.AddTagsRow("EA languages"); Languages.ToList().ForEach(language => LanguageTags.AddLanguageTagsRow(language, eaLanguagesTag)); var allProjectsTag = Tags.AddTagsRow("All projects"); Projects.ToList().ForEach(project => ProjectTags.AddProjectTagsRow(project, allProjectsTag)); }
/// <summary> /// Active Dependent type names of this object /// </summary> public List <string> DependentObjectNames() { var dependentObjects = new List <string>(); if (ProjectTags.Any()) { dependentObjects.Add(typeof(ProjectTag).Name); } return(dependentObjects.Distinct().ToList()); }
/// <summary> /// Removes the specified tag from the selected project elements of enlistment. /// </summary> /// <param name="tag">Tag to be removed from projects.</param> /// <param name="projects">List of projects to remove the tag from.</param> public void RemoveTagFomProjects(string tag, IEnumerable <string> projects) { var tagID = Tags.Single(r => r.Tag.Equals(tag)).ID; foreach (var project in projects) { var projectID = Projects.Single(p => p.Name.Equals(project)).ID; var pt = ProjectTags.Single(x => x.TagID == tagID && x.ProjectID == projectID); ProjectTags.RemoveProjectTagsRow(pt); } }
public async Task AddProjectTag(Project p, string name) { var pt = new ProjectTags() { ProjectId = p.Id, Name = name }; _context.ProjectTags.Add(pt); await _context.SaveChangesAsync(); }
/// <summary> /// Adds an association between the specified tag name and all of the specied projects. /// Makes sure the tag exists (creates it if it doesn't exist) /// </summary> /// <param name="tag">Tag to be applied to projects</param> /// <param name="projects">Collection of projects to apply the tag to.</param> public void ApplyTagToProjects(string tag, IEnumerable <string> projects) { AddMissingTags(new[] { tag }); var tagRow = Tags.Single(r => r.Tag.Equals(tag)); foreach (var project in projects) { var projectRow = Projects.Single(p => p.Name.Equals(project)); if (ProjectTags.Any(row => row.TagID == tagRow.ID && row.ProjectID == projectRow.ID)) { continue; } ProjectTags.AddProjectTagsRow(projectRow, tagRow); } }
public void AddTag(Project project, string tagName) { var tag = _tagService.GetTagByName(tagName) ?? _tagService.CreateTag(tagName); var projectTag = new ProjectTags { Project = project, Tag = tag }; project.ProjectTags.Add(projectTag); SaveChanges(project); foreach (var actionHandler in _tagActionHandlers) { actionHandler.Handle(tag, project, this); } }
public async Task <ManifestTags[]> GetTagsForManifests(Manifest[] manifests) { if (manifests.Length == 0) { return(new ManifestTags[0]); } var projectsTagsResult = await FindTagsForProjects(_settings.Projects); var projectsTags = projectsTagsResult.ToDictionary(pt => pt.ProjectName, pt => pt.Tags); var firstManifest = manifests.First(); var projectsLastUsedTagIndex = _settings.Projects.ToDictionary(p => p.Name, p => { var manifestProjectVersion = firstManifest.ProjectVersions.FirstOrDefault(pv => pv.Name == p.Name); return(manifestProjectVersion == null ? 0 : Array.IndexOf(projectsTags[p.Name], manifestProjectVersion.Version)); }); var manifestsTags = new List <ManifestTags>(); foreach (var manifest in manifests) { var manifestTags = new ManifestTags { ManifestName = manifest.Name }; var manifestProjectsTags = new List <ProjectTags>(); foreach (var project in manifest.ProjectVersions) { // Manifests contains projects which aren't supported by this project's git integration. // Skip them. if (!projectsTags.ContainsKey(project.Name)) { continue; } var currentProjectTags = projectsTags[project.Name]; var projectStartTagIndex = projectsLastUsedTagIndex[project.Name]; var projectEndTagIndex = Array.IndexOf(currentProjectTags, project.Version) + 1; var projectTags = new ProjectTags { ProjectName = project.Name }; if (projectEndTagIndex != -1 && projectEndTagIndex >= projectStartTagIndex) { projectsLastUsedTagIndex[project.Name] = projectEndTagIndex; projectTags.Tags = currentProjectTags.Skip(projectStartTagIndex) .Take(projectEndTagIndex - projectStartTagIndex) .ToArray(); } else { projectTags.Tags = new[] { project.Version }; } manifestProjectsTags.Add(projectTags); } manifestTags.ProjectsTags = manifestProjectsTags.ToArray(); manifestsTags.Add(manifestTags); } return(manifestsTags.ToArray()); }
/// <summary> /// Does this object have any dependent objects? (If it does have dependent objects, these would need to be deleted before this object could be deleted.) /// </summary> /// <returns></returns> public bool HasDependentObjects() { return(ProjectTags.Any()); }
/// <summary> /// Does this object have any dependent objects? (If it does have dependent objects, these would need to be deleted before this object could be deleted.) /// </summary> /// <returns></returns> public bool HasDependentObjects() { return(GrantAllocationAwardLandownerCostShareLineItems.Any() || InteractionEventProjects.Any() || NotificationProjects.Any() || PerformanceMeasureActuals.Any() || PerformanceMeasureExpecteds.Any() || ProjectClassifications.Any() || ProjectCustomAttributes.Any() || ProjectDocuments.Any() || ProjectExemptReportingYears.Any() || ProjectExternalLinks.Any() || ProjectFundingSources.Any() || ProjectGrantAllocationExpenditures.Any() || ProjectGrantAllocationRequests.Any() || ProjectImages.Any() || ProjectInternalNotes.Any() || ProjectLocations.Any() || ProjectLocationStagings.Any() || ProjectNotes.Any() || ProjectOrganizations.Any() || ProjectPeople.Any() || ProjectPriorityLandscapes.Any() || ProjectPrograms.Any() || ProjectRegions.Any() || ProjectTags.Any() || ProjectUpdateBatches.Any() || Treatments.Any()); }
/// <summary> /// Dependent type names of this entity /// </summary> public void DeleteChildren(DatabaseEntities dbContext) { foreach (var x in NotificationProjects.ToList()) { x.DeleteFull(dbContext); } foreach (var x in PerformanceMeasureActuals.ToList()) { x.DeleteFull(dbContext); } foreach (var x in PerformanceMeasureExpecteds.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectAssessmentQuestions.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectAttachments.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectClassifications.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectContacts.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectCustomAttributes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectEvaluations.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectExemptReportingYears.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectExternalLinks.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectFundingSourceBudgets.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectFundingSourceExpenditures.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectGeospatialAreas.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectGeospatialAreaTypeNotes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectImages.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectInternalNotes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectLocations.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectLocationStagings.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectNoFundingSourceIdentifieds.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectNotes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectOrganizations.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectProjectStatuses.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectRelevantCostTypes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectTags.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectUpdateBatches.ToList()) { x.DeleteFull(dbContext); } foreach (var x in SecondaryProjectTaxonomyLeafs.ToList()) { x.DeleteFull(dbContext); } foreach (var x in TechnicalAssistanceRequests.ToList()) { x.DeleteFull(dbContext); } }
/// <summary> /// Active Dependent type names of this object /// </summary> public List <string> DependentObjectNames() { var dependentObjects = new List <string>(); if (NotificationProjects.Any()) { dependentObjects.Add(typeof(NotificationProject).Name); } if (PerformanceMeasureActuals.Any()) { dependentObjects.Add(typeof(PerformanceMeasureActual).Name); } if (PerformanceMeasureExpecteds.Any()) { dependentObjects.Add(typeof(PerformanceMeasureExpected).Name); } if (ProjectAssessmentQuestions.Any()) { dependentObjects.Add(typeof(ProjectAssessmentQuestion).Name); } if (ProjectAttachments.Any()) { dependentObjects.Add(typeof(ProjectAttachment).Name); } if (ProjectClassifications.Any()) { dependentObjects.Add(typeof(ProjectClassification).Name); } if (ProjectContacts.Any()) { dependentObjects.Add(typeof(ProjectContact).Name); } if (ProjectCustomAttributes.Any()) { dependentObjects.Add(typeof(ProjectCustomAttribute).Name); } if (ProjectEvaluations.Any()) { dependentObjects.Add(typeof(ProjectEvaluation).Name); } if (ProjectExemptReportingYears.Any()) { dependentObjects.Add(typeof(ProjectExemptReportingYear).Name); } if (ProjectExternalLinks.Any()) { dependentObjects.Add(typeof(ProjectExternalLink).Name); } if (ProjectFundingSourceBudgets.Any()) { dependentObjects.Add(typeof(ProjectFundingSourceBudget).Name); } if (ProjectFundingSourceExpenditures.Any()) { dependentObjects.Add(typeof(ProjectFundingSourceExpenditure).Name); } if (ProjectGeospatialAreas.Any()) { dependentObjects.Add(typeof(ProjectGeospatialArea).Name); } if (ProjectGeospatialAreaTypeNotes.Any()) { dependentObjects.Add(typeof(ProjectGeospatialAreaTypeNote).Name); } if (ProjectImages.Any()) { dependentObjects.Add(typeof(ProjectImage).Name); } if (ProjectInternalNotes.Any()) { dependentObjects.Add(typeof(ProjectInternalNote).Name); } if (ProjectLocations.Any()) { dependentObjects.Add(typeof(ProjectLocation).Name); } if (ProjectLocationStagings.Any()) { dependentObjects.Add(typeof(ProjectLocationStaging).Name); } if (ProjectNoFundingSourceIdentifieds.Any()) { dependentObjects.Add(typeof(ProjectNoFundingSourceIdentified).Name); } if (ProjectNotes.Any()) { dependentObjects.Add(typeof(ProjectNote).Name); } if (ProjectOrganizations.Any()) { dependentObjects.Add(typeof(ProjectOrganization).Name); } if (ProjectProjectStatuses.Any()) { dependentObjects.Add(typeof(ProjectProjectStatus).Name); } if (ProjectRelevantCostTypes.Any()) { dependentObjects.Add(typeof(ProjectRelevantCostType).Name); } if (ProjectTags.Any()) { dependentObjects.Add(typeof(ProjectTag).Name); } if (ProjectUpdateBatches.Any()) { dependentObjects.Add(typeof(ProjectUpdateBatch).Name); } if (SecondaryProjectTaxonomyLeafs.Any()) { dependentObjects.Add(typeof(SecondaryProjectTaxonomyLeaf).Name); } if (TechnicalAssistanceRequests.Any()) { dependentObjects.Add(typeof(TechnicalAssistanceRequest).Name); } return(dependentObjects.Distinct().ToList()); }
/// <summary> /// Does this object have any dependent objects? (If it does have dependent objects, these would need to be deleted before this object could be deleted.) /// </summary> /// <returns></returns> public bool HasDependentObjects() { return(NotificationProjects.Any() || PerformanceMeasureActuals.Any() || PerformanceMeasureExpecteds.Any() || ProjectAssessmentQuestions.Any() || ProjectAttachments.Any() || ProjectClassifications.Any() || ProjectContacts.Any() || ProjectCustomAttributes.Any() || ProjectEvaluations.Any() || ProjectExemptReportingYears.Any() || ProjectExternalLinks.Any() || ProjectFundingSourceBudgets.Any() || ProjectFundingSourceExpenditures.Any() || ProjectGeospatialAreas.Any() || ProjectGeospatialAreaTypeNotes.Any() || ProjectImages.Any() || ProjectInternalNotes.Any() || ProjectLocations.Any() || ProjectLocationStagings.Any() || ProjectNoFundingSourceIdentifieds.Any() || ProjectNotes.Any() || ProjectOrganizations.Any() || ProjectProjectStatuses.Any() || ProjectRelevantCostTypes.Any() || ProjectTags.Any() || ProjectUpdateBatches.Any() || SecondaryProjectTaxonomyLeafs.Any() || TechnicalAssistanceRequests.Any()); }
public List <Project> GetAssociatedProjects(Person currentPerson) { return(ProjectTags.Select(x => x.Project).ToList().GetActiveProjectsAndProposalsVisibleToUser(currentPerson)); }
public void RemoveTag(Project project, ProjectTags tag) { project.ProjectTags.Remove(tag); SaveChanges(project); }
/// <summary> /// Dependent type names of this entity /// </summary> public void DeleteChildren(DatabaseEntities dbContext) { foreach (var x in GrantAllocationAwardLandownerCostShareLineItems.ToList()) { x.DeleteFull(dbContext); } foreach (var x in InteractionEventProjects.ToList()) { x.DeleteFull(dbContext); } foreach (var x in NotificationProjects.ToList()) { x.DeleteFull(dbContext); } foreach (var x in PerformanceMeasureActuals.ToList()) { x.DeleteFull(dbContext); } foreach (var x in PerformanceMeasureExpecteds.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectClassifications.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectCustomAttributes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectDocuments.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectExemptReportingYears.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectExternalLinks.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectFundingSources.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectGrantAllocationExpenditures.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectGrantAllocationRequests.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectImages.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectInternalNotes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectLocations.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectLocationStagings.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectNotes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectOrganizations.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectPeople.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectPriorityLandscapes.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectPrograms.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectRegions.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectTags.ToList()) { x.DeleteFull(dbContext); } foreach (var x in ProjectUpdateBatches.ToList()) { x.DeleteFull(dbContext); } foreach (var x in Treatments.ToList()) { x.DeleteFull(dbContext); } }
/// <summary> /// Active Dependent type names of this object /// </summary> public List <string> DependentObjectNames() { var dependentObjects = new List <string>(); if (GrantAllocationAwardLandownerCostShareLineItems.Any()) { dependentObjects.Add(typeof(GrantAllocationAwardLandownerCostShareLineItem).Name); } if (InteractionEventProjects.Any()) { dependentObjects.Add(typeof(InteractionEventProject).Name); } if (NotificationProjects.Any()) { dependentObjects.Add(typeof(NotificationProject).Name); } if (PerformanceMeasureActuals.Any()) { dependentObjects.Add(typeof(PerformanceMeasureActual).Name); } if (PerformanceMeasureExpecteds.Any()) { dependentObjects.Add(typeof(PerformanceMeasureExpected).Name); } if (ProjectClassifications.Any()) { dependentObjects.Add(typeof(ProjectClassification).Name); } if (ProjectCustomAttributes.Any()) { dependentObjects.Add(typeof(ProjectCustomAttribute).Name); } if (ProjectDocuments.Any()) { dependentObjects.Add(typeof(ProjectDocument).Name); } if (ProjectExemptReportingYears.Any()) { dependentObjects.Add(typeof(ProjectExemptReportingYear).Name); } if (ProjectExternalLinks.Any()) { dependentObjects.Add(typeof(ProjectExternalLink).Name); } if (ProjectFundingSources.Any()) { dependentObjects.Add(typeof(ProjectFundingSource).Name); } if (ProjectGrantAllocationExpenditures.Any()) { dependentObjects.Add(typeof(ProjectGrantAllocationExpenditure).Name); } if (ProjectGrantAllocationRequests.Any()) { dependentObjects.Add(typeof(ProjectGrantAllocationRequest).Name); } if (ProjectImages.Any()) { dependentObjects.Add(typeof(ProjectImage).Name); } if (ProjectInternalNotes.Any()) { dependentObjects.Add(typeof(ProjectInternalNote).Name); } if (ProjectLocations.Any()) { dependentObjects.Add(typeof(ProjectLocation).Name); } if (ProjectLocationStagings.Any()) { dependentObjects.Add(typeof(ProjectLocationStaging).Name); } if (ProjectNotes.Any()) { dependentObjects.Add(typeof(ProjectNote).Name); } if (ProjectOrganizations.Any()) { dependentObjects.Add(typeof(ProjectOrganization).Name); } if (ProjectPeople.Any()) { dependentObjects.Add(typeof(ProjectPerson).Name); } if (ProjectPriorityLandscapes.Any()) { dependentObjects.Add(typeof(ProjectPriorityLandscape).Name); } if (ProjectPrograms.Any()) { dependentObjects.Add(typeof(ProjectProgram).Name); } if (ProjectRegions.Any()) { dependentObjects.Add(typeof(ProjectRegion).Name); } if (ProjectTags.Any()) { dependentObjects.Add(typeof(ProjectTag).Name); } if (ProjectUpdateBatches.Any()) { dependentObjects.Add(typeof(ProjectUpdateBatch).Name); } if (Treatments.Any()) { dependentObjects.Add(typeof(Treatment).Name); } return(dependentObjects.Distinct().ToList()); }