diff --git a/Site5/App_Code/GetGeographyData.cs b/Logic/Automation/GetGeographyData.cs
similarity index 97%
rename from Site5/App_Code/GetGeographyData.cs
rename to Logic/Automation/GetGeographyData.cs
index 7c38a4b1..46b2184c 100644
--- a/Site5/App_Code/GetGeographyData.cs
+++ b/Logic/Automation/GetGeographyData.cs
@@ -1,890 +1,890 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.296
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-using System;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Web.Services;
-using System.Web.Services.Protocols;
-using System.Xml.Serialization;
-
-//
-// This source code was auto-generated by wsdl, Version=4.0.30319.1.
-//
-
-
-namespace Swarmops.Site.Automation
-{
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- [DebuggerStepThrough()]
- [DesignerCategory("code")]
- [WebServiceBinding(Name = "GetGeographyDataSoap", Namespace = "http://swarmops.com/")]
- [XmlInclude(typeof (BasicGeography))]
- [XmlInclude(typeof (BasicPostalCode))]
- [XmlInclude(typeof (BasicCity))]
- [XmlInclude(typeof (BasicCountry))]
- public partial class GetGeographyData : System.Web.Services.Protocols.SoapHttpClientProtocol
- {
-
- private System.Threading.SendOrPostCallback GetCountriesOperationCompleted;
-
- private System.Threading.SendOrPostCallback GetCountriesInUseOperationCompleted;
-
- private System.Threading.SendOrPostCallback GetCitiesForCountryOperationCompleted;
-
- private System.Threading.SendOrPostCallback GetPostalCodesForCountryOperationCompleted;
-
- private System.Threading.SendOrPostCallback GetGeographyOperationCompleted;
-
- private System.Threading.SendOrPostCallback GetGeographyForCountryOperationCompleted;
-
- ///
- public GetGeographyData()
- {
- this.Url = "http://live.swarmops.com/Automation/GetGeographyData.asmx";
- }
-
- ///
- public event GetCountriesCompletedEventHandler GetCountriesCompleted;
-
- ///
- public event GetCountriesInUseCompletedEventHandler GetCountriesInUseCompleted;
-
- ///
- public event GetCitiesForCountryCompletedEventHandler GetCitiesForCountryCompleted;
-
- ///
- public event GetPostalCodesForCountryCompletedEventHandler GetPostalCodesForCountryCompleted;
-
- ///
- public event GetGeographyCompletedEventHandler GetGeographyCompleted;
-
- ///
- public event GetGeographyForCountryCompletedEventHandler GetGeographyForCountryCompleted;
-
- ///
- [SoapDocumentMethod("http://swarmops.com/GetCountries",
- RequestNamespace = "http://swarmops.com/", ResponseNamespace = "http://swarmops.com/",
- Use = System.Web.Services.Description.SoapBindingUse.Literal,
- ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
- public Country[] GetCountries()
- {
- object[] results = this.Invoke("GetCountries", new object[0]);
- return ((Country[]) (results[0]));
- }
-
- ///
- public System.IAsyncResult BeginGetCountries(System.AsyncCallback callback, object asyncState)
- {
- return this.BeginInvoke("GetCountries", new object[0], callback, asyncState);
- }
-
- ///
- public Country[] EndGetCountries(System.IAsyncResult asyncResult)
- {
- object[] results = this.EndInvoke(asyncResult);
- return ((Country[]) (results[0]));
- }
-
- ///
- public void GetCountriesAsync()
- {
- this.GetCountriesAsync(null);
- }
-
- ///
- public void GetCountriesAsync(object userState)
- {
- if ((this.GetCountriesOperationCompleted == null))
- {
- this.GetCountriesOperationCompleted =
- new System.Threading.SendOrPostCallback(this.OnGetCountriesOperationCompleted);
- }
- this.InvokeAsync("GetCountries", new object[0], this.GetCountriesOperationCompleted, userState);
- }
-
- private void OnGetCountriesOperationCompleted(object arg)
- {
- if ((this.GetCountriesCompleted != null))
- {
- System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs =
- ((System.Web.Services.Protocols.InvokeCompletedEventArgs) (arg));
- this.GetCountriesCompleted(this,
- new GetCountriesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error,
- invokeArgs.Cancelled, invokeArgs.UserState));
- }
- }
-
- ///
- [SoapDocumentMethod("http://swarmops.com/GetCountriesInUse",
- RequestNamespace = "http://swarmops.com/", ResponseNamespace = "http://swarmops.com/",
- Use = System.Web.Services.Description.SoapBindingUse.Literal,
- ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
- public Country[] GetCountriesInUse()
- {
- object[] results = this.Invoke("GetCountriesInUse", new object[0]);
- return ((Country[]) (results[0]));
- }
-
- ///
- public System.IAsyncResult BeginGetCountriesInUse(System.AsyncCallback callback, object asyncState)
- {
- return this.BeginInvoke("GetCountriesInUse", new object[0], callback, asyncState);
- }
-
- ///
- public Country[] EndGetCountriesInUse(System.IAsyncResult asyncResult)
- {
- object[] results = this.EndInvoke(asyncResult);
- return ((Country[]) (results[0]));
- }
-
- ///
- public void GetCountriesInUseAsync()
- {
- this.GetCountriesInUseAsync(null);
- }
-
- ///
- public void GetCountriesInUseAsync(object userState)
- {
- if ((this.GetCountriesInUseOperationCompleted == null))
- {
- this.GetCountriesInUseOperationCompleted =
- new System.Threading.SendOrPostCallback(this.OnGetCountriesInUseOperationCompleted);
- }
- this.InvokeAsync("GetCountriesInUse", new object[0], this.GetCountriesInUseOperationCompleted, userState);
- }
-
- private void OnGetCountriesInUseOperationCompleted(object arg)
- {
- if ((this.GetCountriesInUseCompleted != null))
- {
- System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs =
- ((System.Web.Services.Protocols.InvokeCompletedEventArgs) (arg));
- this.GetCountriesInUseCompleted(this,
- new GetCountriesInUseCompletedEventArgs(invokeArgs.Results,
- invokeArgs.Error,
- invokeArgs.Cancelled,
- invokeArgs.UserState));
- }
- }
-
- ///
- [SoapDocumentMethod("http://swarmops.com/GetCitiesForCountry",
- RequestNamespace = "http://swarmops.com/", ResponseNamespace = "http://swarmops.com/",
- Use = System.Web.Services.Description.SoapBindingUse.Literal,
- ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
- public City[] GetCitiesForCountry(string countryCode)
- {
- object[] results = this.Invoke("GetCitiesForCountry", new object[]
- {
- countryCode
- });
- return ((City[]) (results[0]));
- }
-
- ///
- public System.IAsyncResult BeginGetCitiesForCountry(string countryCode, System.AsyncCallback callback,
- object asyncState)
- {
- return this.BeginInvoke("GetCitiesForCountry", new object[]
- {
- countryCode
- }, callback, asyncState);
- }
-
- ///
- public City[] EndGetCitiesForCountry(System.IAsyncResult asyncResult)
- {
- object[] results = this.EndInvoke(asyncResult);
- return ((City[]) (results[0]));
- }
-
- ///
- public void GetCitiesForCountryAsync(string countryCode)
- {
- this.GetCitiesForCountryAsync(countryCode, null);
- }
-
- ///
- public void GetCitiesForCountryAsync(string countryCode, object userState)
- {
- if ((this.GetCitiesForCountryOperationCompleted == null))
- {
- this.GetCitiesForCountryOperationCompleted =
- new System.Threading.SendOrPostCallback(this.OnGetCitiesForCountryOperationCompleted);
- }
- this.InvokeAsync("GetCitiesForCountry", new object[]
- {
- countryCode
- }, this.GetCitiesForCountryOperationCompleted, userState);
- }
-
- private void OnGetCitiesForCountryOperationCompleted(object arg)
- {
- if ((this.GetCitiesForCountryCompleted != null))
- {
- System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs =
- ((System.Web.Services.Protocols.InvokeCompletedEventArgs) (arg));
- this.GetCitiesForCountryCompleted(this,
- new GetCitiesForCountryCompletedEventArgs(invokeArgs.Results,
- invokeArgs.Error,
- invokeArgs.Cancelled,
- invokeArgs.UserState));
- }
- }
-
- ///
- [SoapDocumentMethod("http://swarmops.com/GetPostalCodesForCountry",
- RequestNamespace = "http://swarmops.com/", ResponseNamespace = "http://swarmops.com/",
- Use = System.Web.Services.Description.SoapBindingUse.Literal,
- ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
- public PostalCode[] GetPostalCodesForCountry(string countryCode)
- {
- object[] results = this.Invoke("GetPostalCodesForCountry", new object[]
- {
- countryCode
- });
- return ((PostalCode[]) (results[0]));
- }
-
- ///
- public System.IAsyncResult BeginGetPostalCodesForCountry(string countryCode, System.AsyncCallback callback,
- object asyncState)
- {
- return this.BeginInvoke("GetPostalCodesForCountry", new object[]
- {
- countryCode
- }, callback, asyncState);
- }
-
- ///
- public PostalCode[] EndGetPostalCodesForCountry(System.IAsyncResult asyncResult)
- {
- object[] results = this.EndInvoke(asyncResult);
- return ((PostalCode[]) (results[0]));
- }
-
- ///
- public void GetPostalCodesForCountryAsync(string countryCode)
- {
- this.GetPostalCodesForCountryAsync(countryCode, null);
- }
-
- ///
- public void GetPostalCodesForCountryAsync(string countryCode, object userState)
- {
- if ((this.GetPostalCodesForCountryOperationCompleted == null))
- {
- this.GetPostalCodesForCountryOperationCompleted =
- new System.Threading.SendOrPostCallback(this.OnGetPostalCodesForCountryOperationCompleted);
- }
- this.InvokeAsync("GetPostalCodesForCountry", new object[]
- {
- countryCode
- }, this.GetPostalCodesForCountryOperationCompleted,
- userState);
- }
-
- private void OnGetPostalCodesForCountryOperationCompleted(object arg)
- {
- if ((this.GetPostalCodesForCountryCompleted != null))
- {
- System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs =
- ((System.Web.Services.Protocols.InvokeCompletedEventArgs) (arg));
- this.GetPostalCodesForCountryCompleted(this,
- new GetPostalCodesForCountryCompletedEventArgs(
- invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled,
- invokeArgs.UserState));
- }
- }
-
- ///
- [SoapDocumentMethod("http://swarmops.com/GetGeography",
- RequestNamespace = "http://swarmops.com/", ResponseNamespace = "http://swarmops.com/",
- Use = System.Web.Services.Description.SoapBindingUse.Literal,
- ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
- public Geography GetGeography(int nodeId)
- {
- object[] results = this.Invoke("GetGeography", new object[]
- {
- nodeId
- });
- return ((Geography) (results[0]));
- }
-
- ///
- public System.IAsyncResult BeginGetGeography(int nodeId, System.AsyncCallback callback, object asyncState)
- {
- return this.BeginInvoke("GetGeography", new object[]
- {
- nodeId
- }, callback, asyncState);
- }
-
- ///
- public Geography EndGetGeography(System.IAsyncResult asyncResult)
- {
- object[] results = this.EndInvoke(asyncResult);
- return ((Geography) (results[0]));
- }
-
- ///
- public void GetGeographyAsync(int nodeId)
- {
- this.GetGeographyAsync(nodeId, null);
- }
-
- ///
- public void GetGeographyAsync(int nodeId, object userState)
- {
- if ((this.GetGeographyOperationCompleted == null))
- {
- this.GetGeographyOperationCompleted =
- new System.Threading.SendOrPostCallback(this.OnGetGeographyOperationCompleted);
- }
- this.InvokeAsync("GetGeography", new object[]
- {
- nodeId
- }, this.GetGeographyOperationCompleted, userState);
- }
-
- private void OnGetGeographyOperationCompleted(object arg)
- {
- if ((this.GetGeographyCompleted != null))
- {
- System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs =
- ((System.Web.Services.Protocols.InvokeCompletedEventArgs) (arg));
- this.GetGeographyCompleted(this,
- new GetGeographyCompletedEventArgs(invokeArgs.Results, invokeArgs.Error,
- invokeArgs.Cancelled, invokeArgs.UserState));
- }
- }
-
- ///
- [SoapDocumentMethod("http://swarmops.com/GetGeographyForCountry",
- RequestNamespace = "http://swarmops.com/", ResponseNamespace = "http://swarmops.com/",
- Use = System.Web.Services.Description.SoapBindingUse.Literal,
- ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
- public Geography GetGeographyForCountry(string countryCode)
- {
- object[] results = this.Invoke("GetGeographyForCountry", new object[]
- {
- countryCode
- });
- return ((Geography) (results[0]));
- }
-
- ///
- public System.IAsyncResult BeginGetGeographyForCountry(string countryCode, System.AsyncCallback callback,
- object asyncState)
- {
- return this.BeginInvoke("GetGeographyForCountry", new object[]
- {
- countryCode
- }, callback, asyncState);
- }
-
- ///
- public Geography EndGetGeographyForCountry(System.IAsyncResult asyncResult)
- {
- object[] results = this.EndInvoke(asyncResult);
- return ((Geography) (results[0]));
- }
-
- ///
- public void GetGeographyForCountryAsync(string countryCode)
- {
- this.GetGeographyForCountryAsync(countryCode, null);
- }
-
- ///
- public void GetGeographyForCountryAsync(string countryCode, object userState)
- {
- if ((this.GetGeographyForCountryOperationCompleted == null))
- {
- this.GetGeographyForCountryOperationCompleted =
- new System.Threading.SendOrPostCallback(this.OnGetGeographyForCountryOperationCompleted);
- }
- this.InvokeAsync("GetGeographyForCountry", new object[]
- {
- countryCode
- }, this.GetGeographyForCountryOperationCompleted, userState);
- }
-
- private void OnGetGeographyForCountryOperationCompleted(object arg)
- {
- if ((this.GetGeographyForCountryCompleted != null))
- {
- System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs =
- ((System.Web.Services.Protocols.InvokeCompletedEventArgs) (arg));
- this.GetGeographyForCountryCompleted(this,
- new GetGeographyForCountryCompletedEventArgs(invokeArgs.Results,
- invokeArgs.Error,
- invokeArgs.Cancelled,
- invokeArgs.UserState));
- }
- }
-
- ///
- public new void CancelAsync(object userState)
- {
- base.CancelAsync(userState);
- }
- }
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- [Serializable()]
- [DebuggerStepThrough()]
- [DesignerCategory("code")]
- [XmlType(Namespace = "http://swarmops.com/")]
- public partial class Country : BasicCountry
- {
- }
-
- ///
- [XmlInclude(typeof (Country))]
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- [Serializable()]
- [DebuggerStepThrough()]
- [DesignerCategory("code")]
- [XmlType(Namespace = "http://swarmops.com/")]
- public partial class BasicCountry
- {
-
- private int countryIdField;
-
- private string nameField;
-
- private string codeField;
-
- private string cultureField;
-
- private int geographyIdField;
-
- private int postalCodeLengthField;
-
- ///
- public int CountryId
- {
- get { return this.countryIdField; }
- set { this.countryIdField = value; }
- }
-
- ///
- public int PostalCodeLength
- {
- get { return this.postalCodeLengthField; }
- set { this.postalCodeLengthField = value; }
- }
-
- ///
- public string Name
- {
- get { return this.nameField; }
- set { this.nameField = value; }
- }
-
- ///
- public string Code
- {
- get { return this.codeField; }
- set { this.codeField = value; }
- }
-
- ///
- public string Culture
- {
- get { return this.cultureField; }
- set { this.cultureField = value; }
- }
-
- ///
- public int GeographyId
- {
- get { return this.geographyIdField; }
- set { this.geographyIdField = value; }
- }
- }
-
- ///
- [XmlInclude(typeof (Geography))]
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- [Serializable()]
- [DebuggerStepThrough()]
- [DesignerCategory("code")]
- [XmlType(Namespace = "http://swarmops.com/")]
- public partial class BasicGeography
- {
-
- private int geographyIdField;
-
- private int parentGeographyIdField;
-
- private string nameField;
-
- private int generationField;
-
- ///
- public int GeographyId
- {
- get { return this.geographyIdField; }
- set { this.geographyIdField = value; }
- }
-
- ///
- public int ParentGeographyId
- {
- get { return this.parentGeographyIdField; }
- set { this.parentGeographyIdField = value; }
- }
-
- ///
- public string Name
- {
- get { return this.nameField; }
- set { this.nameField = value; }
- }
-
- ///
- public int Generation
- {
- get { return this.generationField; }
- set { this.generationField = value; }
- }
- }
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- [Serializable()]
- [DebuggerStepThrough()]
- [DesignerCategory("code")]
- [XmlType(Namespace = "http://swarmops.com/")]
- public partial class Geography : BasicGeography
- {
-
- private Geography[] childrenField;
-
- ///
- public Geography[] Children
- {
- get { return this.childrenField; }
- set { this.childrenField = value; }
- }
- }
-
- ///
- [XmlInclude(typeof (PostalCode))]
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- [Serializable()]
- [DebuggerStepThrough()]
- [DesignerCategory("code")]
- [XmlType(Namespace = "http://swarmops.com/")]
- public partial class BasicPostalCode
- {
-
- private int postalCodeIdField;
-
- private string postalCodeField;
-
- private int cityIdField;
-
- private int countryIdField;
-
- ///
- public int PostalCodeId
- {
- get { return this.postalCodeIdField; }
- set { this.postalCodeIdField = value; }
- }
-
- ///
- public string PostalCode
- {
- get { return this.postalCodeField; }
- set { this.postalCodeField = value; }
- }
-
- ///
- public int CityId
- {
- get { return this.cityIdField; }
- set { this.cityIdField = value; }
- }
-
- ///
- public int CountryId
- {
- get { return this.countryIdField; }
- set { this.countryIdField = value; }
- }
- }
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- [Serializable()]
- [DebuggerStepThrough()]
- [DesignerCategory("code")]
- [XmlType(Namespace = "http://swarmops.com/")]
- public partial class PostalCode : BasicPostalCode
- {
- }
-
- ///
- [XmlInclude(typeof (City))]
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- [Serializable()]
- [DebuggerStepThrough()]
- [DesignerCategory("code")]
- [XmlType(Namespace = "http://swarmops.com/")]
- public partial class BasicCity
- {
-
- private int cityIdField;
-
- private string nameField;
-
- private int countryIdField;
-
- private int geographyIdField;
-
- ///
- public int CityId
- {
- get { return this.cityIdField; }
- set { this.cityIdField = value; }
- }
-
- ///
- public string Name
- {
- get { return this.nameField; }
- set { this.nameField = value; }
- }
-
- ///
- public int CountryId
- {
- get { return this.countryIdField; }
- set { this.countryIdField = value; }
- }
-
- ///
- public int GeographyId
- {
- get { return this.geographyIdField; }
- set { this.geographyIdField = value; }
- }
- }
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- [Serializable()]
- [DebuggerStepThrough()]
- [DesignerCategory("code")]
- [XmlType(Namespace = "http://swarmops.com/")]
- public partial class City : BasicCity
- {
- }
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- public delegate void GetCountriesCompletedEventHandler(object sender, GetCountriesCompletedEventArgs e);
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- [DebuggerStepThrough()]
- [DesignerCategory("code")]
- public partial class GetCountriesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
- {
-
- private object[] results;
-
- internal GetCountriesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled,
- object userState) :
- base(exception, cancelled, userState)
- {
- this.results = results;
- }
-
- ///
- public Country[] Result
- {
- get
- {
- this.RaiseExceptionIfNecessary();
- return ((Country[]) (this.results[0]));
- }
- }
- }
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- public delegate void GetCountriesInUseCompletedEventHandler(object sender, GetCountriesInUseCompletedEventArgs e);
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- [DebuggerStepThrough()]
- [DesignerCategory("code")]
- public partial class GetCountriesInUseCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
- {
-
- private object[] results;
-
- internal GetCountriesInUseCompletedEventArgs(object[] results, System.Exception exception, bool cancelled,
- object userState) :
- base(exception, cancelled, userState)
- {
- this.results = results;
- }
-
- ///
- public Country[] Result
- {
- get
- {
- this.RaiseExceptionIfNecessary();
- return ((Country[]) (this.results[0]));
- }
- }
- }
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- public delegate void GetCitiesForCountryCompletedEventHandler(object sender, GetCitiesForCountryCompletedEventArgs e
- );
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- [DebuggerStepThrough()]
- [DesignerCategory("code")]
- public partial class GetCitiesForCountryCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
- {
-
- private object[] results;
-
- internal GetCitiesForCountryCompletedEventArgs(object[] results, System.Exception exception, bool cancelled,
- object userState) :
- base(exception, cancelled, userState)
- {
- this.results = results;
- }
-
- ///
- public City[] Result
- {
- get
- {
- this.RaiseExceptionIfNecessary();
- return ((City[]) (this.results[0]));
- }
- }
- }
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- public delegate void GetPostalCodesForCountryCompletedEventHandler(
- object sender, GetPostalCodesForCountryCompletedEventArgs e);
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- [DebuggerStepThrough()]
- [DesignerCategory("code")]
- public partial class GetPostalCodesForCountryCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
- {
-
- private object[] results;
-
- internal GetPostalCodesForCountryCompletedEventArgs(object[] results, System.Exception exception, bool cancelled,
- object userState) :
- base(exception, cancelled, userState)
- {
- this.results = results;
- }
-
- ///
- public PostalCode[] Result
- {
- get
- {
- this.RaiseExceptionIfNecessary();
- return ((PostalCode[]) (this.results[0]));
- }
- }
- }
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- public delegate void GetGeographyCompletedEventHandler(object sender, GetGeographyCompletedEventArgs e);
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- [DebuggerStepThrough()]
- [DesignerCategory("code")]
- public partial class GetGeographyCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
- {
-
- private object[] results;
-
- internal GetGeographyCompletedEventArgs(object[] results, System.Exception exception, bool cancelled,
- object userState) :
- base(exception, cancelled, userState)
- {
- this.results = results;
- }
-
- ///
- public Geography Result
- {
- get
- {
- this.RaiseExceptionIfNecessary();
- return ((Geography) (this.results[0]));
- }
- }
- }
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- public delegate void GetGeographyForCountryCompletedEventHandler(
- object sender, GetGeographyForCountryCompletedEventArgs e);
-
- ///
- [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
- [DebuggerStepThrough()]
- [DesignerCategory("code")]
- public partial class GetGeographyForCountryCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
- {
-
- private object[] results;
-
- internal GetGeographyForCountryCompletedEventArgs(object[] results, System.Exception exception, bool cancelled,
- object userState) :
- base(exception, cancelled, userState)
- {
- this.results = results;
- }
-
- ///
- public Geography Result
- {
- get
- {
- this.RaiseExceptionIfNecessary();
- return ((Geography) (this.results[0]));
- }
- }
- }
-
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.296
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Web.Services;
+using System.Web.Services.Protocols;
+using System.Xml.Serialization;
+
+//
+// This source code was auto-generated by wsdl, Version=4.0.30319.1.
+//
+
+
+namespace Swarmops.Logic.Automation
+{
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ [DebuggerStepThrough()]
+ [DesignerCategory("code")]
+ [WebServiceBinding(Name = "GetGeographyDataSoap", Namespace = "http://swarmops.com/")]
+ [XmlInclude(typeof (BasicGeography))]
+ [XmlInclude(typeof (BasicPostalCode))]
+ [XmlInclude(typeof (BasicCity))]
+ [XmlInclude(typeof (BasicCountry))]
+ public partial class GetGeographyData : System.Web.Services.Protocols.SoapHttpClientProtocol
+ {
+
+ private System.Threading.SendOrPostCallback GetCountriesOperationCompleted;
+
+ private System.Threading.SendOrPostCallback GetCountriesInUseOperationCompleted;
+
+ private System.Threading.SendOrPostCallback GetCitiesForCountryOperationCompleted;
+
+ private System.Threading.SendOrPostCallback GetPostalCodesForCountryOperationCompleted;
+
+ private System.Threading.SendOrPostCallback GetGeographyOperationCompleted;
+
+ private System.Threading.SendOrPostCallback GetGeographyForCountryOperationCompleted;
+
+ ///
+ public GetGeographyData()
+ {
+ this.Url = "http://live.swarmops.com/Automation/GetGeographyData.asmx";
+ }
+
+ ///
+ public event GetCountriesCompletedEventHandler GetCountriesCompleted;
+
+ ///
+ public event GetCountriesInUseCompletedEventHandler GetCountriesInUseCompleted;
+
+ ///
+ public event GetCitiesForCountryCompletedEventHandler GetCitiesForCountryCompleted;
+
+ ///
+ public event GetPostalCodesForCountryCompletedEventHandler GetPostalCodesForCountryCompleted;
+
+ ///
+ public event GetGeographyCompletedEventHandler GetGeographyCompleted;
+
+ ///
+ public event GetGeographyForCountryCompletedEventHandler GetGeographyForCountryCompleted;
+
+ ///
+ [SoapDocumentMethod("http://swarmops.com/GetCountries",
+ RequestNamespace = "http://swarmops.com/", ResponseNamespace = "http://swarmops.com/",
+ Use = System.Web.Services.Description.SoapBindingUse.Literal,
+ ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public Country[] GetCountries()
+ {
+ object[] results = this.Invoke("GetCountries", new object[0]);
+ return ((Country[]) (results[0]));
+ }
+
+ ///
+ public System.IAsyncResult BeginGetCountries(System.AsyncCallback callback, object asyncState)
+ {
+ return this.BeginInvoke("GetCountries", new object[0], callback, asyncState);
+ }
+
+ ///
+ public Country[] EndGetCountries(System.IAsyncResult asyncResult)
+ {
+ object[] results = this.EndInvoke(asyncResult);
+ return ((Country[]) (results[0]));
+ }
+
+ ///
+ public void GetCountriesAsync()
+ {
+ this.GetCountriesAsync(null);
+ }
+
+ ///
+ public void GetCountriesAsync(object userState)
+ {
+ if ((this.GetCountriesOperationCompleted == null))
+ {
+ this.GetCountriesOperationCompleted =
+ new System.Threading.SendOrPostCallback(this.OnGetCountriesOperationCompleted);
+ }
+ this.InvokeAsync("GetCountries", new object[0], this.GetCountriesOperationCompleted, userState);
+ }
+
+ private void OnGetCountriesOperationCompleted(object arg)
+ {
+ if ((this.GetCountriesCompleted != null))
+ {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs =
+ ((System.Web.Services.Protocols.InvokeCompletedEventArgs) (arg));
+ this.GetCountriesCompleted(this,
+ new GetCountriesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error,
+ invokeArgs.Cancelled, invokeArgs.UserState));
+ }
+ }
+
+ ///
+ [SoapDocumentMethod("http://swarmops.com/GetCountriesInUse",
+ RequestNamespace = "http://swarmops.com/", ResponseNamespace = "http://swarmops.com/",
+ Use = System.Web.Services.Description.SoapBindingUse.Literal,
+ ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public Country[] GetCountriesInUse()
+ {
+ object[] results = this.Invoke("GetCountriesInUse", new object[0]);
+ return ((Country[]) (results[0]));
+ }
+
+ ///
+ public System.IAsyncResult BeginGetCountriesInUse(System.AsyncCallback callback, object asyncState)
+ {
+ return this.BeginInvoke("GetCountriesInUse", new object[0], callback, asyncState);
+ }
+
+ ///
+ public Country[] EndGetCountriesInUse(System.IAsyncResult asyncResult)
+ {
+ object[] results = this.EndInvoke(asyncResult);
+ return ((Country[]) (results[0]));
+ }
+
+ ///
+ public void GetCountriesInUseAsync()
+ {
+ this.GetCountriesInUseAsync(null);
+ }
+
+ ///
+ public void GetCountriesInUseAsync(object userState)
+ {
+ if ((this.GetCountriesInUseOperationCompleted == null))
+ {
+ this.GetCountriesInUseOperationCompleted =
+ new System.Threading.SendOrPostCallback(this.OnGetCountriesInUseOperationCompleted);
+ }
+ this.InvokeAsync("GetCountriesInUse", new object[0], this.GetCountriesInUseOperationCompleted, userState);
+ }
+
+ private void OnGetCountriesInUseOperationCompleted(object arg)
+ {
+ if ((this.GetCountriesInUseCompleted != null))
+ {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs =
+ ((System.Web.Services.Protocols.InvokeCompletedEventArgs) (arg));
+ this.GetCountriesInUseCompleted(this,
+ new GetCountriesInUseCompletedEventArgs(invokeArgs.Results,
+ invokeArgs.Error,
+ invokeArgs.Cancelled,
+ invokeArgs.UserState));
+ }
+ }
+
+ ///
+ [SoapDocumentMethod("http://swarmops.com/GetCitiesForCountry",
+ RequestNamespace = "http://swarmops.com/", ResponseNamespace = "http://swarmops.com/",
+ Use = System.Web.Services.Description.SoapBindingUse.Literal,
+ ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public City[] GetCitiesForCountry(string countryCode)
+ {
+ object[] results = this.Invoke("GetCitiesForCountry", new object[]
+ {
+ countryCode
+ });
+ return ((City[]) (results[0]));
+ }
+
+ ///
+ public System.IAsyncResult BeginGetCitiesForCountry(string countryCode, System.AsyncCallback callback,
+ object asyncState)
+ {
+ return this.BeginInvoke("GetCitiesForCountry", new object[]
+ {
+ countryCode
+ }, callback, asyncState);
+ }
+
+ ///
+ public City[] EndGetCitiesForCountry(System.IAsyncResult asyncResult)
+ {
+ object[] results = this.EndInvoke(asyncResult);
+ return ((City[]) (results[0]));
+ }
+
+ ///
+ public void GetCitiesForCountryAsync(string countryCode)
+ {
+ this.GetCitiesForCountryAsync(countryCode, null);
+ }
+
+ ///
+ public void GetCitiesForCountryAsync(string countryCode, object userState)
+ {
+ if ((this.GetCitiesForCountryOperationCompleted == null))
+ {
+ this.GetCitiesForCountryOperationCompleted =
+ new System.Threading.SendOrPostCallback(this.OnGetCitiesForCountryOperationCompleted);
+ }
+ this.InvokeAsync("GetCitiesForCountry", new object[]
+ {
+ countryCode
+ }, this.GetCitiesForCountryOperationCompleted, userState);
+ }
+
+ private void OnGetCitiesForCountryOperationCompleted(object arg)
+ {
+ if ((this.GetCitiesForCountryCompleted != null))
+ {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs =
+ ((System.Web.Services.Protocols.InvokeCompletedEventArgs) (arg));
+ this.GetCitiesForCountryCompleted(this,
+ new GetCitiesForCountryCompletedEventArgs(invokeArgs.Results,
+ invokeArgs.Error,
+ invokeArgs.Cancelled,
+ invokeArgs.UserState));
+ }
+ }
+
+ ///
+ [SoapDocumentMethod("http://swarmops.com/GetPostalCodesForCountry",
+ RequestNamespace = "http://swarmops.com/", ResponseNamespace = "http://swarmops.com/",
+ Use = System.Web.Services.Description.SoapBindingUse.Literal,
+ ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public PostalCode[] GetPostalCodesForCountry(string countryCode)
+ {
+ object[] results = this.Invoke("GetPostalCodesForCountry", new object[]
+ {
+ countryCode
+ });
+ return ((PostalCode[]) (results[0]));
+ }
+
+ ///
+ public System.IAsyncResult BeginGetPostalCodesForCountry(string countryCode, System.AsyncCallback callback,
+ object asyncState)
+ {
+ return this.BeginInvoke("GetPostalCodesForCountry", new object[]
+ {
+ countryCode
+ }, callback, asyncState);
+ }
+
+ ///
+ public PostalCode[] EndGetPostalCodesForCountry(System.IAsyncResult asyncResult)
+ {
+ object[] results = this.EndInvoke(asyncResult);
+ return ((PostalCode[]) (results[0]));
+ }
+
+ ///
+ public void GetPostalCodesForCountryAsync(string countryCode)
+ {
+ this.GetPostalCodesForCountryAsync(countryCode, null);
+ }
+
+ ///
+ public void GetPostalCodesForCountryAsync(string countryCode, object userState)
+ {
+ if ((this.GetPostalCodesForCountryOperationCompleted == null))
+ {
+ this.GetPostalCodesForCountryOperationCompleted =
+ new System.Threading.SendOrPostCallback(this.OnGetPostalCodesForCountryOperationCompleted);
+ }
+ this.InvokeAsync("GetPostalCodesForCountry", new object[]
+ {
+ countryCode
+ }, this.GetPostalCodesForCountryOperationCompleted,
+ userState);
+ }
+
+ private void OnGetPostalCodesForCountryOperationCompleted(object arg)
+ {
+ if ((this.GetPostalCodesForCountryCompleted != null))
+ {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs =
+ ((System.Web.Services.Protocols.InvokeCompletedEventArgs) (arg));
+ this.GetPostalCodesForCountryCompleted(this,
+ new GetPostalCodesForCountryCompletedEventArgs(
+ invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled,
+ invokeArgs.UserState));
+ }
+ }
+
+ ///
+ [SoapDocumentMethod("http://swarmops.com/GetGeography",
+ RequestNamespace = "http://swarmops.com/", ResponseNamespace = "http://swarmops.com/",
+ Use = System.Web.Services.Description.SoapBindingUse.Literal,
+ ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public Geography GetGeography(int nodeId)
+ {
+ object[] results = this.Invoke("GetGeography", new object[]
+ {
+ nodeId
+ });
+ return ((Geography) (results[0]));
+ }
+
+ ///
+ public System.IAsyncResult BeginGetGeography(int nodeId, System.AsyncCallback callback, object asyncState)
+ {
+ return this.BeginInvoke("GetGeography", new object[]
+ {
+ nodeId
+ }, callback, asyncState);
+ }
+
+ ///
+ public Geography EndGetGeography(System.IAsyncResult asyncResult)
+ {
+ object[] results = this.EndInvoke(asyncResult);
+ return ((Geography) (results[0]));
+ }
+
+ ///
+ public void GetGeographyAsync(int nodeId)
+ {
+ this.GetGeographyAsync(nodeId, null);
+ }
+
+ ///
+ public void GetGeographyAsync(int nodeId, object userState)
+ {
+ if ((this.GetGeographyOperationCompleted == null))
+ {
+ this.GetGeographyOperationCompleted =
+ new System.Threading.SendOrPostCallback(this.OnGetGeographyOperationCompleted);
+ }
+ this.InvokeAsync("GetGeography", new object[]
+ {
+ nodeId
+ }, this.GetGeographyOperationCompleted, userState);
+ }
+
+ private void OnGetGeographyOperationCompleted(object arg)
+ {
+ if ((this.GetGeographyCompleted != null))
+ {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs =
+ ((System.Web.Services.Protocols.InvokeCompletedEventArgs) (arg));
+ this.GetGeographyCompleted(this,
+ new GetGeographyCompletedEventArgs(invokeArgs.Results, invokeArgs.Error,
+ invokeArgs.Cancelled, invokeArgs.UserState));
+ }
+ }
+
+ ///
+ [SoapDocumentMethod("http://swarmops.com/GetGeographyForCountry",
+ RequestNamespace = "http://swarmops.com/", ResponseNamespace = "http://swarmops.com/",
+ Use = System.Web.Services.Description.SoapBindingUse.Literal,
+ ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public Geography GetGeographyForCountry(string countryCode)
+ {
+ object[] results = this.Invoke("GetGeographyForCountry", new object[]
+ {
+ countryCode
+ });
+ return ((Geography) (results[0]));
+ }
+
+ ///
+ public System.IAsyncResult BeginGetGeographyForCountry(string countryCode, System.AsyncCallback callback,
+ object asyncState)
+ {
+ return this.BeginInvoke("GetGeographyForCountry", new object[]
+ {
+ countryCode
+ }, callback, asyncState);
+ }
+
+ ///
+ public Geography EndGetGeographyForCountry(System.IAsyncResult asyncResult)
+ {
+ object[] results = this.EndInvoke(asyncResult);
+ return ((Geography) (results[0]));
+ }
+
+ ///
+ public void GetGeographyForCountryAsync(string countryCode)
+ {
+ this.GetGeographyForCountryAsync(countryCode, null);
+ }
+
+ ///
+ public void GetGeographyForCountryAsync(string countryCode, object userState)
+ {
+ if ((this.GetGeographyForCountryOperationCompleted == null))
+ {
+ this.GetGeographyForCountryOperationCompleted =
+ new System.Threading.SendOrPostCallback(this.OnGetGeographyForCountryOperationCompleted);
+ }
+ this.InvokeAsync("GetGeographyForCountry", new object[]
+ {
+ countryCode
+ }, this.GetGeographyForCountryOperationCompleted, userState);
+ }
+
+ private void OnGetGeographyForCountryOperationCompleted(object arg)
+ {
+ if ((this.GetGeographyForCountryCompleted != null))
+ {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs =
+ ((System.Web.Services.Protocols.InvokeCompletedEventArgs) (arg));
+ this.GetGeographyForCountryCompleted(this,
+ new GetGeographyForCountryCompletedEventArgs(invokeArgs.Results,
+ invokeArgs.Error,
+ invokeArgs.Cancelled,
+ invokeArgs.UserState));
+ }
+ }
+
+ ///
+ public new void CancelAsync(object userState)
+ {
+ base.CancelAsync(userState);
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ [Serializable()]
+ [DebuggerStepThrough()]
+ [DesignerCategory("code")]
+ [XmlType(Namespace = "http://swarmops.com/")]
+ public partial class Country : BasicCountry
+ {
+ }
+
+ ///
+ [XmlInclude(typeof (Country))]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ [Serializable()]
+ [DebuggerStepThrough()]
+ [DesignerCategory("code")]
+ [XmlType(Namespace = "http://swarmops.com/")]
+ public partial class BasicCountry
+ {
+
+ private int countryIdField;
+
+ private string nameField;
+
+ private string codeField;
+
+ private string cultureField;
+
+ private int geographyIdField;
+
+ private int postalCodeLengthField;
+
+ ///
+ public int CountryId
+ {
+ get { return this.countryIdField; }
+ set { this.countryIdField = value; }
+ }
+
+ ///
+ public int PostalCodeLength
+ {
+ get { return this.postalCodeLengthField; }
+ set { this.postalCodeLengthField = value; }
+ }
+
+ ///
+ public string Name
+ {
+ get { return this.nameField; }
+ set { this.nameField = value; }
+ }
+
+ ///
+ public string Code
+ {
+ get { return this.codeField; }
+ set { this.codeField = value; }
+ }
+
+ ///
+ public string Culture
+ {
+ get { return this.cultureField; }
+ set { this.cultureField = value; }
+ }
+
+ ///
+ public int GeographyId
+ {
+ get { return this.geographyIdField; }
+ set { this.geographyIdField = value; }
+ }
+ }
+
+ ///
+ [XmlInclude(typeof (Geography))]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ [Serializable()]
+ [DebuggerStepThrough()]
+ [DesignerCategory("code")]
+ [XmlType(Namespace = "http://swarmops.com/")]
+ public partial class BasicGeography
+ {
+
+ private int geographyIdField;
+
+ private int parentGeographyIdField;
+
+ private string nameField;
+
+ private int generationField;
+
+ ///
+ public int GeographyId
+ {
+ get { return this.geographyIdField; }
+ set { this.geographyIdField = value; }
+ }
+
+ ///
+ public int ParentGeographyId
+ {
+ get { return this.parentGeographyIdField; }
+ set { this.parentGeographyIdField = value; }
+ }
+
+ ///
+ public string Name
+ {
+ get { return this.nameField; }
+ set { this.nameField = value; }
+ }
+
+ ///
+ public int Generation
+ {
+ get { return this.generationField; }
+ set { this.generationField = value; }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ [Serializable()]
+ [DebuggerStepThrough()]
+ [DesignerCategory("code")]
+ [XmlType(Namespace = "http://swarmops.com/")]
+ public partial class Geography : BasicGeography
+ {
+
+ private Geography[] childrenField;
+
+ ///
+ public Geography[] Children
+ {
+ get { return this.childrenField; }
+ set { this.childrenField = value; }
+ }
+ }
+
+ ///
+ [XmlInclude(typeof (PostalCode))]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ [Serializable()]
+ [DebuggerStepThrough()]
+ [DesignerCategory("code")]
+ [XmlType(Namespace = "http://swarmops.com/")]
+ public partial class BasicPostalCode
+ {
+
+ private int postalCodeIdField;
+
+ private string postalCodeField;
+
+ private int cityIdField;
+
+ private int countryIdField;
+
+ ///
+ public int PostalCodeId
+ {
+ get { return this.postalCodeIdField; }
+ set { this.postalCodeIdField = value; }
+ }
+
+ ///
+ public string PostalCode
+ {
+ get { return this.postalCodeField; }
+ set { this.postalCodeField = value; }
+ }
+
+ ///
+ public int CityId
+ {
+ get { return this.cityIdField; }
+ set { this.cityIdField = value; }
+ }
+
+ ///
+ public int CountryId
+ {
+ get { return this.countryIdField; }
+ set { this.countryIdField = value; }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ [Serializable()]
+ [DebuggerStepThrough()]
+ [DesignerCategory("code")]
+ [XmlType(Namespace = "http://swarmops.com/")]
+ public partial class PostalCode : BasicPostalCode
+ {
+ }
+
+ ///
+ [XmlInclude(typeof (City))]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ [Serializable()]
+ [DebuggerStepThrough()]
+ [DesignerCategory("code")]
+ [XmlType(Namespace = "http://swarmops.com/")]
+ public partial class BasicCity
+ {
+
+ private int cityIdField;
+
+ private string nameField;
+
+ private int countryIdField;
+
+ private int geographyIdField;
+
+ ///
+ public int CityId
+ {
+ get { return this.cityIdField; }
+ set { this.cityIdField = value; }
+ }
+
+ ///
+ public string Name
+ {
+ get { return this.nameField; }
+ set { this.nameField = value; }
+ }
+
+ ///
+ public int CountryId
+ {
+ get { return this.countryIdField; }
+ set { this.countryIdField = value; }
+ }
+
+ ///
+ public int GeographyId
+ {
+ get { return this.geographyIdField; }
+ set { this.geographyIdField = value; }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ [Serializable()]
+ [DebuggerStepThrough()]
+ [DesignerCategory("code")]
+ [XmlType(Namespace = "http://swarmops.com/")]
+ public partial class City : BasicCity
+ {
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ public delegate void GetCountriesCompletedEventHandler(object sender, GetCountriesCompletedEventArgs e);
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ [DebuggerStepThrough()]
+ [DesignerCategory("code")]
+ public partial class GetCountriesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
+ {
+
+ private object[] results;
+
+ internal GetCountriesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled,
+ object userState) :
+ base(exception, cancelled, userState)
+ {
+ this.results = results;
+ }
+
+ ///
+ public Country[] Result
+ {
+ get
+ {
+ this.RaiseExceptionIfNecessary();
+ return ((Country[]) (this.results[0]));
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ public delegate void GetCountriesInUseCompletedEventHandler(object sender, GetCountriesInUseCompletedEventArgs e);
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ [DebuggerStepThrough()]
+ [DesignerCategory("code")]
+ public partial class GetCountriesInUseCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
+ {
+
+ private object[] results;
+
+ internal GetCountriesInUseCompletedEventArgs(object[] results, System.Exception exception, bool cancelled,
+ object userState) :
+ base(exception, cancelled, userState)
+ {
+ this.results = results;
+ }
+
+ ///
+ public Country[] Result
+ {
+ get
+ {
+ this.RaiseExceptionIfNecessary();
+ return ((Country[]) (this.results[0]));
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ public delegate void GetCitiesForCountryCompletedEventHandler(object sender, GetCitiesForCountryCompletedEventArgs e
+ );
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ [DebuggerStepThrough()]
+ [DesignerCategory("code")]
+ public partial class GetCitiesForCountryCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
+ {
+
+ private object[] results;
+
+ internal GetCitiesForCountryCompletedEventArgs(object[] results, System.Exception exception, bool cancelled,
+ object userState) :
+ base(exception, cancelled, userState)
+ {
+ this.results = results;
+ }
+
+ ///
+ public City[] Result
+ {
+ get
+ {
+ this.RaiseExceptionIfNecessary();
+ return ((City[]) (this.results[0]));
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ public delegate void GetPostalCodesForCountryCompletedEventHandler(
+ object sender, GetPostalCodesForCountryCompletedEventArgs e);
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ [DebuggerStepThrough()]
+ [DesignerCategory("code")]
+ public partial class GetPostalCodesForCountryCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
+ {
+
+ private object[] results;
+
+ internal GetPostalCodesForCountryCompletedEventArgs(object[] results, System.Exception exception, bool cancelled,
+ object userState) :
+ base(exception, cancelled, userState)
+ {
+ this.results = results;
+ }
+
+ ///
+ public PostalCode[] Result
+ {
+ get
+ {
+ this.RaiseExceptionIfNecessary();
+ return ((PostalCode[]) (this.results[0]));
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ public delegate void GetGeographyCompletedEventHandler(object sender, GetGeographyCompletedEventArgs e);
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ [DebuggerStepThrough()]
+ [DesignerCategory("code")]
+ public partial class GetGeographyCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
+ {
+
+ private object[] results;
+
+ internal GetGeographyCompletedEventArgs(object[] results, System.Exception exception, bool cancelled,
+ object userState) :
+ base(exception, cancelled, userState)
+ {
+ this.results = results;
+ }
+
+ ///
+ public Geography Result
+ {
+ get
+ {
+ this.RaiseExceptionIfNecessary();
+ return ((Geography) (this.results[0]));
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ public delegate void GetGeographyForCountryCompletedEventHandler(
+ object sender, GetGeographyForCountryCompletedEventArgs e);
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
+ [DebuggerStepThrough()]
+ [DesignerCategory("code")]
+ public partial class GetGeographyForCountryCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
+ {
+
+ private object[] results;
+
+ internal GetGeographyForCountryCompletedEventArgs(object[] results, System.Exception exception, bool cancelled,
+ object userState) :
+ base(exception, cancelled, userState)
+ {
+ this.results = results;
+ }
+
+ ///
+ public Geography Result
+ {
+ get
+ {
+ this.RaiseExceptionIfNecessary();
+ return ((Geography) (this.results[0]));
+ }
+ }
+ }
+
}
\ No newline at end of file
diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj
index 69ec7784..3ec05bf3 100644
--- a/Logic/Logic.csproj
+++ b/Logic/Logic.csproj
@@ -67,6 +67,7 @@
+
@@ -100,6 +101,9 @@
True
Logic.Communications.Transmission.MailPayload.resx
+
+ Component
+
diff --git a/Logic/Structure/GeographyUpdate.cs b/Logic/Structure/GeographyUpdate.cs
index 95b55075..96aa8c2a 100644
--- a/Logic/Structure/GeographyUpdate.cs
+++ b/Logic/Structure/GeographyUpdate.cs
@@ -3,9 +3,16 @@ using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using Swarmops.Basic.Types.Structure;
using Swarmops.Database;
+using Swarmops.Logic.Automation;
+using Swarmops.Logic.Cache;
+using MasterGeography = Swarmops.Logic.Automation.Geography;
+using MasterCity = Swarmops.Logic.Automation.City;
+using MasterPostalCode = Swarmops.Logic.Automation.PostalCode;
+using GeographyDataLoader = Swarmops.Logic.Automation.GetGeographyData;
namespace Swarmops.Logic.Structure
{
@@ -50,5 +57,203 @@ namespace Swarmops.Logic.Structure
return FromBasic (SwarmDb.GetDatabaseForWriting().GetGeographyUpdate (identity)); // "ForWriting" intentional to avoid db replication race conditions
}
+ public new bool Processed
+ {
+ get { return base.Processed; }
+ set
+ {
+ if (value != base.Processed && value)
+ {
+ SwarmDb.GetDatabaseForWriting().SetGeographyUpdateProcessed (this.Identity);
+ base.Processed = true;
+ }
+ }
+ }
+
+ public void Run()
+ {
+ // Run this geography update and apply it to the database.
+
+ if (DateTime.UtcNow < EffectiveDateTime)
+ {
+ // we shouldn't process this yet - return unprocessed
+ return; // DESIGN: throw exception instead?
+ }
+
+ switch (UpdateType)
+ {
+ case "PrimeCountry":
+ PrimeCountry (CountryCode); // static fn so needs to pass country code
+
+ break;
+ case "SetPostalCodeData":
+ break;
+ case "SetCountryPosition":
+ break;
+ default:
+ throw new NotImplementedException("Unimplemented geography update type: " + UpdateType);
+ }
+
+ Processed = true;
+ }
+
+ public static void PrimeCountry (string countryCode)
+ {
+ Country country = Country.FromCode (countryCode);
+ if (country.GeographyId != Geography.RootIdentity)
+ {
+ // already initialized
+ return;
+ }
+
+ GeographyDataLoader geoDataLoader = new GeographyDataLoader();
+
+ MasterGeography geography = geoDataLoader.GetGeographyForCountry(countryCode);
+ MasterCity[] cities = geoDataLoader.GetCitiesForCountry(countryCode);
+ MasterPostalCode[] postalCodes = geoDataLoader.GetPostalCodesForCountry(countryCode);
+
+ // ID Translation lists
+
+ Dictionary geographyIdTranslation = new Dictionary();
+ Dictionary cityIdTranslation = new Dictionary();
+ Dictionary cityIdsUsedLookup = new Dictionary();
+
+ // Create the country's root geography
+
+ int countryRootGeographyId = SwarmDb.GetDatabaseForWriting().CreateGeography(geography.Name,
+ Geography.RootIdentity);
+ geographyIdTranslation[geography.GeographyId] = countryRootGeographyId;
+ SwarmDb.GetDatabaseForWriting().SetCountryGeographyId(country.Identity,
+ countryRootGeographyId);
+
+ int count = 0;
+ int total = InitDatabaseThreadCountGeographyChildren(geography.Children);
+
+ InitDatabaseThreadCreateGeographyChildren(geography.Children, countryRootGeographyId,
+ ref geographyIdTranslation, ref count, total);
+
+ // Find which cities are actually used
+
+ foreach (MasterPostalCode postalCode in postalCodes)
+ {
+ cityIdsUsedLookup[postalCode.CityId] = true;
+ }
+
+ GuidCache.Set ("DbInitProgress", "(finalizing)");
+
+ // Insert cities
+
+ int newCountryId = country.Identity;
+
+ int cityIdHighwater =
+ SwarmDb.GetDatabaseForAdmin().ExecuteAdminCommandScalar("SELECT Max(CityId) FROM Cities;");
+
+ StringBuilder sqlCityBuild =
+ new StringBuilder("INSERT INTO Cities (CityName, GeographyId, CountryId, Comment) VALUES ", 65536);
+ bool insertComma = false;
+
+ foreach (MasterCity city in cities)
+ {
+ if (!geographyIdTranslation.ContainsKey(city.GeographyId))
+ {
+ cityIdsUsedLookup[city.CityId] = false; // force non-use of invalid city
+ }
+
+ if (cityIdsUsedLookup[city.CityId])
+ {
+ int newGeographyId = geographyIdTranslation[city.GeographyId];
+
+ if (insertComma)
+ {
+ sqlCityBuild.Append(",");
+ }
+
+ sqlCityBuild.Append("('" + city.Name.Replace("'", "\\'") + "'," + newGeographyId + "," +
+ newCountryId + ",'')");
+ insertComma = true;
+
+ cityIdTranslation[city.CityId] = ++cityIdHighwater; // Note that we assume the assigned ID here.
+ }
+ }
+
+ sqlCityBuild.Append(";");
+
+ SwarmDb.GetDatabaseForAdmin().ExecuteAdminCommand(sqlCityBuild.ToString());
+ // Inserts all cities in one bulk op, to save roundtrips
+
+ // Insert postal codes, if any
+
+ if (postalCodes.Length > 0)
+ {
+ StringBuilder sqlBuild =
+ new StringBuilder ("INSERT INTO PostalCodes (PostalCode, CityId, CountryId) VALUES ", 65536);
+ insertComma = false;
+
+ foreach (MasterPostalCode postalCode in postalCodes)
+ {
+ if (cityIdsUsedLookup[postalCode.CityId] == false)
+ {
+ // Remnants of invalid pointers
+
+ continue;
+ }
+
+ int newCityId = cityIdTranslation[postalCode.CityId];
+
+ if (insertComma)
+ {
+ sqlBuild.Append (",");
+ }
+
+ sqlBuild.Append ("('" + postalCode.PostalCode.Replace ("'", "\\'") + "'," + newCityId + "," +
+ newCountryId + ")");
+ insertComma = true;
+ }
+
+ sqlBuild.Append (";");
+
+ // Insert all postal codes in one bulk op, to save roundtrips
+ SwarmDb.GetDatabaseForAdmin().ExecuteAdminCommand(sqlBuild.ToString());
+ }
+ }
+
+
+ private static int InitDatabaseThreadCountGeographyChildren(MasterGeography[] children)
+ {
+ int count = 0;
+
+ foreach (MasterGeography child in children)
+ {
+ count++;
+ count += InitDatabaseThreadCountGeographyChildren(child.Children);
+ }
+
+ return count;
+ }
+
+
+
+ private static void InitDatabaseThreadCreateGeographyChildren(MasterGeography[] children,
+ int parentGeographyId,
+ ref Dictionary geographyIdTranslation, ref int count, int total)
+ {
+ count++;
+
+ foreach (MasterGeography geography in children)
+ {
+ int newGeographyId = SwarmDb.GetDatabaseForWriting().CreateGeography(geography.Name, parentGeographyId);
+ geographyIdTranslation[geography.GeographyId] = newGeographyId;
+
+ InitDatabaseThreadCreateGeographyChildren(geography.Children, newGeographyId, ref geographyIdTranslation,
+ ref count, total);
+ }
+
+ if (total != 0)
+ {
+ GuidCache.Set("DbInitProgress", String.Format ("({0}%)", count * 100 / total));
+ // shouldn't be here but wtf
+ }
+ }
+
}
}
diff --git a/Site5/Pages/v5/Init/Default.aspx.cs b/Site5/Pages/v5/Init/Default.aspx.cs
index 05afdac9..f903fcb5 100644
--- a/Site5/Pages/v5/Init/Default.aspx.cs
+++ b/Site5/Pages/v5/Init/Default.aspx.cs
@@ -13,16 +13,17 @@ using System.Web.UI;
using Resources;
using Swarmops.Basic.Enums;
using Swarmops.Database;
+using Swarmops.Logic.Cache;
using Swarmops.Logic.Financial;
using Swarmops.Logic.Security;
using Swarmops.Logic.Structure;
using Swarmops.Logic.Support;
using Swarmops.Logic.Swarm;
-using Swarmops.Site.Automation;
-using City = Swarmops.Site.Automation.City;
-using Country = Swarmops.Site.Automation.Country;
-using Geography = Swarmops.Site.Automation.Geography;
-using PostalCode = Swarmops.Site.Automation.PostalCode;
+using Swarmops.Logic.Automation;
+using City = Swarmops.Logic.Automation.City;
+using Country = Swarmops.Logic.Automation.Country;
+using Geography = Swarmops.Logic.Automation.Geography;
+using PostalCode = Swarmops.Logic.Automation.PostalCode;
public partial class Pages_v5_Init_Default : Page
{
@@ -371,10 +372,7 @@ public partial class Pages_v5_Init_Default : Page
// Create translation lists
- Dictionary geographyIdTranslation = new Dictionary();
- Dictionary cityIdTranslation = new Dictionary();
Dictionary countryIdTranslation = new Dictionary();
- Dictionary cityIdsUsedLookup = new Dictionary();
// Initialize the root geography (which becomes #1 if everything works)
@@ -429,142 +427,10 @@ public partial class Pages_v5_Init_Default : Page
{
// Get the geography layout
- _initMessage = "Retrieving geography for " + countryCode + "...";
+ _initMessage = "Initializing geography for " + countryCode + "... ";
Thread.Sleep (100);
- Geography geography = geoDataFetcher.GetGeographyForCountry (countryCode);
-
- _initProgress = 10 + (int) (countryCount*initStepPerCountry + initStepPerCountry/6);
- _initMessage = "Setting up geography for " + countryCode + "...";
- Thread.Sleep (100);
-
- // Create the country's root geography
-
- int countryRootGeographyId = SwarmDb.GetDatabaseForWriting().CreateGeography (geography.Name,
- rootGeographyId);
- geographyIdTranslation[geography.GeographyId] = countryRootGeographyId;
- SwarmDb.GetDatabaseForWriting().SetCountryGeographyId (countryIdTranslation[countryCode],
- countryRootGeographyId);
-
- count = 0;
- total = InitDatabaseThreadCountGeographyChildren (geography.Children);
-
- InitDatabaseThreadCreateGeographyChildren (geography.Children, countryRootGeographyId,
- ref geographyIdTranslation, countryCode, ref count, total);
-
- _initProgress = 10 + (int) (countryCount*initStepPerCountry + initStepPerCountry/3);
- _initMessage = "Retrieving cities for " + countryCode + "...";
- Thread.Sleep (100);
-
- // Get the postal codes and cities
-
- City[] cities = null;
-
- try
- {
- cities = geoDataFetcher.GetCitiesForCountry (countryCode);
- }
- catch (Exception)
- // This is a SoapHeaderException in VS debugging, but SOMETHING ELSE! in Mono runtime, so make it generic
- {
- // This is typically a country that isn't populated with cities yet. Ignore.
- countryCount++;
- continue;
- }
-
-
- _initProgress = 10 + (int) (countryCount*initStepPerCountry + initStepPerCountry/2);
- _initMessage = "Retrieving postal codes for " + countryCode + "...";
- Thread.Sleep (100);
-
- PostalCode[] postalCodes = geoDataFetcher.GetPostalCodesForCountry (countryCode);
-
- // Find which cities are actually used
-
- foreach (PostalCode postalCode in postalCodes)
- {
- cityIdsUsedLookup[postalCode.CityId] = true;
- }
-
- _initProgress = 10 + (int) (countryCount*initStepPerCountry + initStepPerCountry*2/3);
-
- // Insert cities
-
- int newCountryId = countryIdTranslation[countryCode];
-
- int cityIdHighwater =
- SwarmDb.GetDatabaseForAdmin().ExecuteAdminCommandScalar ("SELECT Max(CityId) FROM Cities;");
-
- _initMessage = string.Format ("Setting up {0:N0} cities for {1}...", cities.Length, countryCode);
-
- StringBuilder sqlCityBuild =
- new StringBuilder ("INSERT INTO Cities (CityName, GeographyId, CountryId, Comment) VALUES ", 65536);
- bool insertComma = false;
-
- foreach (City city in cities)
- {
- if (!geographyIdTranslation.ContainsKey (city.GeographyId))
- {
- cityIdsUsedLookup[city.CityId] = false; // force non-use of invalid city
- }
-
- if (cityIdsUsedLookup[city.CityId])
- {
- int newGeographyId = geographyIdTranslation[city.GeographyId];
-
- if (insertComma)
- {
- sqlCityBuild.Append (",");
- }
-
- sqlCityBuild.Append ("('" + city.Name.Replace ("'", "\\'") + "'," + newGeographyId + "," +
- newCountryId + ",'')");
- insertComma = true;
-
- cityIdTranslation[city.CityId] = ++cityIdHighwater; // Note that we assume the assigned ID here.
- }
- }
-
- sqlCityBuild.Append (";");
-
- SwarmDb.GetDatabaseForAdmin().ExecuteAdminCommand (sqlCityBuild.ToString());
- // Inserts all cities in one bulk op, to save roundtrips
-
- // Insert postal codes
-
- _initProgress = 10 + (int) (countryCount*initStepPerCountry + initStepPerCountry*5/6);
- _initMessage = string.Format ("Setting up {0:N0} postal codes for {1}...", postalCodes.Length,
- countryCode);
-
- StringBuilder sqlBuild =
- new StringBuilder ("INSERT INTO PostalCodes (PostalCode, CityId, CountryId) VALUES ", 65536);
- insertComma = false;
-
- foreach (PostalCode postalCode in postalCodes)
- {
- if (cityIdsUsedLookup[postalCode.CityId] == false)
- {
- // Remnants of invalid pointers
-
- continue;
- }
-
- int newCityId = cityIdTranslation[postalCode.CityId];
-
- if (insertComma)
- {
- sqlBuild.Append (",");
- }
-
- sqlBuild.Append ("('" + postalCode.PostalCode.Replace ("'", "\'") + "'," + newCityId + "," +
- newCountryId + ")");
- insertComma = true;
- }
-
- sqlBuild.Append (";");
-
- SwarmDb.GetDatabaseForAdmin().ExecuteAdminCommand (sqlBuild.ToString());
- // Inserts all postal codes in one bulk op, to save roundtrips
+ GeographyUpdate.PrimeCountry (countryCode);
countryCount++;
@@ -574,12 +440,13 @@ public partial class Pages_v5_Init_Default : Page
// Set Geography at baseline (TODO: Ask for what baseline we got)
Persistence.Key["LastGeographyUpdateId"] = "0";
+ Persistence.Key["LastGeographyUpdate"] = "1900-01-01";
// Set an installation ID
Persistence.Key["SwarmopsInstallationId"] = Guid.NewGuid().ToString();
- // Create initial currencies (European)
+ // Create initial currencies (European et al)
Currency.Create ("EUR", "Euros", "€");
Currency.Create ("USD", "US Dollars", "$");
@@ -611,42 +478,6 @@ public partial class Pages_v5_Init_Default : Page
Thread.Sleep (1000); // give some time for static var to stick and web interface to react before killing thread
}
- private static int InitDatabaseThreadCountGeographyChildren (Geography[] children)
- {
- int count = 0;
-
- foreach (Geography child in children)
- {
- count++;
- count += InitDatabaseThreadCountGeographyChildren (child.Children);
- }
-
- return count;
- }
-
- private static void InitDatabaseThreadCreateGeographyChildren (Geography[] children,
- int parentGeographyId,
- ref Dictionary geographyIdTranslation, string countryCode, ref int count, int total)
- {
- count++;
-
- foreach (Geography geography in children)
- {
- int newGeographyId = SwarmDb.GetDatabaseForWriting().CreateGeography (geography.Name, parentGeographyId);
- geographyIdTranslation[geography.GeographyId] = newGeographyId;
-
- InitDatabaseThreadCreateGeographyChildren (geography.Children, newGeographyId, ref geographyIdTranslation,
- countryCode, ref count, total);
- }
-
- if (total != 0)
- {
- _initMessage = String.Format ("Setting up geography for {0}... ({1}%)", countryCode, count*100/total);
- // shouldn't be here but wtf
- }
- Thread.Sleep (50);
- }
-
[WebMethod]
public static int GetInitProgress()
@@ -669,7 +500,7 @@ public partial class Pages_v5_Init_Default : Page
[WebMethod]
public static string GetInitProgressMessage()
{
- return _initMessage;
+ return _initMessage + GuidCache.Get ("DbInitProgress");
}
[WebMethod]