Exemple #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);
            }
        }
Exemple #2
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public TaxonomyBranch(TaxonomyTrunk taxonomyTrunk, string taxonomyBranchName) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.TaxonomyBranchID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.TaxonomyTrunkID  = taxonomyTrunk.TaxonomyTrunkID;
     this.TaxonomyTrunk    = taxonomyTrunk;
     taxonomyTrunk.TaxonomyBranches.Add(this);
     this.TaxonomyBranchName = taxonomyBranchName;
 }
Exemple #3
0
        public static ComboTreeNode ToComboTreeNode(this TaxonomyTrunk taxonomyTrunk)
        {
            var key           = $"{TaxonomyLevel.Trunk.TaxonomyLevelID}-{taxonomyTrunk.TaxonomyTrunkID}";
            var comboTreeNode = new ComboTreeNode(taxonomyTrunk.GetDisplayName(), key)
            {
                SubNodes = taxonomyTrunk.TaxonomyBranches.SortByOrderThenName().Select(x => x.ToComboTreeNode()).ToList()
            };

            return(comboTreeNode);
        }
 public MatchmakerTaxonomyTier(TaxonomyTrunk taxonomyTrunk, List <MatchmakerTaxonomyTier> branches)
 {
     TaxonomyTierID       = taxonomyTrunk.TaxonomyTrunkID;
     DisplayName          = taxonomyTrunk.GetDisplayName();
     SortOrder            = taxonomyTrunk.TaxonomyTrunkSortOrder;
     Children             = branches;
     TaxonomyLevel        = TaxonomyLevelEnum.Trunk;
     TaxonomyLeaf         = null;
     TaxonomyBranch       = null;
     TaxonomyTrunk        = taxonomyTrunk;
     MaximumChildrenCount = taxonomyTrunk.TaxonomyBranches.Count;
 }
 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;
 }
 public MatchmakerTaxonomyTier(TaxonomyLeaf taxonomyLeaf)
 {
     TaxonomyTierID       = taxonomyLeaf.TaxonomyLeafID;
     DisplayName          = taxonomyLeaf.GetDisplayName();
     SortOrder            = taxonomyLeaf.TaxonomyLeafSortOrder;
     Children             = null;
     TaxonomyLevel        = TaxonomyLevelEnum.Leaf;
     TaxonomyLeaf         = taxonomyLeaf;
     TaxonomyBranch       = null;
     TaxonomyTrunk        = null;
     MaximumChildrenCount = 0;
 }
Exemple #7
0
        public static FancyTreeNode ToFancyTreeNode(this TaxonomyTrunk taxonomyTrunk, FirmaSession currentFirmaSession)
        {
            var fancyTreeNode = new FancyTreeNode($"{UrlTemplate.MakeHrefString(taxonomyTrunk.GetDetailUrl(), taxonomyTrunk.GetDisplayName())}",
                                                  taxonomyTrunk.TaxonomyTrunkID.ToString(), true)
            {
                ThemeColor = taxonomyTrunk.ThemeColor,
                MapUrl     = taxonomyTrunk.GetCustomizedMapUrl(),
                Children   = taxonomyTrunk.TaxonomyBranches.ToList().SortByOrderThenName().Select(x => x.ToFancyTreeNode(currentFirmaSession))
                             .ToList()
            };

            return(fancyTreeNode);
        }
Exemple #8
0
 public TaxonomyTier(TaxonomyLeaf taxonomyLeaf)
 {
     TaxonomyTierID   = taxonomyLeaf.TaxonomyLeafID;
     ThemeColor       = taxonomyLeaf.ThemeColor;
     DisplayName      = taxonomyLeaf.GetDisplayName();
     DisplayNameAsUrl = taxonomyLeaf.GetDisplayNameAsUrl();
     DetailUrl        = taxonomyLeaf.GetDetailUrl();
     TaxonomyTierPerformanceMeasures = taxonomyLeaf.GetTaxonomyTierPerformanceMeasures();
     SortOrder      = taxonomyLeaf.TaxonomyLeafSortOrder;
     TaxonomyLevel  = TaxonomyLevelEnum.Leaf;
     TaxonomyLeaf   = taxonomyLeaf;
     TaxonomyBranch = null;
     TaxonomyTrunk  = null;
 }
Exemple #9
0
 public static void DeleteTaxonomyTrunk(this IQueryable <TaxonomyTrunk> taxonomyTrunks, TaxonomyTrunk taxonomyTrunkToDelete)
 {
     DeleteTaxonomyTrunk(taxonomyTrunks, new List <TaxonomyTrunk> {
         taxonomyTrunkToDelete
     });
 }
Exemple #10
0
 public static List <Project> GetAssociatedProjects(this TaxonomyTrunk taxonomyTrunk, FirmaSession firmaSession)
 {
     return(taxonomyTrunk.TaxonomyBranches.SelectMany(x => x.TaxonomyLeafs.SelectMany(y => y.Projects)).ToList().GetActiveProjectsAndProposals(firmaSession.CanViewProposals(), firmaSession));
 }
Exemple #11
0
 public static string GetCustomizedMapUrl(this TaxonomyTrunk taxonomyTrunk)
 {
     return(ProjectMapCustomization.BuildCustomizedUrl(ProjectLocationFilterType.TaxonomyTrunk, taxonomyTrunk.TaxonomyTrunkID.ToString(), ProjectColorByType.ProjectStage));
 }
Exemple #12
0
 public static HtmlString GetDisplayNameAsUrl(this TaxonomyTrunk taxonomyTrunk)
 {
     return(UrlTemplate.MakeHrefString(taxonomyTrunk.GetDetailUrl(), taxonomyTrunk.GetDisplayName()));
 }
Exemple #13
0
 public static string GetDeleteUrl(this TaxonomyTrunk taxonomyTrunk)
 {
     return(DeleteUrlTemplate.ParameterReplace(taxonomyTrunk.TaxonomyTrunkID));
 }
Exemple #14
0
 public TaxonomyTierSimple(TaxonomyTrunk taxonomyTrunk) : this()
 {
     TaxonomyTierID   = taxonomyTrunk.TaxonomyTrunkID;
     DisplayName      = taxonomyTrunk.GetDisplayName();
     ParentTaxonomyID = null; //trunks don't have parents
 }
Exemple #15
0
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static TaxonomyBranch CreateNewBlank(TaxonomyTrunk taxonomyTrunk)
 {
     return(new TaxonomyBranch(taxonomyTrunk, default(string)));
 }