Added real trees to Geo, Org
This commit is contained in:
+3
-3
@@ -342,7 +342,7 @@ namespace Swarmops
|
||||
|
||||
writer.WriteLine("Förening,Namn (medlemsnr),kön,födelsedatum,bidragsgrund,email,telefon");
|
||||
|
||||
Organizations orgTree = Organization.FromIdentity(2).GetAllBelow();
|
||||
Organizations orgTree = Organization.FromIdentity(2).ThisAndBelow();
|
||||
|
||||
foreach (Organization org in orgTree)
|
||||
{
|
||||
@@ -905,11 +905,11 @@ namespace Swarmops
|
||||
{
|
||||
// For each suborg to UP,
|
||||
|
||||
Organizations orgs = Organization.FromIdentity (2).GetAllBelow();
|
||||
Organizations orgs = Organization.FromIdentity (2).ThisAndBelow();
|
||||
|
||||
foreach (Organization org in orgs)
|
||||
{
|
||||
// For each membership in this suborg,
|
||||
// For each membership in this suborg,§
|
||||
|
||||
Memberships memberships = org.GetMemberships();
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ namespace Swarmops.Logic.DataObjects
|
||||
#endif
|
||||
public static GeographyWithPeople[] SelectSortedStatic (int orgId)
|
||||
{
|
||||
Organizations orgs = Organization.FromIdentity (orgId).GetAllBelow();
|
||||
Organizations orgs = Organization.FromIdentity (orgId).ThisAndBelow();
|
||||
|
||||
List<GeographyWithPeople> resList = new List<GeographyWithPeople>();
|
||||
Geographies tree = Geography.Root.GetAllBelow();
|
||||
Geographies tree = Geography.Root.ThisAndBelow();
|
||||
foreach (Geography geo in tree)
|
||||
{
|
||||
GeographyWithPeople row = new GeographyWithPeople();
|
||||
@@ -29,7 +29,7 @@ namespace Swarmops.Logic.DataObjects
|
||||
row.LeadContent = "";
|
||||
row.SecondsContent = "";
|
||||
row.OrgId = orgId;
|
||||
Geographies gTree = geo.GetAllBelow();
|
||||
Geographies gTree = geo.ThisAndBelow();
|
||||
int[] members = SwarmDb.GetDatabaseForReading()
|
||||
.GetMembersForOrganizationsAndGeographies (orgs.Identities, gTree.Identities);
|
||||
}
|
||||
|
||||
@@ -418,9 +418,9 @@ namespace Swarmops.Logic.Financial
|
||||
return FromIdentityAggressive (accountId);
|
||||
}
|
||||
|
||||
public FinancialAccounts GetAllBelow()
|
||||
public FinancialAccounts ThisAndBelow()
|
||||
{
|
||||
return FinancialAccounts.GetAllBelow (this);
|
||||
return FinancialAccounts.ThisAndBelow (this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -329,7 +329,7 @@ namespace Swarmops.Logic.Security
|
||||
|
||||
// Org lookup will always be needed. Geo lookup may be needed for case 3.
|
||||
|
||||
Organizations orgStructure = this.Organization.GetAllBelow();
|
||||
Organizations orgStructure = this.Organization.ThisAndBelow();
|
||||
int[] orgIds = orgStructure.Identities;
|
||||
foreach (int orgId in orgIds)
|
||||
{
|
||||
@@ -395,7 +395,7 @@ namespace Swarmops.Logic.Security
|
||||
return new People(); // also return empty list
|
||||
}
|
||||
|
||||
Geographies geoStructure = this.Position.Geography.GetAllBelow();
|
||||
Geographies geoStructure = this.Position.Geography.ThisAndBelow();
|
||||
int[] geoIds = geoStructure.Identities;
|
||||
foreach (int geoId in geoIds)
|
||||
{
|
||||
|
||||
@@ -65,6 +65,14 @@ namespace Swarmops.Logic.Structure
|
||||
|
||||
public static readonly int IgnoreGeography = -1; // Used as parameter to methods where geography is optional
|
||||
|
||||
public Tree<Geography> Tree
|
||||
{
|
||||
get
|
||||
{
|
||||
Geographies geographies = this.ThisAndBelow();
|
||||
return Tree<Geography>.FromCollection (geographies);
|
||||
}
|
||||
}
|
||||
|
||||
public Geographies Children
|
||||
{
|
||||
@@ -87,7 +95,7 @@ namespace Swarmops.Logic.Structure
|
||||
get { return FromIdentity (ParentIdentity); }
|
||||
}
|
||||
|
||||
public Geographies GetAllBelow()
|
||||
public Geographies ThisAndBelow()
|
||||
{
|
||||
return Geographies.FromArray (GeographyCache.GetGeographyTree (Identity));
|
||||
// return Geographies.FromArray(SwarmDb.GetDatabaseForReading().GetGeographyTree(Identity));
|
||||
|
||||
@@ -8,6 +8,7 @@ using Swarmops.Basic.Types;
|
||||
using Swarmops.Basic.Types.Structure;
|
||||
using Swarmops.Basic.Types.Swarm;
|
||||
using Swarmops.Common.Enums;
|
||||
using Swarmops.Common.Generics;
|
||||
using Swarmops.Database;
|
||||
using Swarmops.Logic.Cache;
|
||||
using Swarmops.Logic.Communications;
|
||||
@@ -191,6 +192,14 @@ namespace Swarmops.Logic.Structure
|
||||
get { return Organizations.FromArray (OrganizationCache.GetOrganizationChildren (Identity)); }
|
||||
}
|
||||
|
||||
public Tree<Organization> Tree
|
||||
{
|
||||
get
|
||||
{
|
||||
Organizations orgs = this.ThisAndBelow();
|
||||
return Tree<Organization>.FromCollection (orgs);
|
||||
}
|
||||
}
|
||||
|
||||
public OrganizationFinancialAccounts FinancialAccounts
|
||||
{
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace Swarmops.Logic.Structure
|
||||
|
||||
foreach (Organization orgMajor in this)
|
||||
{
|
||||
Organizations orgTree = orgMajor.GetAllBelow();
|
||||
Organizations orgTree = orgMajor.ThisAndBelow();
|
||||
|
||||
foreach (Organization orgMinor in orgTree)
|
||||
{
|
||||
|
||||
@@ -92,10 +92,10 @@ namespace Swarmops.Logic.Swarm
|
||||
Organizations orgTree = null;
|
||||
Geographies nodeTree = null;
|
||||
int[] nodeIds;
|
||||
orgTree = Organization.FromIdentity (organizationId).GetAllBelow();
|
||||
orgTree = Organization.FromIdentity (organizationId).ThisAndBelow();
|
||||
if (geographyId > 0)
|
||||
{
|
||||
nodeTree = Geography.FromIdentity (geographyId).GetAllBelow();
|
||||
nodeTree = Geography.FromIdentity (geographyId).ThisAndBelow();
|
||||
nodeIds = nodeTree.Identities;
|
||||
}
|
||||
else
|
||||
@@ -137,12 +137,12 @@ namespace Swarmops.Logic.Swarm
|
||||
int[] nodeIds;
|
||||
int[] orgIds;
|
||||
|
||||
orgTree = Organization.FromIdentity (organizationId).GetAllBelow();
|
||||
orgTree = Organization.FromIdentity (organizationId).ThisAndBelow();
|
||||
orgIds = orgTree.Identities;
|
||||
|
||||
if (geographyId > 0)
|
||||
{
|
||||
nodeTree = Geography.FromIdentity (geographyId).GetAllBelow();
|
||||
nodeTree = Geography.FromIdentity (geographyId).ThisAndBelow();
|
||||
nodeIds = nodeTree.Identities;
|
||||
}
|
||||
else
|
||||
@@ -235,8 +235,8 @@ namespace Swarmops.Logic.Swarm
|
||||
|
||||
// Expensive op:
|
||||
BasicPersonRole[] basicPersonRoles =
|
||||
SwarmDb.GetDatabaseForReading().GetRolesForOrganizationsGeographies (organization.GetAllBelow().Identities,
|
||||
geography.GetAllBelow().Identities);
|
||||
SwarmDb.GetDatabaseForReading().GetRolesForOrganizationsGeographies (organization.ThisAndBelow().Identities,
|
||||
geography.ThisAndBelow().Identities);
|
||||
|
||||
Dictionary<int, bool> lookup = new Dictionary<int, bool>();
|
||||
foreach (BasicPersonRole basicRole in basicPersonRoles)
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace Swarmops.Frontend.Pages.v5.Admin.Hacks
|
||||
geoNameLookup[countryCode] = countryGeoId;
|
||||
}
|
||||
|
||||
Geographies countryGeographies = Geography.FromIdentity(countryGeoId).GetAllBelow();
|
||||
Geographies countryGeographies = Geography.FromIdentity(countryGeoId).ThisAndBelow();
|
||||
|
||||
foreach (Geography geography in countryGeographies)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Swarmops.Utility.BotCode
|
||||
|
||||
public static string ExportMemberList (int organizationIdRoot, DateTime membersAfter, DateTime membersBefore)
|
||||
{
|
||||
Organizations orgs = Organization.FromIdentity (organizationIdRoot).GetAllBelow();
|
||||
Organizations orgs = Organization.FromIdentity (organizationIdRoot).ThisAndBelow();
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
result.Append (
|
||||
|
||||
Reference in New Issue
Block a user