Added serializability to Geography, methods to Automation/GetGeographyData

This commit is contained in:
Rick Falkvinge
2012-11-05 15:59:40 +00:00
parent 232e2763e8
commit 7d4d05c61d
2 changed files with 17 additions and 6 deletions
+6 -6
View File
@@ -30,24 +30,24 @@ namespace Activizr.Basic.Types
}
/// <summary>
/// The database node id.
/// The database id of this geography.
/// </summary>
public readonly int GeographyId;
public int GeographyId { get; private set; }
/// <summary>
/// The database node id of the parent node.
/// The database id of the parent geography, for linking in a tree structure.
/// </summary>
public readonly int ParentGeographyId;
public int ParentGeographyId { get; protected set; }
/// <summary>
/// The friendly name of the node (city, county, region, etc).
/// </summary>
public readonly string Name;
public string Name { get; protected set; }
/// <summary>
/// The generation of this node. Used in tree-style listings.
/// </summary>
public readonly int Generation;
public int Generation { get; protected set; }
#region IHasIdentity Members
+11
View File
@@ -35,4 +35,15 @@ public class GetGeographyData : System.Web.Services.WebService {
return PostalCodes.ForCountry(countryCode);
}
public Geographies GetGeographiesFromRoot (int rootId)
{
return Geography.FromIdentity(rootId).GetTree();
}
public Geographies GetGeographiesForCountry (string countryCode)
{
Country country = Country.FromCode(countryCode);
return GetGeographiesFromRoot(country.GeographyId);
}
}