Checkpoint commit
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FieldValidation.aspx.cs" Inherits="Swarmops.Frontend.Automation.FieldValidation" %>
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CurrencyTextBox.ascx.cs" Inherits="Swarmops.Frontend.Controls.v5.Financial.CurrencyTextBox" %>
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// This is an ordinary textbox, except it does culture-sensitive and
|
||||
/// asynchronous validation of currency input.
|
||||
/// </summary>
|
||||
public partial class CurrencyTextBox : System.Web.UI.UserControl
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user