예제 #1
0
        public void TestProjectLocationFilterTypesAddedAsProjectProperties()
        {
            var focusArea = TestFramework.TestFocusArea.Create();

            var project = Project.CreateNewBlank(
                ProjectType.CreateNewBlank(TaxonomyBranch.CreateNewBlank(TaxonomyTrunk.CreateNewBlank())),
                ProjectStage.Completed,
                ProjectLocationSimpleType.None,
                // TODO: Verify that "Approved" is the correct project state or use the correct value
                ProjectApprovalStatus.Approved);

            project.FocusArea = focusArea;

            project.ProjectLocationPoint = DbGeometry.PointFromText("POINT(29.11 40.11)", 4326);

            var feature = Project.MappedPointsToGeoJsonFeatureCollection(new List <Project> {
                project
            }, true, true).Features.First();

            foreach (var projectLocationFilterType in ProjectLocationFilterType.All)
            {
                Assert.That(feature.Properties.ContainsKey(projectLocationFilterType.ProjectLocationFilterTypeNameWithIdentifier),
                            "ProjectLocationFilterType {0} not present as a property of Project.",
                            projectLocationFilterType.ProjectLocationFilterTypeNameWithIdentifier);
            }
        }
예제 #2
0
 public static string GetTaxonomyBranchCodeAndName(this TaxonomyBranch taxonomyBranch)
 {
     if (taxonomyBranch.TaxonomyBranchCode != null)
     {
         return(taxonomyBranch.TaxonomyBranchCode + ": " + taxonomyBranch.TaxonomyBranchName);
     }
     return(taxonomyBranch.TaxonomyBranchName);
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public ProjectType(TaxonomyBranch taxonomyBranch, string projectTypeName, bool limitVisibilityToAdmin) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.ProjectTypeID    = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.TaxonomyBranchID = taxonomyBranch.TaxonomyBranchID;
     this.TaxonomyBranch   = taxonomyBranch;
     taxonomyBranch.ProjectTypes.Add(this);
     this.ProjectTypeName        = projectTypeName;
     this.LimitVisibilityToAdmin = limitVisibilityToAdmin;
 }
예제 #4
0
        public static ComboTreeNode ToComboTreeNode(this TaxonomyBranch taxonomyBranch)
        {
            var key           = $"{TaxonomyLevel.Branch.TaxonomyLevelID}-{taxonomyBranch.TaxonomyBranchID}";
            var comboTreeNode = new ComboTreeNode(taxonomyBranch.GetDisplayName(), key)
            {
                SubNodes = taxonomyBranch.TaxonomyLeafs.SortByOrderThenName().Select(x => x.ToComboTreeNode()).ToList()
            };

            return(comboTreeNode);
        }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public PersonStewardTaxonomyBranch(Person person, TaxonomyBranch taxonomyBranch) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.PersonStewardTaxonomyBranchID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.PersonID = person.PersonID;
     this.Person   = person;
     person.PersonStewardTaxonomyBranches.Add(this);
     this.TaxonomyBranchID = taxonomyBranch.TaxonomyBranchID;
     this.TaxonomyBranch   = taxonomyBranch;
     taxonomyBranch.PersonStewardTaxonomyBranches.Add(this);
 }
예제 #6
0
        public static FancyTreeNode ToFancyTreeNode(this TaxonomyBranch taxonomyBranch, FirmaSession currentFirmaSession)
        {
            var fancyTreeNode = new FancyTreeNode($"{UrlTemplate.MakeHrefString(taxonomyBranch.GetDetailUrl(), taxonomyBranch.GetDisplayName())}", taxonomyBranch.TaxonomyBranchID.ToString(), false)
            {
                ThemeColor = string.IsNullOrWhiteSpace(taxonomyBranch.ThemeColor) ? taxonomyBranch.TaxonomyTrunk.ThemeColor : taxonomyBranch.ThemeColor,
                MapUrl     = taxonomyBranch.GetCustomizedMapUrl(),
                Children   = taxonomyBranch.TaxonomyLeafs.SortByOrderThenName().Select(x => x.ToFancyTreeNode(currentFirmaSession)).ToList()
            };

            return(fancyTreeNode);
        }
예제 #7
0
 public MatchmakerTaxonomyTier(TaxonomyBranch taxonomyBranch, List <MatchmakerTaxonomyTier> leaves)
 {
     TaxonomyTierID       = taxonomyBranch.TaxonomyBranchID;
     DisplayName          = taxonomyBranch.GetDisplayName();
     SortOrder            = taxonomyBranch.TaxonomyBranchSortOrder;
     Children             = leaves;
     TaxonomyLevel        = TaxonomyLevelEnum.Branch;
     TaxonomyLeaf         = null;
     TaxonomyBranch       = taxonomyBranch;
     TaxonomyTrunk        = null;
     MaximumChildrenCount = taxonomyBranch.TaxonomyLeafs.Count;
 }
예제 #8
0
 public TaxonomyTier(TaxonomyBranch taxonomyBranch)
 {
     TaxonomyTierID   = taxonomyBranch.TaxonomyBranchID;
     ThemeColor       = taxonomyBranch.ThemeColor;
     DisplayName      = taxonomyBranch.GetDisplayName();
     DisplayNameAsUrl = taxonomyBranch.GetDisplayNameAsUrl();
     DetailUrl        = taxonomyBranch.GetDetailUrl();
     TaxonomyTierPerformanceMeasures = taxonomyBranch.GetTaxonomyTierPerformanceMeasures();
     SortOrder      = taxonomyBranch.TaxonomyBranchSortOrder;
     TaxonomyLevel  = TaxonomyLevelEnum.Branch;
     TaxonomyLeaf   = null;
     TaxonomyBranch = taxonomyBranch;
     TaxonomyTrunk  = null;
 }
예제 #9
0
        public ComboTreeNode ToComboTreeNode()
        {
            switch (TaxonomyLevel)
            {
            case TaxonomyLevelEnum.Leaf:
                return(TaxonomyLeaf.ToComboTreeNode());

            case TaxonomyLevelEnum.Branch:
                return(TaxonomyBranch.ToComboTreeNode());

            case TaxonomyLevelEnum.Trunk:
                return(TaxonomyTrunk.ToComboTreeNode());

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
예제 #10
0
        public FancyTreeNode ToFancyTreeNode(FirmaSession currentFirmaSession)
        {
            switch (TaxonomyLevel)
            {
            case TaxonomyLevelEnum.Leaf:
                return(TaxonomyLeaf.ToFancyTreeNode(currentFirmaSession));

            case TaxonomyLevelEnum.Branch:
                return(TaxonomyBranch.ToFancyTreeNode(currentFirmaSession));

            case TaxonomyLevelEnum.Trunk:
                return(TaxonomyTrunk.ToFancyTreeNode(currentFirmaSession));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
예제 #11
0
        public string GetDisplayNameAsDetailUrl()
        {
            switch (TaxonomyLevel)
            {
            case TaxonomyLevelEnum.Trunk:
                return($"{UrlTemplate.MakeHrefString(TaxonomyTrunk.GetDetailUrl(), GetDisplayName())}");

            case TaxonomyLevelEnum.Branch:
                return($"{UrlTemplate.MakeHrefString(TaxonomyBranch.GetDetailUrl(), GetDisplayName())}");

            case TaxonomyLevelEnum.Leaf:
                return($"{UrlTemplate.MakeHrefString(TaxonomyLeaf.GetDetailUrl(), GetDisplayName())}");

            default:
                return(string.Empty);
            }
        }
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static PersonStewardTaxonomyBranch CreateNewBlank(Person person, TaxonomyBranch taxonomyBranch)
 {
     return(new PersonStewardTaxonomyBranch(person, taxonomyBranch));
 }
예제 #13
0
 public static void DeleteTaxonomyBranch(this IQueryable <TaxonomyBranch> taxonomyBranches, TaxonomyBranch taxonomyBranchToDelete)
 {
     DeleteTaxonomyBranch(taxonomyBranches, new List <TaxonomyBranch> {
         taxonomyBranchToDelete
     });
 }
예제 #14
0
 public static HtmlString GetDisplayNameAsUrl(this TaxonomyBranch taxonomyBranch)
 {
     return(UrlTemplate.MakeHrefString(taxonomyBranch.GetDetailUrl(), taxonomyBranch.GetDisplayName()));
 }
예제 #15
0
 public static List <Project> GetAssociatedProjects(this TaxonomyBranch taxonomyBranch, FirmaSession firmaSession)
 {
     return(taxonomyBranch.TaxonomyLeafs.SelectMany(y => y.GetProjects()).ToList().GetActiveProjectsAndProposals(firmaSession.CanViewProposals()));
 }
예제 #16
0
 public static string GetCustomizedMapUrl(this TaxonomyBranch taxonomyBranch)
 {
     return(ProjectMapCustomization.BuildCustomizedUrl(ProjectLocationFilterType.TaxonomyBranch, taxonomyBranch.TaxonomyBranchID.ToString(), ProjectColorByType.ProjectStage));
 }
예제 #17
0
 public static string GetDeleteUrl(this TaxonomyBranch taxonomyBranch)
 {
     return(DeleteUrlTemplate.ParameterReplace(taxonomyBranch.TaxonomyBranchID));
 }
 public TaxonomyBranchOrganizationTypeExpenditure(OrganizationType organizationType, TaxonomyBranch taxonomyBranch, decimal expenditureAmount) : this(organizationType, taxonomyBranch.GetDisplayNameAsUrl(), taxonomyBranch.TaxonomyTrunk.GetDisplayNameAsUrl(), expenditureAmount)
 {
 }
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static ProjectType CreateNewBlank(TaxonomyBranch taxonomyBranch)
 {
     return(new ProjectType(taxonomyBranch, default(string), default(bool)));
 }
예제 #20
0
 /// <summary>
 /// Constructor for building a new simple object with the POCO class
 /// </summary>
 public TaxonomyTierSimple(TaxonomyBranch taxonomyBranch) : this()
 {
     TaxonomyTierID   = taxonomyBranch.TaxonomyBranchID;
     DisplayName      = taxonomyBranch.GetDisplayName();
     ParentTaxonomyID = taxonomyBranch.TaxonomyTrunkID;
 }