Esempio n. 1
0
        /// <summary>
        /// Active Dependent type names of this object
        /// </summary>
        public List <string> DependentObjectNames()
        {
            var dependentObjects = new List <string>();

            if (PersonStewardTaxonomyBranches.Any())
            {
                dependentObjects.Add(typeof(PersonStewardTaxonomyBranch).Name);
            }

            if (ProjectTypes.Any())
            {
                dependentObjects.Add(typeof(ProjectType).Name);
            }
            return(dependentObjects.Distinct().ToList());
        }
Esempio n. 2
0
        protected virtual bool IsValidForProject(Project project, string projectPath)
        {
            // When there is no project, only single template files can be created.
            if (project == null)
            {
                foreach (FileDescriptionTemplate f in Files)
                {
                    if (!(f is SingleFileDescriptionTemplate))
                    {
                        return(false);
                    }
                }
            }

            // Filter on templates
            foreach (FileDescriptionTemplate f in Files)
            {
                if (!f.SupportsProject(project, projectPath))
                {
                    return(false);
                }
            }

            //filter on conditions
            if (project != null)
            {
                // When file template's project types don't match the current project's type.
                if (ProjectTypes.Any() && project.GetTypeTags().All(p => !ProjectTypes.Contains(p)))
                {
                    return(false);
                }

                foreach (FileTemplateCondition condition in Conditions)
                {
                    if (!condition.ShouldEnableFor(project, projectPath))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Esempio n. 3
0
 /// <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(PersonStewardTaxonomyBranches.Any() || ProjectTypes.Any());
 }