From d218e8e6d1181ca8e06cbc31c62f385628349361 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sat, 17 Nov 2012 18:23:01 +0000 Subject: [PATCH] Another quantum leap ahead - init is now loading database, provisioning geographies. Deploying to test on Mono. --- Database/Configuration.cs | 16 +- Database/Database-Constructors.cs | 12 +- Database/Database-Countries.cs | 28 +- Database/Database-Geographies.cs | 18 + Database/Database-Initialization.cs | 30 ++ Database/Database.csproj | 10 +- Database/DatabaseConnect.Designer.cs | 53 -- Database/DatabaseConnect.settings | 15 - Logic/Logic.csproj | 1 + Logic/Support/DatabaseMaintenance.cs | 52 ++ Site5/App_Code/GetGeographyData.cs | 754 +++++++++++++++++++++++++++ Site5/Pages/v5/Init/Default.aspx | 2 +- Site5/Pages/v5/Init/Default.aspx.cs | 105 +++- 13 files changed, 1002 insertions(+), 94 deletions(-) create mode 100644 Database/Database-Initialization.cs delete mode 100644 Database/DatabaseConnect.Designer.cs delete mode 100644 Database/DatabaseConnect.settings create mode 100644 Logic/Support/DatabaseMaintenance.cs create mode 100644 Site5/App_Code/GetGeographyData.cs diff --git a/Database/Configuration.cs b/Database/Configuration.cs index 0dc2e6d0..18a1a9a3 100644 --- a/Database/Configuration.cs +++ b/Database/Configuration.cs @@ -10,6 +10,9 @@ namespace Activizr.Database { public partial class PirateDb { + // This class is in horrible need of serious refactoring. For its simplicity in task, it's a horrible bowl of spaghetti. + + [Serializable] public class Configuration { @@ -37,13 +40,24 @@ namespace Activizr.Database string testString = _configuration.Admin.Username; - return !String.IsNullOrEmpty(DatabaseConnect.Default.Admin); + return !String.IsNullOrEmpty(testString); } public Credentials Read { get; set; } public Credentials Write { get; set; } public Credentials Admin { get; set; } + + public Configuration Get() + { + if (_configuration == null) + { + Load(); + } + + return _configuration; + } + private static Configuration _configuration; public static bool TestConfigurationWritable() diff --git a/Database/Database-Constructors.cs b/Database/Database-Constructors.cs index ebf54f2c..97cbd65a 100644 --- a/Database/Database-Constructors.cs +++ b/Database/Database-Constructors.cs @@ -17,17 +17,23 @@ namespace Activizr.Database { public static PirateDb GetDatabaseForReading() { - return new PirateDb(DatabaseConnect.Default.Read); + return new PirateDb(ConstructConnectString(new Configuration().Get().Read)); } public static PirateDb GetDatabaseForWriting() { - return new PirateDb(DatabaseConnect.Default.Write); + return new PirateDb(ConstructConnectString(new Configuration().Get().Write)); } public static PirateDb GetDatabaseForAdmin() { - return new PirateDb(DatabaseConnect.Default.Admin); + return new PirateDb(ConstructConnectString(new Configuration().Get().Admin)); + } + + private static string ConstructConnectString (Credentials credentials) + { + return "server=" + credentials.ServerSet.ServerPriorities[0].Split(';')[0] + ";database=" + credentials.Database + + ";user=" + credentials.Username + ";password=" + credentials.Password; } diff --git a/Database/Database-Countries.cs b/Database/Database-Countries.cs index 8b1b0b90..19b7f729 100644 --- a/Database/Database-Countries.cs +++ b/Database/Database-Countries.cs @@ -126,10 +126,8 @@ namespace Activizr.Database - public int CreateCountry (string name, string code) + public int CreateCountry (string name, string code, string culture, int geographyId, int postalCodeLength, string collation) { - throw new NotImplementedException("Creating a country is not implemented at the moment. (It is not a common event.)"); - /* using (DbConnection connection = GetMySqlDbConnection()) { connection.Open(); @@ -139,9 +137,31 @@ namespace Activizr.Database AddParameterWithName(command, "name", name); AddParameterWithName(command, "code", code); + AddParameterWithName(command, "culture", culture); + AddParameterWithName(command, "geographyId", geographyId); + AddParameterWithName(command, "postalCodeLength", postalCodeLength); + AddParameterWithName(command, "collation", collation); return Convert.ToInt32(command.ExecuteScalar()); - }*/ + } } + + public int SetCountryGeographyId (int countryId, int geographyId) + { + using (DbConnection connection = GetMySqlDbConnection()) + { + connection.Open(); + + DbCommand command = GetDbCommand("SetCountryGeographyId", connection); + command.CommandType = CommandType.StoredProcedure; + + AddParameterWithName(command, "countryId", countryId); + AddParameterWithName(command, "geographyId", geographyId); + + return Convert.ToInt32(command.ExecuteScalar()); + } + } + + } } \ No newline at end of file diff --git a/Database/Database-Geographies.cs b/Database/Database-Geographies.cs index 233be27c..6a539172 100644 --- a/Database/Database-Geographies.cs +++ b/Database/Database-Geographies.cs @@ -465,5 +465,23 @@ namespace Activizr.Database return result.ToArray(); } + + public int CreateGeography (string name, int parentGeographyId) + { + using (DbConnection connection = GetMySqlDbConnection()) + { + connection.Open(); + + DbCommand command = GetDbCommand("CreateGeography", connection); + command.CommandType = CommandType.StoredProcedure; + + AddParameterWithName(command, "name", name); + AddParameterWithName(command, "parentGeographyId", parentGeographyId); + + return Convert.ToInt32(command.ExecuteScalar()); + } + } + + } } \ No newline at end of file diff --git a/Database/Database-Initialization.cs b/Database/Database-Initialization.cs new file mode 100644 index 00000000..9ddf2d4a --- /dev/null +++ b/Database/Database-Initialization.cs @@ -0,0 +1,30 @@ +using System.Text; +using System.Data; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.Common; +using System.Text; + +namespace Activizr.Database +{ + partial class PirateDb + { + // This function is bloody dangerous, mmkay? + + public void ExecuteAdminCommand(string sqlSequence) + { + // TODO: Verify that we're in admin mode + + using (DbConnection connection = GetMySqlDbConnection()) + { + connection.Open(); + + DbCommand command = GetDbCommand(sqlSequence, connection); + command.CommandType = CommandType.Text; + + command.ExecuteNonQuery(); + } + } + } +} \ No newline at end of file diff --git a/Database/Database.csproj b/Database/Database.csproj index 8431b701..fd7786b5 100644 --- a/Database/Database.csproj +++ b/Database/Database.csproj @@ -57,6 +57,7 @@ + @@ -117,19 +118,10 @@ - - True - True - DatabaseConnect.settings - - - SettingsSingleFileGenerator - DatabaseConnect.Designer.cs - diff --git a/Database/DatabaseConnect.Designer.cs b/Database/DatabaseConnect.Designer.cs deleted file mode 100644 index 693b0354..00000000 --- a/Database/DatabaseConnect.Designer.cs +++ /dev/null @@ -1,53 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.269 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Activizr.Database { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class DatabaseConnect : global::System.Configuration.ApplicationSettingsBase { - - private static DatabaseConnect defaultInstance = ((DatabaseConnect)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new DatabaseConnect()))); - - public static DatabaseConnect Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string Read { - get { - return ((string)(this["Read"])); - } - } - - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string Write { - get { - return ((string)(this["Write"])); - } - } - - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string Admin { - get { - return ((string)(this["Admin"])); - } - } - } -} diff --git a/Database/DatabaseConnect.settings b/Database/DatabaseConnect.settings deleted file mode 100644 index c05bb51e..00000000 --- a/Database/DatabaseConnect.settings +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj index 36f7c3c5..2f419d14 100644 --- a/Logic/Logic.csproj +++ b/Logic/Logic.csproj @@ -200,6 +200,7 @@ + diff --git a/Logic/Support/DatabaseMaintenance.cs b/Logic/Support/DatabaseMaintenance.cs new file mode 100644 index 00000000..eb94b4ca --- /dev/null +++ b/Logic/Support/DatabaseMaintenance.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Text; +using Activizr.Database; +using Activizr.Logic.Pirates; + +namespace Activizr.Logic.Support +{ + public class DatabaseMaintenance + { + /// + /// Feeds a newly-created database with an empty structure. Do not use on populated databases; it's like a Genesis Device. + /// + static public void FirstInitialization() + { + // Security check: make sure we throw an exception if we try to get person 1. + + bool initialized = false; + Person personOne = null; + string sql = string.Empty; + + try + { + personOne = Person.FromIdentity(1); + initialized = true; + } + catch (Exception) + { + // Do nothing, the exception is expected + } + + if (initialized == true && personOne != null) // double checks in case Database behavior should change to return null rather than throw later + { + throw new InvalidOperationException("Cannot run Genesis Device style initalization on already-populated database"); + } + + using (WebClient client = new WebClient()) + { + sql = client.DownloadString("http://packages.activizr.com/schemas/initialize.sql"); // Hardcoded as security measure - don't want to pass arbitrary sql in from web layer + } + + string[] sqlCommands = sql.Split('#'); // in the file, the commands are split by a single # sign. (Semicolons are an integral part of storedprocs, so they can't be used.) + + foreach (string sqlCommand in sqlCommands) + { + PirateDb.GetDatabaseForAdmin().ExecuteAdminCommand(sqlCommand.Trim()); + } + } + } +} diff --git a/Site5/App_Code/GetGeographyData.cs b/Site5/App_Code/GetGeographyData.cs new file mode 100644 index 00000000..bd5a8f5e --- /dev/null +++ b/Site5/App_Code/GetGeographyData.cs @@ -0,0 +1,754 @@ +//------------------------------------------------------------------------------ +// +// 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 Activizr.Site.Automation +{ + + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Web.Services.WebServiceBindingAttribute(Name="GetGeographyDataSoap", Namespace="http://activizr.com/")] + [System.Xml.Serialization.XmlIncludeAttribute(typeof(BasicGeography))] + [System.Xml.Serialization.XmlIncludeAttribute(typeof(BasicPostalCode))] + [System.Xml.Serialization.XmlIncludeAttribute(typeof(BasicCity))] + [System.Xml.Serialization.XmlIncludeAttribute(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://pirate.activizr.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; + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://activizr.com/GetCountries", RequestNamespace="http://activizr.com/", ResponseNamespace="http://activizr.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)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://activizr.com/GetCountriesInUse", RequestNamespace="http://activizr.com/", ResponseNamespace="http://activizr.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)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://activizr.com/GetCitiesForCountry", RequestNamespace="http://activizr.com/", ResponseNamespace="http://activizr.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)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://activizr.com/GetPostalCodesForCountry", RequestNamespace="http://activizr.com/", ResponseNamespace="http://activizr.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)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://activizr.com/GetGeography", RequestNamespace="http://activizr.com/", ResponseNamespace="http://activizr.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)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://activizr.com/GetGeographyForCountry", RequestNamespace="http://activizr.com/", ResponseNamespace="http://activizr.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")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://activizr.com/")] + public partial class Country : BasicCountry { + } + + /// + [System.Xml.Serialization.XmlIncludeAttribute(typeof(Country))] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://activizr.com/")] + public partial class BasicCountry { + + private int countryIdField; + + private string nameField; + + private string codeField; + + private string cultureField; + + private int geographyIdField; + + /// + public int CountryId { + get { + return this.countryIdField; + } + set { + this.countryIdField = 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; + } + } + } + + /// + [System.Xml.Serialization.XmlIncludeAttribute(typeof(Geography))] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://activizr.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")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://activizr.com/")] + public partial class Geography : BasicGeography { + + private Geography[] childrenField; + + /// + public Geography[] Children { + get { + return this.childrenField; + } + set { + this.childrenField = value; + } + } + } + + /// + [System.Xml.Serialization.XmlIncludeAttribute(typeof(PostalCode))] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://activizr.com/")] + public partial class BasicPostalCode { + + private string postalCodeField; + + private string cityNameField; + + private string countryCodeField; + + /// + public string PostalCode { + get { + return this.postalCodeField; + } + set { + this.postalCodeField = value; + } + } + + /// + public string CityName { + get { + return this.cityNameField; + } + set { + this.cityNameField = value; + } + } + + /// + public string CountryCode { + get { + return this.countryCodeField; + } + set { + this.countryCodeField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://activizr.com/")] + public partial class PostalCode : BasicPostalCode { + } + + /// + [System.Xml.Serialization.XmlIncludeAttribute(typeof(City))] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://activizr.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")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://activizr.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")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("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")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("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")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("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")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("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")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("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")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("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/Site5/Pages/v5/Init/Default.aspx b/Site5/Pages/v5/Init/Default.aspx index 1b877b11..c19c9d41 100644 --- a/Site5/Pages/v5/Init/Default.aspx +++ b/Site5/Pages/v5/Init/Default.aspx @@ -442,7 +442,7 @@

Initializing database

-

Please wait while the database is being initialized with schemas and geographic data from the Activizr servers.

+

Please wait while the database is being initialized with schemas and geographic data from the Activizr servers. This is going to take a significant amount of time; we're loading tons of geodata onto your new server.