diff --git a/.gitignore b/.gitignore index d7b88dc5..53628b15 100644 --- a/.gitignore +++ b/.gitignore @@ -186,3 +186,8 @@ FakesAssemblies/ #OpenOffice lock files .~lock.* +#Everything in external Dependencies that are built +External Dependencies/* +#Except the batch file to rebuild them +!External Dependencies/rebuild-all.cmd + diff --git a/Site5/App_Code/FieldValidation.cs b/Site5/App_Code/FieldValidation.cs index d6de0e73..cd3f2df7 100644 --- a/Site5/App_Code/FieldValidation.cs +++ b/Site5/App_Code/FieldValidation.cs @@ -19,19 +19,16 @@ public class FieldValidation : System.Web.Services.WebService { //InitializeComponent(); } - [WebMethod] - public bool IsAmountValid (string amount) + + private CultureInfo GetUserCulture() { // Determine correct culture for parsing - CultureInfo culture = null; // Set default culture (English, United States, but that doesn't work so fake it to GB) - - string preferredCulture = "en-GB"; + string preferredCulture = "en-US"; // ----------- SET CULTURE ------------ - // Does the user have a culture preference? if (HttpContext.Current.Request.Cookies["PreferredCulture"] != null) @@ -50,6 +47,8 @@ public class FieldValidation : System.Web.Services.WebService { } } + // Actually set the culture + try { culture = CultureInfo.CreateSpecificCulture(preferredCulture); @@ -59,6 +58,15 @@ public class FieldValidation : System.Web.Services.WebService { culture = CultureInfo.InvariantCulture; } + return culture; + } + + + [WebMethod] + public bool IsAmountValid (string amount) + { + CultureInfo culture = GetUserCulture(); + // Try to parse the string we got as a double try diff --git a/Site5/Automation/FieldValidation.aspx b/Site5/Automation/FieldValidation.aspx new file mode 100644 index 00000000..e2892a57 --- /dev/null +++ b/Site5/Automation/FieldValidation.aspx @@ -0,0 +1 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FieldValidation.aspx.cs" Inherits="Swarmops.Frontend.Automation.FieldValidation" %> diff --git a/Site5/Automation/FieldValidation.aspx.cs b/Site5/Automation/FieldValidation.aspx.cs new file mode 100644 index 00000000..93da9391 --- /dev/null +++ b/Site5/Automation/FieldValidation.aspx.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Services; +using System.Web.Services.Description; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace Swarmops.Frontend.Automation +{ + public partial class FieldValidation : DataV5Base + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + [WebMethod] + public static void TestFoo (string input) + { + AuthenticationData authenticationData = GetAuthenticationDataAndCulture(); + + System.Diagnostics.Trace.WriteLine(input); + } + } +} \ No newline at end of file diff --git a/Site5/Controls/v5/Financial/CurrencyTextBox.ascx b/Site5/Controls/v5/Financial/CurrencyTextBox.ascx new file mode 100644 index 00000000..87e23c61 --- /dev/null +++ b/Site5/Controls/v5/Financial/CurrencyTextBox.ascx @@ -0,0 +1 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CurrencyTextBox.ascx.cs" Inherits="Swarmops.Frontend.Controls.v5.Financial.CurrencyTextBox" %> diff --git a/Site5/Controls/v5/Financial/CurrencyTextBox.ascx.cs b/Site5/Controls/v5/Financial/CurrencyTextBox.ascx.cs new file mode 100644 index 00000000..d6fcda5c --- /dev/null +++ b/Site5/Controls/v5/Financial/CurrencyTextBox.ascx.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace Swarmops.Frontend.Controls.v5.Financial +{ + /// + /// This is an ordinary textbox, except it does culture-sensitive and + /// asynchronous validation of currency input. + /// + public partial class CurrencyTextBox : System.Web.UI.UserControl + { + protected void Page_Load(object sender, EventArgs e) + { + + } + } +} \ No newline at end of file